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:21 UTC
[05/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/instances/InstancePropertyValue.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.java
new file mode 100644
index 0000000..08ec988
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.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;
+
+public class InstancePropertyValue extends InstanceElementHeader
+{
+ /*
+ * Common type information - this is augmented by the subclasses
+ */
+ private InstancePropertyCategory instancePropertyCategory = InstancePropertyCategory.UNKNOWN;
+ private String typeGUID = null;
+ private String typeName = null;
+
+
+ /**
+ * Default constructor initializes the instance property value to nulls.
+ *
+ * @param instancePropertyCategory - InstancePropertyCategory Enum
+ */
+ public InstancePropertyValue(InstancePropertyCategory instancePropertyCategory)
+ {
+ super();
+ this.instancePropertyCategory = instancePropertyCategory;
+ }
+
+
+ /**
+ * Copy/clone constructor - initializes the instance property value from the supplied template.
+ *
+ * @param template InstancePropertyValue
+ */
+ public InstancePropertyValue(InstancePropertyValue template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ this.instancePropertyCategory = template.getInstancePropertyCategory();
+ this.typeGUID = template.getTypeGUID();
+ this.typeName = template.getTypeName();
+ }
+ }
+
+
+ /**
+ * Return the category of this instance property's type.
+ *
+ * @return TypeDefCategory enum value
+ */
+ public InstancePropertyCategory getInstancePropertyCategory() { return instancePropertyCategory; }
+
+
+ /**
+ * Return the unique GUID for the type.
+ *
+ * @return String unique identifier
+ */
+ public String getTypeGUID() { return typeGUID; }
+
+
+ /**
+ * Set up the unique GUID of the type.
+ *
+ * @param typeGUID - String unique identifier
+ */
+ public void setTypeGUID(String typeGUID) { this.typeGUID = typeGUID; }
+
+
+ /**
+ * Return the name of the type.
+ *
+ * @return String type name
+ */
+ public String getTypeName() { return typeName; }
+
+
+ /**
+ * Set up the name of the type.
+ *
+ * @param typeName - String type name
+ */
+ public void setTypeName(String typeName) { this.typeName = typeName; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "InstancePropertyValue{" +
+ "instancePropertyCategory=" + instancePropertyCategory +
+ ", typeGUID='" + typeGUID + '\'' +
+ ", typeName='" + typeName + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProvenanceType.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProvenanceType.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProvenanceType.java
new file mode 100644
index 0000000..1715cbf
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProvenanceType.java
@@ -0,0 +1,109 @@
+/*
+ * 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;
+
+/**
+ * InstanceProvenanceType defines where the metadata comes from and, hence if it can be updated.
+ * <ul>
+ * <li>
+ * UNKNOWN - uninitialized provenance value.
+ * </li>
+ * <li>
+ * LOCAL_COHORT - the element is being maintained within the local cohort.
+ * The metadata collection id is for one of the repositories in the cohort.
+ * This metadata collection id identifies the home repository for this element.
+ * </li>
+ * <li>
+ * EXPORT_ARCHIVE - the element was created from an export archive.
+ * The metadata collection id for the element is the metadata collection id of the originating server.
+ * If the originating server later joins the cohort with the same metadata collection Id then these
+ * elements will be refreshed from the originating server’s current repository.
+ * </li>
+ * <li>
+ * CONTENT_PACK - the element comes from an open metadata content pack.
+ * The metadata collection id of the elements is set to the GUID of the pack.
+ * </li>
+ * <li>
+ * DEREGISTERED_REPOSITORY - the element comes from a metadata repository that used to be a part
+ * of the repository cohort but has been deregistered. The metadata collection id remains the same.
+ * If the repository rejoins the cohort then these elements can be refreshed from the rejoining repository.
+ * </li>
+ * </ul>
+ */
+public enum InstanceProvenanceType implements Serializable
+{
+ UNKNOWN (0, "<Unknown>", "Unknown provenance"),
+ LOCAL_COHORT (1, "Local Cohort", "The instance is managed by one of the members of a cohort " +
+ "that the local server belongs to"),
+ EXPORT_ARCHIVE (2, "Export Archive", "The instance comes from an open metadata archive that was " +
+ "created from a metadata export from an open " +
+ "metadata repository"),
+ CONTENT_PACK (3, "Content Pack", "The instance comes from an open metadata archive that was " +
+ "created as a content pack"),
+ DEREGISTERED_REPOSITORY (4, "Deregistered Repository", "The instance is a cached copy of a metadata instance " +
+ "that is owned by a repository that is no longer " +
+ "connected to one of the cohorts that the " +
+ "local server belongs to; it may be out-of-date");
+
+ private static final long serialVersionUID = 1L;
+
+ private int ordinal;
+ private String name;
+ private String description;
+
+
+ /**
+ * Default constructor for the instance provenance type.
+ *
+ * @param ordinal - numerical representation of the instance provenance type
+ * @param name - default string name of the instance provenance type
+ * @param description - default string description of the instance provenance type
+ */
+ InstanceProvenanceType(int ordinal, String name, String description)
+ {
+ this.ordinal = ordinal;
+ this.name = name;
+ this.description = description;
+ }
+
+
+ /**
+ * Return the numeric representation of the instance provenance type.
+ *
+ * @return int ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Return the default name of the instance provenance type.
+ *
+ * @return String name
+ */
+ public String getName() { return name; }
+
+
+ /**
+ * Return the default description of the instance provenance type.
+ *
+ * @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/InstanceStatus.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceStatus.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceStatus.java
new file mode 100644
index 0000000..645bd4c
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceStatus.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 InstanceStatus defines the status of a relationship or an entity in the metadata collection. It effectively
+ * defines its visibility to different types of queries. Most queries by default will only return instances in the
+ * active status.
+ * <ul>
+ * <li>UNKNOWN - the instance has not been initialized.</li>
+ * <li>PROPOSED - the instance has not yet been stored in the metadata collection.</li>
+ * <li>DRAFT - the instance is stored but not fully filled out so should not be used for normal queries.</li>
+ * <li>PREPARED - the instance is stored and complete - it is ready to be moved to active status.</li>
+ * <li>ACTIVE - the instance is in active use.</li>
+ * <li>DELETED - the instance has been deleted and is waiting to be purged. It is kept in the metadata collection
+ * to support a restore request. It is not returned on normal queries.</li>
+ * </ul>
+ */
+public enum InstanceStatus implements Serializable
+{
+ UNKNOWN (0, "<Unknown>", "Unknown instance status."),
+ PROPOSED(1, "Proposed", "Proposed instance to store in the metadata collection."),
+ DRAFT (2, "Draft", "Potentially incomplete draft of instance still being developed."),
+ PREPARED(3, "Prepared", "Complete draft of instance waiting for approval."),
+ ACTIVE (10, "Active", "Active instance in use."),
+ DELETED(99, "Deleted", "Instance that has been deleted and is no longer in use.");
+
+ private static final long serialVersionUID = 1L;
+
+ private int ordinal;
+ private String statusName;
+ private String statusDescription;
+
+
+ /**
+ * Default constructor sets up the specific values for an enum instance.
+ *
+ * @param ordinal - int enum value ordinal
+ * @param statusName - String name
+ * @param statusDescription - String description
+ */
+ InstanceStatus(int ordinal,
+ String statusName,
+ String statusDescription)
+ {
+ this.ordinal = ordinal;
+ this.statusName = statusName;
+ this.statusDescription = statusDescription;
+ }
+
+
+ /**
+ * Return the numerical value for the enum.
+ *
+ * @return int enum value ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Return the descriptive name for the enum.
+ *
+ * @return String name
+ */
+ public String getStatusName() { return statusName; }
+
+
+ /**
+ * Return the description for the enum.
+ *
+ * @return String description
+ */
+ public String getStatusDescription() { return statusDescription; }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java
new file mode 100644
index 0000000..edd786a
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java
@@ -0,0 +1,311 @@
+/*
+ * 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.metadatacollection.properties.typedefs.TypeDefCategory;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefLink;
+
+import java.util.ArrayList;
+
+/**
+ * InstanceType contains information from the instance's TypeDef that are useful for processing the instance.
+ */
+public class InstanceType extends InstanceElementHeader
+{
+ private TypeDefCategory typeDefCategory = TypeDefCategory.UNKNOWN_DEF;
+ private String typeDefGUID = null;
+ private String typeDefName = null;
+ private long typeDefVersion = 0L;
+ private String typeDefDescription = null;
+ private String typeDefDescriptionGUID = null;
+ private ArrayList<TypeDefLink> typeDefSuperTypes = null;
+ private ArrayList<InstanceStatus> validStatusList = null;
+ private ArrayList<String> validInstanceProperties = null;
+
+ /**
+ * Default constructor relies on initialization of variables in the declaration.
+ */
+ public InstanceType()
+ {
+ }
+
+
+ /**
+ * Typical constructor that set all of the properties at once.
+ *
+ * @param typeDefCategory - the category of the type
+ * @param typeDefGUID - unique identifier of the type
+ * @param typeDefName - unique name of the type
+ * @param typeDefVersion - version number of the type
+ * @param typeDefDescription - short description of the type
+ * @param typeDefDescriptionGUID - unique identifier of the glossary term describing this type.
+ * @param typeDefSuperTypes - full list of super types for this type
+ * @param validStatusList - list of statuses that this instance can have
+ * @param validInstanceProperties - full list of valid property names that can be put in the instance (including
+ * properties from the super types)
+ */
+ public InstanceType(TypeDefCategory typeDefCategory,
+ String typeDefGUID,
+ String typeDefName,
+ long typeDefVersion,
+ String typeDefDescription,
+ String typeDefDescriptionGUID,
+ ArrayList<TypeDefLink> typeDefSuperTypes,
+ ArrayList<InstanceStatus> validStatusList,
+ ArrayList<String> validInstanceProperties)
+ {
+ this.typeDefCategory = typeDefCategory;
+ this.typeDefGUID = typeDefGUID;
+ this.typeDefName = typeDefName;
+ this.typeDefVersion = typeDefVersion;
+ this.typeDefDescription = typeDefDescription;
+ this.typeDefDescriptionGUID = typeDefDescriptionGUID;
+ this.typeDefSuperTypes = typeDefSuperTypes;
+ this.validStatusList = validStatusList;
+ this.validInstanceProperties = validInstanceProperties;
+ }
+
+
+ /**
+ * Copy/clone constructor
+ *
+ * @param template - instance type to copy
+ */
+ public InstanceType(InstanceType template)
+ {
+ if (template != null)
+ {
+ typeDefCategory = template.getTypeDefCategory();
+ typeDefGUID = template.getTypeDefGUID();
+ typeDefName = template.getTypeDefName();
+ typeDefVersion = template.getTypeDefVersion();
+ typeDefDescription = template.getTypeDefDescription();
+ typeDefDescriptionGUID = template.getTypeDefDescriptionGUID();
+ typeDefSuperTypes = template.getTypeDefSuperTypes();
+ validStatusList = template.getValidStatusList();
+ validInstanceProperties = template.getValidInstanceProperties();
+ }
+ }
+
+
+ /**
+ * Return the category of this instance. This defines the category of the TypeDef that determines its properties.
+ *
+ * @return TypeDefCategory enum
+ */
+ public TypeDefCategory getTypeDefCategory() { return typeDefCategory; }
+
+
+ /**
+ * Set up the category of this instance. This defines the category of the TypeDef that determines its properties.
+ *
+ * @param typeDefCategory enum
+ */
+ public void setTypeDefCategory(TypeDefCategory typeDefCategory)
+ {
+ this.typeDefCategory = typeDefCategory;
+ }
+
+ /**
+ * Return the unique identifier for the type of this instance.
+ *
+ * @return String unique identifier
+ */
+ public String getTypeDefGUID() { return typeDefGUID; }
+
+
+ /**
+ * Set up the unique identifier for the type of this instance.
+ *
+ * @param typeDefGUID - String unique identifier
+ */
+ public void setTypeDefGUID(String typeDefGUID) { this.typeDefGUID = typeDefGUID; }
+
+
+ /**
+ * Return the name of this instance's type.
+ *
+ * @return String type name
+ */
+ public String getTypeDefName() { return typeDefName; }
+
+
+ /**
+ * Set up the name of this instance's type.
+ *
+ * @param typeDefName - String type name
+ */
+ public void setTypeDefName(String typeDefName) { this.typeDefName = typeDefName; }
+
+
+ /**
+ * Return the version number of this instance's TypeDef.
+ *
+ * @return long version number
+ */
+ public long getTypeDefVersion()
+ {
+ return typeDefVersion;
+ }
+
+
+ /**
+ * Set up the versionName for the TypeDef.
+ *
+ * @param typeDefVersion - long version number
+ */
+ public void setTypeDefVersion(long typeDefVersion)
+ {
+ this.typeDefVersion = typeDefVersion;
+ }
+
+
+ /**
+ * Return the full list of defined super-types for this TypeDef working up the type hierarchy.
+ *
+ * @return list of types
+ */
+ public ArrayList<TypeDefLink> getTypeDefSuperTypes()
+ {
+ return typeDefSuperTypes;
+ }
+
+
+ /**
+ * Set up the full list of defined super-types for this TypeDef working up the type hierarchy.
+ *
+ * @param typeDefSuperTypes - list of type names
+ */
+ public void setTypeDefSuperTypes(ArrayList<TypeDefLink> typeDefSuperTypes)
+ {
+ this.typeDefSuperTypes = typeDefSuperTypes;
+ }
+
+ /**
+ * Return the description for the TypeDef.
+ *
+ * @return - String description
+ */
+ public String getTypeDefDescription()
+ {
+ return typeDefDescription;
+ }
+
+
+ /**
+ * Set up the description for the TypeDef.
+ *
+ * @param typeDefDescription - String description
+ */
+ public void setTypeDefDescription(String typeDefDescription)
+ {
+ this.typeDefDescription = typeDefDescription;
+ }
+
+
+ /**
+ * Return the unique identifier of the glossary term that describes this TypeDef (null if no term defined).
+ *
+ * @return String unique identifier
+ */
+ public String getTypeDefDescriptionGUID()
+ {
+ return typeDefDescriptionGUID;
+ }
+
+
+ /**
+ * Set up the unique identifier of the glossary term that describes this TypeDef (null if no term defined).
+ *
+ * @param typeDefDescriptionGUID - String unique identifier
+ */
+ public void setTypeDefDescriptionGUID(String typeDefDescriptionGUID)
+ {
+ this.typeDefDescriptionGUID = typeDefDescriptionGUID;
+ }
+
+
+ /**
+ * Return the list of valid instance statuses supported by this instance.
+ *
+ * @return InstanceStatus array of supported status.
+ */
+ public ArrayList<InstanceStatus> getValidStatusList()
+ {
+ if ( validStatusList == null)
+ {
+ return validStatusList;
+ }
+ else
+ {
+ return new ArrayList<>(validStatusList);
+ }
+ }
+
+
+ /**
+ * Set up the list of valid instance statuses supported by this instance.
+ *
+ * @param validStatusList - InstanceStatus Array
+ */
+ public void setValidStatusList(ArrayList<InstanceStatus> validStatusList) { this.validStatusList = validStatusList; }
+
+
+ /**
+ * Return the list of valid property names that can be stored in this instance.
+ *
+ * @return array of property names.
+ */
+ public ArrayList<String> getValidInstanceProperties()
+ {
+ return validInstanceProperties;
+ }
+
+
+ /**
+ * Set up the set of valid property names that can be stored in this instance.
+ *
+ * @param validInstanceProperties - array of property names.
+ */
+ public void setValidInstanceProperties(ArrayList<String> validInstanceProperties)
+ {
+ this.validInstanceProperties = validInstanceProperties;
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "InstanceType{" +
+ "typeDefCategory=" + typeDefCategory +
+ ", typeDefGUID='" + typeDefGUID + '\'' +
+ ", typeDefName='" + typeDefName + '\'' +
+ ", typeDefVersion=" + typeDefVersion +
+ ", typeDefDescription='" + typeDefDescription + '\'' +
+ ", typeDefDescriptionGUID='" + typeDefDescriptionGUID + '\'' +
+ ", typeDefSuperTypes=" + typeDefSuperTypes +
+ ", validStatusList=" + validStatusList +
+ ", validInstanceProperties=" + validInstanceProperties +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/MapPropertyValue.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/MapPropertyValue.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/MapPropertyValue.java
new file mode 100644
index 0000000..4bebb02
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/MapPropertyValue.java
@@ -0,0 +1,133 @@
+/*
+ * 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;
+
+
+/**
+ * MapPropertyValue stores the values of a map within an entity, struct or relationship properties.
+ * The elements of the map are stored in an InstanceProperties map.
+ */
+public class MapPropertyValue extends InstancePropertyValue
+{
+ private InstanceProperties mapValues = null;
+
+
+ /**
+ * Default constructor sets the map to empty.
+ */
+ public MapPropertyValue()
+ {
+ super(InstancePropertyCategory.MAP);
+ }
+
+
+ /**
+ * Copy/clone constructor set up the map using the supplied template.
+ *
+ * @param template - ArrayPropertyValue
+ */
+ public MapPropertyValue(MapPropertyValue template)
+ {
+ super(template);
+
+ if (template !=null)
+ {
+ mapValues = template.getMapValues();
+ }
+ }
+
+
+ /**
+ * Return the number of elements in the map.
+ *
+ * @return int - map size
+ */
+ public int getMapElementCount()
+ {
+ if (mapValues == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return mapValues.getPropertyCount();
+ }
+ }
+
+
+ /**
+ * Return a copy of the map elements.
+ *
+ * @return InstanceProperties containing the map elements
+ */
+ public InstanceProperties getMapValues()
+ {
+ if (mapValues == null)
+ {
+ return mapValues;
+ }
+ else
+ {
+ return new InstanceProperties(mapValues);
+ }
+ }
+
+
+ /**
+ * Add or update an element in the map.
+ * 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 propertyName - String name
+ * @param propertyValue - InstancePropertyValue - value to store
+ */
+ public void setMapValue(String propertyName, InstancePropertyValue propertyValue)
+ {
+ if (mapValues == null)
+ {
+ mapValues = new InstanceProperties();
+ }
+ mapValues.setProperty(propertyName, propertyValue);
+ }
+
+
+ /**
+ * Set up the map elements in one call.
+ *
+ * @param mapValues - InstanceProperties containing the array elements
+ */
+ public void setMapValues(InstanceProperties mapValues) { this.mapValues = mapValues; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "MapPropertyValue{" +
+ "mapValues=" + mapValues +
+ ", mapElementCount=" + getMapElementCount() +
+ ", 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/PrimitivePropertyValue.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/PrimitivePropertyValue.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/PrimitivePropertyValue.java
new file mode 100644
index 0000000..fb40758
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/PrimitivePropertyValue.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;
+
+import org.apache.atlas.omrs.ffdc.OMRSErrorCode;
+import org.apache.atlas.omrs.ffdc.exception.OMRSRuntimeException;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.PrimitiveDefCategory;
+
+
+/**
+ * PrimitivePropertyValue stores a single primitive property. This is stored in the specific Java class
+ * for the property value's type although it is stored as an object.
+ */
+public class PrimitivePropertyValue extends InstancePropertyValue
+{
+ private PrimitiveDefCategory primitiveDefCategory = PrimitiveDefCategory.OM_PRIMITIVE_TYPE_UNKNOWN;
+ private Object primitiveValue = null;
+
+
+ /**
+ * Default constructor sets the primitive property value to null.
+ */
+ public PrimitivePropertyValue()
+ {
+ super(InstancePropertyCategory.PRIMITIVE);
+ }
+
+
+ /**
+ * Copy/clone constructor - copies the values from the supplied template.
+ *
+ * @param template - PrimitivePropertyValue
+ */
+ public PrimitivePropertyValue(PrimitivePropertyValue template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ this.primitiveDefCategory = template.getPrimitiveDefCategory();
+ this.primitiveValue = template.getPrimitiveValue();
+ }
+ }
+
+
+ /**
+ * Return the the category of the primitive's type. This sets the name and Java Class used for
+ * the primitive value.
+ *
+ * @return PrimitiveDefCategory
+ */
+ public PrimitiveDefCategory getPrimitiveDefCategory() { return primitiveDefCategory; }
+
+
+ /**
+ * Set up the category of the primitive typ. This sets the name and Java Class used for
+ * the primitive value.
+ *
+ * @param primitiveDefCategory - PrimitiveDefCategory enum
+ */
+ public void setPrimitiveDefCategory(PrimitiveDefCategory primitiveDefCategory)
+ {
+ this.primitiveDefCategory = primitiveDefCategory;
+ }
+
+
+ /**
+ * Return the primitive value. It is already set up to be the appropriate type for the primitive
+ * as defined in the PrimitiveDefCategory.
+ *
+ * @return Object containing the primitive value.
+ */
+ public Object getPrimitiveValue() { return primitiveValue; }
+
+
+ /**
+ * Set up the primitive value. Although it is passed in as a java.lang.Object, it should be the correct
+ * type as defined by the PrimitiveDefCategory. This is validated in this method so it is important to call
+ * setPrimitiveDefCategory() before setPrimitiveValue().
+ *
+ * @param primitiveValue - object contain the primitive value
+ */
+ public void setPrimitiveValue(Object primitiveValue)
+ {
+ try
+ {
+ Class testJavaClass = Class.forName(primitiveDefCategory.getJavaClassName());
+
+ if (!testJavaClass.isInstance(primitiveValue))
+ {
+ /*
+ * The primitive value supplied is the wrong type. Throw an exception.
+ */
+ }
+ }
+ catch (ClassNotFoundException unknownPrimitiveClass)
+ {
+ /*
+ * The java class defined in the primitiveDefCategory is not known. This is an internal error
+ * that needs a code fix in PrimitiveDefCategory.
+ */
+ OMRSErrorCode errorCode = OMRSErrorCode.INVALID_PRIMITIVE_CLASS_NAME;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage(primitiveDefCategory.getJavaClassName(),
+ primitiveDefCategory.getName());
+
+ throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "setPrimitiveValue",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction(),
+ unknownPrimitiveClass);
+ }
+ catch (Error invalidPrimitiveValue)
+ {
+ /*
+ * Some unexpected exception occurred when manipulating the Java Classes. Probably a coding error.
+ */
+ OMRSErrorCode errorCode = OMRSErrorCode.INVALID_PRIMITIVE_VALUE;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage(primitiveDefCategory.getJavaClassName(),
+ primitiveDefCategory.getName());
+
+ throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "setPrimitiveValue",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction(),
+ invalidPrimitiveValue);
+ }
+
+ /*
+ * The primitive value is of the correct type so save it.
+ */
+ this.primitiveValue = primitiveValue;
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "PrimitivePropertyValue{" +
+ "primitiveDefCategory=" + primitiveDefCategory +
+ ", primitiveValue=" + primitiveValue +
+ ", 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/Relationship.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java
new file mode 100644
index 0000000..cd56bbd
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java
@@ -0,0 +1,320 @@
+/*
+ * 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;
+
+
+/**
+ * Relationship is a POJO that manages the properties of an open metadata relationship. This includes information
+ * about the relationship type, the two entities it connects and the properties it holds.
+ */
+public class Relationship extends InstanceHeader
+{
+ private InstanceProperties relationshipProperties = null;
+
+ private String entityOnePropertyName = null;
+ private EntityProxy entityOneProxy = null;
+
+ private String entityTwoPropertyName = null;
+ private EntityProxy entityTwoProxy = null;
+
+
+ /**
+ * Default constructor - empty relationship linked to nothing.
+ */
+ public Relationship()
+ {
+ super();
+
+ /*
+ * Nothing else to do - already initialized to null.
+ */
+
+ }
+
+
+ /**
+ * Copy/clone constructor - builds a relationship from the supplied template.
+ *
+ * @param templateElement - template relationship to copy
+ */
+ public Relationship(Relationship templateElement)
+ {
+ super(templateElement);
+
+ if (templateElement != null)
+ {
+ relationshipProperties = templateElement.getProperties();
+ entityOnePropertyName = templateElement.getEntityOnePropertyName();
+ entityOneProxy = templateElement.getEntityOneProxy();
+ entityTwoPropertyName = templateElement.getEntityTwoPropertyName();
+ entityTwoProxy = templateElement.getEntityTwoProxy();
+ }
+ }
+
+
+ /**
+ * Test to determine if the supplied entity is linked by this relationship.
+ *
+ * @param entityGUID - unique identifier for the entity to test.
+ * @return boolean indicate whether the supplied entity is linked by this relationship
+ */
+ public boolean relatedToEntity(String entityGUID)
+ {
+ if (entityGUID == null)
+ {
+ return false;
+ }
+
+ if (entityOneProxy != null)
+ {
+ if (entityOneProxy.getGUID().equals(entityGUID))
+ {
+ return true;
+ }
+ }
+
+ if (entityTwoProxy != null)
+ {
+ if (entityTwoProxy.getGUID().equals(entityGUID))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Return the GUID at the other end of the relationship to the supplied entity.
+ *
+ * @param entityGUID - unique identifier for the entity to test.
+ * @return String guid for the entity at the other end of the relationship. Null if no matching entity found.
+ */
+ public String getLinkedEntity(String entityGUID)
+ {
+ if ((entityGUID == null) || (entityOneProxy == null) || (entityTwoProxy == null))
+ {
+ return null;
+ }
+
+ String entityOneGUID = entityOneProxy.getGUID();
+ String entityTwoGUID = entityTwoProxy.getGUID();
+
+ if ((entityOneGUID == null) || entityTwoGUID == null)
+ {
+ return null;
+ }
+
+ if (entityOneGUID.equals(entityGUID))
+ {
+ return entityTwoGUID;
+ }
+
+ if (entityTwoGUID.equals(entityGUID))
+ {
+ return entityOneGUID;
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Return an array of the unique identifiers for the entities at either end of the relationship.
+ *
+ * @return String array
+ */
+ public String [] getLinkedEntities()
+ {
+ String[] linkedEntityGUIDs = new String[2];
+
+ if (entityOneProxy == null)
+ {
+ linkedEntityGUIDs[0] = null;
+ }
+ else
+ {
+ linkedEntityGUIDs[0] = entityOneProxy.getGUID();
+ }
+
+ if (entityTwoProxy == null)
+ {
+ linkedEntityGUIDs[1] = null;
+ }
+ else
+ {
+ linkedEntityGUIDs[1] = entityTwoProxy.getGUID();
+ }
+
+ return linkedEntityGUIDs;
+ }
+
+
+ /**
+ * Return a copy of all of the properties for this relationship. Null means no properties exist.
+ *
+ * @return InstanceProperties
+ */
+ public InstanceProperties getProperties()
+ {
+ if (relationshipProperties == null)
+ {
+ return relationshipProperties;
+ }
+ else
+ {
+ return new InstanceProperties(relationshipProperties);
+ }
+ }
+
+
+ /**
+ * Set up the properties for this relationship.
+ *
+ * @param newProperties - InstanceProperties object
+ */
+ public void setProperties(InstanceProperties newProperties)
+ {
+ relationshipProperties = newProperties;
+ }
+
+
+ /**
+ * Return the name of the property for the relationship from the perspective of the entity at the first end of the
+ * relationship.
+ *
+ * @return entityOnePropertyName - String property name
+ */
+ public String getEntityOnePropertyName() {
+ return entityOnePropertyName;
+ }
+
+
+ /**
+ * Set up the property name for the relationship from the perspective of the entity at the first end of the
+ * relationship.
+ *
+ * @param entityOnePropertyName - String property name
+ */
+ public void setEntityOnePropertyName(String entityOnePropertyName)
+ {
+ this.entityOnePropertyName = entityOnePropertyName;
+ }
+
+
+ /**
+ * Return details of the entity at the first end of the relationship.
+ *
+ * @return entityOneProxy - EntityProxy object for the first end of the relationship.
+ */
+ public EntityProxy getEntityOneProxy()
+ {
+ if (entityOneProxy == null)
+ {
+ return entityOneProxy;
+ }
+ else
+ {
+ return new EntityProxy(entityOneProxy);
+ }
+ }
+
+
+ /**
+ * Set up details of the entity at the first end of the relationship.
+ *
+ * @param entityOneProxy - EntityProxy object for the first end of the relationship.
+ */
+ public void setEntityOneProxy(EntityProxy entityOneProxy) { this.entityOneProxy = entityOneProxy; }
+
+
+ /**
+ * Return the property name for the relationship from the perspective of the entity at the second end of the
+ * relationship.
+ *
+ * @return String property name
+ */
+ public String getEntityTwoPropertyName() { return entityTwoPropertyName; }
+
+
+ /**
+ * Set up the property name for the relationship from the perspective of the entity at the second end of the
+ * relationship.
+ *
+ * @param entityTwoPropertyName - String property name
+ */
+ public void setEntityTwoPropertyName(String entityTwoPropertyName) { this.entityTwoPropertyName = entityTwoPropertyName; }
+
+
+ /**
+ * Return details of the entity at second end of the relationship.
+ *
+ * @return EntityProxy object for the second end of the relationship
+ */
+ public EntityProxy getEntityTwoProxy()
+ {
+ if (entityTwoProxy == null)
+ {
+ return entityTwoProxy;
+ }
+ else
+ {
+ return new EntityProxy(entityTwoProxy);
+ }
+ }
+
+
+ /**
+ * Set up the identity of the proxy at the other end of the relationship.
+ *
+ * @param entityTwoProxy - EntityProxy
+ */
+ public void setEntityTwoProxy(EntityProxy entityTwoProxy) { this.entityTwoProxy = entityTwoProxy; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "Relationship{" +
+ "relationshipProperties=" + relationshipProperties +
+ ", entityOneLabel='" + entityOnePropertyName + '\'' +
+ ", entityOneProxy=" + entityOneProxy +
+ ", entityTwoLabel='" + entityTwoPropertyName + '\'' +
+ ", entityTwoProxy=" + entityTwoProxy +
+ ", properties=" + getProperties() +
+ ", 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/StructPropertyValue.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/StructPropertyValue.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/StructPropertyValue.java
new file mode 100644
index 0000000..cd8bff9
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/StructPropertyValue.java
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+
+/**
+ * StructPropertyValue supports the value part of property that is defined as a complex structure.
+ * It manages a list of properties that cover the fields in the structure.
+ */
+public class StructPropertyValue extends InstancePropertyValue
+{
+ private InstanceProperties attributes = null;
+
+
+ /**
+ * Default constructor set StructProperyValue to null.
+ */
+ public StructPropertyValue()
+ {
+ super(InstancePropertyCategory.STRUCT);
+ }
+
+
+ /**
+ * Copy/clone constructor sets up the values based on the template.
+ *
+ * @param template - StructPropertyValue to copy.
+ */
+ public StructPropertyValue(StructPropertyValue template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ attributes = template.getAttributes();
+ }
+ }
+
+
+ /**
+ * Return the attributes that make up the fields of the struct.
+ *
+ * @return attributes - InstanceProperties iterator
+ */
+ public InstanceProperties getAttributes()
+ {
+ if (attributes == null)
+ {
+ return attributes;
+ }
+ else
+ {
+ return new InstanceProperties(attributes);
+ }
+ }
+
+ /**
+ * Set up the attributes that make up the fields of the struct.
+ *
+ * @param attributes - InstanceProperties iterator
+ */
+ public void setAttributes(InstanceProperties attributes) { this.attributes = attributes; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "StructPropertyValue{" +
+ "attributes=" + attributes +
+ ", 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/typedefs/AttributeCardinality.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeCardinality.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeCardinality.java
new file mode 100644
index 0000000..9ca7b80
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeCardinality.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.typedefs;
+
+import java.io.Serializable;
+
+/**
+ * AttributeCardinality is used on a association from one TypeDef to another. It defines how many instances the "linked to" TypeDef
+ * are permitted to be connected to the "linked from" TypeDef:
+ * <ul>
+ * <li>
+ * UNKNOWN - uninitialized cardinality
+ * </li>
+ * <li>
+ * AT_MOST_ONE - means there can be zero or one instances connected to an instance of this TypeDef. This
+ * relationship is often written as 0..1.</li>
+ * <li>
+ * ONE_ONLY - means there must be one instance, no more and no less.
+ * </li>
+ * <li>
+ * AT_LEAST_ONE_ORDERED - means there must be one or more instances connected to an instance of this TypeDef.
+ * This relationship is often written as 1..*. The linked instances are maintained
+ * in an ordered list/array.
+ * </li>
+ * <li>
+ * AT_LEAST_ONE_UNORDERED - means there must be one or more instances connected to an instance of this TypeDef.
+ * This relationship is often written as 1..*. The linked instances are maintained
+ * in an unordered set.
+ * </li>
+ * <li>
+ * ANY_NUMBER_ORDERED - means there can be none, one or many instances connected an instance of this TypeDef.
+ * This relationship is often written as 0..*. The linked instances are maintained
+ * in an ordered list/array.
+ * </li>
+ * <li>
+ * ANY_NUMBER_UNORDERED - means there can be none, one or many instances connected an instance of this TypeDef.
+ * This relationship is often written as 0..*. The linked instances are maintained
+ * in an unordered set.
+ * </li>
+ * </ul>
+ */
+public enum AttributeCardinality implements Serializable
+{
+ UNKNOWN (0, "<Unknown>", "Unknown or uninitialized cardinality"),
+ AT_MOST_ONE (1, "At Most One", "0..1 - Zero or one instances. 0..1."),
+ ONE_ONLY (2, "One Only", "1 - One instance, no more and no less"),
+ AT_LEAST_ONE_ORDERED (3, "At Least One (Ordered)", "1..* - One or more instances (stored in specific order)"),
+ AT_LEAST_ONE_UNORDERED (4, "At Least One (Unordered)", "1..* - One or more instances (stored in any order)"),
+ ANY_NUMBER_ORDERED (5, "Any Number (Ordered)", "0..* - Any number of instances (stored in a specific order)"),
+ ANY_NUMBER_UNORDERED (6, "Any Number (Unordered)", "0..* - Any number of instances (stored in any order)");
+
+ 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 cardinality
+ * @param name - default string name of the cardinality
+ * @param description - default string description of the cardinality
+ */
+ AttributeCardinality(int ordinal, String name, String description)
+ {
+ this.ordinal = ordinal;
+ this.name = name;
+ this.description = description;
+ }
+
+
+ /**
+ * Return the numeric representation of the cardinality.
+ *
+ * @return int ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Return the default name of the cardinality.
+ *
+ * @return String name
+ */
+ public String getName() { return name; }
+
+
+ /**
+ * Return the default description of the cardinality.
+ *
+ * @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/typedefs/AttributeTypeDef.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java
new file mode 100644
index 0000000..d68d233
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java
@@ -0,0 +1,215 @@
+/*
+ * 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.typedefs;
+
+
+import java.util.Objects;
+
+/**
+ * The AttributeTypeDef class is used to identify the type of an attribute. These can be:
+ * <ul>
+ * <li>PrimitiveDef</li>
+ * <li>CollectionDef</li>
+ * <li>EnumDef</li>
+ * </ul>
+ */
+public abstract class AttributeTypeDef extends TypeDefElementHeader
+{
+ protected AttributeTypeDefCategory category = AttributeTypeDefCategory.UNKNOWN_DEF;
+ protected String guid = null;
+ protected String name = null;
+ protected String description = null;
+ protected String descriptionGUID = null;
+
+
+ /**
+ * Minimal constructor is passed the category of the attribute type
+ *
+ * @param category - category of this TypeDef
+ */
+ public AttributeTypeDef(AttributeTypeDefCategory category)
+ {
+ this.category = category;
+ }
+
+
+ /**
+ * Typical constructor is passed the values that describe the type.
+ *
+ * @param category - category of this TypeDef
+ * @param guid - unique id for the TypeDef
+ * @param name - unique name for the TypeDef
+ */
+ public AttributeTypeDef(AttributeTypeDefCategory category,
+ String guid,
+ String name)
+ {
+ super();
+
+ this.category = category;
+ this.guid = guid;
+ this.name = name;
+ }
+
+
+ /**
+ * Copy/clone constructor copies the values from the supplied template.
+ *
+ * @param template AttributeTypeDef
+ */
+ public AttributeTypeDef(AttributeTypeDef template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ this.category = template.getCategory();
+ this.guid = template.getGUID();
+ this.name = template.getName();
+ this.description = template.getDescription();
+ this.descriptionGUID = template.getDescriptionGUID();
+ }
+ }
+
+
+ /**
+ * Return the category of the TypeDef.
+ *
+ * @return AttributeTypeDefCategory enum
+ */
+ public AttributeTypeDefCategory getCategory() { return category; }
+
+
+ /**
+ * Set up the category of the TypeDef.
+ *
+ * @param category - AttributeTypeDefCategory enum
+ */
+ public void setCategory(AttributeTypeDefCategory category) { this.category = category; }
+
+
+ /**
+ * Return the unique identifier for this TypeDef.
+ *
+ * @return String guid
+ */
+ public String getGUID() { return guid; }
+
+
+ /**
+ * Set up the unique identifier for this TypeDef.
+ *
+ * @param guid - String guid
+ */
+ public void setGUID(String guid) { this.guid = guid; }
+
+
+ /**
+ * Return the type name for this TypeDef. In simple environments, the type name is unique but where metadata
+ * repositories from different vendors are in operation it is possible that 2 types may have a name clash. The
+ * GUID is the reliable unique identifier.
+ *
+ * @return String name
+ */
+ public String getName() { return name; }
+
+
+ /**
+ * Set up the type name for this TypeDef. In simple environments, the type name is unique but where metadata
+ * repositories from different vendors are in operation it is possible that 2 types may have a name clash. The
+ * GUID is the reliable unique identifier.
+ *
+ * @param name - String name
+ */
+ public void setName(String name) { this.name = name; }
+
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getDescriptionGUID()
+ {
+ return descriptionGUID;
+ }
+
+ public void setDescriptionGUID(String descriptionGUID)
+ {
+ this.descriptionGUID = descriptionGUID;
+ }
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "AttributeTypeDef{" +
+ "category=" + category +
+ ", guid='" + guid + '\'' +
+ ", name='" + name + '\'' +
+ ", description='" + description + '\'' +
+ ", descriptionGUID='" + descriptionGUID + '\'' +
+ '}';
+ }
+
+
+ /**
+ * Validated that the GUID, name and version number of a TypeDef are equal.
+ *
+ * @param object to test
+ * @return boolean flag to say object is the same TypeDefSummary
+ */
+ @Override
+ public boolean equals(Object object)
+ {
+ if (this == object)
+ {
+ return true;
+ }
+ if (object == null || getClass() != object.getClass())
+ {
+ return false;
+ }
+ AttributeTypeDef that = (AttributeTypeDef) object;
+ return category == that.category &&
+ Objects.equals(guid, that.guid) &&
+ Objects.equals(name, that.name);
+ }
+
+
+ /**
+ * Using the GUID as a hashcode - it should be unique if all connected metadata repositories are behaving properly.
+ *
+ * @return int hash code
+ */
+ @Override
+ public int hashCode()
+ {
+ return guid != null ? guid.hashCode() : 0;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDefCategory.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDefCategory.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDefCategory.java
new file mode 100644
index 0000000..22ddf42
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDefCategory.java
@@ -0,0 +1,84 @@
+/*
+ * 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.typedefs;
+
+import java.io.Serializable;
+
+/**
+ * The AttributeTypeDefCategory defines the list of valid types of a attribute (property) for an open metadata instance.
+ */
+public enum AttributeTypeDefCategory implements Serializable
+{
+ UNKNOWN_DEF (0, "<Unknown>", "Uninitialized AttributeTypeDef object."),
+ PRIMITIVE (1, "Primitive", "A primitive type."),
+ COLLECTION (2, "Collection", "A collection object."),
+ ENUM_DEF (4, "EnumDef", "A pre-defined list of valid values.");
+
+ private static final long serialVersionUID = 1L;
+
+ private int typeCode;
+ private String typeName;
+ private String typeDescription;
+
+
+ /**
+ * Constructor to set up a single instances of the enum.
+ */
+ AttributeTypeDefCategory(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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java
new file mode 100644
index 0000000..cfb2143
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java
@@ -0,0 +1,162 @@
+/*
+ * 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.typedefs;
+
+
+import java.util.ArrayList;
+
+/**
+ * ClassificationDef stores the properties for the definition of a type of classification. Many of the properties
+ * are inherited from TypeDef. ClassificationDef adds a list of Entity Types that this Classification can be
+ * connected to and a boolean to indicate if this classification is propagatable.
+ */
+public class ClassificationDef extends TypeDef
+{
+ private ArrayList<TypeDefLink> validEntityDefs = null;
+ private boolean propagatable = false;
+
+
+ /**
+ * Minimal constructor - sets up an empty ClassificationDef.
+ */
+ public ClassificationDef()
+ {
+ super(TypeDefCategory.CLASSIFICATION_DEF);
+ }
+
+
+ /**
+ * Typical constructor is passed the properties of the typedef's super class being constructed.
+ *
+ * @param category - category of this TypeDef
+ * @param guid - unique id for the TypeDef
+ * @param name - unique name for the TypeDef
+ * @param version - active version number for the TypeDef
+ * @param versionName - unique name for the TypeDef
+ */
+ public ClassificationDef(TypeDefCategory category,
+ String guid,
+ String name,
+ long version,
+ String versionName)
+ {
+ super(category, guid, name, version, versionName);
+ }
+
+
+ /**
+ * Copy/clone constructor copies values from the supplied template.
+ *
+ * @param template - template to copy
+ */
+ public ClassificationDef(ClassificationDef template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ validEntityDefs = template.getValidEntityDefs();
+ propagatable = template.isPropagatable();
+ }
+ }
+
+
+ /**
+ * Return the list of identifiers for the types of entities that this type of Classification can be connected to.
+ *
+ * @return List of entity type identifiers
+ */
+ public ArrayList<TypeDefLink> getValidEntityDefs()
+ {
+ if (validEntityDefs == null)
+ {
+ return validEntityDefs;
+ }
+ else
+ {
+ return new ArrayList<>(validEntityDefs);
+ }
+ }
+
+
+ /**
+ * Set up the list of identifiers for the types of entities that this type of Classification can be connected to.
+ *
+ * @param validEntityDefs - List of entity type identifiers
+ */
+ public void setValidEntityDefs(ArrayList<TypeDefLink> validEntityDefs)
+ {
+ this.validEntityDefs = validEntityDefs;
+ }
+
+
+ /**
+ * Return whether this classification should propagate to other entities if the relationship linking them
+ * allows classification propagation.
+ *
+ * @return boolean flag
+ */
+ public boolean isPropagatable()
+ {
+ return propagatable;
+ }
+
+
+ /**
+ * Sets up whether this classification should propagate to other entities if the relationship linking them
+ * allows classification propagation.
+ *
+ * @param propagatable - boolean flag
+ */
+ public void setPropagatable(boolean propagatable)
+ {
+ this.propagatable = propagatable;
+ }
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "ClassificationDef{" +
+ "validEntityDefs=" + validEntityDefs +
+ ", propagatable=" + propagatable +
+ ", superType=" + superType +
+ ", description='" + description + '\'' +
+ ", descriptionGUID='" + descriptionGUID + '\'' +
+ ", origin='" + origin + '\'' +
+ ", createdBy='" + createdBy + '\'' +
+ ", updatedBy='" + updatedBy + '\'' +
+ ", createTime=" + createTime +
+ ", updateTime=" + updateTime +
+ ", options=" + options +
+ ", externalStandardMappings=" + externalStandardMappings +
+ ", validInstanceStatusList=" + validInstanceStatusList +
+ ", initialStatus=" + initialStatus +
+ ", propertiesDefinition=" + propertiesDefinition +
+ ", version=" + version +
+ ", versionName='" + versionName + '\'' +
+ ", category=" + category +
+ ", guid='" + guid + '\'' +
+ ", name='" + name + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationPropagationRule.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationPropagationRule.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationPropagationRule.java
new file mode 100644
index 0000000..71d6f91
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationPropagationRule.java
@@ -0,0 +1,87 @@
+/*
+ * 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.typedefs;
+
+import java.io.Serializable;
+
+/**
+ * ClassificationPropagationRule is part of a relationship definition (RelationshipDef).
+ * It indicates whether classifications from one entity should propagate across a relationship instance.
+ * It allows classification for, say confidentiality to be propagated to related entities.
+ * <p>
+ * The propagation rule defines the direction of propagation:
+ * </p>
+ * <ul>
+ * <li>NONE - no propagation of classifications across the relationship.</li>
+ * <li>ONE_TO_TWO - from entity at end 1 of the relationship to the entity at end 2 of the relationship.</li>
+ * <li>TWO_TO_ONE - from entity at end 2 of the relationship to the entity at end 1 of the relationship.</li>
+ * <li>BOTH - two way propagation.</li>
+ * </ul>
+ */
+public enum ClassificationPropagationRule implements Serializable
+{
+ NONE (0, "NONE", "No classification propagation"),
+ ONE_TO_TWO (1, "ONE_TO_TWO", "Classification propagation direction is one way from entity one to entity two"),
+ TWO_TO_ONE (2, "TWO_TO_ONE", "Classification propagation direction is one way from entity two to entity one"),
+ BOTH (3, "BOTH", "Classification propagation in both directions");
+
+ 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 propagation rule
+ * @param name - default string name of the propagation rule
+ * @param description - default string description of the propagation rule
+ */
+ ClassificationPropagationRule(int ordinal, String name, String description)
+ {
+ this.ordinal = ordinal;
+ this.name = name;
+ this.description = description;
+ }
+
+
+ /**
+ * Return the numeric representation of the propagation rule.
+ *
+ * @return int ordinal
+ */
+ public int getOrdinal() { return ordinal; }
+
+
+ /**
+ * Return the default name of the propagation rule.
+ *
+ * @return String name
+ */
+ public String getName() { return name; }
+
+
+ /**
+ * Return the default description of the propagation rule.
+ *
+ * @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/typedefs/CollectionDef.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/CollectionDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/CollectionDef.java
new file mode 100644
index 0000000..cca95f7
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/CollectionDef.java
@@ -0,0 +1,143 @@
+/*
+ * 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.typedefs;
+
+
+import java.util.ArrayList;
+
+/**
+ * CollectionDef supports the definition of a collection type. This information about the generic
+ * collection type is managed in the CollectionDefCategory. It is instantiated with specific primitive
+ * types when it is linked to a specific TypeDefAttribute.
+ */
+public class CollectionDef extends AttributeTypeDef
+{
+ private CollectionDefCategory collectionDefCategory = null;
+ private int argumentCount = 0;
+ private ArrayList<PrimitiveDefCategory> argumentTypes = null;
+
+
+ /**
+ * Typical constructor initializes the CollectionDef based on the supplied category.
+ *
+ * @param collectionDefCategory - CollectionDefCategory Enum
+ */
+ public CollectionDef(CollectionDefCategory collectionDefCategory)
+ {
+ super(AttributeTypeDefCategory.COLLECTION);
+
+ this.collectionDefCategory = collectionDefCategory;
+ this.argumentCount = collectionDefCategory.getArgumentCount();
+ this.argumentTypes = new ArrayList<>();
+
+ /*
+ * Set up the type of the elements stored in the collection as "unknown" - like an initialized Java generic.
+ */
+ for (int i=0; i<argumentCount; i++)
+ {
+ argumentTypes.add(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_UNKNOWN);
+ }
+ }
+
+
+ /**
+ * Copy/clone constructor creates a copy of the supplied template.
+ *
+ * @param template CollectionDef to copy
+ */
+ public CollectionDef(CollectionDef template)
+ {
+ super(template);
+
+ if (template != null)
+ {
+ this.collectionDefCategory = template.getCollectionDefCategory();
+ this.argumentCount = template.getArgumentCount();
+ this.argumentTypes = template.getArgumentTypes();
+ }
+ }
+
+
+ /**
+ * Return the type category for this collection type.
+ *
+ * @return CollectionDefCategory Enum
+ */
+ public CollectionDefCategory getCollectionDefCategory() { return collectionDefCategory; }
+
+
+ /**
+ * Return the number of arguments needed to set up the collection type name.
+ *
+ * @return int count
+ */
+ public int getArgumentCount()
+ {
+ return argumentCount;
+ }
+
+
+ /**
+ * Return the list of argument types set up for this collection.
+ *
+ * @return list of argument type
+ */
+ public ArrayList<PrimitiveDefCategory> getArgumentTypes()
+ {
+ if (argumentTypes == null)
+ {
+ return argumentTypes;
+ }
+ else
+ {
+ return new ArrayList<>(argumentTypes);
+ }
+ }
+
+
+ /**
+ * Set up the list of argument types.
+ *
+ * @param argumentTypes - list of argument types
+ */
+ public void setArgumentTypes(ArrayList<PrimitiveDefCategory> argumentTypes)
+ {
+ this.argumentTypes = argumentTypes;
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return JSON style description of variables.
+ */
+ @Override
+ public String toString()
+ {
+ return "CollectionDef{" +
+ "collectionDefCategory=" + collectionDefCategory +
+ ", argumentCount=" + argumentCount +
+ ", argumentTypes=" + argumentTypes +
+ ", category=" + category +
+ ", guid='" + guid + '\'' +
+ ", name='" + name + '\'' +
+ ", description='" + description + '\'' +
+ ", descriptionGUID='" + descriptionGUID + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/CollectionDefCategory.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/CollectionDefCategory.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/CollectionDefCategory.java
new file mode 100644
index 0000000..d077a66
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/CollectionDefCategory.java
@@ -0,0 +1,101 @@
+/*
+ * 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.typedefs;
+
+import org.apache.atlas.omrs.metadatacollection.properties.instances.ArrayPropertyValue;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.MapPropertyValue;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.StructPropertyValue;
+
+import java.io.Serializable;
+
+/**
+ * This enum defines the list of open metadata collection types. These types are generic types that need to
+ * be configured with specific primitive types before they can be used as an attribute type.
+ *
+ * The enum includes a code value, a string name for the type (used in self describing structures such as JSON or XML)
+ * and the name of the Java Class that supports this type.
+ */
+public enum CollectionDefCategory implements Serializable
+{
+ OM_COLLECTION_UNKNOWN (0, "<>", 0, null),
+ OM_COLLECTION_MAP (1, "map<{$0}, {$1}>", 2, MapPropertyValue.class.getName()),
+ OM_COLLECTION_ARRAY (2, "array<{$0}>", 1, ArrayPropertyValue.class.getName()),
+ OM_COLLECTION_STRUCT (3, "struct<>", 0, StructPropertyValue.class.getName());
+
+ private static final long serialVersionUID = 1L;
+
+ private int code;
+ private String name;
+ private int argumentCount;
+ private String javaClassName;
+
+
+ /**
+ * Constructor to set up a single instances of the enum.
+ *
+ * @param code - code for the enum
+ * @param name - String name for the enum before it is configured with primitive types
+ * @param argumentCount - number of arguments needed to configure the collection type
+ * @param javaClassName - Java class used to manage this type of collection
+ */
+ CollectionDefCategory(int code, String name, int argumentCount, String javaClassName)
+ {
+ this.code = code;
+ this.name = name;
+ this.argumentCount = argumentCount;
+ this.javaClassName = javaClassName;
+ }
+
+
+ /**
+ * Return the numeric code for the primitive type which can be used in optimized data flows.
+ *
+ * @return int type code
+ */
+ public int getCode() {
+ return code;
+ }
+
+
+ /**
+ * Return the name of type - which can be used for text-based interchange formats such as JSON or XML.
+ *
+ * @return String type name
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * Return the number of arguments for this collection type.
+ *
+ * @return int number of elements
+ */
+ public int getArgumentCount() { return argumentCount; }
+
+
+ /**
+ * Return the name of the java class that can be used to store properties of this type.
+ *
+ * @return String java class name.
+ */
+ public String getJavaClassName() {
+ return javaClassName;
+ }
+}