org.odpi.openmetadata.accessservices.digitalarchitecture.properties.RelationshipProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of digital-architecture-api Show documentation
Show all versions of digital-architecture-api Show documentation
API classes for the Digital Architecture Open Metadata Access Service (OMAS).
The newest version!
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.digitalarchitecture.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* RelationshipProperties provides the base class for relationships items. This provides extended properties with the ability to
* set effectivity dates.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "class")
@JsonSubTypes(
{
@JsonSubTypes.Type(value = ReferenceValueAssignmentProperties.class, name = "ReferenceValueAssignmentProperties"),
@JsonSubTypes.Type(value = ValidValueAssignmentProperties.class, name = "ValidValueAssignmentProperties"),
@JsonSubTypes.Type(value = ValidValueMembershipProperties.class, name = "ValidValueMembershipProperties"),
@JsonSubTypes.Type(value = ValidValuesMappingProperties.class, name = "ValidValuesMappingProperties"),
@JsonSubTypes.Type(value = ValidValuesImplProperties.class, name = "ValidValuesImplProperties"),
})
public class RelationshipProperties
{
private Date effectiveFrom = null;
private Date effectiveTo = null;
private Map extendedProperties = null;
/**
* Default constructor
*/
public RelationshipProperties()
{
super();
}
/**
* Copy/clone constructor. Retrieve values from the supplied template
*
* @param template element to copy
*/
public RelationshipProperties(RelationshipProperties template)
{
if (template != null)
{
effectiveFrom = template.getEffectiveFrom();
effectiveTo = template.getEffectiveTo();
extendedProperties = template.getExtendedProperties();
}
}
/**
* Return the date/time that this element is effective from (null means effective from the epoch).
*
* @return date object
*/
public Date getEffectiveFrom()
{
return effectiveFrom;
}
/**
* Set up the date/time that this element is effective from (null means effective from the epoch).
*
* @param effectiveFrom date object
*/
public void setEffectiveFrom(Date effectiveFrom)
{
this.effectiveFrom = effectiveFrom;
}
/**
* Return the date/time that element is effective to (null means that it is effective indefinitely into the future).
*
* @return date object
*/
public Date getEffectiveTo()
{
return effectiveTo;
}
/**
* Set the date/time that element is effective to (null means that it is effective indefinitely into the future).
*
* @param effectiveTo date object
*/
public void setEffectiveTo(Date effectiveTo)
{
this.effectiveTo = effectiveTo;
}
/**
* Return the properties that have been defined for a subtype of this object that are not supported explicitly
* by this bean.
*
* @return property map
*/
public Map getExtendedProperties()
{
if (extendedProperties == null)
{
return null;
}
else if (extendedProperties.isEmpty())
{
return null;
}
else
{
return new HashMap<>(extendedProperties);
}
}
/**
* Set up the properties that have been defined for a subtype of this object that are not supported explicitly
* by this bean.
*
* @param extendedProperties property map
*/
public void setExtendedProperties(Map extendedProperties)
{
this.extendedProperties = extendedProperties;
}
/**
* Standard toString method.
*
* @return print out of variables in a JSON-style
*/
@Override
public String toString()
{
return "RelationshipProperties{" +
"effectiveFrom=" + effectiveFrom +
", effectiveTo=" + effectiveTo +
", extendedProperties=" + extendedProperties +
'}';
}
/**
* Compare the values of the supplied object with those stored in the current object.
*
* @param objectToCompare supplied object
* @return boolean result of comparison
*/
@Override
public boolean equals(Object objectToCompare)
{
if (this == objectToCompare)
{
return true;
}
if (objectToCompare == null || getClass() != objectToCompare.getClass())
{
return false;
}
RelationshipProperties that = (RelationshipProperties) objectToCompare;
return Objects.equals(effectiveFrom, that.effectiveFrom) &&
Objects.equals(effectiveTo, that.effectiveTo);
}
/**
* Return hash code based on properties.
*
* @return int
*/
@Override
public int hashCode()
{
return Objects.hash(effectiveFrom, effectiveTo);
}
}