You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by da...@apache.org on 2018/02/16 09:52:22 UTC
[06/30] atlas git commit: ATLAS-2246: OMRS Connector API plus REST
and IGC Connector skeleton - 15th February 2018
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/MatchCriteria.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/MatchCriteria.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/MatchCriteria.java
new file mode 100644
index 0000000..b60558e
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/MatchCriteria.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties;
+
+
+import java.io.Serializable;
+
+/**
+ * The MatchCriteria enum defines how the metadata instances in the metadata collection should be matched
+ * against the properties supplied on the search request.
+ * <ul>
+ * <li>ALL means all properties must match.</li>
+ * <li>ANY means a match on any of properties is good enough.</li>
+ * <li>NONE means return instances where none of the supplied properties match.</li>
+ * </ul>
+ */
+public enum MatchCriteria implements Serializable
+{
+ ALL (0, "All", "All properties must match."),
+ ANY (1, "Any", "A match on any of properties in the instance is good enough."),
+ NONE (2, "None", "Return instances where none of the supplied properties match.");
+
+ private static final long serialVersionUID = 1L;
+
+ private int ordinal;
+ private String name;
+ private String description;
+
+ /**
+ * Constructor to set up a single instances of the enum.
+ *
+ * @param ordinal - numerical representation of the match criteria
+ * @param name - default string name of the match criteria
+ * @param description - default string description of the match criteria
+ */
+ MatchCriteria(int ordinal, String name, String description)
+ {
+ this.ordinal = ordinal;
+ this.name = name;
+ this.description = description;
+ }
+
+ /**
+ * Return the numeric representation of the match criteria.
+ *
+ * @return int ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Return the default name of the match criteria.
+ *
+ * @return String name
+ */
+ public String getName() { return name; }
+
+
+ /**
+ * Return the default description of the match criteria.
+ *
+ * @return String description
+ */
+ public String getDescription() { return description; }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/SequencingOrder.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/SequencingOrder.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/SequencingOrder.java
new file mode 100644
index 0000000..9ed91c7
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/SequencingOrder.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties;
+
+import java.io.Serializable;
+
+/**
+ * SequencingOrder is used for search requests against a metadata collection. It defines how the results should
+ * to be ordered before they are returned. This is particularly important when the results are to returned
+ * over multiple pages since the caller does not have all of the results at once to perform the sort themselves.
+ *
+ * The sequencing order values are:
+ * <ul>
+ * <li>
+ * ANY - return the results in any order. This is default.
+ * </li>
+ * <li>
+ * GUID - return in GUID sequence. This is used when the caller just needs a consistent order in the
+ * order that results are returned.
+ * </li>
+ * <li>
+ * CREATION_DATE_RECENT - return in the order that the elements were created - the most recent ones first.
+ * </li>
+ * <li>
+ * CREATION_DATE_OLDEST - return in the order that the elements were created - the oldest ones first.
+ * </li>
+ * <li>
+ * LAST_UPDATE_RECENT - return in the order of the latest update - the most recent first.
+ * </li>
+ * <li>
+ * LAST_UPDATE_OLDEST - return in the order of the latest update - the oldest first.
+ * </li>
+ * <li>
+ * PROPERTY_ASCENDING - return in ascending order of the values in a sequencing property. The sequencing
+ * property will be supplied as a parameter.
+ * </li>
+ * <li>
+ * PROPERTY_DESCENDING - return in descending order of the values in a sequencing property. The sequencing
+ * property will be supplied as a parameter.
+ * </li>
+ * </ul>
+ */
+public enum SequencingOrder implements Serializable
+{
+ ANY (0, "Any Order", "Any order."),
+ GUID (1, "GUID", "Order by GUID."),
+ CREATION_DATE_RECENT (2, "Creation Date (Recent First)", "Order by creation date, most recently created first."),
+ CREATION_DATE_OLDEST (3, "Creation Date (Oldest First)", "Order by creation date, oldest first."),
+ LAST_UPDATE_RECENT (4, "Last Update Date (Recent First)", "Order by last update date, most recently updated first."),
+ LAST_UPDATE_OLDEST (5, "Last Update Date (Oldest First)", "Order by last update date, most recently updated last."),
+ PROPERTY_ASCENDING (6, "By property value (Ascending)", "Order by property value, lowest value first."),
+ PROPERTY_DESCENDING (7, "By property value (Descending)", "Order by property value, highest first.");
+
+ private static final long serialVersionUID = 1L;
+
+ private int ordinal;
+ private String name;
+ private String description;
+
+ /**
+ * Constructor to set up a single instances of the enum.
+ *
+ * @param ordinal - numerical representation of the sequencing order
+ * @param name - default string name of the sequencing order
+ * @param description - default string description of the sequencing order
+ */
+ SequencingOrder(int ordinal, String name, String description)
+ {
+ this.ordinal = ordinal;
+ this.name = name;
+ this.description = description;
+ }
+
+ /**
+ * Return the numeric representation of the sequencing order.
+ *
+ * @return int ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Return the default name of the sequencing order.
+ *
+ * @return String name
+ */
+ public String getName() { return name; }
+
+
+ /**
+ * Return the default description of the sequencing order.
+ *
+ * @return String description
+ */
+ public String getDescription() { return description; }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ArrayPropertyValue.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ArrayPropertyValue.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ArrayPropertyValue.java
new file mode 100644
index 0000000..055293d
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ArrayPropertyValue.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import org.apache.atlas.omrs.ffdc.OMRSErrorCode;
+import org.apache.atlas.omrs.ffdc.exception.OMRSRuntimeException;
+
+/**
+ * ArrayPropertyValue stores the values of an array within an entity, struct or relationship properties.
+ * The elements of the array are stored in an InstanceProperties map where the property name is set to the element
+ * number and the property value is set to the value of the element in the array.
+ */
+public class ArrayPropertyValue extends InstancePropertyValue
+{
+ private int arrayCount = 0;
+ private InstanceProperties arrayValues = null;
+
+
+ /**
+ * Default constructor sets the array to empty.
+ */
+ public ArrayPropertyValue()
+ {
+ super(InstancePropertyCategory.ARRAY);
+ }
+
+
+ /**
+ * Copy/clone constructor set up the array using the supplied template.
+ *
+ * @param template - ArrayPropertyValue
+ */
+ public ArrayPropertyValue(ArrayPropertyValue template)
+ {
+ super(template);
+
+ if (template !=null)
+ {
+ arrayCount = template.getArrayCount();
+ arrayValues = template.getArrayValues();
+ }
+ }
+
+
+ /**
+ * Return the number of elements in the array.
+ *
+ * @return int - array size
+ */
+ public int getArrayCount() { return arrayCount; }
+
+
+ /**
+ * Set up the number of elements in the array.
+ *
+ * @param arrayCount - int - array size
+ */
+ public void setArrayCount(int arrayCount) { this.arrayCount = arrayCount; }
+
+
+ /**
+ * Return a copy of the array elements.
+ *
+ * @return InstanceProperties containing the array elements
+ */
+ public InstanceProperties getArrayValues()
+ {
+ if (arrayValues == null)
+ {
+ return arrayValues;
+ }
+ else
+ {
+ return new InstanceProperties(arrayValues);
+ }
+ }
+
+
+ /**
+ * Add or update an element in the array.
+ *
+ * @param elementNumber - index number of the element in the array
+ * @param propertyValue - value to store
+ */
+ public void setArrayValue(int elementNumber, InstancePropertyValue propertyValue)
+ {
+ if (arrayCount > elementNumber)
+ {
+ if (arrayValues == null)
+ {
+ arrayValues = new InstanceProperties();
+ }
+ arrayValues.setProperty(new Integer(elementNumber).toString(), propertyValue);
+ }
+ else
+ {
+ /*
+ * Throw runtime exception to show the caller they are not using the array correctly.
+ */
+ OMRSErrorCode errorCode = OMRSErrorCode.ARRAY_OUT_OF_BOUNDS;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage(this.getClass().getSimpleName(),
+ new Integer(elementNumber).toString(),
+ new Integer(arrayCount).toString());
+
+ throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "setArrayValue",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction());
+ }
+ }
+
+
+ /**
+ * Set up the array elements in one call.
+ *
+ * @param arrayValues - InstanceProperties containing the array elements
+ */
+ public void setArrayValues(InstanceProperties arrayValues) { this.arrayValues = arrayValues; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "ArrayPropertyValue{" +
+ "arrayCount=" + arrayCount +
+ ", arrayValues=" + arrayValues +
+ ", instancePropertyCategory=" + getInstancePropertyCategory() +
+ ", typeGUID='" + getTypeGUID() + '\'' +
+ ", typeName='" + getTypeName() + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Classification.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Classification.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Classification.java
new file mode 100644
index 0000000..98d41f3
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Classification.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import org.apache.atlas.omrs.ffdc.OMRSErrorCode;
+import org.apache.atlas.omrs.ffdc.exception.OMRSRuntimeException;
+
+
+/**
+ * The Classification class stores information about a classification assigned to an entity. The Classification
+ * has a name and some properties. Some classifications are explicitly added to an entity and other
+ * classifications are propagated to an entity along the relationships connected to it. The origin of the
+ * classification is also stored.
+ *
+ * Note: it is not valid to have a classification with a null or blank name.
+ */
+public class Classification extends InstanceAuditHeader
+{
+ private String classificationName = null;
+ private InstanceProperties classificationProperties = null;
+ private ClassificationOrigin classificationOrigin = null;
+ private String classificationOriginGUID = null;
+
+ /*
+ * A private validation method used by the constructors
+ */
+ private String validateName(String name)
+ {
+ /*
+ * Throw an exception if the classification's name is null because that does not make sense.
+ * The constructors do not catch this exception so it is received by the creator of the classification
+ * object.
+ */
+ if (name == null || name.equals(""))
+ {
+ /*
+ * Build and throw exception. This should not happen - likely to be a problem in the
+ * repository connector.
+ */
+ OMRSErrorCode errorCode = OMRSErrorCode.NULL_CLASSIFICATION_NAME;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage();
+
+ throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "validateName",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction());
+ }
+ else
+ {
+ return name;
+ }
+ }
+
+
+ /**
+ * Typical constructor - verifies and saves parameters.
+ *
+ * @param name - name of the classification
+ * @param properties - additional properties for the classification
+ * @param origin - the origin of the classification
+ * @param originGUID - the guid of the entity of the classification origin was propagated.
+ */
+ public Classification(String name,
+ InstanceProperties properties,
+ ClassificationOrigin origin,
+ String originGUID)
+ {
+ this.classificationName = validateName(name);
+ this.classificationProperties = properties;
+ this.classificationOrigin = origin;
+ this.classificationOriginGUID = originGUID;
+ }
+
+
+ /**
+ * Default constructor for automated generation tools.
+ */
+ public Classification()
+ {
+
+ }
+
+
+ /**
+ * Copy/clone Constructor - sets up new classification using values from the template
+ *
+ * @param templateClassification - object to copy
+ */
+ public Classification(Classification templateClassification)
+ {
+ /*
+ * An empty classification object is passed in the variable declaration so throw exception
+ * because we need the classification name.
+ */
+ if (templateClassification == null)
+ {
+ /*
+ * Build and throw exception. This should not happen - likely to be a problem in the
+ * repository connector.
+ */
+ OMRSErrorCode errorCode = OMRSErrorCode.NULL_CLASSIFICATION_NAME;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage("<Unknown>");
+
+ throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "Copy Constructor",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction());
+ }
+ else
+ {
+ /*
+ * Extract and save the values from the template.
+ */
+ this.classificationName = validateName(templateClassification.getName());
+ this.classificationProperties = templateClassification.getProperties();
+ this.classificationOrigin = templateClassification.getClassificationOrigin();
+ this.classificationOriginGUID = templateClassification.getClassificationOriginGUID();
+ }
+ }
+
+
+ /**
+ * Return the name of the classification.
+ *
+ * @return name of classification
+ */
+ public String getName()
+ {
+ return classificationName;
+ }
+
+
+ /**
+ * Set up the name of the classification.
+ *
+ * @param classificationName - String name
+ */
+ public void setName(String classificationName)
+ {
+ this.classificationName = validateName(classificationName);
+ }
+
+
+ /**
+ * Returns a collection of the additional stored properties for the classification.
+ * If no stored properties are present then null is returned.
+ *
+ * @return properties for the classification
+ */
+ public InstanceProperties getProperties()
+ {
+ if (classificationProperties == null)
+ {
+ return classificationProperties;
+ }
+ else
+ {
+ return new InstanceProperties(classificationProperties);
+ }
+ }
+
+
+ /**
+ * Set up a collection of the additional stored properties for the classification.
+ *
+ * @param classificationProperties - properties object
+ */
+ public void setProperties(InstanceProperties classificationProperties)
+ {
+ this.classificationProperties = classificationProperties;
+ }
+
+
+ /**
+ * Return the origin of the classification.
+ *
+ * @return ClassificationOrigin enum
+ */
+ public ClassificationOrigin getClassificationOrigin()
+ {
+ return classificationOrigin;
+ }
+
+
+ /**
+ * Set up the origin of the classification.
+ *
+ * @param classificationOrigin - ClassificationOrigin enum
+ */
+ public void setClassificationOrigin(ClassificationOrigin classificationOrigin)
+ {
+ this.classificationOrigin = classificationOrigin;
+ }
+
+
+ /**
+ * Return the guid of the entity where a propagate classification came from.
+ *
+ * @return unique identifier of the classification's origin
+ */
+ public String getClassificationOriginGUID()
+ {
+ return classificationOriginGUID;
+ }
+
+
+ /**
+ * Set up the guid of the entity where a propagate classification came from.
+ *
+ * @param classificationOriginGUID - unique identifier of the classification's origin
+ */
+ public void setClassificationOriginGUID(String classificationOriginGUID)
+ {
+ this.classificationOriginGUID = classificationOriginGUID;
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "Classification{" +
+ "classificationName='" + classificationName + '\'' +
+ ", classificationProperties=" + classificationProperties +
+ ", classificationOrigin=" + classificationOrigin +
+ ", classificationOriginGUID='" + classificationOriginGUID + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ClassificationOrigin.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ClassificationOrigin.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ClassificationOrigin.java
new file mode 100644
index 0000000..d78f261
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/ClassificationOrigin.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import java.io.Serializable;
+
+/**
+ * ClassificationOrigin describes the provenance of a classification attached to an entity. Most classifications
+ * are explicitly assigned to an entity. However, it is possible for some classifications to flow along
+ * relationships to other entities. These are the propagated classifications. Each entity can only have one
+ * classification of a certain type. A propagated classification can not override an assigned classification.
+ * Classifications can only be attached to entities of specific types. However a propagated classification can
+ * flow through an entity that does not support the particular type of classification and then on to other
+ * relationships attached to the entity. The ClassificationPropagateRule in the relationship's RelationshipDef
+ * defines where the classification can flow to.
+ */
+public enum ClassificationOrigin implements Serializable
+{
+ ASSIGNED (0, "Assigned", "The classification is explicitly assigned to the entity"),
+ PROPAGATED (1, "Propagated", "The classification has propagated along a relationship to this entity");
+
+ private static final long serialVersionUID = 1L;
+
+ private int ordinal;
+ private String name;
+ private String description;
+
+
+ /**
+ * Default constructor for the classification origin.
+ *
+ * @param ordinal - numerical representation of the classification origin
+ * @param name - default string name of the classification origin
+ * @param description - default string description of the classification origin
+ */
+ ClassificationOrigin(int ordinal, String name, String description)
+ {
+ this.ordinal = ordinal;
+ this.name = name;
+ this.description = description;
+ }
+
+
+ /**
+ * Return the numeric representation of the classification origin.
+ *
+ * @return int ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Return the default name of the classification origin.
+ *
+ * @return String name
+ */
+ public String getName() { return name; }
+
+
+ /**
+ * Return the default description of the classification origin.
+ *
+ * @return String description
+ */
+ public String getDescription() { return description; }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java
new file mode 100644
index 0000000..95e08d2
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+/**
+ * EntityDetail stores all of the type-specific properties for the entity. These properties can be
+ * requested in an InstanceProperties object on request.
+ */
+public class EntityDetail extends EntitySummary
+{
+ private InstanceProperties entityProperties = null;
+
+ /**
+ * Default Constructor - no properties established
+ */
+ public EntityDetail()
+ {
+ super();
+ }
+
+
+ /**
+ * Copy/clone constructor - properties copied from template.
+ *
+ * @param templateElement - element to copy.
+ */
+ public EntityDetail(EntityDetail templateElement)
+ {
+ super(templateElement);
+
+ if (templateElement != null)
+ {
+ entityProperties = templateElement.getProperties();
+ }
+ }
+
+
+ /**
+ * Return a copy of all of the properties for this entity. Null means no properties exist.
+ *
+ * @return InstanceProperties
+ */
+ public InstanceProperties getProperties()
+ {
+ if (entityProperties == null)
+ {
+ return entityProperties;
+ }
+ else
+ {
+ return new InstanceProperties(entityProperties);
+ }
+ }
+
+
+ /**
+ * Set up the properties for this entity.
+ *
+ * @param newProperties - InstanceProperties object
+ */
+ public void setProperties(InstanceProperties newProperties)
+ {
+ entityProperties = newProperties;
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "EntityDetail{" +
+ "entityProperties=" + entityProperties +
+ ", classifications=" + getClassifications() +
+ ", type=" + getType() +
+ ", instanceProvenanceType=" + getInstanceProvenanceType() +
+ ", metadataCollectionId='" + getMetadataCollectionId() + '\'' +
+ ", instanceURL='" + getInstanceURL() + '\'' +
+ ", GUID='" + getGUID() + '\'' +
+ ", status=" + getStatus() +
+ ", createdBy='" + getCreatedBy() + '\'' +
+ ", updatedBy='" + getUpdatedBy() + '\'' +
+ ", createTime=" + getCreateTime() +
+ ", updateTime=" + getUpdateTime() +
+ ", versionName=" + getVersion() +
+ ", statusOnDelete=" + getStatusOnDelete() +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java
new file mode 100644
index 0000000..09c0de7
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+/**
+ * EntityProxy summarizes an entity instance. It is used to describe one of the entities connected together by a
+ * relationship.
+ */
+public class EntityProxy extends EntitySummary
+{
+ private InstanceProperties uniqueAttributes = null;
+
+
+ /**
+ * Default constructor - sets up an empty entity proxy.
+ */
+ public EntityProxy()
+ {
+ super();
+ }
+
+
+ /**
+ * Copy/clone constructor for the entity proxy.
+ *
+ * @param template - entity proxy to copy
+ */
+ public EntityProxy(EntityProxy template)
+ {
+ super(template);
+
+ if (template == null)
+ {
+ this.uniqueAttributes = template.getUniqueAttributes();
+ }
+ }
+
+
+ /**
+ * Return a copy of the unique attributes for the entity.
+ *
+ * @return InstanceProperties iterator
+ */
+ public InstanceProperties getUniqueAttributes()
+ {
+ if (uniqueAttributes == null)
+ {
+ return uniqueAttributes;
+ }
+ else
+ {
+ return new InstanceProperties(uniqueAttributes);
+ }
+ }
+
+
+ /**
+ * Set up the list of unique properties for this entity proxy. These attributes provide properties such
+ * as unique names etc that are useful to display.
+ *
+ * @param uniqueAttributes - InstanceProperties iterator
+ */
+ public void setUniqueAttributes(InstanceProperties uniqueAttributes) { this.uniqueAttributes = uniqueAttributes; }
+
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "EntityProxy{" +
+ "uniqueAttributes=" + uniqueAttributes +
+ ", classifications=" + getClassifications() +
+ ", type=" + getType() +
+ ", instanceProvenanceType=" + getInstanceProvenanceType() +
+ ", metadataCollectionId='" + getMetadataCollectionId() + '\'' +
+ ", instanceURL='" + getInstanceURL() + '\'' +
+ ", GUID='" + getGUID() + '\'' +
+ ", status=" + getStatus() +
+ ", createdBy='" + getCreatedBy() + '\'' +
+ ", updatedBy='" + getUpdatedBy() + '\'' +
+ ", createTime=" + getCreateTime() +
+ ", updateTime=" + getUpdateTime() +
+ ", versionName=" + getVersion() +
+ ", statusOnDelete=" + getStatusOnDelete() +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java
new file mode 100644
index 0000000..056ea42
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import java.util.ArrayList;
+
+
+/**
+ * EntitySummary is a POJO that provides the basic header attributes for an open metadata entity.
+ * This includes a summary of its type, its unique
+ * identifier (guid) last update data and a list of the classifications for the entity.
+ */
+public class EntitySummary extends InstanceHeader
+{
+ /*
+ * Details of classifications.
+ */
+ private ArrayList<Classification> classifications = null;
+
+
+ /**
+ * Default constructor - creates an empty entity
+ */
+ public EntitySummary()
+ {
+ /*
+ * Nothing to do - everything already initialized
+ */
+ super();
+ }
+
+ /**
+ * Copy/clone constructor.
+ *
+ * @param templateElement - template to copy.
+ */
+ public EntitySummary(EntitySummary templateElement)
+ {
+ super(templateElement);
+
+ if (templateElement != null)
+ {
+ classifications = templateElement.getClassifications();
+ }
+ }
+
+
+ /**
+ * Return a copy of the classifications for the entity. This is a list stored in a newly initialized
+ * iterator.
+ *
+ * @return Classifications iterator
+ */
+ public ArrayList<Classification> getClassifications()
+ {
+ if (classifications == null)
+ {
+ return classifications;
+ }
+ else
+ {
+ return new ArrayList<>(classifications);
+ }
+ }
+
+
+ /**
+ * Set up the classifications for an entity. This is stored as an iterator.
+ *
+ * @param classifications - Classifications list
+ */
+ public void setClassifications(ArrayList<Classification> classifications) { this.classifications = classifications; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "EntitySummary{" +
+ "classifications=" + classifications +
+ ", type=" + getType() +
+ ", instanceProvenanceType=" + getInstanceProvenanceType() +
+ ", metadataCollectionId='" + getMetadataCollectionId() + '\'' +
+ ", instanceURL='" + getInstanceURL() + '\'' +
+ ", GUID='" + getGUID() + '\'' +
+ ", status=" + getStatus() +
+ ", createdBy='" + getCreatedBy() + '\'' +
+ ", updatedBy='" + getUpdatedBy() + '\'' +
+ ", createTime=" + getCreateTime() +
+ ", updateTime=" + getUpdateTime() +
+ ", versionName=" + getVersion() +
+ ", statusOnDelete=" + getStatusOnDelete() +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityUniverse.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityUniverse.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityUniverse.java
new file mode 100644
index 0000000..a5af8f9
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityUniverse.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import java.util.ArrayList;
+
+/**
+ * EntityUniverse extends EntityDetail to add the relationships that this entity has. These are available
+ * in an iterator to make them easy to process.
+ */
+public class EntityUniverse extends EntityDetail
+{
+ private ArrayList<Relationship> entityRelationships = null;
+
+
+ /**
+ * Default constructor - initializes entity's universe as empty.
+ */
+ public EntityUniverse()
+ {
+ super();
+ }
+
+
+ /**
+ * Copy/clone constructor.
+ *
+ * @param templateElement - template to copy. If null passed, the EntityUniverse is initialized as empty.
+ */
+ public EntityUniverse(EntityUniverse templateElement)
+ {
+ super(templateElement);
+
+ if (templateElement != null)
+ {
+ entityRelationships = templateElement.getEntityRelationships();
+ }
+ }
+
+
+ /**
+ * Copy/clone constructor from an EntityDetail.
+ *
+ * @param templateElement - template to copy. If null passed, the EntityUniverse is initialized as empty.
+ */
+ public EntityUniverse(EntityDetail templateElement)
+ {
+ super(templateElement);
+ }
+
+
+ /**
+ * Return a copy of the relationships for this entity in an iterator.
+ *
+ * @return Relationships list.
+ */
+ public ArrayList<Relationship> getEntityRelationships()
+ {
+ return entityRelationships;
+ }
+
+
+ /**
+ * Set up the list of relationships for this entity.
+ *
+ * @param entityRelationships - Relationships list
+ */
+ public void setEntityRelationships(ArrayList<Relationship> entityRelationships)
+ {
+ this.entityRelationships = entityRelationships;
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "EntityUniverse{" +
+ "entityRelationships=" + entityRelationships +
+ ", properties=" + getProperties() +
+ ", classifications=" + getClassifications() +
+ ", type=" + getType() +
+ ", instanceProvenanceType=" + getInstanceProvenanceType() +
+ ", metadataCollectionId='" + getMetadataCollectionId() + '\'' +
+ ", instanceURL='" + getInstanceURL() + '\'' +
+ ", GUID='" + getGUID() + '\'' +
+ ", status=" + getStatus() +
+ ", createdBy='" + getCreatedBy() + '\'' +
+ ", updatedBy='" + getUpdatedBy() + '\'' +
+ ", createTime=" + getCreateTime() +
+ ", updateTime=" + getUpdateTime() +
+ ", version=" + getVersion() +
+ ", statusOnDelete=" + getStatusOnDelete() +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EnumPropertyValue.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EnumPropertyValue.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EnumPropertyValue.java
new file mode 100644
index 0000000..7d433d2
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EnumPropertyValue.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+/**
+ * An EnumPropertyValue stores the value for an enum property.
+ */
+public class EnumPropertyValue extends InstancePropertyValue
+{
+ private int ordinal = 99;
+ private String symbolicName = null;
+ private String description = null;
+
+
+ /**
+ * Default constructor initializes an empty enum value
+ */
+ public EnumPropertyValue()
+ {
+ super(InstancePropertyCategory.ENUM);
+ }
+
+
+ /**
+ * Copy/clone constructor initializes the enum with the values from the template.
+ *
+ * @param template - EnumPropertyValue to copy
+ */
+ public EnumPropertyValue(EnumPropertyValue template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ this.ordinal = template.getOrdinal();
+ this.symbolicName = template.getSymbolicName();
+ this.description = template.getDescription();
+ }
+ }
+
+
+ /**
+ * Return the integer ordinal for this enum.
+ *
+ * @return int ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Set the integer ordinal for this enum.
+ *
+ * @param ordinal - int
+ */
+ public void setOrdinal(int ordinal) { this.ordinal = ordinal; }
+
+
+ /**
+ * Return the symbolic name for this enum value.
+ *
+ * @return String symbolic name
+ */
+ public String getSymbolicName() { return symbolicName; }
+
+
+ /**
+ * Set up the symbolic name for this enum value.
+ *
+ * @param symbolicName - String symbolic name
+ */
+ public void setSymbolicName(String symbolicName) { this.symbolicName = symbolicName; }
+
+
+ /**
+ * Return the description for this enum.
+ *
+ * @return String description
+ */
+ public String getDescription() { return description; }
+
+
+ /**
+ * Set up the description for this enum.
+ *
+ * @param description - String description
+ */
+ public void setDescription(String description) { this.description = description; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "EnumPropertyValue{" +
+ "ordinal=" + ordinal +
+ ", symbolicName='" + symbolicName + '\'' +
+ ", description='" + description + '\'' +
+ ", instancePropertyCategory=" + getInstancePropertyCategory() +
+ ", typeGUID='" + getTypeGUID() + '\'' +
+ ", typeName='" + getTypeName() + '\'' +
+ '}';
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java
new file mode 100644
index 0000000..f79aeba
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ * InstanceAuditHeader manages the attributes that are common to classifications and "proper" instances, ie
+ * as entities and relationships. We need to be able to audit when these fundamental elements change and
+ * by whom. Thus they share this header.
+ */
+public abstract class InstanceAuditHeader extends InstanceElementHeader
+{
+ /*
+ * Summary information about this element's type
+ */
+ protected InstanceType type = null;
+
+ /*
+ * Standard header information for a classification, entity and relationship.
+ */
+ protected String createdBy = null;
+ protected String updatedBy = null;
+ protected Date createTime = null;
+ protected Date updateTime = null;
+ protected Long version = 0L;
+
+ protected InstanceStatus currentStatus = InstanceStatus.UNKNOWN;
+
+ /*
+ * Used only if the status is DELETED. It defines the status to use if the instance is restored.
+ */
+ protected InstanceStatus statusOnDelete = InstanceStatus.UNKNOWN;
+
+
+ /**
+ * Default Constructor sets the instance to nulls.
+ */
+ public InstanceAuditHeader()
+ {
+ super();
+ }
+
+
+ /**
+ * Copy/clone constructor set the value to those supplied in the template.
+ *
+ * @param template - Instance header
+ */
+ public InstanceAuditHeader(InstanceAuditHeader template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ this.type = template.getType();
+ this.createdBy = template.getCreatedBy();
+ this.updatedBy = template.getUpdatedBy();
+ this.createTime = template.getCreateTime();
+ this.updateTime = template.getUpdateTime();
+ this.version = template.getVersion();
+ this.currentStatus = template.getStatus();
+ this.statusOnDelete = template.getStatusOnDelete();
+ }
+ }
+
+
+ /**
+ * Return the type of this instance. This identifies the type definition (TypeDef) that determines its properties.
+ *
+ * @return InstanceType object
+ */
+ public InstanceType getType()
+ {
+ if (type == null)
+ {
+ return type;
+ }
+ else
+ {
+ return new InstanceType(type);
+ }
+ }
+
+
+ /**
+ * Set up the type of this instance. This identifies the type definition (TypeDef) that determines its properties.
+ *
+ * @param type - InstanceType object
+ */
+ public void setType(InstanceType type)
+ {
+ this.type = type;
+ }
+
+
+ /**
+ * Return the status of this instance (UNKNOWN, PROPOSED, DRAFT, ACTIVE, DELETED).
+ *
+ * @return InstanceStatus
+ */
+ public InstanceStatus getStatus() { return currentStatus; }
+
+
+ /**
+ * Set up the status of this instance (UNKNOWN, PROPOSED, DRAFT, ACTIVE, DELETED).
+ *
+ * @param newStatus - InstanceStatus
+ */
+ public void setStatus(InstanceStatus newStatus) { this.currentStatus = newStatus; }
+
+
+ /**
+ * Return the name of the user that created this instance.
+ *
+ * @return String user name
+ */
+ public String getCreatedBy() { return createdBy; }
+
+
+ /**
+ * Set up the name of the user that created this instance.
+ *
+ * @param createdBy String user name
+ */
+ public void setCreatedBy(String createdBy) { this.createdBy = createdBy; }
+
+
+ /**
+ * Return the name of the user that last updated this instance.
+ *
+ * @return String user name
+ */
+ public String getUpdatedBy() { return updatedBy; }
+
+
+ /**
+ * Set up the name of the user that last updated this instance.
+ *
+ * @param updatedBy - String user name
+ */
+ public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; }
+
+
+ /**
+ * Return the date/time that this instance was created.
+ *
+ * @return Date creation time
+ */
+ public Date getCreateTime()
+ {
+ if (createTime == null)
+ {
+ return createTime;
+ }
+ else
+ {
+ return new Date(createTime.getTime());
+ }
+ }
+
+
+ /**
+ * Set up the time that this instance was created.
+ *
+ * @param createTime Date of creation
+ */
+ public void setCreateTime(Date createTime) { this.createTime = createTime; }
+
+
+ /**
+ * Return what was the late time this instance was updated.
+ *
+ * @return Date - last update time
+ */
+ public Date getUpdateTime()
+ {
+ if (updateTime == null)
+ {
+ return updateTime;
+ }
+ else
+ {
+ return new Date(updateTime.getTime());
+ }
+ }
+
+
+ /**
+ * Set up the last update time for this instance.
+ *
+ * @param updateTime - Date - last update time
+ */
+ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
+
+
+ /**
+ * Return the version number for this instance.
+ *
+ * @return Long versionName number
+ */
+ public Long getVersion() { return version; }
+
+
+ /**
+ * Set up the versionName number for this instance.
+ *
+ * @param version - Long versionName number
+ */
+ public void setVersion(Long version) { this.version = version; }
+
+
+ /**
+ * Return the status to use when a deleted instance is restored. UNKNOWN is used whenever the instance is
+ * not in DELETED status.
+ *
+ * @return InstanceStatus
+ */
+ public InstanceStatus getStatusOnDelete() { return statusOnDelete; }
+
+
+ /**
+ * Set up the status to use when a deleted instance is restored. UNKNOWN is used whenever the instance is
+ * not in DELETED status.
+ *
+ * @param statusOnDelete - InstanceStatus Enum
+ */
+ public void setStatusOnDelete(InstanceStatus statusOnDelete) { this.statusOnDelete = statusOnDelete; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "InstanceHeader{" +
+ "type=" + type +
+ ", status=" + currentStatus +
+ ", createdBy='" + createdBy + '\'' +
+ ", updatedBy='" + updatedBy + '\'' +
+ ", createTime=" + createTime +
+ ", updateTime=" + updateTime +
+ ", versionName=" + version +
+ ", statusOnDelete=" + statusOnDelete +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceElementHeader.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceElementHeader.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceElementHeader.java
new file mode 100644
index 0000000..0ffef54
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceElementHeader.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import java.io.Serializable;
+
+/**
+ * InstanceElementHeader provides a common base for all instance information from the metadata collection.
+ * It implements Serializable.
+ */
+public abstract class InstanceElementHeader implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Default Constructor sets the instance to nulls
+ */
+ public InstanceElementHeader()
+ {
+ /*
+ * Nothing to do.
+ */
+ }
+
+
+ /**
+ * Copy/clone constructor set values from the template
+ *
+ * @param template - InstanceElementHeader to copy
+ */
+ public InstanceElementHeader(InstanceElementHeader template)
+ {
+ /*
+ * Nothing to do.
+ */
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceGraph.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceGraph.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceGraph.java
new file mode 100644
index 0000000..11fc7e1
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceGraph.java
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+
+import java.util.ArrayList;
+
+/**
+ * InstanceGraph stores a subgraph of entities and relationships and provides methods to access its content.
+ * It stores a list of entities and a list of relationships. It is possible to request a list for each
+ * of these two lists, or request elements that link to a specific element. For example, request the relationships
+ * that link to an entity or the entity at a specific end of a relationship.
+ */
+public class InstanceGraph extends InstanceElementHeader
+{
+ private ArrayList<EntityDetail> entityElementList = null;
+ private ArrayList<Relationship> relationshipElementList = null;
+
+
+ /**
+ * Default Constructor creates a graph with the supplied list of elements. It assumes the caller has supplied
+ * elements that do link together. However, this graph supports graph fragments.
+ *
+ * @param entityElementList - list of entity elements to add to the list
+ * @param relationshipElementList - list of relationship elements to add to the list
+ */
+ public InstanceGraph(ArrayList<EntityDetail> entityElementList,
+ ArrayList<Relationship> relationshipElementList)
+ {
+ this.entityElementList = entityElementList;
+ this.relationshipElementList = relationshipElementList;
+ }
+
+
+ /**
+ * Copy/clone constructor.
+ *
+ * @param templateGraph - graph to copy; null to create an empty graph
+ */
+ public InstanceGraph(InstanceGraph templateGraph)
+ {
+ if (templateGraph != null)
+ {
+ entityElementList = templateGraph.getEntities();
+ relationshipElementList = templateGraph.getRelationships();
+ }
+ }
+
+
+ /**
+ * Return the list of all of the entities (vertices/nodes) in the instance graph. Null means empty graph.
+ *
+ * @return EntityDetails - entity list
+ */
+ public ArrayList<EntityDetail> getEntities()
+ {
+ if (entityElementList != null)
+ {
+ ArrayList<EntityDetail> entities = new ArrayList<>();
+
+ for (EntityDetail entity : entityElementList)
+ {
+ entities.add(new EntityDetail(entity));
+ }
+ return entities;
+ }
+ else
+ {
+ return entityElementList;
+ }
+ }
+
+
+ /**
+ * Return the list of all relationships (edges/links) in the instance graph. Null means a disconnected/empty graph.
+ *
+ * @return Relationships - relationship list
+ */
+ public ArrayList<Relationship> getRelationships()
+ {
+ if (relationshipElementList != null)
+ {
+ ArrayList<Relationship> relationships = new ArrayList<>();
+
+ for (Relationship relationship : relationshipElementList)
+ {
+ relationships.add(new Relationship(relationship));
+ }
+
+ return relationships;
+ }
+ else
+ {
+ return relationshipElementList;
+ }
+ }
+
+
+ /**
+ * Return a list of relationships that are connected to a specific entity.
+ *
+ * @param anchorEntityGUID - unique identifier for an entity
+ * @return Relationships - relationship iterator
+ */
+ public ArrayList<Relationship> getRelationshipsForEntity(String anchorEntityGUID)
+ {
+ ArrayList<Relationship> matchingRelationships = new ArrayList<>();
+
+ /*
+ * Load copies of each relationship that matches the requested entity into matchingRelationships.
+ */
+ if (relationshipElementList != null)
+ {
+ for (Relationship relationship : relationshipElementList)
+ {
+ if (relationship.relatedToEntity(anchorEntityGUID))
+ {
+ matchingRelationships.add(new Relationship(relationship));
+ }
+ }
+ }
+
+ /*
+ * Return any matched relationships in an iterator for the caller to step through.
+ */
+ if (matchingRelationships.isEmpty())
+ {
+ return null;
+ }
+ else
+ {
+ return matchingRelationships;
+ }
+ }
+
+
+ /**
+ * Return the entity connected at the far end of an entity's relationship.
+ *
+ * @param anchorEntityGUID - unique id for the known entity.
+ * @param linkingRelationshipGUID - the relationship to traverse.
+ * @return EntityDetail - the requested entity at the far end of the relationship.
+ * Null if the relationship or entity is not found.
+ */
+ public EntityDetail getLinkedEntity(String anchorEntityGUID, String linkingRelationshipGUID)
+ {
+ Relationship matchingRelationship = null;
+ String linkedEntityGUID = null;
+ EntityDetail linkedEntity = null;
+
+ /*
+ * Step through the list of relationships looking for the matching one. If parameters are null we will not
+ * match with the list.
+ */
+ if (relationshipElementList != null)
+ {
+ for (Relationship relationship : relationshipElementList)
+ {
+ if (relationship.getGUID().equals(linkingRelationshipGUID))
+ {
+ matchingRelationship = relationship;
+ break;
+ }
+ }
+ }
+
+ /*
+ * Return null if the relationship is not known
+ */
+ if (matchingRelationship == null)
+ {
+ return null;
+ }
+
+ /*
+ * Extract the guid of the linking entity.
+ */
+ linkedEntityGUID = matchingRelationship.getLinkedEntity(anchorEntityGUID);
+
+ /*
+ * Return null if the entity does not match.
+ */
+ if (linkedEntityGUID == null)
+ {
+ return null;
+ }
+
+ /*
+ * Step through the list of entities in the graph looking for the appropriate entity to return.
+ * If no match occurs, null will be returned.
+ */
+ for (EntityDetail entity : entityElementList)
+ {
+ if (entity.getGUID().equals(linkedEntityGUID))
+ {
+ linkedEntity = new EntityDetail(entity);
+ break;
+ }
+ }
+
+ return linkedEntity;
+ }
+
+
+ /**
+ * Return the number of entities in the graph.
+ *
+ * @return elementCount for entities
+ */
+ public int getEntityElementCount()
+ {
+ return entityElementList.size();
+ }
+
+
+ /**
+ * Return the number of relationships in the graph.
+ *
+ * @return elementCount for relationships
+ */
+ public int getRelationshipElementCount()
+ {
+ return relationshipElementList.size();
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "InstanceGraph{" +
+ "entityElementList=" + entityElementList +
+ ", relationshipElementList=" + relationshipElementList +
+ ", entities=" + getEntities() +
+ ", relationships=" + getRelationships() +
+ ", entityElementCount=" + getEntityElementCount() +
+ ", relationshipElementCount=" + getRelationshipElementCount() +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java
new file mode 100644
index 0000000..934974d
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+
+/**
+ * InstanceHeader manages the attributes that are common to entities and relationship instances. This includes
+ * information abut its type, provenance and change history.
+ */
+public abstract class InstanceHeader extends InstanceAuditHeader
+{
+ /*
+ * Provenance information defining where the instance came from and whether this is a master or reference copy.
+ */
+ private InstanceProvenanceType instanceProvenanceType = InstanceProvenanceType.UNKNOWN;
+ private String metadataCollectionId = null;
+
+ /*
+ * Entities and relationships have unique identifiers.
+ */
+ private String guid = null;
+
+ /*
+ * Some metadata repositories offer a direct URL to access the instance.
+ */
+ private String instanceURL = null;
+
+ /**
+ * Default Constructor sets the instance to nulls.
+ */
+ public InstanceHeader()
+ {
+ super();
+ }
+
+
+ /**
+ * Copy/clone constructor set the value to those supplied in the template.
+ *
+ * @param template - Instance header
+ */
+ public InstanceHeader(InstanceHeader template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ this.metadataCollectionId = template.getMetadataCollectionId();
+ this.instanceProvenanceType = template.getInstanceProvenanceType();
+ this.guid = template.getGUID();
+ this.instanceURL = template.getInstanceURL();
+ }
+ }
+
+
+ /**
+ * Return the type of the provenance for this instance (UNKNOWN, LOCAL_COHORT, EXPORT_ARCHIVE, CONTENT_PACK,
+ * DEREGISTERED_REPOSITORY, CONFIGURATION).
+ *
+ * @return InstanceProvenanceType enum
+ */
+ public InstanceProvenanceType getInstanceProvenanceType() { return instanceProvenanceType; }
+
+
+ /**
+ * Set up the type of the provenance for this instance (UNKNOWN, LOCAL_COHORT, EXPORT_ARCHIVE, CONTENT_PACK,
+ * DEREGISTERED_REPOSITORY, CONFIGURATION).
+ *
+ * @param instanceProvenanceType - InstanceProvenanceType enum
+ */
+ public void setInstanceProvenanceType(InstanceProvenanceType instanceProvenanceType)
+ {
+ this.instanceProvenanceType = instanceProvenanceType;
+ }
+
+
+ /**
+ * Return the unique identifier for the metadata collection that is the home for this instance.
+ * If the metadataCollectionId is null it means this instance belongs to the local metadata collection.
+ *
+ * @return metadataCollectionId - String unique identifier for the repository
+ */
+ public String getMetadataCollectionId() { return metadataCollectionId; }
+
+
+ /**
+ * Set up the unique identifier for the home metadata collection for this instance.
+ * If the metadataCollectionId is null it means this instance belongs to the local metadata collection.
+ *
+ * @param metadataCollectionId - String unique identifier for the repository
+ */
+ public void setMetadataCollectionId(String metadataCollectionId) { this.metadataCollectionId = metadataCollectionId; }
+
+
+ /**
+ * Return the URL for this instance (or null if the metadata repository does not support instance URLs).
+ *
+ * @return String URL
+ */
+ public String getInstanceURL()
+ {
+ return instanceURL;
+ }
+
+
+ /**
+ * Set up the URL for this instance (or null if the metadata repository does not support instance URLs).
+ *
+ * @param instanceURL - String URL
+ */
+ public void setInstanceURL(String instanceURL)
+ {
+ this.instanceURL = instanceURL;
+ }
+
+
+ /**
+ * Return the unique identifier for this instance.
+ *
+ * @return guid - String unique identifier
+ */
+ public String getGUID() { return guid; }
+
+
+ /**
+ * Set up the unique identifier for this instance.
+ *
+ * @param guid - String unique identifier
+ */
+ public void setGUID(String guid) { this.guid = guid; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "InstanceHeader{" +
+ "type=" + type +
+ ", instanceProvenanceType=" + instanceProvenanceType +
+ ", metadataCollectionId='" + metadataCollectionId + '\'' +
+ ", instanceURL='" + instanceURL + '\'' +
+ ", currentStatus=" + currentStatus +
+ ", guid='" + guid + '\'' +
+ ", createdBy='" + createdBy + '\'' +
+ ", updatedBy='" + updatedBy + '\'' +
+ ", createTime=" + createTime +
+ ", updateTime=" + updateTime +
+ ", versionName=" + version +
+ ", statusOnDelete=" + statusOnDelete +
+ ", GUID='" + getGUID() + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java
new file mode 100644
index 0000000..bc228d3
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java
@@ -0,0 +1,196 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import org.apache.atlas.omrs.ffdc.OMRSErrorCode;
+import org.apache.atlas.omrs.ffdc.exception.OMRSRuntimeException;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+/**
+ * The InstanceProperties class provides support for arbitrary properties to be added to an entity,
+ * struct or relationship object.
+ * It wraps a java.util.Map map object built around HashMap. The property name (or domain) of the map is the name
+ * of the property. The property value (or range) of the map is a subclass of InstancePropertyValue depending on
+ * the type of the property:
+ * <ul>
+ * <li>
+ * PrimitivePropertyValue - for primitives such as strings and numbers. The full list of primitives are
+ * given in PrimitiveDefCategory.
+ * </li>
+ * <li>
+ * EnumPropertyValue - for properties with a type consisting of an enumeration of valid values. Each
+ * </li>
+ * <li>
+ * StructPropertyValue - for properties that have a type of a complex structure (aka struct).
+ * The Struct can be thought of as a list of related properties.
+ * </li>
+ * <li>
+ * MapPropertyValue - for properties that have a type of map.
+ * The map holds an unordered list of name-value pairs. The pairs are of the same type and the name for
+ * the pair is unique within the map.
+ * </li>
+ * <li>
+ * ArrayPropertyValue - for properties that have a type of Array.
+ * This is an ordered list of values of the same type.
+ * </li>
+ * </ul>
+ */
+public class InstanceProperties extends InstanceElementHeader
+{
+ /*
+ * Map from property name to property value. The value includes type information.
+ */
+ private Map<String, InstancePropertyValue> instanceProperties = new HashMap<>();
+
+
+ /**
+ * Typical constructor
+ */
+ public InstanceProperties()
+ {
+ super();
+ }
+
+
+ /**
+ * Copy/clone Constructor.
+ *
+ * @param templateProperties - template object to copy.
+ */
+ public InstanceProperties(InstanceProperties templateProperties)
+ {
+ super(templateProperties);
+
+ /*
+ * An empty properties object is created in the private variable declaration so nothing to do.
+ */
+ if (templateProperties != null)
+ {
+ /*
+ * Process templateProperties if they are not null
+ */
+ Iterator<String> propertyNames = templateProperties.getPropertyNames();
+
+ if (propertyNames != null)
+ {
+ while (propertyNames.hasNext())
+ {
+ String newPropertyName = propertyNames.next();
+ InstancePropertyValue newPropertyValue = templateProperties.getPropertyValue(newPropertyName);
+
+ instanceProperties.put(newPropertyName, newPropertyValue);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Returns a list of the instance properties for the element.
+ * If no stored properties are present then null is returned.
+ *
+ * @return list of properties
+ */
+ public Iterator<String> getPropertyNames()
+ {
+ return instanceProperties.keySet().iterator();
+ }
+
+
+ /**
+ * Returns the requested instance property for the element.
+ * If no stored property with that name is present then null is returned.
+ *
+ * @param name - String name of the property to return.
+ * @return requested property value.
+ */
+ public InstancePropertyValue getPropertyValue(String name)
+ {
+ return instanceProperties.get(name);
+ }
+
+
+ /**
+ * Adds or updates an instance property.
+ * If a null is supplied for the property name, an OMRS runtime exception is thrown.
+ * If a null is supplied for the property value, the property is removed.
+ *
+ * @param newPropertyName - name
+ * @param newPropertyValue - value
+ */
+ public void setProperty(String newPropertyName, InstancePropertyValue newPropertyValue)
+ {
+ if (newPropertyName == null)
+ {
+ /*
+ * Build and throw exception.
+ */
+ OMRSErrorCode errorCode = OMRSErrorCode.NULL_PROPERTY_NAME;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage();
+
+ throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "setProperty",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction());
+ }
+ else if (newPropertyValue == null)
+ {
+ instanceProperties.remove(newPropertyName);
+ }
+ else
+ {
+ instanceProperties.put(newPropertyName, newPropertyValue);
+ }
+ }
+
+
+ /**
+ * Return the number of properties stored.
+ *
+ * @return int property count
+ */
+ public int getPropertyCount()
+ {
+ return instanceProperties.size();
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "InstanceProperties{" +
+ "instanceProperties=" + instanceProperties +
+ ", propertyNames=" + getPropertyNames() +
+ ", propertyCount=" + getPropertyCount() +
+ '}';
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyCategory.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyCategory.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyCategory.java
new file mode 100644
index 0000000..f7393eb
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyCategory.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.omrs.metadatacollection.properties.instances;
+
+import java.io.Serializable;
+
+/**
+ * The InstancePropertyCategory defines the list of value types for the properties for open metadata.
+ * It is used in the InstancePropertyValue class to distinguish its subclasses.
+ */
+public enum InstancePropertyCategory implements Serializable
+{
+ UNKNOWN (0, "<Unknown>", "Uninitialized InstancePropertyValue object."),
+ PRIMITIVE (1, "Primitive", "A primitive type."),
+ ENUM (2, "Enum", "A pre-defined list of valid values."),
+ STRUCT (3, "Struct", "A collection of related properties."),
+ MAP (4, "Map", "A set of name->value pairs where all names are unique in the map."),
+ ARRAY (5, "Array", "An ordered list of values, each with the same type.");
+
+ private static final long serialVersionUID = 1L;
+
+ private int typeCode;
+ private String typeName;
+ private String typeDescription;
+
+
+ /**
+ * Default Constructor
+ *
+ * @param typeCode - ordinal for this enum
+ * @param typeName - symbolic name for this enum
+ * @param typeDescription - short description for this enum
+ */
+ InstancePropertyCategory(int typeCode, String typeName, String typeDescription)
+ {
+ /*
+ * Save the values supplied
+ */
+ this.typeCode = typeCode;
+ this.typeName = typeName;
+ this.typeDescription = typeDescription;
+ }
+
+
+ /**
+ * Return the code for this enum instance
+ *
+ * @return int - type code
+ */
+ public int getTypeCode()
+ {
+ return typeCode;
+ }
+
+
+ /**
+ * Return the default name for this enum instance.
+ *
+ * @return String - default name
+ */
+ public String getTypeName()
+ {
+ return typeName;
+ }
+
+
+ /**
+ * Return the default description for the type for this enum instance.
+ *
+ * @return String - default description
+ */
+ public String getTypeDescription()
+ {
+ return typeDescription;
+ }
+}