org.odpi.openmetadata.accessservices.digitalarchitecture.properties.ReferenceableProperties Maven / Gradle / Ivy
/* 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.*;
import org.odpi.openmetadata.accessservices.digitalarchitecture.metadataelements.ElementClassification;
import java.io.Serializable;
import java.util.*;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* Many open metadata entities are referenceable. It means that they have a qualified name and additional
* properties.
*/
@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 = ValidValueProperties.class, name = "ValidValueProperties"),
@JsonSubTypes.Type(value = ReferenceDataAssetProperties.class, name = "ReferenceDataAssetProperties"),
@JsonSubTypes.Type(value = ConnectionProperties.class, name = "ConnectionProperties"),
@JsonSubTypes.Type(value = ConnectorTypeProperties.class, name = "ConnectorTypeProperties"),
@JsonSubTypes.Type(value = LocationProperties.class, name = "LocationProperties"),
@JsonSubTypes.Type(value = MeaningProperties.class, name = "MeaningProperties")
})
public class ReferenceableProperties implements Serializable
{
private static final long serialVersionUID = 1L;
private String qualifiedName = null;
private Map additionalProperties = null;
private List classifications = null;
private String typeName = null;
private Map extendedProperties = null;
/**
* Default constructor
*/
public ReferenceableProperties()
{
super();
}
/**
* Copy/clone constructor. Retrieves values from the supplied template
*
* @param template element to copy
*/
public ReferenceableProperties(ReferenceableProperties template)
{
if (template != null)
{
qualifiedName = template.getQualifiedName();
additionalProperties = template.getAdditionalProperties();
classifications = template.getClassifications();
typeName = template.getTypeName();
extendedProperties = template.getExtendedProperties();
}
}
/**
* Set up the fully qualified name.
*
* @param qualifiedName String name
*/
public void setQualifiedName(String qualifiedName)
{
this.qualifiedName = qualifiedName;
}
/**
* Returns the stored qualified name property for the metadata entity.
* If no qualified name is available then the empty string is returned.
*
* @return qualifiedName
*/
public String getQualifiedName()
{
return qualifiedName;
}
/**
* Set up additional properties.
*
* @param additionalProperties Additional properties object
*/
public void setAdditionalProperties(Map additionalProperties)
{
this.additionalProperties = additionalProperties;
}
/**
* Return a copy of the additional properties. Null means no additional properties are available.
*
* @return AdditionalProperties
*/
public Map getAdditionalProperties()
{
if (additionalProperties == null)
{
return null;
}
else if (additionalProperties.isEmpty())
{
return null;
}
else
{
return additionalProperties;
}
}
/**
* Return the list of classifications associated with the asset. This is an list and the
* pointers are set to the start of the list of classifications
*
* @return Classifications list of classifications
*/
public List getClassifications()
{
if (classifications == null)
{
return null;
}
else if (classifications.isEmpty())
{
return null;
}
else
{
return new ArrayList<>(classifications);
}
}
/**
* Set up the classifications associated with this connection.
*
* @param classifications list of classifications
*/
public void setClassifications(List classifications)
{
this.classifications = classifications;
}
/**
* Return the name of the open metadata type for this element.
*
* @return string name
*/
public String getTypeName()
{
return typeName;
}
/**
* Set up the name of the open metadata type for this element.
*
* @param typeName string name
*/
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
/**
* 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 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 "Referenceable{" +
"qualifiedName='" + qualifiedName + '\'' +
", additionalProperties=" + additionalProperties +
", typeName=" + typeName +
", extendedProperties=" + getExtendedProperties() +
", classifications=" + getClassifications() +
'}';
}
/**
* 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;
}
ReferenceableProperties that = (ReferenceableProperties) objectToCompare;
return Objects.equals(qualifiedName, that.qualifiedName) &&
Objects.equals(additionalProperties, that.additionalProperties) &&
Objects.equals(classifications, that.classifications) &&
Objects.equals(typeName, that.typeName) &&
Objects.equals(extendedProperties, that.extendedProperties);
}
/**
* Return has code based on properties.
*
* @return int
*/
@Override
public int hashCode()
{
return Objects.hash(qualifiedName, additionalProperties, classifications, typeName, extendedProperties);
}
}