class OMRSArchiveBuilder {

    public void addRelationshipDef(RelationshipDef   relationshipDef)
    {
        final String methodName = "addRelationshipDef";

        if (relationshipDef != null)
        {
            log.debug("Adding RelationshipDef: " + relationshipDef.toString());
            
            this.checkForBlanksInTypeName(relationshipDef.getName());
            RelationshipDef duplicateElement = relationshipDefMap.put(relationshipDef.getName(), relationshipDef);

            if (duplicateElement != null)
            {
                throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPE_IN_ARCHIVE.getMessageDefinition(relationshipDef.getName(),
                                                                                                               TypeDefCategory.RELATIONSHIP_DEF.getName(),
                                                                                                               duplicateElement.toString(),
                                                                                                               relationshipDef.toString()),
                                                  this.getClass().getName(),
                                                  methodName);
            }

            Object  duplicateGUID = guidMap.put(relationshipDef.getGUID(), relationshipDef);

            if (duplicateGUID != null)
            {
                throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_GUID_IN_ARCHIVE.getMessageDefinition(relationshipDef.getGUID(),
                                                                                                               duplicateGUID.toString(),
                                                                                                               relationshipDef.toString()),
                                                  this.getClass().getName(),
                                                  methodName);
            }

            Object  duplicateName = nameMap.put(relationshipDef.getName(), relationshipDef);

            if (duplicateName != null)
            {
                throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_TYPENAME_IN_ARCHIVE.getMessageDefinition(relationshipDef.getName(),
                                                                                                                   duplicateName.toString(),
                                                                                                                   relationshipDef.toString()),
                                                  this.getClass().getName(),
                                                  methodName);
            }
            
            this.checkRelationshipDefDuplicateAttributes(relationshipDef);

            if (relationshipDef.getPropertiesDefinition() != null)
            {
                Set<String> attributeSet = new HashSet<>();
                for (TypeDefAttribute typeDefAttr : relationshipDef.getPropertiesDefinition())
                {
                    String duplicateAttributeName = typeDefAttr.getAttributeName();
                    if (attributeSet.contains(duplicateAttributeName))
                    {
                        /*
                         * relationship duplicate attribute name
                         */
                        throw new OMRSLogicErrorException(OMRSErrorCode.DUPLICATE_RELATIONSHIP_ATTR_IN_ARCHIVE.getMessageDefinition(duplicateAttributeName,
                                                                                                                                    relationshipDef.getName()),
                                                          this.getClass().getName(),
                                                          methodName);
                    }
                    attributeSet.add(duplicateAttributeName);
                }
            }
            relationshipDefList.add(relationshipDef);
        }
    }

    public  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);
    public  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);
    public  OMRSArchiveBuilder(String                     archiveGUID,
                              String                     archiveName,
                              String                     archiveDescription,
                              OpenMetadataArchiveType    archiveType,
                              String                     archiveVersion,
                              String                     originatorName,
                              String                     originatorLicense,
                              Date                       creationDate,
                              List<OpenMetadataArchive>  dependsOnArchives);

}