Skip to content

Commit 7a034a1

Browse files
committed
Newly annotated classes: Dashlet, Rating, Apikey, Device, AttributeOption
1 parent 20d1fb2 commit 7a034a1

File tree

10 files changed

+122
-26
lines changed

10 files changed

+122
-26
lines changed

logicaldoc-core/src/main/java/com/logicaldoc/core/dashlet/Dashlet.java

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package com.logicaldoc.core.dashlet;
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,6 +16,10 @@
816
* @author Marco Meschieri - LogicalDOC
917
* @since 8.2.3
1018
*/
19+
@Entity
20+
@Table(name = "ld_dashlet")
21+
@Cacheable
22+
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
1123
public class Dashlet extends PersistentObject {
1224

1325
private static final long serialVersionUID = 1L;
@@ -22,23 +34,31 @@ public class Dashlet extends PersistentObject {
2234

2335
public static final String TYPE_CONTENT = "content";
2436

25-
private String type = TYPE_DOCEVENT;
26-
27-
private String query;
28-
29-
private String content;
30-
37+
@Column(name = "ld_name", length = 255, nullable = false)
3138
private String name;
32-
39+
40+
@Column(name = "ld_title", length = 255, nullable = false)
3341
private String title;
34-
42+
43+
@Column(name = "ld_type", length = 255, nullable = false)
44+
private String type = TYPE_DOCEVENT;
45+
46+
@Column(name = "ld_max")
3547
private Integer max;
3648

3749
/**
3850
* To mark that it must display just unique records
3951
*/
52+
@Column(name = "ld_unique", nullable = false)
4053
private int unique = 0;
54+
55+
@Column(name = "ld_query")
56+
private String query;
57+
58+
@Column(name = "ld_content")
59+
private String content;
4160

61+
@Column(name = "ld_columns")
4262
private String columns;
4363

4464
public Dashlet() {

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
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+
import javax.persistence.Transient;
8+
9+
import org.hibernate.annotations.Cache;
10+
import org.hibernate.annotations.CacheConcurrencyStrategy;
11+
312
import com.logicaldoc.core.PersistentObject;
413

514
/**
@@ -8,20 +17,30 @@
817
* @author Matteo Caruso - LogicalDOC
918
* @since 6.1
1019
*/
20+
@Entity
21+
@Table(name = "ld_rating")
22+
@Cacheable
23+
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
1124
public class Rating extends PersistentObject {
1225

1326
private static final long serialVersionUID = 1L;
1427

28+
@Column(name = "ld_docid", nullable = false)
1529
private long docId;
1630

31+
@Column(name = "ld_userid", nullable = false)
1732
private long userId;
1833

34+
@Column(name = "ld_username", length = 255)
35+
private String username;
36+
37+
@Column(name = "ld_vote", nullable = false)
1938
private int vote = 0;
2039

40+
@Transient
2141
private Integer count;
2242

23-
private String username;
24-
43+
@Transient
2544
private Float average;
2645

2746
public long getUserId() {

logicaldoc-core/src/main/java/com/logicaldoc/core/metadata/AttributeOption.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package com.logicaldoc.core.metadata;
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,26 +16,36 @@
816
* @author Marco Meschieri - LogicalDOC
917
* @since 7.1
1018
*/
19+
@Entity
20+
@Table(name = "ld_extoption")
21+
@Cacheable
22+
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
1123
public class AttributeOption extends PersistentObject implements Comparable<AttributeOption> {
1224

1325
private static final long serialVersionUID = 1L;
1426

27+
@Column(name = "ld_setid", nullable = false)
1528
private long setId;
1629

30+
@Column(name = "ld_attribute", nullable = false)
1731
private String attribute;
1832

19-
/**
20-
* An category, just to organize the values in groups
21-
*/
22-
private String category;
23-
2433
/**
2534
* The value of this option
2635
*/
36+
@Column(name = "ld_value", nullable = false)
2737
private String value;
38+
39+
/**
40+
* An category, just to organize the values in groups
41+
*/
42+
@Column(name = "ld_category", nullable = false)
43+
private String category;
2844

45+
@Column(name = "ld_label", nullable = false)
2946
private String label;
3047

48+
@Column(name = "ld_position", nullable = false)
3149
private int position = 0;
3250

3351
public AttributeOption() {

logicaldoc-core/src/main/java/com/logicaldoc/core/security/Device.java

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
import java.io.Serializable;
44
import java.util.Date;
55

6+
import javax.persistence.Cacheable;
7+
import javax.persistence.Column;
8+
import javax.persistence.Entity;
9+
import javax.persistence.Table;
610
import javax.servlet.http.Cookie;
711
import javax.servlet.http.HttpServletRequest;
812

913
import org.apache.commons.lang3.StringUtils;
14+
import org.hibernate.annotations.Cache;
15+
import org.hibernate.annotations.CacheConcurrencyStrategy;
1016

1117
import com.logicaldoc.core.PersistentObject;
1218

@@ -18,6 +24,10 @@
1824
* @author Marco Meschieri - LogicalDOC
1925
* @since 8.5.3
2026
*/
27+
@Entity
28+
@Table(name = "ld_device")
29+
@Cacheable
30+
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
2131
public class Device extends PersistentObject implements Serializable {
2232

2333
public static final String PARAM_DEVICE = "device";
@@ -27,47 +37,58 @@ public class Device extends PersistentObject implements Serializable {
2737
/**
2838
* A unique identifier of the device
2939
*/
40+
@Column(name = "ld_deviceid", length = 255, nullable = false)
3041
private String deviceId;
3142

43+
@Column(name = "ld_userid")
44+
private long userId;
45+
46+
@Column(name = "ld_username", length = 255)
47+
private String username;
48+
3249
/**
3350
* Name of the browser
3451
*/
52+
@Column(name = "ld_browser", length = 255)
3553
private String browser = "unknown";
36-
54+
3755
/**
3856
* Version of the browser
3957
*/
58+
@Column(name = "ld_browserversion", length = 255)
4059
private String browserVersion;
4160

4261
/**
4362
* Name of the operative system
4463
*/
64+
@Column(name = "ld_operativesystem", length = 255)
4565
private String operativeSystem;
4666

4767
/**
4868
* Type of device
4969
*/
70+
@Column(name = "ld_type", length = 255)
5071
private String type;
5172

5273
/**
5374
* Instant of last login
5475
*/
76+
@Column(name = "ld_lastlogin")
5577
private Date lastLogin;
5678

79+
@Column(name = "ld_trusted", nullable = false)
80+
private int trusted = 0;
81+
5782
/**
5883
* IP of last login
5984
*/
85+
@Column(name = "ld_ip", length = 255)
6086
private String ip;
6187

62-
private long userId;
63-
64-
private String username;
65-
66-
private int trusted = 0;
67-
6888
/**
6989
* Optional label assigned to the device
7090
*/
91+
@Column(name = "ld_label", length = 255)
7192
private String label;
7293

7394
public Device() {
@@ -81,7 +102,7 @@ public Device() {
81102
*/
82103
public Device(HttpServletRequest request) {
83104
setDeviceId(getDeviceId(request));
84-
105+
85106
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
86107
setBrowser(agent.getBrowser().getName());
87108

logicaldoc-core/src/main/java/com/logicaldoc/core/security/apikey/ApiKey.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
import java.security.NoSuchAlgorithmException;
44
import java.util.Date;
55

6+
import javax.persistence.Cacheable;
7+
import javax.persistence.Column;
8+
import javax.persistence.Entity;
9+
import javax.persistence.Table;
10+
import javax.persistence.Transient;
11+
612
import org.apache.commons.lang.StringUtils;
13+
import org.hibernate.annotations.Cache;
14+
import org.hibernate.annotations.CacheConcurrencyStrategy;
715

816
import com.logicaldoc.core.PersistentObject;
917
import com.logicaldoc.util.crypt.CryptUtil;
@@ -14,20 +22,30 @@
1422
* @author Marco Meschieri - LogicalDOC
1523
* @since 8.9.4
1624
*/
25+
@Entity
26+
@Table(name = "ld_apikey")
27+
@Cacheable
28+
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
1729
public class ApiKey extends PersistentObject {
1830

1931
private static final long serialVersionUID = 1L;
2032

33+
@Column(name = "ld_userid", nullable = false)
2134
private long userId;
2235

36+
@Column(name = "ld_name", length = 255, nullable = false)
2337
private String name;
2438

25-
private String label;
26-
39+
@Column(name = "ld_lastused")
2740
private Date lastUsed;
28-
41+
42+
@Column(name = "ld_key", length = 255, nullable = false)
2943
private String key;
44+
45+
@Column(name = "ld_label", length = 255, nullable = false)
46+
private String label;
3047

48+
@Transient
3149
private String decodedKey;
3250

3351
public ApiKey() {

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

File renamed without changes.

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

File renamed without changes.

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

File renamed without changes.

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

File renamed without changes.

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

File renamed without changes.

0 commit comments

Comments
 (0)