Project

General

Profile

« Previous | Next » 

Revision 49899

added javax.persistance annotations

View differences:

modules/dnet-datasource-manager-common/trunk/dnet-datasource-manager-common.iml
16 16
    <orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.1" level="project" />
17 17
    <orderEntry type="library" name="Maven: org.codehaus.mojo:animal-sniffer-annotations:1.14" level="project" />
18 18
    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
19
    <orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
19 20
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
20 21
  </component>
21 22
</module>
modules/dnet-datasource-manager-common/trunk/src/main/java/eu/dnetlib/enabling/datasources/common/ApiParamKey.java
3 3
import java.io.Serializable;
4 4
import java.util.Objects;
5 5

  
6
import javax.persistence.Embeddable;
7
import javax.persistence.JoinColumn;
8
import javax.persistence.ManyToOne;
9
import javax.persistence.MappedSuperclass;
10

  
6 11
import com.google.common.collect.ComparisonChain;
7 12

  
8 13
/**
9 14
 * Created by claudio on 13/04/2017.
10 15
 */
16
@Embeddable
17
@MappedSuperclass
18
public class ApiParamKey<A extends Api> implements Serializable {
11 19

  
12
public class ApiParamKey implements Serializable {
13

  
14 20
	/**
15 21
	 * 
16 22
	 */
17
	private static final long serialVersionUID = 1640636806392015938L;
23
	protected static final long serialVersionUID = 1640636806392015938L;
18 24

  
19
	private Api api = null;
25
	@ManyToOne
26
	@JoinColumn(name = "api")
27
	protected A api = null;
20 28

  
21
	private String param;
29
	protected String param;
22 30

  
23 31
	public ApiParamKey() {}
24 32

  
......
31 39
		return this;
32 40
	}
33 41

  
34
	public Api getApi() {
42
	public A getApi() {
35 43
		return api;
36 44
	}
37 45

  
38
	public void setApi(final Api api) {
46
	public void setApi(final A api) {
39 47
		this.api = api;
40 48
	}
41 49

  
modules/dnet-datasource-manager-common/trunk/src/main/java/eu/dnetlib/enabling/datasources/common/Organization.java
2 2

  
3 3
import java.sql.Date;
4 4
import java.util.Set;
5
import javax.persistence.*;
5 6

  
7
@MappedSuperclass
6 8
public class Organization<DS extends Datasource<?, ?>> {
7 9

  
8
	private String id;
9
	private String legalshortname;
10
	private String legalname;
11
	private String websiteurl;
12
	private String logourl;
10
	@Id
11
	protected String id;
12
	protected String legalshortname;
13
	protected String legalname;
14
	protected String websiteurl;
15
	protected String logourl;
13 16

  
14
	private Boolean eclegalbody;
17
	@Column(name = "ec_legalbody")
18
	protected Boolean eclegalbody;
15 19

  
16
	private Boolean eclegalperson;
20
	@Column(name = "ec_legalperson")
21
	protected Boolean eclegalperson;
17 22

  
18
	private Boolean ecnonprofit;
23
	@Column(name = "ec_nonprofit")
24
	protected Boolean ecnonprofit;
19 25

  
20
	private Boolean ecresearchorganization;
26
	@Column(name = "ec_researchorganization")
27
	protected Boolean ecresearchorganization;
21 28

  
22
	private Boolean echighereducation;
29
	@Column(name = "ec_highereducation")
30
	protected Boolean echighereducation;
23 31

  
24
	private Boolean ecinternationalorganizationeurinterests;
32
	@Column(name = "ec_internationalorganizationeurinterests")
33
	protected Boolean ecinternationalorganizationeurinterests;
25 34

  
26
	private Boolean ecinternationalorganization;
35
	@Column(name = "ec_internationalorganization")
36
	protected Boolean ecinternationalorganization;
27 37

  
28
	private Boolean ecenterprise;
38
	@Column(name = "ec_enterprise")
39
	protected Boolean ecenterprise;
29 40

  
30
	private Boolean ecsmevalidated;
41
	@Column(name = "ec_smevalidated")
42
	protected Boolean ecsmevalidated;
31 43

  
32
	private Boolean ecnutscode;
44
	@Column(name = "ec_nutscode")
45
	protected Boolean ecnutscode;
33 46

  
34
	private String country;
35
	private String collectedfrom;
47
	protected String country;
48
	protected String collectedfrom;
36 49

  
37
	private Date dateofcollection;
38
	private String provenanceaction;
50
	protected Date dateofcollection;
51
	protected String provenanceaction;
39 52

  
40
	private Set<DS> datasources;
53
	@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER, mappedBy = "organizations")
54
	protected Set<DS> datasources;
41 55

  
42 56
	public Organization() {}
43 57

  
modules/dnet-datasource-manager-common/trunk/src/main/java/eu/dnetlib/enabling/datasources/common/Api.java
4 4
import java.util.Objects;
5 5
import java.util.Set;
6 6

  
7
import javax.persistence.*;
8

  
7 9
import com.google.common.collect.ComparisonChain;
8 10
import com.google.gson.Gson;
9 11

  
10 12
/**
11 13
 * Api
12 14
 */
13
public class Api implements Comparable<Api> {
15
@MappedSuperclass
16
public class Api<AP extends ApiParam> implements Comparable<Api<AP>> {
14 17

  
15
	private String id = null;
16
	private String protocol = null;
17
	private String datasource = null;
18
	private String contentdescription = null;
19
	private Boolean active = false;
20
	private Boolean removable = false;
21
	private String typology = null;
22
	private String compatibility;
23
	private String metadataIdentifierPath;
24
	private Integer lastCollectionTotal;
25
	private Date lastCollectionDate;
26
	private String lastCollectionMdid;
27
	private Integer lastAggregationTotal;
28
	private Date lastAggregationDate;
29
	private String lastAggregationMdid;
30
	private Integer lastDownloadTotal;
31
	private Date lastDownloadDate;
32
	private String lastDownloadMdid;
33
	private String lastValidationJob;
34
	private String baseurl = null;
35
	private Set<ApiParam> apiParams;
18
	@Id
19
	protected String id = null;
20
	protected String protocol = null;
21
	protected String datasource = null;
22
	protected String contentdescription = null;
23
	protected Boolean active = false;
24
	protected Boolean removable = false;
25
	protected String typology = null;
26
	protected String compatibility;
36 27

  
28
	@Column(name = "metadata_identifier_path")
29
	protected String metadataIdentifierPath;
30

  
31
	@Column(name = "last_collection_total")
32
	protected Integer lastCollectionTotal;
33

  
34
	@Column(name = "last_collection_date")
35
	protected Date lastCollectionDate;
36

  
37
	@Column(name = "last_collection_mdid")
38
	protected String lastCollectionMdid;
39

  
40
	@Column(name = "last_aggregation_total")
41
	protected Integer lastAggregationTotal;
42

  
43
	@Column(name = "last_aggregation_date")
44
	protected Date lastAggregationDate;
45

  
46
	@Column(name = "last_aggregation_mdid")
47
	protected String lastAggregationMdid;
48

  
49
	@Column(name = "last_download_total")
50
	protected Integer lastDownloadTotal;
51

  
52
	@Column(name = "last_download_date")
53
	protected Date lastDownloadDate;
54

  
55
	@Column(name = "last_download_objid")
56
	protected String lastDownloadMdid;
57

  
58
	@Column(name = "last_validation_job")
59
	protected String lastValidationJob;
60
	protected String baseurl = null;
61

  
62
	@OneToMany(mappedBy = "id.api", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
63
	protected Set<AP> apiParams;
64

  
37 65
	public Api() {}
38 66

  
39 67
	public String getId() {
......
116 144
		return baseurl;
117 145
	}
118 146

  
119
	public Set<ApiParam> getApiParams() {
147
	public Set<AP> getApiParams() {
120 148
		return apiParams;
121 149
	}
122 150

  
......
220 248
		return this;
221 249
	}
222 250

  
223
	public Api setApiParams(final Set<ApiParam> apiParams) {
251
	public Api setApiParams(final Set<AP> apiParams) {
224 252
		this.apiParams = apiParams;
225 253
		return this;
226 254
	}
modules/dnet-datasource-manager-common/trunk/src/main/java/eu/dnetlib/enabling/datasources/common/Identity.java
1 1
package eu.dnetlib.enabling.datasources.common;
2 2

  
3
import javax.persistence.Id;
4
import javax.persistence.MappedSuperclass;
5

  
3 6
/**
4 7
 * Created by claudio on 13/04/2017.
5 8
 */
6

  
9
@MappedSuperclass
7 10
public class Identity {
8 11

  
9
	private String pid;
12
	@Id
13
	protected String pid;
10 14

  
11
	private String issuertype;
15
	protected String issuertype;
12 16

  
13 17
	public Identity() {}
14 18

  
modules/dnet-datasource-manager-common/trunk/src/main/java/eu/dnetlib/enabling/datasources/common/Datasource.java
2 2

  
3 3
import java.sql.Date;
4 4
import java.util.Set;
5
import javax.persistence.*;
5 6

  
6 7
/**
7 8
 * Datasource
8 9
 */
10
@MappedSuperclass
9 11
public class Datasource<ORG extends Organization, ID extends Identity> {
10 12

  
11
	private String id = null;
12
	private String officialname = null;
13
	private String englishname = null;
14
	private String websiteurl = null;
15
	private String logourl = null;
16
	private String contactemail = null;
17
	private Double latitude;
18
	private Double longitude;
19
	private String timezone = null;
20
	private String namespaceprefix;
21
	private String languages;
13
	@Id
14
	protected String id = null;
15
	protected String officialname = null;
16
	protected String englishname = null;
17
	protected String websiteurl = null;
18
	protected String logourl = null;
19
	protected String contactemail = null;
20
	protected Double latitude;
21
	protected Double longitude;
22
	protected String timezone = null;
22 23

  
23
	private String od_contenttypes;
24
	private String collectedfrom = null;
25
	private Date dateofvalidation = null;
26
	private String typology = null;
27
	private String provenanceaction;
28
	private Date dateofcollection;
29
	private String platform;
24
	@Column(name = "namespaceprefix", columnDefinition = "bpchar(12)")
25
	protected String namespaceprefix;
30 26

  
31
	private String activationId;
32
	private String description = null;
27
	protected String languages;
33 28

  
34
	private Date releasestartdate;
35
	private Date releaseenddate;
36
	private String missionstatementurl;
37
	private Boolean dataprovider;
38
	private Boolean serviceprovider;
29
	protected String od_contenttypes;
30
	protected String collectedfrom = null;
31
	protected Date dateofvalidation = null;
32
	protected String typology = null;
33
	protected String provenanceaction;
34
	protected Date dateofcollection;
35
	protected String platform;
39 36

  
40
	private String databaseaccesstype;
41
	private String datauploadtype;
42
	private String databaseaccessrestriction;
43
	private String datauploadrestriction;
37
	@Column(name = "activationid")
38
	protected String activationId;
39
	protected String description = null;
44 40

  
45
	private Boolean versioning;
46
	private String citationguidelineurl;
47
	private String qualitymanagementkind;
48
	private String pidsystems;
41
	protected Date releasestartdate;
42
	protected Date releaseenddate;
43
	protected String missionstatementurl;
44
	protected Boolean dataprovider;
45
	protected Boolean serviceprovider;
49 46

  
50
	private String certificates;
51
	private String aggregator;
47
	protected String databaseaccesstype;
48
	protected String datauploadtype;
49
	protected String databaseaccessrestriction;
50
	protected String datauploadrestriction;
52 51

  
53
	private String issn = null;
54
	private String eissn = null;
55
	private String lissn = null;
52
	protected Boolean versioning;
53
	protected String citationguidelineurl;
54
	protected String qualitymanagementkind;
55
	protected String pidsystems;
56 56

  
57
	private String registeredby = null;
57
	protected String certificates;
58
	protected String aggregator;
58 59

  
59
	private String subjects;
60
	protected String issn = null;
61
	protected String eissn = null;
62
	protected String lissn = null;
60 63

  
61
	private Boolean managed;
64
	protected String registeredby = null;
62 65

  
63
	private Set<ORG> organizations;
66
	protected String subjects;
64 67

  
65
	private Set<ID> identities;
68
	protected Boolean managed;
66 69

  
70
	@ManyToMany(
71
			cascade = { CascadeType.PERSIST, CascadeType.MERGE },
72
			fetch = FetchType.LAZY)
73
	@JoinTable(
74
			name = "dsm_datasource_organization",
75
			joinColumns = @JoinColumn(name="datasource"),
76
			inverseJoinColumns = @JoinColumn(name="organization"))
77
	protected Set<ORG> organizations;
78

  
79
	@ManyToMany(
80
			cascade = { CascadeType.PERSIST, CascadeType.MERGE },
81
			fetch = FetchType.LAZY )
82
	@JoinTable(
83
			name = "dsm_datasourcepids",
84
			joinColumns = @JoinColumn(name = "datasource"),
85
			inverseJoinColumns = @JoinColumn(name = "pid"))
86
	protected Set<ID> identities;
87

  
67 88
	public Datasource() {}
68 89

  
69 90
	public String getId() {
modules/dnet-datasource-manager-common/trunk/src/main/java/eu/dnetlib/enabling/datasources/common/ApiParam.java
1 1
package eu.dnetlib.enabling.datasources.common;
2 2

  
3
public class ApiParam {
3
import javax.persistence.EmbeddedId;
4
import javax.persistence.MappedSuperclass;
4 5

  
5
	private ApiParamKey id;
6
@MappedSuperclass
7
public class ApiParam<APK extends ApiParamKey> {
6 8

  
7
	private String value;
9
	@EmbeddedId
10
	protected APK id;
8 11

  
12
	protected String value;
13

  
9 14
	public ApiParam() {}
10 15

  
11
	public ApiParamKey getId() {
16
	public APK getId() {
12 17
		return id;
13 18
	}
14 19

  
15
	public ApiParam setId(final ApiParamKey id) {
20
	public ApiParam setId(final APK id) {
16 21
		this.id = id;
17 22
		return this;
18 23
	}
modules/dnet-datasource-manager-common/trunk/src/main/java/eu/dnetlib/enabling/datasources/common/DatasourceManagerCommon.java
20 20

  
21 21
	void saveDs(DS datasource) throws DatasourceManagerException;
22 22

  
23
	void updateCompliance(String apiId, String compliance) throws DatasourceManagerException;
23
	void updateCompliance(String dsId, String apiId, String compliance) throws DatasourceManagerException;
24 24

  
25 25
}
modules/dnet-datasource-manager-common/trunk/pom.xml
26 26
			<artifactId>gson</artifactId>
27 27
			<version>2.8.0</version>
28 28
		</dependency>
29
		<dependency>
30
			<groupId>javax.persistence</groupId>
31
			<artifactId>persistence-api</artifactId>
32
			<version>1.0</version>
33
		</dependency>
34

  
29 35
	</dependencies>
30 36
</project>

Also available in: Unified diff