org.odpi.openmetadata.accessservices.digitalservice.rest.RelationshipRequestBody Maven / Gradle / Ivy
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.digitalservice.rest;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.odpi.openmetadata.accessservices.digitalservice.properties.RelationshipProperties;
import java.util.Objects;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* RelationshipRequestBody describes the request body used when linking elements together.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class RelationshipRequestBody extends ExternalSourceRequestBody
{
private RelationshipProperties properties = null;
/**
* Default constructor
*/
public RelationshipRequestBody()
{
super();
}
/**
* Copy/clone constructor.
*
* @param template object to copy
*/
public RelationshipRequestBody(RelationshipRequestBody template)
{
super(template);
if (template != null)
{
properties = template.getProperties();
}
}
/**
* Return the properties for the relationship.
*
* @return properties object
*/
public RelationshipProperties getProperties()
{
return properties;
}
/**
* Set up the properties for the relationship.
*
* @param properties properties object
*/
public void setProperties(RelationshipProperties properties)
{
this.properties = properties;
}
/**
* JSON-style toString
*
* @return return string containing the property names and values
*/
@Override
public String toString()
{
return "RelationshipRequestBody{" +
"externalSourceGUID='" + getExternalSourceGUID() + '\'' +
", externalSourceName='" + getExternalSourceName() + '\'' +
", properties=" + properties +
'}';
}
/**
* Return comparison result based on the content of the properties.
*
* @param objectToCompare test object
* @return result of comparison
*/
@Override
public boolean equals(Object objectToCompare)
{
if (this == objectToCompare)
{
return true;
}
if (objectToCompare == null || getClass() != objectToCompare.getClass())
{
return false;
}
if (!super.equals(objectToCompare))
{
return false;
}
RelationshipRequestBody that = (RelationshipRequestBody) objectToCompare;
return Objects.equals(getProperties(), that.getProperties());
}
/**
* Return hash code for this object
*
* @return int hash code
*/
@Override
public int hashCode()
{
return Objects.hash(super.hashCode(), properties);
}
}