Added the proper _PROPERTY suffix to propagationConstraint property name

This commit is contained in:
Luca Frosini 2021-01-13 21:53:16 +01:00
parent 2b5b897dc0
commit 8e755e02c3
5 changed files with 31 additions and 5 deletions

View File

@ -85,7 +85,7 @@ public abstract class RelationImpl<S extends Resource, T extends Entity>
if (key.startsWith("@")) { if (key.startsWith("@")) {
return; return;
} }
if (key.compareTo(PROPAGATION_CONSTRAINT) == 0) { if (key.compareTo(PROPAGATION_CONSTRAINT_PROPERTY) == 0) {
return; return;
} }
if (key.compareTo(TARGET_PROPERTY) == 0) { if (key.compareTo(TARGET_PROPERTY) == 0) {

View File

@ -35,7 +35,7 @@ public interface Relation<S extends Resource, T extends Entity> extends Relation
public static final String NAME = "Relation"; //Relation.class.getSimpleName(); public static final String NAME = "Relation"; //Relation.class.getSimpleName();
public static final String PROPAGATION_CONSTRAINT = "propagationConstraint"; public static final String PROPAGATION_CONSTRAINT_PROPERTY = "propagationConstraint";
@JsonIgnoreProperties({Resource.CONSISTS_OF_PROPERTY, Resource.IS_RELATED_TO_PROPERTY}) @JsonIgnoreProperties({Resource.CONSISTS_OF_PROPERTY, Resource.IS_RELATED_TO_PROPERTY})
@JsonGetter(value = SOURCE_PROPERTY) @JsonGetter(value = SOURCE_PROPERTY)
@ -54,7 +54,7 @@ public interface Relation<S extends Resource, T extends Entity> extends Relation
@Override @Override
public void setTarget(T target); public void setTarget(T target);
@ISProperty(name = PROPAGATION_CONSTRAINT) @ISProperty(name = PROPAGATION_CONSTRAINT_PROPERTY)
public PropagationConstraint getPropagationConstraint(); public PropagationConstraint getPropagationConstraint();
@JsonAnyGetter @JsonAnyGetter

View File

@ -4,6 +4,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore; import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
@ -223,5 +224,26 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
+ linkedClass + "]"; + linkedClass + "]";
} }
@Override
public int hashCode() {
return Objects.hash(description, linkedClass, linkedType, mandatory, max, min, name, notnull, readonly, regexp,
type);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PropertyDefinitionImpl other = (PropertyDefinitionImpl) obj;
return Objects.equals(description, other.description) && Objects.equals(linkedClass, other.linkedClass)
&& Objects.equals(linkedType, other.linkedType) && mandatory == other.mandatory
&& Objects.equals(max, other.max) && Objects.equals(min, other.min) && Objects.equals(name, other.name)
&& notnull == other.notnull && readonly == other.readonly && Objects.equals(regexp, other.regexp)
&& Objects.equals(type, other.type);
}
} }

View File

@ -9,10 +9,14 @@ import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.TypeVersion; import org.gcube.informationsystem.utils.TypeVersion;
/** /**
* A convenient type to define a Resource in terms of:
* mandatory/recommended ConsistsOf->Facets;
* suggested IsRelatedTo->Resource.
*
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonDeserialize(as=LinkedEntityImpl.class) @JsonDeserialize(as=LinkedEntityImpl.class)
@TypeMetadata(name = LinkedEntity.NAME, description = "This class provides information for LinkedEntity", version = TypeVersion.MINIMAL_VERSION_STRING) @TypeMetadata(name = LinkedEntity.NAME, description = " A convenient type to define a Resource in terms of: mandatory/recommended ConsistsOf->Facets; uggested IsRelatedTo->Resource.", version = TypeVersion.MINIMAL_VERSION_STRING)
@Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION) @Change(version = TypeVersion.MINIMAL_VERSION_STRING, description = TypeVersion.MINIMAL_VERSION_DESCRIPTION)
public interface LinkedEntity extends PropertyElement { public interface LinkedEntity extends PropertyElement {

View File

@ -100,7 +100,7 @@ public class PropagationConstraintTest {
// TODO This fails // TODO This fails
String consistsOfString = "{\"" + Element.CLASS_PROPERTY + "\":\"" + ConsistsOf.NAME + "\",\"" + ConsistsOf.PROPAGATION_CONSTRAINT + "\":"+ pcString + ",\"" + ConsistsOf.HEADER_PROPERTY + "\": " + hString + ",\"" + ConsistsOf.TARGET_PROPERTY + "\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"@class\":\"MySoftwareFacet\",\"header\":"+ "{\"@class\":\"Header\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null}" + ",\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}" + "}"; String consistsOfString = "{\"" + Element.CLASS_PROPERTY + "\":\"" + ConsistsOf.NAME + "\",\"" + ConsistsOf.PROPAGATION_CONSTRAINT_PROPERTY + "\":"+ pcString + ",\"" + ConsistsOf.HEADER_PROPERTY + "\": " + hString + ",\"" + ConsistsOf.TARGET_PROPERTY + "\":{\"@superClasses\":[\"SoftwareFacet\", \"Facet\", \"Entity\"],\"@class\":\"MySoftwareFacet\",\"header\":"+ "{\"@class\":\"Header\",\"uuid\":\"3ace4bd0-e5cd-49a3-97a8-a0a9468ce6d4\",\"creator\":null, \"creationTime\":null, \"lastUpdateTime\":null}" + ",\"name\":\"WhnManager\",\"group\":\"VREManagement\",\"version\":\"2.0.0-SNAPSHOT\",\"description\":\"Web Hosting Node Service\",\"qualifier\":null,\"optional\":false}" + "}";
logger.debug(consistsOfString); logger.debug(consistsOfString);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")