http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java new file mode 100644 index 0000000..72e216a --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java @@ -0,0 +1,93 @@ +/* + * 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; + +/** + * EntityDef describes a type of entity in the metadata collection. It is the simplest TypeDef that adds + * no other properties beyond TypeDef. + */ +public class EntityDef extends TypeDef +{ + /** + * Minimal constructor - initializes the superclass as an Entity + */ + public EntityDef() + { + super(TypeDefCategory.ENTITY_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 EntityDef(TypeDefCategory category, + String guid, + String name, + long version, + String versionName) + { + super(category, guid, name, version, versionName); + } + + + /** + * Copy/clone constructor - copies the values from the supplied template. + * + * @param template EntityDef + */ + public EntityDef(EntityDef template) + { + super(template); + } + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "EntityDef{" + + "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/EnumDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EnumDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EnumDef.java new file mode 100644 index 0000000..5f7b881 --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EnumDef.java @@ -0,0 +1,119 @@ +/* + * 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; + +/** + * The EnumDef describes an open metadata enumeration. This enumeration consists of a list of valid values + * (stored in EnumElementDef objects) and a default value. + */ +public class EnumDef extends AttributeTypeDef +{ + private ArrayList<EnumElementDef> elementDefs = null; + private EnumElementDef defaultValue = null; + + + /** + * Default constructor sets up an empty EnumDef. + */ + public EnumDef() + { + super(AttributeTypeDefCategory.ENUM_DEF); + } + + + /** + * Copy/clone constructor sets the EnumDef based on the values from the supplied template. + * + * @param template EnumDef + */ + public EnumDef(EnumDef template) + { + super(template); + + if (template != null) + { + elementDefs = template.getElementDefs(); + defaultValue = template.getDefaultValue(); + } + } + + + /** + * Return the list of defined Enum values for this EnumDef. + * + * @return EnumElementDefs list + */ + public ArrayList<EnumElementDef> getElementDefs() + { + if (elementDefs == null) + { + return elementDefs; + } + else + { + return new ArrayList<>(elementDefs); + } + } + + + /** + * Set up the list of defined Enum values for this EnumDef. + * + * @param elementDefs - EnumElementDefs list + */ + public void setElementDefs(ArrayList<EnumElementDef> elementDefs) { this.elementDefs = elementDefs; } + + + /** + * Return the default value for the EnumDef. + * + * @return EnumElementDef representing the default value + */ + public EnumElementDef getDefaultValue() { return defaultValue; } + + + /** + * Set up the default value for the EnumDef. + * + * @param defaultValue - EnumElementDef representing the default value + */ + public void setDefaultValue(EnumElementDef defaultValue) { this.defaultValue = defaultValue; } + + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "EnumDef{" + + "elementDefs=" + elementDefs + + ", defaultValue=" + defaultValue + + ", 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/EnumElementDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EnumElementDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EnumElementDef.java new file mode 100644 index 0000000..810bc85 --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EnumElementDef.java @@ -0,0 +1,144 @@ +/* + * 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; + + +/** + * EnumElementDef describes a single valid value defined for an enum. + */ +public class EnumElementDef extends TypeDefElementHeader +{ + private int ordinal = 99; + private String value = null; + private String description = null; + private String descriptionGUID = null; + + + /** + * Default constructor - sets up an empty EnumElementDef + */ + public EnumElementDef() + { + super(); + } + + + /** + * Copy/clone constructor - sets up an EnumElementDef based on the values supplied in the template. + * + * @param template EnumElementDef + */ + public EnumElementDef(EnumElementDef template) + { + super(template); + + if (template != null) + { + ordinal = template.getOrdinal(); + value = template.getValue(); + description = template.getDescription(); + descriptionGUID = template.getDescriptionGUID(); + } + } + + + /** + * Return the numeric value used for the enum value. + * + * @return int ordinal + */ + public int getOrdinal() { return ordinal; } + + + /** + * Set up the numeric value for the enum value. + * + * @param ordinal int + */ + public void setOrdinal(int ordinal) { this.ordinal = ordinal; } + + + /** + * Return the symbolic name for the enum value. + * + * @return String name + */ + public String getValue() { return value; } + + + /** + * Set up the symbolic name for the enum value. + * + * @param value String name + */ + public void setValue(String value) { this.value = value; } + + + /** + * Return the description for the enum value. + * + * @return String description + */ + public String getDescription() { return description; } + + + /** + * Set up the description for the enum value. + * + * @param description String + */ + public void setDescription(String description) { this.description = description; } + + + /** + * Return the unique identifier (guid) of the glossary term that describes this EnumElementDef. + * + * @return String guid + */ + public String getDescriptionGUID() + { + return descriptionGUID; + } + + + /** + * Set up the unique identifier (guid) of the glossary term that describes this EnumElementDef. + * + * @param descriptionGUID - String guid + */ + public void setDescriptionGUID(String descriptionGUID) + { + this.descriptionGUID = descriptionGUID; + } + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "EnumElementDef{" + + "ordinal=" + ordinal + + ", value='" + value + '\'' + + ", 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/ExternalStandardMapping.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ExternalStandardMapping.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ExternalStandardMapping.java new file mode 100644 index 0000000..e9cca34 --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ExternalStandardMapping.java @@ -0,0 +1,141 @@ +/* + * 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; + +/** + * ExternalStandardMapping defines a mapping of TypeDefs and TypeDefAttributes to an external standard. It includes the name + * of the standard, the organization that owns the standard and the equivalent type in the external standard. + * This mapping is done on a property type by property type basis. The aim is to create clarity on the meaning + * of the open metadata types and support importers and exporters between open metadata types and external standards. + */ +public class ExternalStandardMapping extends TypeDefElementHeader +{ + private String standardName = null; + private String standardOrganization = null; + private String standardTypeName = null; + + + /** + * Default Constructor - initializes to null. + */ + public ExternalStandardMapping() + { + /* + * Initialize superclass. + */ + super(); + } + + + /** + * Copy/clone constructor - copies values from supplied template. + * + * @param templateElement - template to copy. + */ + public ExternalStandardMapping(ExternalStandardMapping templateElement) + { + /* + * Initialize superclass. + */ + super(templateElement); + + /* + * Copy the template values over. + */ + this.standardName = templateElement.getStandardName(); + this.standardOrganization = templateElement.getStandardOrganization(); + this.standardTypeName = templateElement.getStandardTypeName(); + } + + + /** + * Return the name of the standard that this mapping relates to. + * + * @return String standard name + */ + public String getStandardName() { + return standardName; + } + + + /** + * Set up the name of the standard that this mapping relates to. + * + * @param standardName - String standard name + */ + public void setStandardName(String standardName) { + this.standardName = standardName; + } + + + /** + * Return the name of organization that owns the standard that this mapping refers to. + * + * @return String organization name + */ + public String getStandardOrganization() { + return standardOrganization; + } + + + /** + * Set up the name of the organization that owns the standard that this mapping refers to. + * + * @param standardOrganization - String organization name + */ + public void setStandardOrganization(String standardOrganization) + { + this.standardOrganization = standardOrganization; + } + + + /** + * Return the name of the type from the standard that is equivalent to the linked open metadata type. + * + * @return String type name from standard + */ + public String getStandardTypeName() { + return standardTypeName; + } + + + /** + * Set up the name of the type from the standard that is equivalent to the linked open metadata type. + * + * @param standardTypeName - String type name from standard + */ + public void setStandardTypeName(String standardTypeName) { + this.standardTypeName = standardTypeName; + } + + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "ExternalStandardMapping{" + + "standardName='" + standardName + '\'' + + ", standardOrganization='" + standardOrganization + '\'' + + ", standardTypeName='" + standardTypeName + '\'' + + '}'; + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDef.java new file mode 100644 index 0000000..94ab27b --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDef.java @@ -0,0 +1,83 @@ +/* + * 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; + +/** + * PrimitiveDef supports the definition of a primitive type. This information is managed in the + * PrimitiveDefCategory. + */ +public class PrimitiveDef extends AttributeTypeDef +{ + private PrimitiveDefCategory primitiveDefCategory = null; + + + /** + * Default constructor initializes the PrimitiveDef based on the supplied category. + * + * @param primitiveDefCategory - PrimitiveDefCategory Enum + */ + public PrimitiveDef(PrimitiveDefCategory primitiveDefCategory) + { + super(AttributeTypeDefCategory.PRIMITIVE); + + this.primitiveDefCategory = primitiveDefCategory; + } + + + /** + * Copy/clone constructor creates a copy of the supplied template. + * + * @param template PrimitiveDef to copy + */ + public PrimitiveDef(PrimitiveDef template) + { + super(template); + + if (template != null) + { + this.primitiveDefCategory = template.getPrimitiveDefCategory(); + } + } + + + /** + * Return the type category for this primitive type. + * + * @return PrimitiveDefCategory Enum + */ + public PrimitiveDefCategory getPrimitiveDefCategory() { return primitiveDefCategory; } + + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "PrimitiveDef{" + + "primitiveDefCategory=" + primitiveDefCategory + + ", 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/PrimitiveDefCategory.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java new file mode 100644 index 0000000..2c5f65a --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java @@ -0,0 +1,103 @@ +/* + * 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; +import java.util.ArrayList; + +/** + * This enumeration defines the list of open metadata primitive types. This 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 PrimitiveDefCategory implements Serializable +{ + OM_PRIMITIVE_TYPE_UNKNOWN (0, "<>", null, null), + OM_PRIMITIVE_TYPE_BOOLEAN (1, "boolean", "java.lang.Boolean", "3863f010-611c-41fe-aaae-5d4d427f863b"), + OM_PRIMITIVE_TYPE_BYTE (2, "byte", "java.lang.Byte", "6b7d410a-2e8a-4d12-981a-a806449f9bdb"), + OM_PRIMITIVE_TYPE_CHAR (3, "char", "java.Lang.Char", "b0abebe5-cf85-4065-86ad-f3c6360ed9c7"), + OM_PRIMITIVE_TYPE_SHORT (4, "short", "java.lang.Short", "8e95b966-ab60-46d4-a03f-40c5a1ba6c2a"), + OM_PRIMITIVE_TYPE_INT (5, "int", "java.lang.Integer", "7fc49104-fd3a-46c8-b6bf-f16b6074cd35"), + OM_PRIMITIVE_TYPE_LONG (6, "long", "java.lang.Long", "33a91510-92ee-4825-9f49-facd7a6f9db6"), + OM_PRIMITIVE_TYPE_FLOAT (7, "float", "java.lang.Float", "52aeb769-37b7-4b30-b949-ddc7dcebcfa2"), + OM_PRIMITIVE_TYPE_DOUBLE (8, "double", "java.lang.Double", "e13572e8-25c3-4994-acb6-2ea66c95812e"), + OM_PRIMITIVE_TYPE_BIGINTEGER(9, "biginteger", "java.math.BigInteger", "8aa56e52-1076-4e0d-9b66-3873a1ed7392"), + OM_PRIMITIVE_TYPE_BIGDECIMAL(10, "bigdecimal", "java.math.BigDecimal", "d5c8ad9f-8fee-4a64-80b3-63ce1e47f6bb"), + OM_PRIMITIVE_TYPE_STRING (11, "string", "java.lang.String", "b34a64b9-554a-42b1-8f8a-7d5c2339f9c4"), + OM_PRIMITIVE_TYPE_DATE (12, "date", "java.util.Date", "1bef35ca-d4f9-48db-87c2-afce4649362d"); + + private static final long serialVersionUID = 1L; + + private int code; + private String name; + private String javaClassName; + private String guid; + + + /** + * Constructor to set up a single instances of the enum. + * + * @param code - int code for enum + * @param name - String name of the primitive type + * @param javaClassName - String name of the class that stores the primitive attribute. + */ + PrimitiveDefCategory(int code, String name, String javaClassName, String guid) + { + this.code = code; + this.name = name; + this.javaClassName = javaClassName; + this.guid = guid; + } + + /** + * 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 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; + } + + + /** + * Return the guid for this primitive type. + * + * @return String guid + */ + public String getGUID() { return guid; } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipCategory.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipCategory.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipCategory.java new file mode 100644 index 0000000..da21faa --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipCategory.java @@ -0,0 +1,94 @@ +/* + * 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; + +/** + * <p> + * The RelationshipCategory determines the style of relationship around containment and lifecycle. + * UML terminology is used for the values. All relationships are navigable in both directions. + * </p> + * <p> + * Association is a simple relationship with no containment. + * Composition and Aggregation are containment relationships which means there is a notion of + * control or collective management of the contained entities by the containing entity. + * </p> + * <p> + * Entities in an aggregation relationship can be + * aggregated by many other entities and their lifecycle is not controlled by the containing entity. + * For example, contained entities are not deleted when the containing entity is deleted. + * </p> + * <p> + * Composition relationship is a "part of" relationship where the contained entities can only exist in the + * scope/context of the containing entity. Often the fully qualified name of a contained entity + * in a composition relationship includes the name of its containing entity. + * </p> + */ +public enum RelationshipCategory implements Serializable +{ + UNKNOWN (0, "<Unknown>", "Uninitialized Relationship."), + ASSOCIATION(1, "Association", "Simple relationship."), + AGGREGATION(2, "Aggregation", "A grouping of entities that are managed together."), + COMPOSITION(3, "Composition", "A grouping of entities that are part of a bigger concept."); + + 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 - code value + * @param name - name + * @param description - default description + */ + RelationshipCategory(int ordinal, String name, String description) + { + this.ordinal = ordinal; + this.name = name; + this.description = description; + } + + + /** + * Return the numeric representation of the relationship category. + * + * @return int ordinal + */ + public int getOrdinal() { return ordinal; } + + + /** + * Return the default name of the relationship category. + * + * @return String name + */ + public String getName() { return name; } + + + /** + * Return the default description of the relationship category. + * + * @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/RelationshipContainerEnd.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipContainerEnd.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipContainerEnd.java new file mode 100644 index 0000000..4c533c1 --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipContainerEnd.java @@ -0,0 +1,75 @@ +/* + * 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 RelationshipContainerEnd enum defines which end of the relationship is the container (where the diamond is + * in UML-speak). NOT_APPLICABLE is used on an association. END1 or END2 is used on an aggregation or composition. + */ +public enum RelationshipContainerEnd implements Serializable +{ + NOT_APPLICABLE (0, "Not Applicable", "This relationship does not support containment."), + END1 (1, "End 1", "The containment is at end 1."), + END2 (2, "End 2", "The containment is at end 2."); + + 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 container end + * @param name - default string name of the container end + * @param description - default string description of the container + */ + RelationshipContainerEnd(int ordinal, String name, String description) + { + this.ordinal = ordinal; + this.name = name; + this.description = description; + } + + /** + * Return the numeric representation of the container end indicator. + * + * @return int ordinal + */ + public int getOrdinal() { return ordinal; } + + + /** + * Return the default name of the container end indicator. + * + * @return String name + */ + public String getName() { return name; } + + + /** + * Return the default description of the container end indicator. + * + * @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/RelationshipDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java new file mode 100644 index 0000000..44f7adb --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java @@ -0,0 +1,217 @@ +/* + * 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; + + +/** + * RelationshipDef describes the type of a relationship. A relationships links two entities together. + * The RelationshipDef defines the types of those entities in the RelationshipEndDefs. It + * defines if this relationship allows classifications to propagate through it and also it defines the type of + * relationship - such as association, composition and aggregation. + */ +public class RelationshipDef extends TypeDef +{ + private RelationshipCategory relationshipCategory = RelationshipCategory.UNKNOWN; + private RelationshipContainerEnd relationshipContainerEnd = RelationshipContainerEnd.NOT_APPLICABLE; + private ClassificationPropagationRule propagationRule = ClassificationPropagationRule.NONE; + private RelationshipEndDef endDef1 = null; + private RelationshipEndDef endDef2 = null; + + + /** + * Minimal constructor builds an empty RelationshipDef + */ + public RelationshipDef() + { + super(TypeDefCategory.RELATIONSHIP_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 RelationshipDef(TypeDefCategory category, + String guid, + String name, + long version, + String versionName) + { + super(category, guid, name, version, versionName); + } + + + /** + * Copy/clone constructor creates a copy of the supplied template. + * + * @param templateTypeDef - template to copy + */ + public RelationshipDef(RelationshipDef templateTypeDef) + { + super(templateTypeDef); + + if (templateTypeDef != null) + { + this.relationshipCategory = templateTypeDef.getRelationshipCategory(); + this.propagationRule = templateTypeDef.getPropagationRule(); + this.endDef1 = templateTypeDef.getEndDef1(); + this.endDef2 = templateTypeDef.getEndDef2(); + } + } + + + /** + * Return the specific category for this relationship. + * + * @return RelationshipCategory Enum + */ + public RelationshipCategory getRelationshipCategory() { return relationshipCategory; } + + + /** + * Set up the specific category for this relationship. + * + * @param relationshipCategory - RelationshipCategory enum + */ + public void setRelationshipCategory(RelationshipCategory relationshipCategory) + { + this.relationshipCategory = relationshipCategory; + } + + + /** + * Return the enum that defines which end of the relationship is the container (the diamond end in UML-speak). + * This is used in conjunction with relationship categories AGGREGATION and COMPOSITION. + * + * @return RelationshipContainerEnd enum value + */ + public RelationshipContainerEnd getRelationshipContainerEnd() + { + return relationshipContainerEnd; + } + + + /** + * Set up the enum that defines which end of the relationship is the container (the diamond end in UML-speak). + * This is used in conjunction with relationship categories AGGREGATION and COMPOSITION. + * + * @param relationshipContainerEnd - RelationshipContainerEnd enum value + */ + public void setRelationshipContainerEnd(RelationshipContainerEnd relationshipContainerEnd) + { + this.relationshipContainerEnd = relationshipContainerEnd; + } + + + /** + * Return the rule that determines if classifications are propagated across this relationship. + * + * @return ClassificationPropagationRule Enum + */ + public ClassificationPropagationRule getPropagationRule() { return propagationRule; } + + + /** + * Set up the rule that determines if classifications are propagated across this relationship. + * + * @param propagationRule - ClassificationPropagationRule Enum + */ + public void setPropagationRule(ClassificationPropagationRule propagationRule) + { + this.propagationRule = propagationRule; + } + + + /** + * Return the details associated with the first end of the relationship. + * + * @return endDef1 RelationshipEndDef + */ + public RelationshipEndDef getEndDef1() + { + return endDef1; + } + + + /** + * Set up the details associated with the first end of the relationship. + * + * @param endDef1 RelationshipEndDef + */ + public void setEndDef1(RelationshipEndDef endDef1) { this.endDef1 = endDef1; } + + + /** + * Return the details associated with the second end of the relationship. + * + * @return endDef2 RelationshipEndDef + */ + public RelationshipEndDef getEndDef2() + { + return endDef2; + } + + + /** + * Set up the details associated with the second end of the relationship. + * + * @param endDef2 RelationshipEndDef + */ + public void setEndDef2(RelationshipEndDef endDef2) { this.endDef2 = endDef2; } + + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "RelationshipDef{" + + "relationshipCategory=" + relationshipCategory + + ", relationshipContainerEnd=" + relationshipContainerEnd + + ", propagationRule=" + propagationRule + + ", endDef1=" + endDef1 + + ", endDef2=" + endDef2 + + ", 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/RelationshipEndDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipEndDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipEndDef.java new file mode 100644 index 0000000..3ff3837 --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipEndDef.java @@ -0,0 +1,193 @@ +/* + * 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; + + +/** + * RelationshipEndDef describes the type of the entity and the attribute information for one end of a RelationshipDef. + */ +public class RelationshipEndDef extends TypeDefElementHeader +{ + private TypeDefLink entityType = null; + private String attributeName = null; + private String attributeDescription = null; + private String attributeDescriptionGUID = null; + private AttributeCardinality attributeCardinality = AttributeCardinality.UNKNOWN; + + + /** + * Default constructor - create an empty end + */ + public RelationshipEndDef() + { + super(); + } + + + /** + * Copy/clone constructor - copy the supplied template into the new end. + * + * @param template - RelationshipEndDef + */ + public RelationshipEndDef(RelationshipEndDef template) + { + super(template); + + if (template != null) + { + entityType = template.getEntityType(); + attributeName = template.getAttributeName(); + attributeCardinality = template.getAttributeCardinality(); + attributeDescription = template.getAttributeDescription(); + } + } + + + /** + * Return the identifiers of the EntityDef describing the type of entity on this end of the relationship. + * + * @return TypeDefLink unique identifiers + */ + public TypeDefLink getEntityType() + { + if (entityType == null) + { + return entityType; + } + else + { + return new TypeDefLink(entityType); + } + } + + + /** + * Set up the guid of the EntityDef describing the type of entity on this end of the relationship. + * + * @param entityType - TypeDefLink unique identifiers for the entity's type + */ + public void setEntityType(TypeDefLink entityType) + { + this.entityType = entityType; + } + + + /** + * Return the attribute name used to describe this end of the relationship + * + * @return String name for the attribute + */ + public String getAttributeName() + { + return attributeName; + } + + + /** + * Set up the attribute name used to describe this end of the relationship. + * + * @param attributeName - String name for the attribute + */ + public void setAttributeName(String attributeName) + { + this.attributeName = attributeName; + } + + + /** + * Return the cardinality for this end of the relationship. + * + * @return AttributeCardinality Enum + */ + public AttributeCardinality getAttributeCardinality() + { + return attributeCardinality; + } + + + /** + * Set up the cardinality for this end of the relationship. + * + * @param attributeCardinality - AttributeCardinality Enum + */ + public void setAttributeCardinality(AttributeCardinality attributeCardinality) + { + this.attributeCardinality = attributeCardinality; + } + + + /** + * Return the attributeDescription of this end of the relationship. + * + * @return String attributeDescription + */ + public String getAttributeDescription() + { + return attributeDescription; + } + + + /** + * Set up the attributeDescription for this end of the relationship. + * + * @param attributeDescription - String + */ + public void setAttributeDescription(String attributeDescription) + { + this.attributeDescription = attributeDescription; + } + + + /** + * Return the unique identifier (guid) of the glossary term that describes this RelationshipEndDef. + * + * @return String guid + */ + public String getAttributeDescriptionGUID() + { + return attributeDescriptionGUID; + } + + + /** + * Set up the unique identifier (guid) of the glossary term that describes this RelationshipEndDef. + * + * @param attributeDescriptionGUID - String guid + */ + public void setAttributeDescriptionGUID(String attributeDescriptionGUID) + { + this.attributeDescriptionGUID = attributeDescriptionGUID; + } + + + /** + * Standard toString method. + * + * @return JSON style attributeDescription of variables. + */ + @Override + public String toString() + { + return "RelationshipEndDef{" + + "entityType='" + entityType + '\'' + + ", attributeName='" + attributeName + '\'' + + ", attributeDescription='" + attributeDescription + '\'' + + ", attributeCardinality=" + attributeCardinality + + '}'; + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java new file mode 100644 index 0000000..710f78d --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java @@ -0,0 +1,437 @@ +/* + * 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.InstanceStatus; + +import java.util.ArrayList; +import java.util.Date; +import java.util.Map; + +/** + * The TypeDef is the base class for objects that store the properties of an open metadata type + * definition (call ed a TypeDef). + * <p> + * The different categories of Typedefs are listed in TypeDefCategory. + */ +public abstract class TypeDef extends TypeDefSummary +{ + protected TypeDefLink superType = null; + protected String description = null; + protected String descriptionGUID = null; + protected String origin = null; + protected String createdBy = null; + protected String updatedBy = null; + protected Date createTime = null; + protected Date updateTime = null; + protected Map<String, String> options = null; + protected ArrayList<ExternalStandardMapping> externalStandardMappings = null; + protected ArrayList<InstanceStatus> validInstanceStatusList = null; + protected InstanceStatus initialStatus = null; + protected ArrayList<TypeDefAttribute> propertiesDefinition = null; + + + /** + * Minimal constructor is passed the category of the typedef being constructed. + * The rest of the properties are null. + * + * @param category - TypeDefCategory enum + */ + public TypeDef(TypeDefCategory category) + { + super(); + this.category = category; + } + + + /** + * 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 TypeDef(TypeDefCategory category, + String guid, + String name, + long version, + String versionName) + { + super(category, guid, name, version, versionName); + } + + + /** + * Copy/clone constructor copies the values from the supplied template. + * + * @param template TypeDef + */ + public TypeDef(TypeDef template) + { + super(template); + + if (template != null) + { + this.superType = template.getSuperType(); + this.description = template.getDescription(); + this.descriptionGUID = template.getDescriptionGUID(); + this.origin = template.getOrigin(); + this.createdBy = template.getCreatedBy(); + this.updatedBy = template.getUpdatedBy(); + this.createTime = template.getCreateTime(); + this.updateTime = template.getUpdateTime(); + this.options = template.getOptions(); + this.externalStandardMappings = template.getExternalStandardMappings(); + this.validInstanceStatusList = template.getValidInstanceStatusList(); + this.propertiesDefinition = template.getPropertiesDefinition(); + } + } + + + /** + * Return the super type for the TypeDef (or null if top-level) + * + * @return TypeDefLink for the super type + */ + public TypeDefLink getSuperType() + { + return superType; + } + + + /** + * Set up supertype for the TypeDef. Only single inheritance is supported. Use null if this type + * is top-level. + * + * @param superType TypeDefLink for the super type + */ + public void setSuperType(TypeDefLink superType) { this.superType = superType; } + + + /** + * Return the description of this TypeDef. + * + * @return String description + */ + public String getDescription() + { + return description; + } + + + /** + * Set up the description of this TypeDef. + * + * @param description String + */ + public void setDescription(String description) + { + this.description = description; + } + + + /** + * Return the unique identifier (guid) of the glossary term that describes this TypeDef. + * + * @return String guid + */ + public String getDescriptionGUID() + { + return descriptionGUID; + } + + + /** + * Set up the unique identifier (guid) of the glossary term that describes this TypeDef. + * + * @param descriptionGUID - String guid + */ + public void setDescriptionGUID(String descriptionGUID) + { + this.descriptionGUID = descriptionGUID; + } + + + /** + * Return the unique identifier for metadata collection Id where this TypeDef came from. + * + * @return String guid + */ + public String getOrigin() + { + return origin; + } + + + /** + * Set up the unique identifier for metadata collection Id where this TypeDef came from. + * + * @param origin - String guid + */ + public void setOrigin(String origin) + { + this.origin = origin; + } + + + /** + * Return the user name of the person that created this TypeDef. + * + * @return String name + */ + public String getCreatedBy() + { + return createdBy; + } + + + /** + * Set up the user name of the person that created this TypeDef. + * + * @param createdBy String name + */ + public void setCreatedBy(String createdBy) + { + this.createdBy = createdBy; + } + + + /** + * Return the user name of the person that last updated this TypeDef. + * + * @return String name + */ + public String getUpdatedBy() + { + return updatedBy; + } + + + /** + * Set up the user name of the person that last updated this TypeDef. + * + * @param updatedBy String name + */ + public void setUpdatedBy(String updatedBy) + { + this.updatedBy = updatedBy; + } + + + /** + * Return the date/time that this TypeDef was created. + * + * @return Date + */ + public Date getCreateTime() + { + return createTime; + } + + + /** + * Set up the date/time that this TypeDef was created. + * + * @param createTime Date + */ + public void setCreateTime(Date createTime) + { + this.createTime = createTime; + } + + + /** + * Return the date/time that this TypeDef was last updated. + * + * @return Date + */ + public Date getUpdateTime() + { + return updateTime; + } + + + /** + * Set up the date/time that this TypeDef was last updated. + * + * @param updateTime Date + */ + public void setUpdateTime(Date updateTime) + { + this.updateTime = updateTime; + } + + + /** + * Return the options for this TypeDef. These are private properties used by the processors of this TypeDef + * and ignored by the OMRS. + * + * @return Map from String to String + */ + public Map<String, String> getOptions() + { + return options; + } + + + /** + * Set up the options for this TypeDef. These are private properties used by the processors of this TypeDef + * and ignored by the OMRS. + * + * @param options - Map from String to String + */ + public void setOptions(Map<String, String> options) + { + this.options = options; + } + + + /** + * Return the list of mappings to external standards. + * + * @return ExternalStandardMappings list + */ + public ArrayList<ExternalStandardMapping> getExternalStandardMappings() + { + if (externalStandardMappings == null) + { + return externalStandardMappings; + } + else + { + return new ArrayList<>(externalStandardMappings); + } + } + + + /** + * Set up the list of mappings to external standards. + * + * @param externalStandardMappings - ExternalStandardMappings list + */ + public void setExternalStandardMappings(ArrayList<ExternalStandardMapping> externalStandardMappings) + { + this.externalStandardMappings = externalStandardMappings; + } + + + /** + * Return the list of valid instance statuses supported by this TypeDef. + * + * @return InstanceStatus array of supported status values. + */ + public ArrayList<InstanceStatus> getValidInstanceStatusList() + { + return validInstanceStatusList; + } + + + /** + * Set up the list of valid instance statuses supported by this TypeDef. + * + * @param validInstanceStatusList - InstanceStatus Array + */ + public void setValidInstanceStatusList(ArrayList<InstanceStatus> validInstanceStatusList) + { + this.validInstanceStatusList = validInstanceStatusList; + } + + + /** + * Return the initial status setting for an instance of this type. + * + * @return InstanceStatus enum + */ + public InstanceStatus getInitialStatus() + { + return initialStatus; + } + + + /** + * Set up the initial status setting for an instance of this type. + * + * @param initialStatus - InstanceStatus enum + */ + public void setInitialStatus(InstanceStatus initialStatus) + { + this.initialStatus = initialStatus; + } + + + /** + * Return the list of AttributeDefs that define the valid properties for this type of classification. + * + * @return AttributeDefs list + */ + public ArrayList<TypeDefAttribute> getPropertiesDefinition() + { + if(propertiesDefinition == null) + { + return propertiesDefinition; + } + else + { + return new ArrayList<>(propertiesDefinition); + } + } + + + /** + * Set up the list of AttributeDefs that define the valid properties for this type of classification. + * + * @param propertiesDefinition - AttributeDefs list + */ + public void setPropertiesDefinition(ArrayList<TypeDefAttribute> propertiesDefinition) + { + this.propertiesDefinition = propertiesDefinition; + } + + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "TypeDef{" + + "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/TypeDefAttribute.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefAttribute.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefAttribute.java new file mode 100644 index 0000000..36c4b24 --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefAttribute.java @@ -0,0 +1,310 @@ +/* + * 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; + +/** + * TypeDefAttribute stores the properties used to describe a attribute within a Classification, + * Entity or Relationship. The attribute may itself be of types Enum, Collection or Primitive Types. + */ +public class TypeDefAttribute extends TypeDefElementHeader +{ + protected String attributeName = null; + protected AttributeTypeDef attributeType = null; + protected String attributeDescription = null; + protected String attributeDescriptionGUID = null; + protected AttributeCardinality cardinality = AttributeCardinality.UNKNOWN; + protected int valuesMinCount = 0; + protected int valuesMaxCount = 1; + protected boolean isIndexable = true; + protected boolean isUnique = false; + protected String defaultValue = null; + protected ArrayList<ExternalStandardMapping> externalStandardMappings = null; + + + /** + * Default constructor creates an empty TypeDefAttribute. + */ + public TypeDefAttribute() + { + super(); + } + + + /** + * Copy/clone constructor initialized with the values from the supplied template. + * + * @param template - TypeDefAttribute to copy + */ + public TypeDefAttribute(TypeDefAttribute template) + { + super(template); + + if (template != null) + { + attributeName = template.getAttributeName(); + attributeType = template.getAttributeType(); + attributeDescription = template.getAttributeDescription(); + attributeDescriptionGUID = template.getAttributeDescriptionGUID(); + cardinality = template.getAttributeCardinality(); + valuesMinCount = template.getValuesMinCount(); + valuesMaxCount = template.getValuesMaxCount(); + isUnique = template.isUnique(); + isIndexable = template.isIndexable(); + defaultValue = template.getDefaultValue(); + externalStandardMappings = template.getExternalStandardMappings(); + } + } + + + /** + * Return the name of this attribute. + * + * @return String name + */ + public String getAttributeName() + { + return attributeName; + } + + + /** + * Set up the name of this attribute. + * + * @param attributeName - String name + */ + public void setAttributeName(String attributeName) + { + this.attributeName = attributeName; + } + + + /** + * Return the name of the type for the value in this attribute. + * + * @return AttributeTypeDef - definition of attribute type + */ + public AttributeTypeDef getAttributeType() { return attributeType; } + + + /** + * Set up the name of the type for the value in this attribute. + * + * @param attributeType AttributeTypeDef + */ + public void setAttributeType(AttributeTypeDef attributeType) { this.attributeType = attributeType; } + + + /** + * Return the short description of the attribute. + * + * @return String description + */ + public String getAttributeDescription() + { + return attributeDescription; + } + + + /** + * Set up the short description of the attribute. + * + * @param attributeDescription - String description + */ + public void setAttributeDescription(String attributeDescription) + { + this.attributeDescription = attributeDescription; + } + + + /** + * Return the unique id of the glossary term that describes this attribute (or null if + * no attribute defined). + * + * @return String guid + */ + public String getAttributeDescriptionGUID() + { + return attributeDescriptionGUID; + } + + + /** + * Set up the unique id of the glossary term that describes this attribute (or null if + * no attribute defined). + * + * @param attributeDescriptionGUID - String guid + */ + public void setAttributeDescriptionGUID(String attributeDescriptionGUID) + { + this.attributeDescriptionGUID = attributeDescriptionGUID; + } + + + /** + * Return the cardinality of this attribute. + * + * @return AttributeCardinality Enum. + */ + public AttributeCardinality getAttributeCardinality() { return cardinality; } + + + /** + * Set up the cardinality for this attribute. + * + * @param attributeCardinality enum value + */ + public void setAttributeCardinality(AttributeCardinality attributeCardinality) { this.cardinality = attributeCardinality; } + + + /** + * Return the minimum number of values for this attribute (relevant for Arrays, Sets and Maps). + * + * @return int minimum count + */ + public int getValuesMinCount() { return valuesMinCount; } + + + /** + * Set up the minimum number of values for this attribute (relevant for Arrays, Sets and Maps). + * + * @param valuesMinCount int minimum count + */ + public void setValuesMinCount(int valuesMinCount) { this.valuesMinCount = valuesMinCount; } + + + /** + * Return the maximum number of values for this attribute (relevant for Arrays, Sets and Maps). + * + * @return int maximum count + */ + public int getValuesMaxCount() { return valuesMaxCount; } + + + /** + * Set up the maximum number of values for this attribute (relevant for Arrays, Sets and Maps). + * + * @param valuesMaxCount int maximum count + */ + public void setValuesMaxCount(int valuesMaxCount) { this.valuesMaxCount = valuesMaxCount; } + + + /** + * Return whether the value for this attribute is unique across the specific instances of Struct, Classification, + * Entity or Relationship types that this attribute included in. + * + * @return boolean isUnique flag + */ + public boolean isUnique() { return isUnique; } + + + /** + * Set up the isUnique flag. This indicates whether the value for this attribute is unique + * across the specific instances of Struct, Classification, + * Entity or Relationship types that this attribute included in. + * + * @param unique boolean isUnique flag + */ + public void setUnique(boolean unique) { isUnique = unique; } + + + /** + * Return whether this attribute should be included in the metadata collection's search index. + * + * @return boolean isIndexable flag + */ + public boolean isIndexable() { return isIndexable; } + + + /** + * Set up the isIndexable flag. This indicates whether this attribute should be included in the + * metadata collection's search index. + * + * @param indexable boolean isIndexable flag + */ + public void setIndexable(boolean indexable) { isIndexable = indexable; } + + + /** + * Return the default value for this attribute. + * + * @return String default value + */ + public String getDefaultValue() { return defaultValue; } + + + /** + * Set up the default value for this attribute. + * + * @param defaultValue String + */ + public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } + + + /** + * Return the list of mappings to external standards. + * + * @return ExternalStandardMappings list + */ + public ArrayList<ExternalStandardMapping> getExternalStandardMappings() + { + if (externalStandardMappings == null) + { + return externalStandardMappings; + } + else + { + return new ArrayList<>(externalStandardMappings); + } + } + + + /** + * Set up the list of mappings to external standards. + * + * @param externalStandardMappings - ExternalStandardMappings list + */ + public void setExternalStandardMappings(ArrayList<ExternalStandardMapping> externalStandardMappings) + { + this.externalStandardMappings = externalStandardMappings; + } + + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "TypeDefAttribute{" + + "attributeName='" + attributeName + '\'' + + ", attributeType=" + attributeType + + ", cardinality=" + cardinality + + ", valuesMinCount=" + valuesMinCount + + ", valuesMaxCount=" + valuesMaxCount + + ", isIndexable=" + isIndexable + + ", isUnique=" + isUnique + + ", defaultValue='" + defaultValue + '\'' + + ", externalStandardMappings=" + externalStandardMappings + + '}'; + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefCategory.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefCategory.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefCategory.java new file mode 100644 index 0000000..1cd3b71 --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefCategory.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 TypeDefCategory defines the list of valid types of TypeDef for open metadata instances. + */ +public enum TypeDefCategory implements Serializable +{ + UNKNOWN_DEF (0, "<Unknown>", "Uninitialized TypeDef object."), + CLASSIFICATION_DEF (5, "ClassificationDef", "A description of a specific characteristic or grouping for entities."), + ENTITY_DEF (6, "EntityDef", "An object or concept of interest."), + RELATIONSHIP_DEF (8, "RelationshipDef", "A link between two entities."); + + 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. + */ + TypeDefCategory(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/TypeDefElementHeader.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefElementHeader.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefElementHeader.java new file mode 100644 index 0000000..6323bbf --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefElementHeader.java @@ -0,0 +1,51 @@ +/* + * 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; + +/** + * TypeDefElementHeader provides a common base for all typedef information. + */ +public class TypeDefElementHeader implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** + * Default constructor sets TypeDef to nulls. + */ + public TypeDefElementHeader() + { + /* + * Nothing to do + */ + } + + + /** + * Copy/clone constructor set TypeDef to value in template. + * + * @param template - TypeDefElementHeader + */ + public TypeDefElementHeader(TypeDefElementHeader 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/typedefs/TypeDefGallery.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefGallery.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefGallery.java new file mode 100644 index 0000000..a29c57c --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefGallery.java @@ -0,0 +1,121 @@ +/* + * 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; + +/** + * TypeDefGallery contains details of the AttributeTypeDefs and full TypeDefs supported by a rep + */ +public class TypeDefGallery +{ + private ArrayList<AttributeTypeDef> attributeTypeDefs = null; + private ArrayList<TypeDef> typeDefs = null; + + + /** + * Default constructor + */ + public TypeDefGallery() + { + } + + + /** + * Copy/clone constructor + * + * @param template - template to copy + */ + public TypeDefGallery(TypeDefGallery template) + { + if (template != null) + { + ArrayList<AttributeTypeDef> templateAttributeTypeDefs = template.getAttributeTypeDefs(); + ArrayList<TypeDef> templateTypeDefs = template.getTypeDefs(); + + if (templateAttributeTypeDefs != null) + { + attributeTypeDefs = new ArrayList<>(templateAttributeTypeDefs); + } + + if (templateTypeDefs != null) + { + typeDefs = new ArrayList<>(templateTypeDefs); + } + } + } + + + /** + * Return the list of attribute type definitions from the gallery. + * + * @return list of attribute type definitions + */ + public ArrayList<AttributeTypeDef> getAttributeTypeDefs() + { + if (attributeTypeDefs == null) + { + return attributeTypeDefs; + } + else + { + return new ArrayList<>(attributeTypeDefs); + } + } + + + /** + * Set up the list of attribute type definitions from the gallery. + * + * @param attributeTypeDefs - list of attribute type definitions + */ + public void setAttributeTypeDefs(ArrayList<AttributeTypeDef> attributeTypeDefs) + { + this.attributeTypeDefs = attributeTypeDefs; + } + + + /** + * Return the list of type definitions from the gallery. + * + * @return list of type definitions + */ + public ArrayList<TypeDef> getTypeDefs() + { + if (typeDefs == null) + { + return typeDefs; + } + else + { + return new ArrayList<>(typeDefs); + } + } + + + /** + * Set up the list of type definitions from the gallery. + * + * @param typeDefs - list of type definitions + */ + public void setTypeDefs(ArrayList<TypeDef> typeDefs) + { + this.typeDefs = typeDefs; + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefLink.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefLink.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefLink.java new file mode 100644 index 0000000..83b63ed --- /dev/null +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefLink.java @@ -0,0 +1,175 @@ +/* + * 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 TypeDefHolds holds basic identifying information used to link one TypeDef to another. It is used in + * the definition of types - ie in the TypeDefs themselves. Examples include linking a classification to an + * entity, identifying super types and defining the entities at either end of a relationship. + * <p> + * TypeDefs are identified using both the guid and the type name. Both should be unique and most processing is + * with the type name because that is easiest for people to work with. The guid provides a means to check the + * identity of the types since it is easy to introduce two types with the same name in the distributed model. + * </p> + */ +public class TypeDefLink extends TypeDefElementHeader +{ + protected String guid = null; + protected String name = null; + + + /** + * Default constructor + */ + public TypeDefLink() + { + super(); + } + + + /** + * Typical constructor is passed the unique identifier and name of the typedef being constructed. + * + * @param guid - unique id for the TypeDef + * @param name - unique name for the TypeDef + */ + public TypeDefLink(String guid, + String name) + { + super(); + + this.guid = guid; + this.name = name; + } + + + /** + * Copy/clone constructor copies the values from the supplied template. + * + * @param template TypeDefSummary + */ + public TypeDefLink(TypeDefLink template) + { + super(template); + + if (template != null) + { + this.guid = template.getGUID(); + this.name = template.getName(); + } + } + + + /** + * 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; + } + + + /** + * Standard toString method. + * + * @return JSON style description of variables. + */ + @Override + public String toString() + { + return "TypeDefSummary{" + + ", guid='" + guid + '\'' + + ", name='" + name + '\'' + + '}'; + } + + + /** + * 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; + } + TypeDefLink that = (TypeDefLink) object; + return 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; + } +}
