http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omrs/src/main/java/org/apache/atlas/omrs/archivemanager/opentypes/OpenMetadataTypesArchive.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/archivemanager/opentypes/OpenMetadataTypesArchive.java b/omrs/src/main/java/org/apache/atlas/omrs/archivemanager/opentypes/OpenMetadataTypesArchive.java deleted file mode 100644 index 3fe4d34..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/archivemanager/opentypes/OpenMetadataTypesArchive.java +++ /dev/null @@ -1,17114 +0,0 @@ -/* - * 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.archivemanager.opentypes; - - -import org.apache.atlas.omrs.archivemanager.OMRSArchiveBuilder; -import org.apache.atlas.omrs.archivemanager.OMRSArchiveHelper; -import org.apache.atlas.omrs.archivemanager.properties.OpenMetadataArchive; -import org.apache.atlas.omrs.archivemanager.properties.OpenMetadataArchiveType; -import org.apache.atlas.omrs.ffdc.OMRSErrorCode; -import org.apache.atlas.omrs.ffdc.exception.OMRSLogicErrorException; -import org.apache.atlas.omrs.metadatacollection.properties.typedefs.*; - -import java.util.ArrayList; -import java.util.Date; - -/** - * OpenMetadataTypesArchive builds an open metadata archive containing all of the standard open metadata types. - * These types have hardcoded dates and guids so that however many times this archive is rebuilt, it will - * produce the same content. - * <p> - * Details of the open metadata types are documented on the wiki: - * <a href="https://cwiki.apache.org/confluence/display/ATLAS/Building+out+the+Open+Metadata+Typesystem">Building out the Open Metadata Typesystem</a> - * </p> - * <p> - * There are 8 areas, each covering a different topic area of metadata. The module breaks down the process of creating - * the models into the areas and then the individual models to simplify the maintenance of this class - * </p> - */ -public class OpenMetadataTypesArchive -{ - /* - * This is the header information for the archive. - */ - private static final String archiveGUID = "bce3b0a0-662a-4f87-b8dc-844078a11a6e"; - private static final String archiveName = "Open Metadata Types"; - private static final String archiveDescription = "Standard types for open metadata repositories."; - private static final OpenMetadataArchiveType archiveType = OpenMetadataArchiveType.CONTENT_PACK; - private static final String originatorName = "Apache Atlas (OMRS)"; - private static final Date creationDate = new Date(1516313040008L); - - /* - * Specific values for initializing TypeDefs - */ - private static final long versionNumber = 1L; - private static final String versionName = "1.0"; - - - private OMRSArchiveBuilder archiveBuilder; - private OMRSArchiveHelper archiveHelper; - - - /** - * Default constructor sets up the archive builder. This in turn sets up the header for the archive. - */ - public OpenMetadataTypesArchive() - { - this.archiveBuilder = new OMRSArchiveBuilder(archiveGUID, - archiveName, - archiveDescription, - archiveType, - originatorName, - creationDate, - null); - - this.archiveHelper = new OMRSArchiveHelper(archiveBuilder, - archiveGUID, - originatorName, - creationDate, - versionNumber, - versionName); - } - - - /** - * Return the unique identifier for this archive. - * - * @return String guid - */ - public String getArchiveGUID() - { - return archiveGUID; - } - - /** - * Returns the open metadata type archive containing all of the standard open metadata types. - * - * @return populated open metadata archive object - */ - public OpenMetadataArchive getOpenMetadataArchive() - { - final String methodName = "getOpenMetadataArchive()"; - - if (this.archiveBuilder != null) - { - /* - * Call each of the methods to systematically add the contents of the archive. - */ - this.addStandardPrimitiveDefs(); - this.addStandardCollectionDefs(); - this.addArea0Types(); - this.addArea1Types(); - this.addArea2Types(); - this.addArea3Types(); - this.addArea4Types(); - this.addArea5Types(); - this.addArea6Types(); - this.addArea7Types(); - - /* - * The completed archive is ready to be packaged up and returned - */ - return this.archiveBuilder.getOpenMetadataArchive(); - } - else - { - /* - * This is a logic error since it means the creation of the archive builder threw an exception - * in the constructor and so this object should not be used. - */ - OMRSErrorCode errorCode = OMRSErrorCode.ARCHIVE_UNAVAILABLE; - String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(); - - throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - } - - - /* - * ======================================== - * Attribute types - */ - - - /** - * Add the standard primitive types to the archive builder. - */ - private void addStandardPrimitiveDefs() - { - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_UNKNOWN)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BYTE)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_CHAR)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_SHORT)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_FLOAT)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DOUBLE)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGINTEGER)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGDECIMAL)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING)); - this.archiveBuilder.addPrimitiveDef(archiveHelper.getPrimitiveDef(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DATE)); - } - - - /** - * Add the standard collection types to the archive builder. - */ - private void addStandardCollectionDefs() - { - this.archiveBuilder.addCollectionDef(getMapStringStringCollectionDef()); - this.archiveBuilder.addCollectionDef(getArrayStringCollectionDef()); - - } - - - /** - * Defines the "map<string,string>" type. - * - * @return CollectionDef for this type - */ - private CollectionDef getMapStringStringCollectionDef() - { - final String guid = "005c7c14-ac84-4136-beed-959401b041f8"; - final String description = "A map from String to String."; - final String descriptionGUID = null; - - return archiveHelper.getMapCollectionDef(guid, - description, - descriptionGUID, - PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING, - PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING); - } - - - /** - * Define the "array<string>" type. - * - * @return CollectionDef for this object - */ - private CollectionDef getArrayStringCollectionDef() - { - final String guid = "0428b5d3-f824-459c-b7f5-f8151de59707"; - final String description = "An array of Strings."; - final String descriptionGUID = null; - - return archiveHelper.getArrayCollectionDef(guid, - description, - descriptionGUID, - PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING); - } - - - - - /* - * ======================================== - * AREA 0 - common types and infrastructure - */ - - /** - * Add the list of area 0 types - */ - private void addArea0Types() - { - this.add0010BaseModel(); - this.add0015LinkedMediaTypes(); - this.add0017ExternalIdentifiers(); - this.add0020PropertyFacets(); - this.add0025Locations(); - this.add0030HostsAndPlatforms(); - this.add0035ComplexHosts(); - this.add0040SoftwareServers(); - this.add0045ServersAndAssets(); - this.add0070NetworksAndGateways(); - this.add0090CloudPlatformsAndServices(); - } - - /* - * ------------------------------------------------------------------------------------------------------- - */ - - /** - * 0010 Base Model defines the core entities that have been inherited from the original Apache Atlas model. - * It defines an initial set of asset types that need to be governed (more assets are defined in Area 2). - */ - private void add0010BaseModel() - { - this.archiveBuilder.addEntityDef(getReferenceableEntity()); - this.archiveBuilder.addEntityDef(getAssetEntity()); - this.archiveBuilder.addEntityDef(getInfrastructureEntity()); - this.archiveBuilder.addEntityDef(getProcessEntity()); - this.archiveBuilder.addEntityDef(getDataSetEntity()); - - this.archiveBuilder.addRelationshipDef(getProcessInputRelationship()); - this.archiveBuilder.addRelationshipDef(getProcessOutputRelationship()); - } - - - /** - * The Referenceable entity is the superclass of all of the governed open metadata entities. It specifies that - * these entities have a unique identifier called "qualifiedName". - * - * @return Referenceable EntityDef - */ - private EntityDef getReferenceableEntity() - { - /* - * Build the Entity - */ - final String guid = "a32316b8-dc8c-48c5-b12b-71c1b2a080bf"; - final String name = "Referenceable"; - final String description = "An open metadata entity that has a unique identifier."; - final String descriptionGUID = null; - - EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, - name, - null, - description, - descriptionGUID); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "qualifiedName"; - final String attribute1Description = "Unique identifier for the entity."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "additionalProperties"; - final String attribute2Description = "Additional properties for the element."; - final String attribute2DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - property.setUnique(true); - properties.add(property); - property = archiveHelper.getMapStringStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - - entityDef.setPropertiesDefinition(properties); - - return entityDef; - } - - - /** - * The Asset entity is the root entity for the assets that open metadata and governance is governing. - * - * @return Asset EntityDef - */ - private EntityDef getAssetEntity() - { - /* - * Build the Entity - */ - final String guid = "896d14c2-7522-4f6c-8519-757711943fe6"; - final String name = "Asset"; - final String description = "The description of an asset that needs to be catalogued and governed."; - final String descriptionGUID = null; - final String superTypeName = "Referenceable"; - - EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "name"; - final String attribute1Description = "Display name for the asset."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "description"; - final String attribute2Description = "Description of the asset."; - final String attribute2DescriptionGUID = null; - final String attribute3Name = "owner"; - final String attribute3Description = "User name of the person or process that owns the asset."; - final String attribute3DescriptionGUID = null; - - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute3Name, attribute3Description, attribute3DescriptionGUID); - properties.add(property); - - entityDef.setPropertiesDefinition(properties); - - return entityDef; - } - - - /** - * The Infrastructure entity describes an asset that is physical infrastructure or part of the software - * platform that supports the data and process assets. - * - * @return Infrastructure EntityDef - */ - private EntityDef getInfrastructureEntity() - { - /* - * Build the Entity - */ - final String guid = "c19746ac-b3ec-49ce-af4b-83348fc55e07"; - final String name = "Infrastructure"; - final String description = "Physical infrastructure or software platform."; - final String descriptionGUID = null; - final String superTypeName = "Asset"; - - return archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - } - - - /** - * The Process entity describes a well-defined sequence of activities performed by people or software components. - * - * @return Process EntityDef - */ - private EntityDef getProcessEntity() - { - /* - * Build the Entity - */ - final String guid = "d8f33bd7-afa9-4a11-a8c7-07dcec83c050"; - final String name = "Process"; - final String description = "Well-defined sequence of activities performed by people or software components."; - final String descriptionGUID = null; - final String superTypeName = "Asset"; - - return archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - } - - - /** - * The DataSet entity describes a collection of related data. - * - * @return DataSet EntityDef - */ - private EntityDef getDataSetEntity() - { - /* - * Build the Entity - */ - final String guid = "1449911c-4f44-4c22-abc0-7540154feefb"; - final String name = "DataSet"; - final String description = "Collection of related data."; - final String descriptionGUID = null; - final String superTypeName = "Asset"; - - return archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - } - - - /** - * The ProcessInput relationship describes the data set(s) that are passed into a process. - * - * @return ProcessInput RelationshipDef - */ - private RelationshipDef getProcessInputRelationship() - { - /* - * Build the relationship - */ - final String guid = "9a6583c4-7419-4d5a-a6e5-26b0033fa349"; - final String name = "ProcessInput"; - final String description = "The DataSets passed into a Process."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.AGGREGATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Process"; - final String end1AttributeName = "consumedByProcess"; - final String end1AttributeDescription = "Processes that consume this DataSet."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "DataSet"; - final String end2AttributeName = "processInputData"; - final String end2AttributeDescription = "DataSets consumed by this Process."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - - return relationshipDef; - } - - - /** - * The ProcessOutput relationship describes the data set(s) that are produced by a process. - * - * @return ProcessOutput RelationshipDef - */ - private RelationshipDef getProcessOutputRelationship() - { - /* - * Build the relationship - */ - final String guid = "8920eada-9b05-4368-b511-b8506a4bef4b"; - final String name = "ProcessOutput"; - final String description = "The DataSets produced by a Process."; - final String descriptionGUID = null; - final RelationshipCategory relationshipCategory = RelationshipCategory.AGGREGATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Process"; - final String end1AttributeName = "producedByProcess"; - final String end1AttributeDescription = "Processes that produce this DataSet."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "DataSet"; - final String end2AttributeName = "processOutputData"; - final String end2AttributeDescription = "DataSets produced by this Process."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - - return relationshipDef; - } - - - /* - * ------------------------------------------------------------------------------------------------------- - */ - - - /** - * 0015 Linked Media Types describe different media (like images and documents) that enhance the description - * of an entity. Media entities can be added to any Referenceable entities. - */ - private void add0015LinkedMediaTypes() - { - this.archiveBuilder.addEnumDef(getMediaUsageTypeEnum()); - - this.archiveBuilder.addEntityDef(getExternalReferenceEntity()); - this.archiveBuilder.addEntityDef(getRelatedMediaEntity()); - this.archiveBuilder.addEntityDef(getMediaUsageEntity()); - - - this.archiveBuilder.addRelationshipDef(getExternalReferenceLinkRelationship()); - this.archiveBuilder.addRelationshipDef(getMediaReferenceRelationship()); - this.archiveBuilder.addRelationshipDef(getMediaUsageGuidanceRelationship()); - - } - - - private EnumDef getMediaUsageTypeEnum() - { - final String guid = "c6861a72-7485-48c9-8040-876f6c342b61"; - final String name = "MediaUsageType"; - final String description = "Defines how a related media reference should be used."; - final String descriptionGUID = null; - - EnumDef enumDef = archiveHelper.getEmptyEnumDef(guid, name, description, descriptionGUID); - - ArrayList<EnumElementDef> elementDefs = new ArrayList<>(); - EnumElementDef elementDef; - - final int element1Ordinal = 0; - final String element1Value = "Icon"; - final String element1Description = "Provides a small image to represent the asset in tree views and graphs."; - final String element1DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element1Ordinal, element1Value, element1Description, element1DescriptionGUID); - elementDefs.add(elementDef); - - final int element2Ordinal = 1; - final String element2Value = "Thumbnail"; - final String element2Description = "Provides a small image about the asset that can be used in lists."; - final String element2DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element2Ordinal, element2Value, element2Description, element2DescriptionGUID); - elementDefs.add(elementDef); - - final int element3Ordinal = 2; - final String element3Value = "Illustration"; - final String element3Description = "Illustrates how the asset works or what it contains. It is complementary to the asset's description."; - final String element3DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element3Ordinal, element3Value, element3Description, element3DescriptionGUID); - elementDefs.add(elementDef); - - final int element4Ordinal = 3; - final String element4Value = "UsageGuidance"; - final String element4Description = "Provides guidance to a person on how to use the asset."; - final String element4DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element4Ordinal, element4Value, element4Description, element4DescriptionGUID); - elementDefs.add(elementDef); - - final int element5Ordinal = 99; - final String element5Value = "Other"; - final String element5Description = "Another usage."; - final String element5DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element5Ordinal, element5Value, element5Description, element5DescriptionGUID); - elementDefs.add(elementDef); - - enumDef.setElementDefs(elementDefs); - - return enumDef; - } - - - private EntityDef getExternalReferenceEntity() - { - final String guid = "af536f20-062b-48ef-9c31-1ddd05b04c56"; - final String name = "ExternalReference"; - final String description = "A link to more information."; - final String descriptionGUID = null; - - final String superTypeName = "Referenceable"; - - EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "displayName"; - final String attribute1Description = "Consumable name for reports and user interfaces."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "url"; - final String attribute2Description = "Location of the external reference."; - final String attribute2DescriptionGUID = null; - final String attribute3Name = "version"; - final String attribute3Description = "Version number of the external reference."; - final String attribute3DescriptionGUID = null; - final String attribute4Name = "description"; - final String attribute4Description = "Description of the external reference."; - final String attribute4DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute3Name, attribute3Description, attribute3DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute4Name, attribute4Description, attribute4DescriptionGUID); - properties.add(property); - - entityDef.setPropertiesDefinition(properties); - - return entityDef; - } - - - private EntityDef getRelatedMediaEntity() - { - final String guid = "747f8b86-fe7c-4c9b-ba75-979e093cc307"; - final String name = "RelatedMedia"; - final String description = "Images, video or sound media."; - final String descriptionGUID = null; - - final String superTypeName = "ExternalReference"; - - return archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - } - - - private EntityDef getMediaUsageEntity() - { - final String guid = "b9599da3-ce7e-4981-b25e-86d03340da0b"; - final String name = "MediaUsage"; - final String description = "Guidance on a particular way a specific piece of media could be used."; - final String descriptionGUID = null; - - EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, - name, - null, - description, - descriptionGUID); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "mediaUsageType"; - final String attribute1Description = "Type of media usage."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "guidance"; - final String attribute2Description = "Advice on how the media should be used in this context."; - final String attribute2DescriptionGUID = null; - - property = archiveHelper.getEnumTypeDefAttribute("MediaUsageType", attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - - entityDef.setPropertiesDefinition(properties); - - return entityDef; - } - - - private RelationshipDef getExternalReferenceLinkRelationship() - { - final String guid = "7d818a67-ab45-481c-bc28-f6b1caf12f06"; - final String name = "ExternalReferenceLink"; - final String description = "Link to more information."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.ASSOCIATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Referenceable"; - final String end1AttributeName = "relatedItem"; - final String end1AttributeDescription = "Item that is referencing this work."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "ExternalReference"; - final String end2AttributeName = "externalReference"; - final String end2AttributeDescription = "Link to more information from an external source."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "referenceId"; - final String attribute1Description = "Local identifier for the reference."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "description"; - final String attribute2Description = "Description of the relevance of this reference to the linked item."; - final String attribute2DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - - relationshipDef.setPropertiesDefinition(properties); - - return relationshipDef; - } - - - private RelationshipDef getMediaReferenceRelationship() - { - final String guid = "1353400f-b0ab-4ab9-ab09-3045dd8a7140"; - final String name = "MediaReference"; - final String description = "Link to related media such as images, videos and audio."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.ASSOCIATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Referenceable"; - final String end1AttributeName = "consumingItem"; - final String end1AttributeDescription = "Item that is referencing this work."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "RelatedMedia"; - final String end2AttributeName = "relatedMedia"; - final String end2AttributeDescription = "Link to external media."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "mediaId"; - final String attribute1Description = "Local identifier for the media."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "description"; - final String attribute2Description = "Description of the relevance of this media to the linked item."; - final String attribute2DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - - relationshipDef.setPropertiesDefinition(properties); - - return relationshipDef; - } - - - private RelationshipDef getMediaUsageGuidanceRelationship() - { - final String guid = "952b5c8b-42fb-4ff2-a15f-a9eebb82d2ca"; - final String name = "MediaUsageGuidance"; - final String description = "Link to information on how a specific piece of media could be used."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.COMPOSITION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "RelatedMedia"; - final String end1AttributeName = "parentMedia"; - final String end1AttributeDescription = "Parent media that this guidance is for."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "MediaUsage"; - final String end2AttributeName = "usageRecommendation"; - final String end2AttributeDescription = "Link to guidance on how related media should be used."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - return relationshipDef; - } - - /* - * ------------------------------------------------------------------------------------------------------- - */ - - - /** - * 0017 External Identifiers define identifiers used to identify this entity in other systems. - */ - private void add0017ExternalIdentifiers() - { - this.archiveBuilder.addEnumDef(getKeyPatternEnum()); - - this.archiveBuilder.addEntityDef(getExternalIdEntity()); - - this.archiveBuilder.addRelationshipDef(getExternalIdScopeRelationship()); - this.archiveBuilder.addRelationshipDef(getExternalIdLinkRelationship()); - } - - - private EnumDef getKeyPatternEnum() - { - final String guid = "8904df8f-1aca-4de8-9abd-1ef2aadba300"; - final String name = "KeyPattern"; - final String description = "Defines the type of identifier used for an asset."; - final String descriptionGUID = null; - - EnumDef enumDef = archiveHelper.getEmptyEnumDef(guid, name, description, descriptionGUID); - - ArrayList<EnumElementDef> elementDefs = new ArrayList<>(); - EnumElementDef elementDef; - - final int element1Ordinal = 0; - final String element1Value = "LocalKey"; - final String element1Description = "Unique key allocated and used within the scope of a single system."; - final String element1DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element1Ordinal, element1Value, element1Description, element1DescriptionGUID); - elementDefs.add(elementDef); - - final int element2Ordinal = 1; - final String element2Value = "RecycledKey"; - final String element2Description = "Key allocated and used within the scope of a single system that is periodically reused for different records."; - final String element2DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element2Ordinal, element2Value, element2Description, element2DescriptionGUID); - elementDefs.add(elementDef); - - final int element3Ordinal = 2; - final String element3Value = "NaturalKey"; - final String element3Description = "Key derived from an attribute of the entity, such as email address, passport number."; - final String element3DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element3Ordinal, element3Value, element3Description, element3DescriptionGUID); - elementDefs.add(elementDef); - - final int element4Ordinal = 3; - final String element4Value = "MirrorKey"; - final String element4Description = "Key value copied from another system."; - final String element4DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element4Ordinal, element4Value, element4Description, element4DescriptionGUID); - elementDefs.add(elementDef); - - final int element5Ordinal = 4; - final String element5Value = "AggregateKey"; - final String element5Description = "Key formed by combining keys from multiple systems."; - final String element5DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element5Ordinal, element5Value, element5Description, element5DescriptionGUID); - elementDefs.add(elementDef); - - final int element6Ordinal = 5; - final String element6Value = "CallersKey"; - final String element6Description = "Key from another system can bey used if system name provided."; - final String element6DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element6Ordinal, element6Value, element6Description, element6DescriptionGUID); - elementDefs.add(elementDef); - - final int element7Ordinal = 6; - final String element7Value = "StableKey"; - final String element7Description = "Key value will remain active even if records are merged."; - final String element7DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element7Ordinal, element7Value, element7Description, element7DescriptionGUID); - elementDefs.add(elementDef); - - final int element8Ordinal = 99; - final String element8Value = "Other"; - final String element8Description = "Another key pattern."; - final String element8DescriptionGUID = null; - - elementDef = archiveHelper.getEnumElementDef(element8Ordinal, element8Value, element8Description, element8DescriptionGUID); - elementDefs.add(elementDef); - - enumDef.setElementDefs(elementDefs); - - return enumDef; - } - - - private EntityDef getExternalIdEntity() - { - final String guid = "7c8f8c2c-cc48-429e-8a21-a1f1851ccdb0"; - final String name = "ExternalId"; - final String description = "Alternative identifier used in another system."; - final String descriptionGUID = null; - - final String superTypeName = "Referenceable"; - - EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "identifier"; - final String attribute1Description = "Identifier used in an external system."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "keyPattern"; - final String attribute2Description = "Management pattern associated with the identifier."; - final String attribute2DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getEnumTypeDefAttribute("KeyPattern", attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - - entityDef.setPropertiesDefinition(properties); - - return entityDef; - } - - - private RelationshipDef getExternalIdScopeRelationship() - { - final String guid = "8c5b1415-2d1f-4190-ba6c-1fdd47f03269"; - final String name = "ExternalIdScope"; - final String description = "Places where an external identifier is recognized."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.ASSOCIATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Referenceable"; - final String end1AttributeName = "scopedTo"; - final String end1AttributeDescription = "Identifies where this external identifier is known."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "ExternalId"; - final String end2AttributeName = "managedResources"; - final String end2AttributeDescription = "Link to details of a resource that this component manages."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "description"; - final String attribute1Description = "Description of the relationship between the resources and the managing component."; - final String attribute1DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - - - relationshipDef.setPropertiesDefinition(properties); - - return relationshipDef; - } - - - private RelationshipDef getExternalIdLinkRelationship() - { - final String guid = "28ab0381-c662-4b6d-b787-5d77208de126"; - final String name = "ExternalIdLink"; - final String description = "Link between an external identifier and an asset or related item."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.ASSOCIATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Referenceable"; - final String end1AttributeName = "resource"; - final String end1AttributeDescription = "Resource being identified."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "ExternalId"; - final String end2AttributeName = "alsoKnownAs"; - final String end2AttributeDescription = "Identifier used in an external system."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "description"; - final String attribute1Description = "Description of how the external identifier relates to the resource."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "usage"; - final String attribute2Description = "Description of how the external identifier can be used."; - final String attribute2DescriptionGUID = null; - final String attribute3Name = "source"; - final String attribute3Description = "Details of where the external identifier was sourced from."; - final String attribute3DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute3Name, attribute3Description, attribute3DescriptionGUID); - properties.add(property); - - relationshipDef.setPropertiesDefinition(properties); - - return relationshipDef; - } - - - /* - * ------------------------------------------------------------------------------------------------------- - */ - - - /** - * 0020 Property Facets define blocks of properties that are unique to a particular vendor or service. - */ - private void add0020PropertyFacets() - { - this.archiveBuilder.addEntityDef(getPropertyFacetEntity()); - - this.archiveBuilder.addRelationshipDef(getReferenceableFacetRelationship()); - } - - - private EntityDef getPropertyFacetEntity() - { - final String guid = "6403a704-aad6-41c2-8e08-b9525c006f85"; - final String name = "PropertyFacet"; - final String description = "Additional properties that support a particular vendor or service."; - final String descriptionGUID = null; - - final String superTypeName = "Referenceable"; - - EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "version"; - final String attribute1Description = "Version of the property facet schema."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "description"; - final String attribute2Description = "Description of the property facet contents."; - final String attribute2DescriptionGUID = null; - final String attribute3Name = "properties"; - final String attribute3Description = "Properties for the property facet."; - final String attribute3DescriptionGUID = null; - - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - property = archiveHelper.getMapStringStringTypeDefAttribute(attribute3Name, attribute3Description, attribute3DescriptionGUID); - properties.add(property); - - entityDef.setPropertiesDefinition(properties); - - return entityDef; - } - - - private RelationshipDef getReferenceableFacetRelationship() - { - final String guid = "58c87647-ada9-4c90-a3c3-a40ace46b1f7"; - final String name = "ReferenceableFacet"; - final String description = "Link between a property facet and the resource it relates to."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.COMPOSITION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Referenceable"; - final String end1AttributeName = "relatedEntity"; - final String end1AttributeDescription = "Identifies which element this property facet belongs to."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "PropertyFacet"; - final String end2AttributeName = "facets"; - final String end2AttributeDescription = "Additional properties from different sources."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "source"; - final String attribute1Description = "Source of this property facet."; - final String attribute1DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - - relationshipDef.setPropertiesDefinition(properties); - - return relationshipDef; - } - - /* - * ------------------------------------------------------------------------------------------------------- - */ - - - /** - * 0025 Locations define entities that describe physical, logical and cyber locations for Assets. - */ - private void add0025Locations() - { - this.archiveBuilder.addEntityDef(getLocationEntity()); - - this.archiveBuilder.addRelationshipDef(getNestedLocationRelationship()); - this.archiveBuilder.addRelationshipDef(getAdjacentLocationRelationship()); - this.archiveBuilder.addRelationshipDef(getAssetLocationRelationship()); - - this.archiveBuilder.addClassificationDef(getMobileAssetClassification()); - this.archiveBuilder.addClassificationDef(getFixedLocationClassification()); - this.archiveBuilder.addClassificationDef(getSecureLocationClassification()); - this.archiveBuilder.addClassificationDef(getCyberLocationClassification()); - } - - - private EntityDef getLocationEntity() - { - final String guid = "3e09cb2b-5f15-4fd2-b004-fe0146ad8628"; - final String name = "Location"; - final String description = "A physical place, digital location or area."; - final String descriptionGUID = null; - - final String superTypeName = "Referenceable"; - - EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, - name, - this.archiveBuilder.getEntityDef(superTypeName), - description, - descriptionGUID); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "displayName"; - final String attribute1Description = "Consumable name for reports and user interfaces."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "description"; - final String attribute2Description = "Description of the location."; - final String attribute2DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - - entityDef.setPropertiesDefinition(properties); - - return entityDef; - } - - - private RelationshipDef getNestedLocationRelationship() - { - final String guid = "f82a96c2-95a3-4223-88c0-9cbf2882b772"; - final String name = "NestedLocation"; - final String description = "Link between two locations to show one is nested inside another."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.AGGREGATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Location"; - final String end1AttributeName = "groupingLocation"; - final String end1AttributeDescription = "Location that is covering the broader area."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "Location"; - final String end2AttributeName = "nestedLocation"; - final String end2AttributeDescription = "Location that is nested in this location."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - return relationshipDef; - } - - - private RelationshipDef getAdjacentLocationRelationship() - { - final String guid = "017d0518-fc25-4e5e-985e-491d91e61e17"; - final String name = "AdjacentLocation"; - final String description = "Link between two locations that are next to one another."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.ASSOCIATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Location"; - final String end1AttributeName = "peerLocation"; - final String end1AttributeDescription = "Location that is adjacent to this location."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "Location"; - final String end2AttributeName = "peerLocation"; - final String end2AttributeDescription = "Location that is adjacent to this location."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - return relationshipDef; - } - - - private RelationshipDef getAssetLocationRelationship() - { - final String guid = "bc236b62-d0e6-4c5c-93a1-3a35c3dba7b1"; - final String name = "AssetLocation"; - final String description = "Location of an Asset."; - final String descriptionGUID = null; - - final RelationshipCategory relationshipCategory = RelationshipCategory.ASSOCIATION; - final ClassificationPropagationRule classificationPropagationRule = ClassificationPropagationRule.NONE; - - RelationshipDef relationshipDef = archiveHelper.getBasicRelationshipDef(guid, - name, - null, - description, - descriptionGUID, - relationshipCategory, - classificationPropagationRule); - - RelationshipEndDef relationshipEndDef; - - /* - * Set up end 1. - */ - final String end1EntityType = "Location"; - final String end1AttributeName = "knownLocations"; - final String end1AttributeDescription = "Places where this asset is sited."; - final String end1AttributeDescriptionGUID = null; - final AttributeCardinality end1Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end1EntityType), - end1AttributeName, - end1AttributeDescription, - end1AttributeDescriptionGUID, - end1Cardinality); - relationshipDef.setEndDef1(relationshipEndDef); - - - /* - * Set up end 2. - */ - final String end2EntityType = "Location"; - final String end2AttributeName = "localAssets"; - final String end2AttributeDescription = "Assets sited at this location."; - final String end2AttributeDescriptionGUID = null; - final AttributeCardinality end2Cardinality = AttributeCardinality.ANY_NUMBER_UNORDERED; - - relationshipEndDef = archiveHelper.getRelationshipEndDef(this.archiveBuilder.getEntityDef(end2EntityType), - end2AttributeName, - end2AttributeDescription, - end2AttributeDescriptionGUID, - end2Cardinality); - relationshipDef.setEndDef2(relationshipEndDef); - - return relationshipDef; - } - - - private ClassificationDef getMobileAssetClassification() - { - final String guid = "b25fb90d-8fa2-4aa9-b884-ff0a6351a697"; - final String name = "MobileAsset"; - final String description = "An asset not restricted to a single physical location."; - final String descriptionGUID = null; - - final String linkedToEntity = "Asset"; - - return archiveHelper.getClassificationDef(guid, - name, - null, - description, - descriptionGUID, - this.archiveBuilder.getEntityDef(linkedToEntity), - false); - } - - - private ClassificationDef getFixedLocationClassification() - { - final String guid = "bc111963-80c7-444f-9715-946c03142dd2"; - final String name = "FixedLocation"; - final String description = "A location linked to a physical place."; - final String descriptionGUID = null; - - final String linkedToEntity = "Location"; - - ClassificationDef classificationDef = archiveHelper.getClassificationDef(guid, - name, - null, - description, - descriptionGUID, - this.archiveBuilder.getEntityDef(linkedToEntity), - false); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "coordinates"; - final String attribute1Description = "Geographical coordinates of this location."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "address"; - final String attribute2Description = "Postal address of this location."; - final String attribute2DescriptionGUID = null; - final String attribute3Name = "timezone"; - final String attribute3Description = "Timezone for the location."; - final String attribute3DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute3Name, attribute3Description, attribute3DescriptionGUID); - properties.add(property); - - classificationDef.setPropertiesDefinition(properties); - - return classificationDef; - } - - - private ClassificationDef getSecureLocationClassification() - { - final String guid = "e7b563c0-fcdd-4ba7-a046-eecf5c4638b8"; - final String name = "SecureLocation"; - final String description = "A location that protects the assets in its care."; - final String descriptionGUID = null; - - final String linkedToEntity = "Location"; - - ClassificationDef classificationDef = archiveHelper.getClassificationDef(guid, - name, - null, - description, - descriptionGUID, - this.archiveBuilder.getEntityDef(linkedToEntity), - false); - - /* - * Build the attributes - */ - ArrayList<TypeDefAttribute> properties = new ArrayList<>(); - TypeDefAttribute property; - - final String attribute1Name = "description"; - final String attribute1Description = "Description of the security at this location."; - final String attribute1DescriptionGUID = null; - final String attribute2Name = "level"; - final String attribute2Description = "Level of security at this location."; - final String attribute2DescriptionGUID = null; - - property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID); - properties.add(property); - property = archiveHelper.getStringTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID); - properties.add(property); - - classificationDef.setPropertiesDefinition(properties); - - return classificationDef; - } - - - private ClassificationDef getCyberLocationClassification() - { - final String guid = "f9ec3633-8ac8-480b-aa6d-5e674b9e1b17"; - final String name = "CyberLocation"; - final String description = "A digital
<TRUNCATED>