Creating IS model refs #4023
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/information-system-model@128743 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9b608644fc
commit
fcd2a7bd93
16
pom.xml
16
pom.xml
|
@ -17,6 +17,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
<serviceClass>InformationSystem</serviceClass>
|
||||
<jackson.version>2.2.3</jackson.version>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
|
@ -26,6 +27,21 @@
|
|||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.entity;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Entity;
|
||||
import org.gcube.informationsystem.model.entity.Header;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public abstract class EntityImpl implements Entity {
|
||||
|
||||
@JsonDeserialize(as = HeaderImpl.class)
|
||||
protected Header header;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private EntityImpl(){}
|
||||
|
||||
protected EntityImpl(String name, String description, String version){
|
||||
this.header = new HeaderImpl(name, description, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Header getHeader() {
|
||||
return this.header;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.entity;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Facet;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public abstract class FacetImpl extends EntityImpl implements Facet {
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param description
|
||||
* @param version
|
||||
*/
|
||||
protected FacetImpl(String name, String description, String version) {
|
||||
super(name, description, version);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.entity;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Header;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class HeaderImpl implements Header {
|
||||
|
||||
protected String id;
|
||||
protected String creator;
|
||||
protected Calendar creationTime;
|
||||
protected Calendar lastUpdateTime;
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected String version;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private HeaderImpl(){
|
||||
|
||||
}
|
||||
|
||||
protected HeaderImpl(String name, String description, String version){
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
protected void setID(String id){
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreator() {
|
||||
return this.creator;
|
||||
}
|
||||
|
||||
protected void setCreator(String creator){
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Calendar getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Calendar getLastUpdateTime() {
|
||||
return lastUpdateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Facet;
|
||||
import org.gcube.informationsystem.model.entity.Resource;
|
||||
import org.gcube.informationsystem.model.relation.RelationProperty;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public abstract class ResourceImpl extends EntityImpl implements Resource {
|
||||
|
||||
protected Map<Facet, RelationProperty> addedFacets;
|
||||
protected Map<Facet, RelationProperty> attachedFacets;
|
||||
protected List<Facet> detachedFacets;
|
||||
|
||||
|
||||
protected Map<Resource, RelationProperty> attachedResourceProfiles;
|
||||
protected List<Resource> detachedResourceProfiles;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param description
|
||||
* @param version
|
||||
*/
|
||||
protected ResourceImpl(String name, String description, String version) {
|
||||
super(name, description, version);
|
||||
addedFacets = new HashMap<Facet, RelationProperty>();
|
||||
attachedFacets = new HashMap<Facet, RelationProperty>();
|
||||
detachedFacets = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFacet(Facet facet) {
|
||||
addedFacets.put(facet, null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFacet(Facet facet, RelationProperty relationProperty) {
|
||||
addedFacets.put(facet, relationProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachFacet(Facet facet) {
|
||||
attachedFacets.put(facet, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachFacet(Facet facet, RelationProperty relationProperty) {
|
||||
attachedFacets.put(facet, relationProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachFacet(Facet facet) {
|
||||
detachedFacets.add(facet);
|
||||
attachedFacets.remove(facet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachResource(Resource resource) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachResource(Resource resource,
|
||||
RelationProperty relationProperty) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachResource(Resource resource) {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.relation;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Facet;
|
||||
import org.gcube.informationsystem.model.entity.Resource;
|
||||
import org.gcube.informationsystem.model.relation.ConsistOf;
|
||||
import org.gcube.informationsystem.model.relation.RelationProperty;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class ConsistOfImpl<Out extends Resource, In extends Facet> extends
|
||||
RelationImpl<Out, In> implements ConsistOf<Out, In> {
|
||||
|
||||
/**
|
||||
* @param source
|
||||
* @param target
|
||||
* @param relationProperty
|
||||
*/
|
||||
public ConsistOfImpl(Out source, In target,
|
||||
RelationProperty relationProperty) {
|
||||
super(source, target, relationProperty);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.relation;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Resource;
|
||||
import org.gcube.informationsystem.model.relation.RelatedTo;
|
||||
import org.gcube.informationsystem.model.relation.RelationProperty;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class RelatedToImpl<Out extends Resource, In extends Resource> extends
|
||||
RelationImpl<Out, In> implements RelatedTo<Out, In> {
|
||||
|
||||
/**
|
||||
* @param source
|
||||
* @param target
|
||||
* @param relationProperty
|
||||
*/
|
||||
public RelatedToImpl(Out source, In target,
|
||||
RelationProperty relationProperty) {
|
||||
super(source, target, relationProperty);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.relation;
|
||||
|
||||
import org.gcube.informationsystem.model.entity.Entity;
|
||||
import org.gcube.informationsystem.model.relation.Relation;
|
||||
import org.gcube.informationsystem.model.relation.RelationProperty;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public abstract class RelationImpl<Out extends Entity, In extends Entity> implements Relation<Out, In> {
|
||||
|
||||
protected Out source;
|
||||
protected In target;
|
||||
@JsonDeserialize(as = RelationPropertyImpl.class)
|
||||
protected RelationProperty relationProperty;
|
||||
|
||||
protected RelationImpl(Out source, In target, RelationProperty relationProperty){
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.relationProperty = relationProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Out getSource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public In getTarget() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RelationProperty getRelationProperty() {
|
||||
return this.relationProperty;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.impl.relation;
|
||||
|
||||
import org.gcube.informationsystem.impl.AccessPolicyImpl;
|
||||
import org.gcube.informationsystem.model.AccessPolicy;
|
||||
import org.gcube.informationsystem.model.relation.RelationProperty;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class RelationPropertyImpl implements RelationProperty {
|
||||
|
||||
protected String purpose;
|
||||
protected ReferentiaIntegrity referentiaIntegrity;
|
||||
@JsonDeserialize(as = AccessPolicyImpl.class)
|
||||
protected AccessPolicy accessPolicy;
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return this.purpose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPurpose(String purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReferentiaIntegrity getReferentialIntegrity() {
|
||||
return this.referentiaIntegrity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReferentialIntegrity(ReferentiaIntegrity referentialIntegrity) {
|
||||
this.referentiaIntegrity = referentialIntegrity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessPolicy getPolicy() {
|
||||
return this.accessPolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPolicy(AccessPolicy accessPolicy) {
|
||||
this.accessPolicy = accessPolicy;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.model.entity;
|
||||
|
||||
import org.gcube.informationsystem.model.Header;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.informationsystem.model;
|
||||
package org.gcube.informationsystem.model.entity;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
Loading…
Reference in New Issue