org.odpi.openmetadata.accessservices.assetowner.metadataelements.FileElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of asset-owner-api Show documentation
Show all versions of asset-owner-api Show documentation
API classes for the Asset Owner Open Metadata Access Service (OMAS).
/* SPDX-License-Identifier: Apache 2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.assetowner.metadataelements;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.odpi.openmetadata.accessservices.assetowner.properties.FileProperties;
import java.io.Serializable;
import java.util.Objects;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
/**
* FileElement contains the properties and header for a file retrieved from the metadata repository.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class FileElement implements MetadataElement, Serializable
{
private static final long serialVersionUID = 1L;
private ElementHeader elementHeader = null;
private FileProperties fileProperties = null;
/**
* Default constructor
*/
public FileElement()
{
super();
}
/**
* Copy/clone constructor
*
* @param template object to copy
*/
public FileElement(FileElement template)
{
if (template != null)
{
elementHeader = template.getElementHeader();
fileProperties = template.getFileProperties();
}
}
/**
* Return the element header associated with the properties.
*
* @return element header object
*/
@Override
public ElementHeader getElementHeader()
{
return elementHeader;
}
/**
* Set up the element header associated with the properties.
*
* @param elementHeader element header object
*/
@Override
public void setElementHeader(ElementHeader elementHeader)
{
this.elementHeader = elementHeader;
}
/**
* Return the properties that describe the file.
*
* @return properties bean
*/
public FileProperties getFileProperties()
{
return fileProperties;
}
/**
* Set up the file properties.
*
* @param fileProperties properties bean
*/
public void setFileProperties(FileProperties fileProperties)
{
this.fileProperties = fileProperties;
}
/**
* JSON-style toString
*
* @return return string containing the property names and values
*/
@Override
public String toString()
{
return "FileElement{" +
"elementHeader=" + elementHeader +
", fileProperties=" + fileProperties +
'}';
}
/**
* 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;
}
FileElement that = (FileElement) objectToCompare;
return Objects.equals(elementHeader, that.elementHeader) &&
Objects.equals(fileProperties, that.fileProperties);
}
/**
* Return hash code for this object
*
* @return int hash code
*/
@Override
public int hashCode()
{
return Objects.hash(super.hashCode(), elementHeader, fileProperties);
}
}