Skip to content

Commit b57ed5b

Browse files
committed
Core Update - LocalSessionFactory - Contact and Bookmark annotated
1 parent 2c20728 commit b57ed5b

File tree

29 files changed

+531
-387
lines changed

29 files changed

+531
-387
lines changed

logicaldoc-cmis/src/test/resources/contexttest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</bean>
4949

5050
<!-- Hibernate SessionFactory -->
51-
<bean id="SessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
51+
<bean id="SessionFactory" class="com.logicaldoc.util.spring.LocalSessionFactory"
5252
abstract="false" lazy-init="default" autowire="default">
5353
<property name="dataSource">
5454
<ref bean="DataSource" />

logicaldoc-core/src/main/java/com/logicaldoc/core/PersistentObject.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@
33
import java.io.Serializable;
44
import java.util.Date;
55

6+
import javax.persistence.Column;
7+
import javax.persistence.GeneratedValue;
8+
import javax.persistence.Id;
9+
import javax.persistence.MappedSuperclass;
10+
import javax.persistence.Version;
11+
12+
import org.hibernate.annotations.GenericGenerator;
13+
import org.hibernate.annotations.Parameter;
14+
import org.hibernate.annotations.Where;
15+
616
/**
717
* This abstract class defines the minimum requirements of persistent objects.
818
*
919
* @author Marco Meschieri - LogicalDOC
1020
* @since 4.0
1121
*/
22+
@MappedSuperclass
23+
@Where(clause = "ld_deleted=0")
1224
public abstract class PersistentObject implements Serializable {
1325

1426
private static final long serialVersionUID = 1L;
@@ -23,16 +35,30 @@ public abstract class PersistentObject implements Serializable {
2335
*/
2436
public static final int DELETED_CODE_STRONG = 2;
2537

26-
private long id = 0;
27-
38+
@Id
39+
@GeneratedValue(generator = "hilo")
40+
@GenericGenerator(name = "hilo", strategy = "enhanced-table", parameters = {
41+
@Parameter(name = "table_name", value = "hibernate_sequences"),
42+
@Parameter(name = "prefer_entity_table_as_segment_value", value = "true"),
43+
@Parameter(name = "optimizer", value = "org.hibernate.id.enhanced.HiLoOptimizer"),
44+
@Parameter(name = "initial_value", value = "100") })
45+
@Column(name = "ld_id")
46+
public long id = 0;
47+
48+
@Column(name = "ld_tenantid", nullable = false)
2849
private long tenantId = 1L;
2950

51+
@Column(name = "ld_deleted", nullable = false)
3052
private int deleted = 0;
3153

54+
@Column(name = "ld_lastmodified", nullable = false)
3255
private Date lastModified = new Date();
3356

57+
@Column(name = "ld_creation", nullable = false)
3458
private Date creation = new Date();
3559

60+
@Version
61+
@Column(name = "ld_recordversion", nullable = false)
3662
private long recordVersion = 0L;
3763

3864
/**

logicaldoc-core/src/main/java/com/logicaldoc/core/contact/Contact.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package com.logicaldoc.core.contact;
22

3+
import javax.persistence.Cacheable;
4+
import javax.persistence.Column;
5+
import javax.persistence.Entity;
6+
import javax.persistence.Table;
7+
8+
import org.hibernate.annotations.Cache;
9+
import org.hibernate.annotations.CacheConcurrencyStrategy;
10+
311
import com.logicaldoc.core.PersistentObject;
412

513
/**
@@ -8,24 +16,35 @@
816
* @author Marco Meschieri - LogicalDOC
917
* @since 6.8
1018
*/
19+
@Entity
20+
@Table(name = "ld_contact")
21+
@Cacheable
22+
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
1123
public class Contact extends PersistentObject {
12-
1324
private static final long serialVersionUID = 1L;
1425

26+
@Column(name = "ld_userid")
1527
private Long userId;
1628

29+
@Column(name = "ld_firstname", length = 255)
1730
private String firstName;
1831

32+
@Column(name = "ld_lastname", length = 255)
1933
private String lastName;
2034

35+
@Column(name = "ld_company", length = 255)
2136
private String company;
2237

38+
@Column(name = "ld_email", length = 512)
2339
private String email;
2440

41+
@Column(name = "ld_phone", length = 255)
2542
private String phone;
2643

44+
@Column(name = "ld_mobile", length = 255)
2745
private String mobile;
2846

47+
@Column(name = "ld_address", length = 512)
2948
private String address;
3049

3150
public Contact() {

logicaldoc-core/src/main/java/com/logicaldoc/core/document/Bookmark.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package com.logicaldoc.core.document;
22

3+
import javax.persistence.Cacheable;
4+
import javax.persistence.Column;
5+
import javax.persistence.Entity;
6+
import javax.persistence.Table;
7+
8+
import org.hibernate.annotations.Cache;
9+
import org.hibernate.annotations.CacheConcurrencyStrategy;
310
import org.slf4j.Logger;
411
import org.slf4j.LoggerFactory;
512

@@ -15,6 +22,10 @@
1522
* @author Matteo Caruso - LogicalDOC
1623
* @since 5.2
1724
*/
25+
@Entity
26+
@Table(name = "ld_bookmark")
27+
@Cacheable
28+
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
1829
public class Bookmark extends PersistentObject {
1930

2031
private static final Logger log = LoggerFactory.getLogger(Bookmark.class);
@@ -25,19 +36,26 @@ public class Bookmark extends PersistentObject {
2536

2637
public static final int TYPE_FOLDER = 1;
2738

39+
@Column(name = "ld_userid", nullable = false)
2840
private long userId;
2941

42+
@Column(name = "ld_docid", nullable = false)
3043
private long targetId;
3144

45+
@Column(name = "ld_title", length = 255, nullable = false)
3246
private String title = "";
3347

48+
@Column(name = "ld_description", length = 4000, nullable = false)
3449
private String description = "";
3550

51+
@Column(name = "ld_position", nullable = false)
3652
private int position = 0;
3753

3854
// The document file extension
55+
@Column(name = "ld_filetype", length = 40)
3956
private String fileType;
4057

58+
@Column(name = "ld_type", nullable = false)
4159
private int type = TYPE_DOCUMENT;
4260

4361
public long getUserId() {

logicaldoc-core/src/main/resources/mappings/Bookmark.hbm.xml renamed to logicaldoc-core/src/main/resources/mappings/Bookmark.hbm.skip

File renamed without changes.

logicaldoc-core/src/main/resources/mappings/Contact.hbm.xml renamed to logicaldoc-core/src/main/resources/mappings/Contact.hbm.skip

File renamed without changes.

logicaldoc-core/src/main/resources/sql/logicaldoc-core.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ values (5,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0);
696696
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
697697
values (5,-10000,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1);
698698
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
699-
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/',1,1);
699+
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/',1,1);
700700

701701
insert into ld_folder (ld_id,ld_lastmodified,ld_deleted,ld_name,ld_parentid,ld_type,ld_creation, ld_templocked,ld_tenantid,ld_recordversion,ld_position,ld_hidden,ld_path)
702702
values (4,CURRENT_TIMESTAMP,0,'Default',5,1,CURRENT_TIMESTAMP,0,1,1,1,0,'/4');
@@ -709,7 +709,7 @@ values (4,4,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
709709
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
710710
values (4,-10000,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
711711
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
712-
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/Default',1,1);
712+
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/Default',1,1);
713713

714714
insert into ld_messagetemplate (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_name, ld_type, ld_language, ld_subject, ld_body,ld_tenantid,ld_recordversion)
715715
values(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,0,'task.report','system','en', '$product - $task',

logicaldoc-core/src/main/resources/sql/logicaldoc-core.sql.mariadb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ values (5,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0);
690690
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
691691
values (5,-10000,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1);
692692
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
693-
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/',1,1);
693+
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/',1,1);
694694

695695
insert into ld_folder (ld_id,ld_lastmodified,ld_deleted,ld_name,ld_parentid,ld_type,ld_creation, ld_templocked,ld_tenantid,ld_recordversion,ld_position,ld_hidden,ld_path)
696696
values (4,CURRENT_TIMESTAMP,0,'Default',5,1,CURRENT_TIMESTAMP,0,1,1,1,0,'/4');
@@ -703,7 +703,7 @@ values (4,4,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
703703
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
704704
values (4,-10000,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
705705
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
706-
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/Default',1,1)
706+
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/Default',1,1)
707707

708708
insert into ld_messagetemplate (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_name, ld_type, ld_language, ld_subject, ld_body,ld_tenantid,ld_recordversion)
709709
values(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,0,'task.report','system','en', '$product - $task',

logicaldoc-core/src/main/resources/sql/logicaldoc-core.sql.mssql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ values (5,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0);
692692
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
693693
values (5,-10000,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1);
694694
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
695-
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/',1,1);
695+
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/',1,1);
696696

697697
insert into ld_folder (ld_id,ld_lastmodified,ld_deleted,ld_name,ld_parentid,ld_type,ld_creation, ld_templocked,ld_tenantid,ld_recordversion,ld_position,ld_hidden,ld_path)
698698
values (4,CURRENT_TIMESTAMP,0,'Default',5,1,CURRENT_TIMESTAMP,0,1,1,1,0,'/4');
@@ -705,7 +705,7 @@ values (4,4,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
705705
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
706706
values (4,-10000,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
707707
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
708-
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/Default',1,1)
708+
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/Default',1,1)
709709

710710
insert into ld_messagetemplate (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_name, ld_type, ld_language, ld_subject, ld_body,ld_tenantid,ld_recordversion)
711711
values(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,0,'task.report','system','en', '$product - $task',

logicaldoc-core/src/main/resources/sql/logicaldoc-core.sql.mysql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ values (5,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0);
690690
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
691691
values (5,-10000,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1);
692692
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
693-
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/',1,1);
693+
values (1,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,5,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/',1,1);
694694

695695
insert into ld_folder (ld_id,ld_lastmodified,ld_deleted,ld_name,ld_parentid,ld_type,ld_creation, ld_templocked,ld_tenantid,ld_recordversion,ld_position,ld_hidden,ld_path)
696696
values (4,CURRENT_TIMESTAMP,0,'Default',5,1,CURRENT_TIMESTAMP,0,1,1,1,0,'/4');
@@ -703,7 +703,7 @@ values (4,4,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
703703
insert into ld_folder_acl(ld_folderid, ld_groupid, ld_read, ld_write, ld_add, ld_security, ld_immutable, ld_delete, ld_rename, ld_import, ld_export, ld_sign, ld_archive, ld_workflow, ld_download, ld_calendar, ld_subscription, ld_print, ld_password, ld_move, ld_email, ld_automation, ld_store, ld_readingreq, ld_preview, ld_customid)
704704
values (4,-10000,1,1,1,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1);
705705
insert into ld_folder_history (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_docid, ld_folderid, ld_userid, ld_date, ld_username, ld_event, ld_comment, ld_version, ld_notified, ld_new, ld_path,ld_tenantid,ld_recordversion)
706-
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,'CURRENT_TIMESTAMP','admin','event.folder.created',null,'1.0',0,1,'/Default',1,1);
706+
values (2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,0,null,4,1,CURRENT_TIMESTAMP,'admin','event.folder.created',null,'1.0',0,1,'/Default',1,1);
707707

708708
insert into ld_messagetemplate (ld_id, ld_lastmodified, ld_creation, ld_deleted, ld_name, ld_type, ld_language, ld_subject, ld_body,ld_tenantid,ld_recordversion)
709709
values(1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,0,'task.report','system','en', '$product - $task',

0 commit comments

Comments
 (0)