@Test public void testAddEntityDef() { OMRSArchiveBuilder omrsArchiveBuilder = getOMRSArchiveBuilder(); EntityDef entityDefA = new EntityDef(TypeDefCategory.ENTITY_DEF, "1111", "EntityDefA", 1L, "1"); omrsArchiveBuilder.addEntityDef(entityDefA); }
public void addEntityDef(EntityDef entityDef) { final String methodName = "addEntityDef"; if (entityDef != null) { log.debug("Adding EntityDef: " + entityDef.toString()); this.checkForBlanksInTypeName(entityDef.getName()); EntityDef duplicateElement = entityDefMap.put(entityDef.getName(), entityDef); if (duplicateElement != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPE_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), TypeDefCategory.ENTITY_DEF.getName(), duplicateElement.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateGUID = guidMap.put(entityDef.getGUID(), entityDef); if (duplicateGUID != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_GUID_IN_ARCHIVE.getMessageDefinition(entityDef.getGUID(), duplicateGUID.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateName = nameMap.put(entityDef.getName(), entityDef); if (duplicateName != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPENAME_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), duplicateName.toString(), entityDef.toString()), this.getClass().getName(), methodName); } if (entityDef.getPropertiesDefinition() != null) { Set<String> attrSet = new HashSet<>(); for (TypeDefAttribute typeDefAttr : entityDef.getPropertiesDefinition()) { String duplicateAttributeName = typeDefAttr.getAttributeName(); if (attrSet.contains(duplicateAttributeName)) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_ENTITY_ATTR_IN_ARCHIVE.getMessageDefinition(duplicateAttributeName, entityDef.getName()), this.getClass().getName(), methodName); } attrSet.add(duplicateAttributeName); } } entityDefList.add(entityDef); } }
OMRSArchiveBuilder { public void addEntityDef(EntityDef entityDef) { final String methodName = "addEntityDef"; if (entityDef != null) { log.debug("Adding EntityDef: " + entityDef.toString()); this.checkForBlanksInTypeName(entityDef.getName()); EntityDef duplicateElement = entityDefMap.put(entityDef.getName(), entityDef); if (duplicateElement != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPE_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), TypeDefCategory.ENTITY_DEF.getName(), duplicateElement.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateGUID = guidMap.put(entityDef.getGUID(), entityDef); if (duplicateGUID != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_GUID_IN_ARCHIVE.getMessageDefinition(entityDef.getGUID(), duplicateGUID.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateName = nameMap.put(entityDef.getName(), entityDef); if (duplicateName != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPENAME_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), duplicateName.toString(), entityDef.toString()), this.getClass().getName(), methodName); } if (entityDef.getPropertiesDefinition() != null) { Set<String> attrSet = new HashSet<>(); for (TypeDefAttribute typeDefAttr : entityDef.getPropertiesDefinition()) { String duplicateAttributeName = typeDefAttr.getAttributeName(); if (attrSet.contains(duplicateAttributeName)) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_ENTITY_ATTR_IN_ARCHIVE.getMessageDefinition(duplicateAttributeName, entityDef.getName()), this.getClass().getName(), methodName); } attrSet.add(duplicateAttributeName); } } entityDefList.add(entityDef); } } }
OMRSArchiveBuilder { public void addEntityDef(EntityDef entityDef) { final String methodName = "addEntityDef"; if (entityDef != null) { log.debug("Adding EntityDef: " + entityDef.toString()); this.checkForBlanksInTypeName(entityDef.getName()); EntityDef duplicateElement = entityDefMap.put(entityDef.getName(), entityDef); if (duplicateElement != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPE_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), TypeDefCategory.ENTITY_DEF.getName(), duplicateElement.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateGUID = guidMap.put(entityDef.getGUID(), entityDef); if (duplicateGUID != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_GUID_IN_ARCHIVE.getMessageDefinition(entityDef.getGUID(), duplicateGUID.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateName = nameMap.put(entityDef.getName(), entityDef); if (duplicateName != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPENAME_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), duplicateName.toString(), entityDef.toString()), this.getClass().getName(), methodName); } if (entityDef.getPropertiesDefinition() != null) { Set<String> attrSet = new HashSet<>(); for (TypeDefAttribute typeDefAttr : entityDef.getPropertiesDefinition()) { String duplicateAttributeName = typeDefAttr.getAttributeName(); if (attrSet.contains(duplicateAttributeName)) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_ENTITY_ATTR_IN_ARCHIVE.getMessageDefinition(duplicateAttributeName, entityDef.getName()), this.getClass().getName(), methodName); } attrSet.add(duplicateAttributeName); } } entityDefList.add(entityDef); } } OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     archiveVersion,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives); }
OMRSArchiveBuilder { public void addEntityDef(EntityDef entityDef) { final String methodName = "addEntityDef"; if (entityDef != null) { log.debug("Adding EntityDef: " + entityDef.toString()); this.checkForBlanksInTypeName(entityDef.getName()); EntityDef duplicateElement = entityDefMap.put(entityDef.getName(), entityDef); if (duplicateElement != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPE_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), TypeDefCategory.ENTITY_DEF.getName(), duplicateElement.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateGUID = guidMap.put(entityDef.getGUID(), entityDef); if (duplicateGUID != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_GUID_IN_ARCHIVE.getMessageDefinition(entityDef.getGUID(), duplicateGUID.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateName = nameMap.put(entityDef.getName(), entityDef); if (duplicateName != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPENAME_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), duplicateName.toString(), entityDef.toString()), this.getClass().getName(), methodName); } if (entityDef.getPropertiesDefinition() != null) { Set<String> attrSet = new HashSet<>(); for (TypeDefAttribute typeDefAttr : entityDef.getPropertiesDefinition()) { String duplicateAttributeName = typeDefAttr.getAttributeName(); if (attrSet.contains(duplicateAttributeName)) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_ENTITY_ATTR_IN_ARCHIVE.getMessageDefinition(duplicateAttributeName, entityDef.getName()), this.getClass().getName(), methodName); } attrSet.add(duplicateAttributeName); } } entityDefList.add(entityDef); } } OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     archiveVersion,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives); void addPrimitiveDef(PrimitiveDef   primitiveDef); PrimitiveDef getPrimitiveDef(String   primitiveDefName); void addCollectionDef(CollectionDef  collectionDef); void addEnumDef(EnumDef    enumDef); void addClassificationDef(ClassificationDef   classificationDef); void addEntityDef(EntityDef    entityDef); EntityDef getEntityDef(String   entityDefName); void addRelationshipDef(RelationshipDef   relationshipDef); TypeDefPatch getPatchForType(String  typeName); void addTypeDefPatch(TypeDefPatch  typeDefPatch); TypeDef getTypeDefByName(String  typeName); void addEntity(EntityDetail   entity); EntityDetail getEntity(String   guid); void addRelationship(Relationship  relationship); Relationship getRelationship(String   guid); void addClassification(ClassificationEntityExtension classification); OpenMetadataArchive getOpenMetadataArchive(); void logBadArchiveContent(String   methodName); }
OMRSArchiveBuilder { public void addEntityDef(EntityDef entityDef) { final String methodName = "addEntityDef"; if (entityDef != null) { log.debug("Adding EntityDef: " + entityDef.toString()); this.checkForBlanksInTypeName(entityDef.getName()); EntityDef duplicateElement = entityDefMap.put(entityDef.getName(), entityDef); if (duplicateElement != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPE_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), TypeDefCategory.ENTITY_DEF.getName(), duplicateElement.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateGUID = guidMap.put(entityDef.getGUID(), entityDef); if (duplicateGUID != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_GUID_IN_ARCHIVE.getMessageDefinition(entityDef.getGUID(), duplicateGUID.toString(), entityDef.toString()), this.getClass().getName(), methodName); } Object duplicateName = nameMap.put(entityDef.getName(), entityDef); if (duplicateName != null) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPENAME_IN_ARCHIVE.getMessageDefinition(entityDef.getName(), duplicateName.toString(), entityDef.toString()), this.getClass().getName(), methodName); } if (entityDef.getPropertiesDefinition() != null) { Set<String> attrSet = new HashSet<>(); for (TypeDefAttribute typeDefAttr : entityDef.getPropertiesDefinition()) { String duplicateAttributeName = typeDefAttr.getAttributeName(); if (attrSet.contains(duplicateAttributeName)) { throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_ENTITY_ATTR_IN_ARCHIVE.getMessageDefinition(duplicateAttributeName, entityDef.getName()), this.getClass().getName(), methodName); } attrSet.add(duplicateAttributeName); } } entityDefList.add(entityDef); } } OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     archiveVersion,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives); void addPrimitiveDef(PrimitiveDef   primitiveDef); PrimitiveDef getPrimitiveDef(String   primitiveDefName); void addCollectionDef(CollectionDef  collectionDef); void addEnumDef(EnumDef    enumDef); void addClassificationDef(ClassificationDef   classificationDef); void addEntityDef(EntityDef    entityDef); EntityDef getEntityDef(String   entityDefName); void addRelationshipDef(RelationshipDef   relationshipDef); TypeDefPatch getPatchForType(String  typeName); void addTypeDefPatch(TypeDefPatch  typeDefPatch); TypeDef getTypeDefByName(String  typeName); void addEntity(EntityDetail   entity); EntityDetail getEntity(String   guid); void addRelationship(Relationship  relationship); Relationship getRelationship(String   guid); void addClassification(ClassificationEntityExtension classification); OpenMetadataArchive getOpenMetadataArchive(); void logBadArchiveContent(String   methodName);  }