Project

General

Profile

« Previous | Next » 

Revision 46896

Copying project to move to java 8

View differences:

modules/uoa-domain/trunk/deploy.info
1
{
2
  "type_source": "SVN", 
3
  "goal": "package -U -T 4C source:jar", 
4
  "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-domain/trunk", 
5
  "deploy_repository": "dnet4-snapshots", 
6
  "version": "4", 
7
  "mail": "antleb@di.uoa.gr, kiatrop@di.uoa.gr", 
8
  "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", 
9
  "name": "uoa-domain"
10
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/ActionType.java
1
/**
2
 * 
3
 */
4
package eu.dnetlib.domain;
5

  
6
public enum ActionType {
7
	CREATE("CREATE"),
8
	UPDATE("UPDATE"),
9
	DELETE("DELETE");
10
	
11
	private final String value;
12

  
13
	ActionType(String str) {
14
		this.value = str;
15
	}
16

  
17
	public String getValue() {
18
		return value;
19
	}
20

  
21
	@Override
22
	public String toString() {
23
		return this.getValue();
24
	}
25
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/Record1.java
1
package eu.dnetlib.domain.enabling;
2

  
3
public class Record1 {
4

  
5
	protected String status;
6
	protected int total;
7

  
8
	public String getStatus() {
9
		return status;
10
	}
11

  
12
	public void setStatus(String status) {
13
		this.status = status;
14
	}
15

  
16
	public int getTotal() {
17
		return total;
18
	}
19

  
20
	public void setTotal(int total) {
21
		this.total = total;
22
	}
23

  
24
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/VocabularySearchCriteria.java
1
package eu.dnetlib.domain.enabling;
2

  
3
import eu.dnetlib.domain.SearchCriteria;
4

  
5
public class VocabularySearchCriteria implements SearchCriteria {
6
	private String name = null;
7

  
8
	public VocabularySearchCriteria() {
9
	}
10
	
11
	public VocabularySearchCriteria(String name) {
12
		this.name = name;
13
	}
14

  
15
	public String getName() {
16
		return name;
17
	}
18

  
19
	public void setName(String name) {
20
		this.name = name;
21
	}
22

  
23
	public boolean matches(Object o) {
24
		Vocabulary vocab = (Vocabulary) o;
25

  
26
		if (this.name != null) {
27
			return this.name.equals(vocab.getName());
28
		}
29
		
30
		return true;
31
	}
32
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/SecurityProfileSearchCriteria.java
1
package eu.dnetlib.domain.enabling;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5

  
6
import eu.dnetlib.domain.SearchCriteria;
7
import eu.dnetlib.domain.SearchCriteriaImpl;
8

  
9
public class SecurityProfileSearchCriteria extends SearchCriteriaImpl implements
10
		SearchCriteria {
11

  
12
	private List<String> driverResourceIds = new ArrayList<String>();
13

  
14
	public boolean matches(Object o) {
15
		if (!(o instanceof SecurityProfile)) {
16
			return false;
17
		}
18

  
19
		SecurityProfile profile = (SecurityProfile) o;
20

  
21
		if (driverResourceIds != null) {
22
			for (String driverResourceId : driverResourceIds)
23
				if (driverResourceId != null) {
24
					if (profile.getDriverResourceId() == null
25
							|| !profile.getDriverResourceId().equals(
26
									driverResourceId))
27
						return false;
28
				}
29
		}
30

  
31
		return true;
32
	}
33

  
34
	public List<String> getDriverResourceIds() {
35
		return driverResourceIds;
36
	}
37

  
38
	public void setDriverResourceIds(List<String> driverResourceIds) {
39
		this.driverResourceIds = driverResourceIds;
40
	}
41
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/StartPullRSType.java
1
package eu.dnetlib.domain.enabling;
2

  
3
public class StartPullRSType {
4

  
5
	protected Integer keepAliveTime;
6
	protected String styleSheet;
7
	protected Integer total;
8

  
9
	public Integer getKeepAliveTime() {
10
		return keepAliveTime;
11
	}
12

  
13
	public void setKeepAliveTime(Integer keepAliveTime) {
14
		this.keepAliveTime = keepAliveTime;
15
	}
16

  
17
	public String getStyleSheet() {
18
		return styleSheet;
19
	}
20

  
21
	public void setStyleSheet(String styleSheet) {
22
		this.styleSheet = styleSheet;
23
	}
24

  
25
	public Integer getTotal() {
26
		return total;
27
	}
28

  
29
	public void setTotal(Integer total) {
30
		this.total = total;
31
	}
32

  
33
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/PreparePullRSType.java
1
package eu.dnetlib.domain.enabling;
2

  
3
public class PreparePullRSType {
4

  
5
	protected Integer keepAliveTime;
6
	protected String styleSheet;
7
	protected Integer total;
8

  
9
	public Integer getKeepAliveTime() {
10
		return keepAliveTime;
11
	}
12

  
13
	public void setKeepAliveTime(Integer keepAliveTime) {
14
		this.keepAliveTime = keepAliveTime;
15
	}
16

  
17
	public String getStyleSheet() {
18
		return styleSheet;
19
	}
20

  
21
	public void setStyleSheet(String styleSheet) {
22
		this.styleSheet = styleSheet;
23
	}
24

  
25
	public Integer getTotal() {
26
		return total;
27
	}
28

  
29
	public void setTotal(Integer total) {
30
		this.total = total;
31
	}
32

  
33
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/Subscription.java
1
package eu.dnetlib.domain.enabling;
2

  
3
import eu.dnetlib.domain.EPR;
4

  
5
/**
6
 * Represents a subscription used for communication with the IS_SN
7
 * 
8
 * @author christos
9
 * 
10
 */
11
public class Subscription {
12
	private String id = null;
13
	private String topic = null;
14
	private int timeToLive = 0;
15
	private EPR epr = null;
16

  
17
	public EPR getEpr() {
18
		return epr;
19
	}
20

  
21
	public void setEpr(EPR epr) {
22
		this.epr = epr;
23
	}
24

  
25
	public String getId() {
26
		return id;
27
	}
28

  
29
	public void setId(String id) {
30
		this.id = id;
31
	}
32

  
33
	public String getTopic() {
34
		return topic;
35
	}
36

  
37
	public void setTopic(String topic) {
38
		this.topic = topic;
39
	}
40

  
41
	public int getTimeToLive() {
42
		return timeToLive;
43
	}
44

  
45
	public void setTimeToLive(int timeToLive) {
46
		this.timeToLive = timeToLive;
47
	}
48

  
49
	public String toString() {
50
		return topic;
51
	}
52
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/Notification.java
1
package eu.dnetlib.domain.enabling;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.util.Date;
5

  
6
import javax.xml.parsers.DocumentBuilder;
7
import javax.xml.parsers.DocumentBuilderFactory;
8
import javax.xml.parsers.ParserConfigurationException;
9
import javax.xml.xpath.XPath;
10
import javax.xml.xpath.XPathConstants;
11
import javax.xml.xpath.XPathExpression;
12
import javax.xml.xpath.XPathFactory;
13

  
14
import org.apache.log4j.Logger;
15
import org.w3c.dom.Document;
16
import org.w3c.dom.Node;
17

  
18
import eu.dnetlib.domain.ActionType;
19
import eu.dnetlib.domain.ResourceType;
20

  
21
public class Notification {
22
	private static Logger logger = Logger.getLogger(Notification.class);
23
	
24
	private String subscriptionId = null;
25
	private String message = null;
26
	private String topic = null;
27
	private String isId = null;
28
	private Date date = new Date();
29
	
30
	private ActionType actionType = null;
31
	private ResourceType resourceType = null;
32
	private String resource = null;
33
	private String resourceId = null;
34
	
35
	public Notification(String subscriptionId, String message, String topic,
36
			String isId) throws Exception  {
37
		super();
38
		
39
		this.subscriptionId = subscriptionId;
40
		this.message = message;
41
		this.topic = topic;
42
		this.isId = isId;
43
		
44
		this.resource = message;
45
		this.resourceId = this.getField(message, "RESOURCE_IDENTIFIER");
46
		this.resourceType = ResourceType.valueOf(ResourceType.class, this.getField(message, "RESOURCE_TYPE").toUpperCase());
47
		this.actionType = ActionType.valueOf(topic.split("\\.")[0]);
48
	}
49

  
50
	public Notification(String subscriptionId, String resource,
51
			String resourceId, ResourceType resourceType, ActionType actionType) {
52
		this.resource = resource;
53
		this.resourceId = resourceId;
54
		this.resourceType = resourceType;
55
		this.actionType = actionType;
56
		
57
		this.subscriptionId = subscriptionId;
58
		this.message = resource;
59
		this.topic = actionType.getValue() + "." + resourceType.getValue();
60
	}
61

  
62
	public String getSubscriptionId() {
63
		return subscriptionId;
64
	}
65

  
66
	public String getMessage() {
67
		return message;
68
	}
69

  
70
	public String getTopic() {
71
		return topic;
72
	}
73

  
74
	public String getIsId() {
75
		return isId;
76
	}
77

  
78
	public Date getDate() {
79
		return date;
80
	}
81

  
82
	public ActionType getActionType() {
83
		return actionType;
84
	}
85

  
86
	public ResourceType getResourceType() {
87
		return resourceType;
88
	}
89

  
90
	public String getResource() {
91
		return resource;
92
	}
93

  
94
	public String getResourceId() {
95
		return resourceId;
96
	}
97

  
98
	private String getField(String xml, String fieldName) throws Exception {
99
		ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes());
100
		DocumentBuilderFactory domFactory = DocumentBuilderFactory
101
				.newInstance();
102

  
103
		domFactory.setNamespaceAware(true); // never forget this!
104

  
105
		try {
106
			DocumentBuilder builder = domFactory.newDocumentBuilder();
107
			Document doc = builder.parse(bis);
108
			XPathFactory factory = XPathFactory.newInstance();
109
			XPath xpath = factory.newXPath();
110

  
111
			XPathExpression expression = xpath.compile("//*[local-name()='"
112
					+ fieldName + "']");
113

  
114
			Node node = (Node) expression.evaluate(doc, XPathConstants.NODE);
115
			String value = node.getAttributes().getNamedItem("value").getTextContent();
116
			
117
			logger.debug("Field : " + fieldName + ":" + value);
118

  
119
			return value;
120
		} catch (ParserConfigurationException e) {
121
			throw new Exception("XML Parser configuration Error", e);
122
		}
123
	}
124
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/CreatePullRSType.java
1
package eu.dnetlib.domain.enabling;
2

  
3
public class CreatePullRSType {
4

  
5
	protected Integer keepAliveTime;
6
	protected String styleSheet;
7
	protected Integer total;
8

  
9
	public Integer getKeepAliveTime() {
10
		return keepAliveTime;
11
	}
12

  
13
	public void setKeepAliveTime(Integer keepAliveTime) {
14
		this.keepAliveTime = keepAliveTime;
15
	}
16

  
17
	public String getStyleSheet() {
18
		return styleSheet;
19
	}
20

  
21
	public void setStyleSheet(String styleSheet) {
22
		this.styleSheet = styleSheet;
23
	}
24

  
25
	public Integer getTotal() {
26
		return total;
27
	}
28

  
29
	public void setTotal(Integer total) {
30
		this.total = total;
31
	}
32

  
33
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/Vocabulary.java
1
package eu.dnetlib.domain.enabling;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5
import java.util.Map;
6
import java.util.TreeMap;
7

  
8
import eu.dnetlib.domain.DriverResource;
9

  
10
/**
11
 * 
12
 * The domain object for the Vocabulary resource data structure
13
 * 
14
 */
15
@SuppressWarnings("serial")
16
public class Vocabulary extends DriverResource {
17
	private String name = null;
18
	private Map<String, String> nameMap = null;
19
	private Map<String, String> encodingMap = null;
20
	
21
	public Vocabulary(String name, Map<String, String> nameMap) {
22
		this.setResourceType("VocabularyDSResourceType");
23
		this.setResourceKind("VocabularyDSResources");
24
		
25
		this.name = name;
26
		initializeMaps(nameMap);
27
	}
28
	
29
	public Vocabulary(String name, Map<String, String> nameMap, Map<String, String> encodingMap) {
30
		this.setResourceType("VocabularyDSResourceType");
31
		this.setResourceKind("VocabularyDSResources");
32
		
33
		this.name = name;
34
		this.nameMap = nameMap;
35
		this.encodingMap = encodingMap;	
36
	}
37
	
38
	public void initializeMaps(Map<String, String> nameMap) {
39
		this.nameMap = nameMap;
40
		this.encodingMap = new TreeMap<String, String>();
41
		for (String name : nameMap.keySet()) {
42
			encodingMap.put(nameMap.get(name), name);
43
		}
44
	}
45

  
46
	public String getName() {
47
		return name;
48
	}
49

  
50
	public void setName(String name) {
51
		this.name = name;
52
	}
53

  
54
	public String getEncoding(String englishName) {
55
		return nameMap.get(englishName);
56
	}
57
	
58
	public String getEnglishName(String encoding) {
59
		return encodingMap.get(encoding);
60
	}
61
	
62
	public List<String> getEnglishNames() {
63
		return new ArrayList<String>(this.nameMap.keySet());
64
	}
65
	
66
	public List<String> getEncodings() {
67
		return new ArrayList<String>(this.encodingMap.keySet());
68
	}
69

  
70
	public Map<String, String> getAsMap() { return this.encodingMap; }
71
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/SecurityProfile.java
1
package eu.dnetlib.domain.enabling;
2

  
3
import com.google.gwt.user.client.rpc.IsSerializable;
4
import eu.dnetlib.domain.DriverResource;
5

  
6
import java.util.ArrayList;
7
import java.util.List;
8

  
9
/**
10
 * 
11
 * The domain object for the SecurityProfile resource data structure
12
 * 
13
 */
14
public class SecurityProfile extends DriverResource implements IsSerializable {
15
	private static final long serialVersionUID = 6533097295469183688L;
16

  
17
	private String driverResourceId;
18
	private List<String> identities = new ArrayList<String>();
19
	private String password = null;
20

  
21
	public SecurityProfile() {
22
		this.setResourceKind("SecurityProfileDSResources");
23
		this.setResourceType("SecurityProfileDSResourceType");
24
	}
25

  
26
	@Deprecated
27
	public String getId() {
28
		return this.getResourceId();
29
	}
30

  
31
	@Deprecated
32
	public void setId(String id) {
33
		this.setResourceId(id);
34
	}
35

  
36
	public List<String> getIdentities() {
37
		return identities;
38
	}
39

  
40
	public void setIdentities(List<String> identities) {
41
		this.identities = identities;
42
	}
43

  
44
	public String getDriverResourceId() {
45
		return driverResourceId;
46
	}
47

  
48
	public void setDriverResourceId(String recourceId) {
49
		this.driverResourceId = recourceId;
50
	}
51

  
52
	public String getPassword() {
53
		return password;
54
	}
55

  
56
	public void setPassword(String password) {
57
		this.password = password;
58
	}
59

  
60
	@Override
61
	public int hashCode() {
62
		final int prime = 31;
63
		int result = super.hashCode();
64
		result = prime
65
				* result
66
				+ ((driverResourceId == null) ? 0 : driverResourceId.hashCode());
67
		result = prime * result
68
				+ ((identities == null) ? 0 : identities.hashCode());
69
		result = prime * result
70
				+ ((password == null) ? 0 : password.hashCode());
71
		return result;
72
	}
73

  
74
	@Override
75
	public boolean equals(Object obj) {
76
		if (this == obj)
77
			return true;
78
		if (!super.equals(obj))
79
			return false;
80
		if (getClass() != obj.getClass())
81
			return false;
82
		SecurityProfile other = (SecurityProfile) obj;
83
		if (driverResourceId == null) {
84
			if (other.driverResourceId != null)
85
				return false;
86
		} else if (!driverResourceId.equals(other.driverResourceId))
87
			return false;
88
		if (identities == null) {
89
			if (other.identities != null)
90
				return false;
91
		} else if (!identities.equals(other.identities))
92
			return false;
93
		if (password == null) {
94
			if (other.password != null)
95
				return false;
96
		} else if (!password.equals(other.password))
97
			return false;
98
		return true;
99
	}
100
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/enabling/ListResourceProfilesType.java
1
package eu.dnetlib.domain.enabling;
2

  
3
public class ListResourceProfilesType {
4

  
5
	protected String format;
6
	protected String resourceType;
7

  
8
	public String getFormat() {
9
		return format;
10
	}
11

  
12
	public void setFormat(String format) {
13
		this.format = format;
14
	}
15

  
16
	public String getResourceType() {
17
		return resourceType;
18
	}
19

  
20
	public void setResourceType(String resourceType) {
21
		this.resourceType = resourceType;
22
	}
23
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/DriverResource.java
1
package eu.dnetlib.domain;
2

  
3
import java.io.Serializable;
4
import java.util.Date;
5

  
6
/**
7
 * The base class for all domain objects in the driver domain. This class groups
8
 * all common information, such as the <i>resourceId</id> and the
9
 * <i>resourceUri</id>.
10
 * 
11
 */
12
public abstract class DriverResource implements Serializable {
13
	private static final long serialVersionUID = 1583061448986459014L;
14

  
15
	private String resourceId = null;
16
	private String resourceUri = null;
17
	private String resourceKind = null;
18
	private String resourceType = null;
19
	private Date dateOfCreation = null;
20

  
21
	public Date getDateOfCreation() {
22
		return dateOfCreation;
23
	}
24

  
25
	public void setDateOfCreation(Date dateOfCreation) {
26
		this.dateOfCreation = dateOfCreation;
27
	}
28

  
29
	public String getResourceId() {
30
		return resourceId;
31
	}
32

  
33
	public void setResourceId(String resourceId) {
34
		this.resourceId = resourceId;
35
	}
36

  
37
	public String getResourceKind() {
38
		return resourceKind;
39
	}
40

  
41
	public void setResourceKind(String resourceKind) {
42
		this.resourceKind = resourceKind;
43
	}
44

  
45
	public String getResourceType() {
46
		return resourceType;
47
	}
48

  
49
	public void setResourceType(String resourceType) {
50
		this.resourceType = resourceType;
51
	}
52

  
53
	public String getResourceUri() {
54
		return resourceUri;
55
	}
56

  
57
	public void setResourceUri(String resourceUri) {
58
		this.resourceUri = resourceUri;
59
	}
60

  
61
	@Override
62
	public int hashCode() {
63
		final int prime = 31;
64
		int result = 1;
65
		result = prime * result
66
				+ ((dateOfCreation == null) ? 0 : dateOfCreation.hashCode());
67
		result = prime * result
68
				+ ((resourceId == null) ? 0 : resourceId.hashCode());
69
		result = prime * result
70
				+ ((resourceKind == null) ? 0 : resourceKind.hashCode());
71
		result = prime * result
72
				+ ((resourceType == null) ? 0 : resourceType.hashCode());
73
		result = prime * result
74
				+ ((resourceUri == null) ? 0 : resourceUri.hashCode());
75
		return result;
76
	}
77

  
78
	@Override
79
	public boolean equals(Object obj) {
80
		if (this == obj)
81
			return true;
82
		if (obj == null)
83
			return false;
84
		if (getClass() != obj.getClass())
85
			return false;
86
		DriverResource other = (DriverResource) obj;
87
		if (dateOfCreation == null) {
88
			if (other.dateOfCreation != null)
89
				return false;
90
		} else if (!dateOfCreation.equals(other.dateOfCreation))
91
			return false;
92
		if (resourceId == null) {
93
			if (other.resourceId != null)
94
				return false;
95
		} else if (!resourceId.equals(other.resourceId))
96
			return false;
97
		if (resourceKind == null) {
98
			if (other.resourceKind != null)
99
				return false;
100
		} else if (!resourceKind.equals(other.resourceKind))
101
			return false;
102
		if (resourceType == null) {
103
			if (other.resourceType != null)
104
				return false;
105
		} else if (!resourceType.equals(other.resourceType))
106
			return false;
107
		if (resourceUri == null) {
108
			if (other.resourceUri != null)
109
				return false;
110
		} else if (!resourceUri.equals(other.resourceUri))
111
			return false;
112
		return true;
113
	}
114
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/DriverServiceProfileSearchCriteria.java
1
package eu.dnetlib.domain;
2

  
3

  
4

  
5

  
6
public class DriverServiceProfileSearchCriteria extends SearchCriteriaImpl
7
	implements SearchCriteria {
8
	
9
	private String resourceType = null;
10
	private String resourceKind = null;
11
	private Boolean includePending = null;
12
	private String parentId = null;
13
	private String parentType = null;
14
	private String resourceUri = null;
15

  
16
	public String getParentId() {
17
		return parentId;
18
	}
19

  
20
	public void setParentId(String parentId) {
21
		this.parentId = parentId;
22
	}
23

  
24
	public String getParentType() {
25
		return parentType;
26
	}
27

  
28
	public void setParentType(String parentType) {
29
		this.parentType = parentType;
30
	}
31

  
32
	public String getResourceUri() {
33
		return resourceUri;
34
	}
35

  
36
	public void setResourceUri(String resourceUri) {
37
		this.resourceUri = resourceUri;
38
	}
39

  
40
	public Boolean getIncludePending() {
41
		return includePending;
42
	}
43

  
44
	public void setIncludePending(Boolean includePending) {
45
		this.includePending = includePending;
46
	}
47

  
48
	public String getResourceType() {
49
		return resourceType;
50
	}
51

  
52
	public void setResourceType(String serviceType) {
53
		this.resourceType = serviceType;
54
	}
55

  
56
	public boolean matches(Object o) {
57
		throw new UnsupportedOperationException();
58
	}
59

  
60
	public String getResourceKind() {
61
		return resourceKind;
62
	}
63

  
64
	public void setResourceKind(String resourceKind) {
65
		this.resourceKind = resourceKind;
66
	}
67
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/EPR.java
1
package eu.dnetlib.domain;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
public class EPR {
7
	/** The w3c epr. Kept to avoid parsing/creating it if not needed. */
8
	private String epr = null;
9
	
10
	/** The reference parameters of the w3c epr */
11
	private Map<String, String> parameters = new HashMap<String, String>();
12
	
13
	/** The address of the w3c epr */
14
	private String address = null;
15
	
16
	/** Service name of the w3c epr */
17
	private String serviceName = null;
18
	
19
	/** Endpoint name of the w3c epr */
20
	private String endpointName = null;
21
	
22
	public String getParameter(String name) {
23
		return parameters.get(name);
24
	}
25
	
26
	public void setParameter(String name, String value) {
27
		this.epr = null;
28
		this.parameters.put(name, value);
29
	}
30
	
31
	public String[] getParameterNames() {
32
		return parameters.keySet().toArray(new String[] {});
33
	}
34
	
35
	public void removeParameter(String name) {
36
		this.epr = null;
37
		
38
		this.parameters.remove(name);
39
	}
40
	
41
	public void clearParameters() {
42
		this.epr = null;
43
		
44
		this.parameters.clear();
45
	}
46

  
47
	public String getEpr() {
48
		return epr;
49
	}
50

  
51
	public void setEpr(String epr) {
52
		this.epr = epr;
53
	}
54

  
55
	public String getAddress() {
56
		return address;
57
	}
58

  
59
	public void setAddress(String address) {
60
		this.epr = null;
61
		
62
		this.address = address;
63
	}
64
	
65
	public String getServiceName() {
66
		return serviceName;
67
	}
68

  
69
	public void setServiceName(String serviceName) {
70
		this.serviceName = serviceName;
71
	}
72

  
73
	public String getEndpointName() {
74
		return endpointName;
75
	}
76

  
77
	public void setEndpointName(String endpointName) {
78
		this.endpointName = endpointName;
79
	}
80

  
81
	@Override
82
	public String toString() {
83
		StringBuilder builder = new StringBuilder();
84
		
85
		builder.append("[address: ").append(address).append(", serviceName: ");
86
		builder.append(serviceName).append(", endpointName: ");
87
		builder.append(endpointName).append(", parameters: ");
88
		builder.append(parameters.toString()).append("]");
89
		
90
		return builder.toString();
91
	}
92
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/SearchCriteria.java
1
package eu.dnetlib.domain;
2

  
3
/**
4
 * This interface is used to define search criteria in order to search for resources in the IS_Lookup.
5
 * Provides only one method, <code>matches(Object)</code>
6
 */
7
public interface SearchCriteria {
8
	public boolean matches(Object o);
9
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/functionality/PlainTextDisplayType.java
1
package eu.dnetlib.domain.functionality;
2

  
3
import java.util.Locale;
4
import java.util.Map;
5

  
6
public class PlainTextDisplayType extends DisplayType {
7
	
8
	public PlainTextDisplayType(String field) {
9
		super(field);
10
	}
11
	
12
	public PlainTextDisplayType(String field, Map<Locale, String> descriptionMap) {
13
		super(field);
14
		setDescriptionMap(descriptionMap);
15
	}
16
	
17
/*	@Override
18
	public int getDisplayMessage(StringBuilder builder, Document document, 
19
			String fieldValue) {
20
		String finalValue = replaceFieldValueExpression(document, getDescription(), fieldValue);
21
		builder.append(finalValue);
22
		return finalValue.length();
23
	}
24

  
25
	@Override
26
	int getDisplayMessage(StringBuilder builder, Document document,
27
			String fieldValue, String secondaryLink) {
28
		String finalValue = replaceFieldValueExpression(document, secondaryLink, fieldValue);
29
		builder.append(finalValue);
30
		return finalValue.length();
31
	}
32
*/	
33
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/functionality/UpdateCollectionType.java
1
package eu.dnetlib.domain.functionality;
2

  
3
import java.util.List;
4

  
5
public class UpdateCollectionType {
6

  
7
	protected Boolean cContainer;
8
	protected List<Record1> cDesc;
9
	protected Boolean cFrozen;
10
	protected String cImage;
11
	protected String cMemCond;
12
	protected String cName;
13
	protected String cOwner;
14
	protected Boolean cPrivate;
15
	protected String cSource;
16
	protected String cSubject;
17
	protected Boolean cVisible;
18

  
19
	public Boolean getCContainer() {
20
		return cContainer;
21
	}
22

  
23
	public void setCContainer(Boolean container) {
24
		cContainer = container;
25
	}
26

  
27
	public List<Record1> getCDesc() {
28
		return cDesc;
29
	}
30

  
31
	public void setCDesc(List<Record1> desc) {
32
		cDesc = desc;
33
	}
34

  
35
	public Boolean getCFrozen() {
36
		return cFrozen;
37
	}
38

  
39
	public void setCFrozen(Boolean frozen) {
40
		cFrozen = frozen;
41
	}
42

  
43
	public String getCImage() {
44
		return cImage;
45
	}
46

  
47
	public void setCImage(String image) {
48
		cImage = image;
49
	}
50

  
51
	public String getCMemCond() {
52
		return cMemCond;
53
	}
54

  
55
	public void setCMemCond(String memCond) {
56
		cMemCond = memCond;
57
	}
58

  
59
	public String getCName() {
60
		return cName;
61
	}
62

  
63
	public void setCName(String name) {
64
		cName = name;
65
	}
66

  
67
	public String getCOwner() {
68
		return cOwner;
69
	}
70

  
71
	public void setCOwner(String owner) {
72
		cOwner = owner;
73
	}
74

  
75
	public Boolean getCPrivate() {
76
		return cPrivate;
77
	}
78

  
79
	public void setCPrivate(Boolean private1) {
80
		cPrivate = private1;
81
	}
82

  
83
	public String getCSource() {
84
		return cSource;
85
	}
86

  
87
	public void setCSource(String source) {
88
		cSource = source;
89
	}
90

  
91
	public String getCSubject() {
92
		return cSubject;
93
	}
94

  
95
	public void setCSubject(String subject) {
96
		cSubject = subject;
97
	}
98

  
99
	public Boolean getCVisible() {
100
		return cVisible;
101
	}
102

  
103
	public void setCVisible(Boolean visible) {
104
		cVisible = visible;
105
	}
106
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/functionality/WebInterfaceServiceProfile.java
1
package eu.dnetlib.domain.functionality;
2

  
3
import java.util.Date;
4

  
5
import eu.dnetlib.domain.DriverServiceProfile;
6

  
7
public class WebInterfaceServiceProfile extends DriverServiceProfile {
8

  
9
	private static final long serialVersionUID = -6866028072976712196L;
10

  
11
	public WebInterfaceServiceProfile() {
12
		super("ServiceResources", "UserInterfaceServiceResourceType",
13
				new Date());
14
	}
15

  
16
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/functionality/ObjectPage.java
1
package eu.dnetlib.domain.functionality;
2

  
3
import java.util.SortedSet;
4

  
5
/**
6
 * This class represents a single page of objects which is part of a multi-page sequence.
7
 * @author thanos
8
 * @see eu.dnetlib.api.functionality.NotificationService
9
 * @see eu.dnetlib.api.functionality.AlertService
10
 * @param <E> the type of the objects contained in this page
11
 * 
12
 */
13
public class ObjectPage<E> {
14
	private int pageNumber;
15
	private int pageSize;
16
	private int totalObjects;
17
	private SortedSet<E> objects;
18

  
19
	/**
20
	 * Construct a new object page.
21
	 * @param pageNumber the number of this page
22
	 * @param pageSize the size of this page
23
	 * @param totalObjects the total number of available objects
24
	 * @param objects the objects contained in this page
25
	 */
26
	public ObjectPage(final int pageNumber, final int pageSize, final int totalObjects, final SortedSet<E> objects) {
27
		this.pageNumber = pageNumber;
28
		this.pageSize = pageSize;
29
		this.totalObjects = totalObjects;
30
		this.objects = objects;
31
	}
32
	
33
	/**
34
	 * Construct a new object page with page number, page size and total objects set to zero and objects set to null.
35
	 */
36
	public ObjectPage() {
37
		this(0, 0, 0, null);
38
	}
39

  
40
	/**
41
	 * Get the page number.
42
	 * @return the page number of this object page
43
	 */
44
	public int getPageNumber() {
45
		return pageNumber;
46
	}
47
	
48
	/**
49
	 * Set the page number.
50
	 * @param pageNumber the page number of this object page
51
	 */
52
	public void setPageNumber(final int pageNumber) {
53
		this.pageNumber = pageNumber;
54
	}
55

  
56
	/**
57
	 * Get the page size.
58
	 * @return the page size of this object page
59
	 */
60
	public int getPageSize() {
61
		return pageSize;
62
	}
63
	
64
	/**
65
	 * Set the page size.
66
	 * @param pageSize the page size of this object page
67
	 */
68
	public void setPageSize(final int pageSize) {
69
		this.pageSize = pageSize;
70
	}
71

  
72
	/**
73
	 * Get the total objects.
74
	 * @return the total objects of this page
75
	 */
76
	public int getTotalObjects() {
77
		return totalObjects;
78
	}
79
	
80
	/**
81
	 * Set the total objects.
82
	 * @param totalObjects the total objects of this page
83
	 */
84
	public void setTotalObjects(final int totalObjects) {
85
		this.totalObjects = totalObjects;
86
	}
87

  
88
	/**
89
	 * Get the objects.
90
	 * @return the objects of this page
91
	 */
92
	public SortedSet<E> getObjects() {
93
		return objects;
94
	}
95
	
96
	/**
97
	 * Set the objects.
98
	 * @param objects the objects of this page
99
	 */
100
	public void setObjects(SortedSet<E> objects) {
101
		this.objects = objects;
102
	}
103
	
104
	/**
105
	 * Get the first object.
106
	 * @return the number of the first object of this page
107
	 */
108
	public int getFrom() {
109
		return pageNumber * pageSize;
110
	}
111
	
112
	/**
113
	 * Get the last object.
114
	 * @return the number of the last object of this page
115
	 */
116
	public int getTo() {
117
		final int to = (pageNumber + 1) * pageSize;
118
		return (to > totalObjects) ? totalObjects : to;
119
	}
120
	
121
	/**
122
	 * Get the total pages.
123
	 * @return the total number of available pages
124
	 */
125
	public int getTotalPages() {
126
		return (int) Math.ceil((float) totalObjects / pageSize);
127
	}
128
	
129
	@Override
130
	public String toString() {
131
		return getFrom() + " - " + getTo() + " of " + totalObjects + " (page " + pageNumber + " of " + getTotalPages() + ", page size " + pageSize + ")";
132
	}
133
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/functionality/NotificationSchedule.java
1
package eu.dnetlib.domain.functionality;
2

  
3
/**
4
 * This class represents an execution schedule for a notification query. 
5
 * @author thanos
6
 * @see eu.dnetlib.api.functionality.NotificationService
7
 * @see eu.dnetlib.functionality.notification.executor.NotificationQueryExecutor
8
 * @see NotificationQuery
9
 * @see NotificationEvent
10
 * @see NotificationResult
11
 * @see NotificationSubscription
12
 *
13
 */
14
public class NotificationSchedule implements Comparable<NotificationSchedule> {
15
	private String queryId;
16
	private Float triggerThreshold;
17
	private boolean percentileThreshold;
18
	private long executionPeriod;
19
	private boolean enabled;
20
	
21
	/**
22
	 * Construct a new notification schedule.
23
	 * @param queryId the unique identifier of the query of this schedule
24
	 * @param triggerThreshold the trigger threshold of this schedule or null if no threshold applies
25
	 * @param percentileThreshold true if trigger threshold is percentile threshold, false otherwise
26
	 * @param executionPeriod the execution period of this schedule expressed in minutes
27
	 * @param enabled true if this topic is currently enabled, false if it currently disabled
28
	 */
29
	public NotificationSchedule(final String queryId, final Float triggerThreshold, final boolean percentileThreshold, final long executionPeriod, final boolean enabled) {
30
		this.queryId = queryId;
31
		this.triggerThreshold = triggerThreshold;
32
		this.percentileThreshold = percentileThreshold;
33
		this.executionPeriod = executionPeriod;
34
		this.enabled = enabled;
35
	}
36
	
37
	/**
38
	 * Construct a new notification query with query identifier and trigger threshold set to null, percentile threshold and enabled set to false and execution period set to zero.
39
	 */
40
	public NotificationSchedule() {
41
		this(null, null, false, 0L, false);
42
	}
43

  
44
	/**
45
	 * Get the query of this schedule.
46
	 * @return the unique identifier of the query of this schedule
47
	 */
48
	public String getQueryId() {
49
		return queryId;
50
	}
51

  
52
	/**
53
	 * Set the query of this schedule.
54
	 * @param queryId the unique identifier of the query of this schedule
55
	 */
56
	public void setQueryId(final String queryId) {
57
		this.queryId = queryId;
58
	}
59

  
60
	/**
61
	 * Get the trigger threshold of this schedule.
62
	 * @return the trigger threshold of this schedule
63
	 */
64
	public Float getTriggerThreshold() {
65
		return triggerThreshold;
66
	}
67

  
68
	/**
69
	 * Set the trigger threshold of this schedule.
70
	 * @param triggerThreshold the the trigger threshold of this schedule
71
	 */
72
	public void setTriggerThreshold(final Float triggerThreshold) {
73
		this.triggerThreshold = triggerThreshold;
74
	}
75

  
76
	/**
77
	 * Check if the trigger threshold of this schedule  is percentile.
78
	 * @return true if the trigger threshold of this topic is percentile, false otherwise
79
	 */
80
	public boolean isPercentileThreshold() {
81
		return percentileThreshold;
82
	}
83

  
84
	/**
85
	 * Set the percentile status of the trigger threshold of this schedule.
86
	 * @param percentileThreshold true to set a percentile trigger threshold to this schedule, false otherwise
87
	 */
88
	public void setPercentileThreshold(final boolean percentileThreshold) {
89
		this.percentileThreshold = percentileThreshold;
90
	}
91

  
92
	/**
93
	 * Get the execution period of this schedule.
94
	 * @return the the execution period of this schedule
95
	 */
96
	public long getExecutionPeriod() {
97
		return executionPeriod;
98
	}
99

  
100
	/**
101
	 * Set the execution period of this schedule.
102
	 * @param executionPeriod the execution period of this schedule
103
	 */
104
	public void setExecutionPeriod(final long executionPeriod) {
105
		this.executionPeriod = executionPeriod;
106
	}
107

  
108
	/**
109
	 * Check if this schedule is enabled.
110
	 * @return true if this schedule is currently enabled, false otherwise
111
	 */
112
	public boolean isEnabled() {
113
		return enabled;
114
	}
115

  
116
	/**
117
	 * Set the enabled status of this schedule.
118
	 * @param enabled true to enable this schedule, false to disable it
119
	 */
120
	public void setEnabled(final boolean enabled) {
121
		this.enabled = enabled;
122
	}
123

  
124
	@Override
125
	public int compareTo(final NotificationSchedule schedule) {
126
		return queryId.compareTo(schedule.queryId);
127
	}
128
	@Override
129
	public boolean equals(final Object object) {
130
		if (!(object instanceof NotificationSchedule))
131
			return false;
132
		final NotificationSchedule schedule = (NotificationSchedule) object;
133
		return (queryId == null) ? (schedule.queryId == null) : queryId.equals(schedule.queryId);
134
	}
135
	
136
	@Override
137
	public int hashCode() {
138
		return (queryId == null) ? 0 : queryId.hashCode();
139
	}
140
	
141
	@Override
142
	public String toString() {
143
		return queryId;
144
	}
145
}
modules/uoa-domain/trunk/src/main/java/eu/dnetlib/domain/functionality/CollectionSearchCriteria.java
1
package eu.dnetlib.domain.functionality;
2

  
3
import eu.dnetlib.domain.SearchCriteria;
4
import eu.dnetlib.domain.SearchCriteriaImpl;
5

  
6
public class CollectionSearchCriteria extends SearchCriteriaImpl implements
7
		SearchCriteria {
8

  
9
	private String parentId = null;
10
	private Boolean root = null;
11
	private Boolean isPrivate = null;
12
	private String ownerId = null;
13
	private String name = null;
14
	private Boolean isContainer = null;
15

  
16
	public Boolean getIsContainer() {
17
		return isContainer;
18
	}
19

  
20
	public void setIsContainer(Boolean isContainer) {
21
		this.isContainer = isContainer;
22
	}
23

  
24
	public String getParentId() {
25
		return parentId;
26
	}
27

  
28
	public void setParentId(String parentId) {
29
		this.parentId = parentId;
30
	}
31

  
32
	public Boolean getRoot() {
33
		return root;
34
	}
35

  
36
	public void setRoot(Boolean root) {
37
		this.root = root;
38
	}
39

  
40
	public boolean matches(Object o) {
41
		Collection collection = (Collection) o;
42

  
43
		if (this.getContains() != null) {
44
			if (collection.getName() == null
45
					|| !collection.getName().toLowerCase().contains(
46
							this.getContains().toLowerCase()))
47
				return false;
48
		}
49

  
50
		if (this.getStartsWith() != null) {
51
			if (collection.getName() == null
52
					|| !collection.getName().toLowerCase().startsWith(
53
							this.getStartsWith().toLowerCase()))
54
				return false;
55
		}
56

  
57
		if (this.getEndsWith() != null) {
58
			if (collection.getName() == null
59
					|| !collection.getName().toLowerCase().endsWith(
60
							this.getEndsWith().toLowerCase()))
61
				return false;
62
		}
63

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff