@SuppressWarnings("deprecation")
 private static ArrayList<String> getExistingTypes(COBIEType.Documents documents) {
   ArrayList<String> existingTypes = new ArrayList<String>();
   for (DocumentType document : documents.getDocumentArray()) {
     if (document.getSheetName().equalsIgnoreCase(COBieUtility.CobieSheetName.Type.name())
         && !COBieUtility.isNA(document.getName())) {
       existingTypes.add(document.getName());
     }
   }
   return existingTypes;
 }
  private static void exportDocumentInformationObjects(
      IfcModelInterface model,
      LogHandler loggerHandler,
      ArrayList<String> documentNames,
      COBIEType.Documents documents) {
    String name;
    String createdBy;
    Calendar createdOn;
    String category;
    String approvalBy;
    String stage;
    String sheetName;
    String rowName;
    String directory;
    String file;
    String extSystem;
    String extObject;
    String extIdentifier;
    String description;
    String reference;
    IfcOwnerHistory oh;
    DocumentType tempDocument;
    for (IfcRelAssociatesDocument relAssociatesDocument :
        model.getAll(IfcRelAssociatesDocument.class)) {
      IfcDocumentSelect docInfoSelect = relAssociatesDocument.getRelatingDocument();
      if (docInfoSelect instanceof IfcDocumentInformation) {
        IfcDocumentInformation docInfo = (IfcDocumentInformation) docInfoSelect;
        try {

          name = IfcToDocument.nameFromDocumentInformation(docInfo);
          oh = relAssociatesDocument.getOwnerHistory();
          createdBy = COBieIfcUtility.getEmailFromOwnerHistory(oh);
          createdOn = IfcToContact.getCreatedOn(oh.getCreationDate());
          category = IfcToDocument.categoryFromDocumentInformation(docInfo);
          approvalBy = IfcToDocument.approvalByFromDocumentInformation(docInfo);
          stage = IfcToDocument.stageFromDocumentInformation(docInfo);
          sheetName = IfcToDocument.sheetNameFromRelAssociatesDocument(relAssociatesDocument);
          rowName = IfcToDocument.rowNameFromRelAssociatesDocument(relAssociatesDocument);
          directory = IfcToDocument.directoryFromDocumentInformation(docInfo);
          file = IfcToDocument.fileFromDocumentInformation(docInfo);
          extSystem = COBieIfcUtility.getApplicationName(oh);
          extObject = IfcToDocument.extObjectFromRelAssociatesDocument(relAssociatesDocument);
          extIdentifier = IfcToDocument.extIdFromRelAssociatesDocument(relAssociatesDocument);
          description = IfcToDocument.descriptionFromDocumentInformation(docInfo);
          reference = IfcToDocument.referenceFromDocumentInformation(docInfo);

          tempDocument = documents.addNewDocument();
          tempDocument.setName(name);
          tempDocument.setCreatedBy(createdBy);
          tempDocument.setCreatedOn(createdOn);
          tempDocument.setCategory(category);
          tempDocument.setApprovalBy(approvalBy);
          tempDocument.setStage(stage);
          tempDocument.setSheetName(sheetName);
          tempDocument.setRowName(rowName);
          tempDocument.setDirectory(directory);
          tempDocument.setFile(file);
          tempDocument.setExtSystem(extSystem);
          tempDocument.setExtIdentifier(extIdentifier);
          tempDocument.setExtObject(extObject);
          tempDocument.setDescription(description);
          tempDocument.setReference(reference);
          documentNames.add(name);
          loggerHandler.rowWritten();
        } catch (Exception ex) {
          loggerHandler.error(ex);
        }
      }
    }
  }
  private static void exportTypeInformation(
      IfcModelInterface model,
      LogHandler loggerHandler,
      ArrayList<String> typeNames,
      ArrayList<String> documentNames,
      COBIEType.Documents documents) {
    String name;
    String createdBy;
    Calendar createdOn;
    String category;
    String approvalBy;
    String stage;
    String sheetName;
    String rowName;
    String directory;
    String file;
    String extSystem;
    String extObject;
    String extIdentifier;
    String description;
    String reference;
    IfcOwnerHistory oh;
    DocumentType tempDocument;
    if (documentNames.size() == 0) {
      for (IfcRelDefinesByType defByType : model.getAll(IfcRelDefinesByType.class)) {
        try {
          IfcTypeObject type = defByType.getRelatingType();
          if (type != null) {
            name = IfcToDocument.nameFromTypeObject(type);
            if (!typeNames.contains(name)) {

              oh = COBieIfcUtility.firstOwnerHistoryFromModel(model);
              createdBy = COBieIfcUtility.getEmailFromOwnerHistory(oh);
              createdOn = IfcToContact.getCreatedOn(oh.getCreationDate());
              category = IfcToDocument.categoryFromTypeObject(type);
              approvalBy = IfcToDocument.ApprovalBy;
              stage = IfcToDocument.Stage;
              sheetName = IfcToDocument.TypeSheetName;
              rowName = IfcToType.nameFromTypeObject(type);
              directory = IfcToDocument.Directory;
              file = IfcToDocument.File;
              extSystem = COBieIfcUtility.getApplicationName(oh);
              extObject = IfcToType.extObjectFromTypeObject(type);
              extIdentifier = COBieIfcUtility.extIdFromRoot(type);
              description = IfcToDocument.descriptionFromTypeObject(type);
              reference = IfcToDocument.Reference;

              tempDocument = documents.addNewDocument();
              typeNames.add(name);
              tempDocument.setName(name);
              tempDocument.setCreatedBy(createdBy);
              tempDocument.setCreatedOn(createdOn);
              tempDocument.setCategory(category);
              tempDocument.setApprovalBy(approvalBy);
              tempDocument.setStage(stage);
              tempDocument.setSheetName(sheetName);
              tempDocument.setRowName(rowName);
              tempDocument.setDirectory(directory);
              tempDocument.setFile(file);
              tempDocument.setExtSystem(extSystem);
              tempDocument.setExtObject(extObject);
              tempDocument.setExtIdentifier(extIdentifier);
              tempDocument.setDescription(description);
              tempDocument.setReference(reference);
              loggerHandler.rowWritten();
            }
          }
        } catch (Exception ex) {
          loggerHandler.error(ex);
        }
      }
    }
  }
  private static void exportBAMieClassificationReferences(
      IfcModelInterface model,
      LogHandler loggerHandler,
      ArrayList<String> documentNames,
      COBIEType.Documents documents) {
    String name;
    String createdBy;
    Calendar createdOn;
    String category;
    String approvalBy;
    String stage;
    String sheetName;
    String rowName;
    String directory;
    String extSystem;
    String extObject;
    String extIdentifier;
    String description;
    String reference;
    IfcOwnerHistory oh;
    DocumentType tempDocument;
    for (IfcDistributionElement element : model.getAllWithSubTypes(IfcDistributionElement.class)) {
      try {
        for (IfcRelAssociates relAssociates : element.getHasAssociations()) {
          if (relAssociates instanceof IfcRelAssociatesClassification) {
            category = COBieIfcUtility.getObjectClassificationCategoryString(element);
            if (ClassificationHandler.isBAMieRelAssociatesClassification(
                (IfcRelAssociatesClassification) relAssociates)) {
              name = COBieUtility.getCOBieString(element.getName());
              oh = element.getOwnerHistory();
              createdBy = COBieIfcUtility.getEmailFromOwnerHistory(oh);
              createdOn = IfcToContact.getCreatedOn(oh.getCreationDate());
              category = IfcToDocument.BAMIE_CATEGORY;
              approvalBy = IfcToDocument.ApprovalBy;
              stage = IfcToDocument.Stage;
              sheetName = COBieUtility.CobieSheetName.Component.name();
              rowName = IfcToDocument.bamieRowNameFromDistributionElement(element);
              extSystem = COBieIfcUtility.getApplicationName(oh);
              extObject = IfcToComponent.extObjectFromProduct(element);
              extIdentifier = COBieIfcUtility.extIdFromRoot(element);
              description = COBieUtility.getCOBieString(element.getName());
              reference = IfcToDocument.Reference;

              IfcClassificationReference classificationReference =
                  COBieIfcUtility.getObjectClassificationReference(element);
              directory = COBieUtility.getCOBieString(classificationReference.getLocation());

              tempDocument = documents.addNewDocument();
              tempDocument.setName(name);
              tempDocument.setCreatedBy(createdBy);
              tempDocument.setCreatedOn(createdOn);
              tempDocument.setCategory(category);
              tempDocument.setApprovalBy(approvalBy);
              tempDocument.setStage(stage);
              tempDocument.setSheetName(sheetName);
              tempDocument.setRowName(rowName);
              tempDocument.setDirectory(directory);
              tempDocument.setFile(COBieUtility.COBieNA);
              tempDocument.setExtSystem(extSystem);
              tempDocument.setExtObject(extObject);
              tempDocument.setExtIdentifier(extIdentifier);
              tempDocument.setDescription(description);
              tempDocument.setReference(reference);
              loggerHandler.rowWritten();
            }
          }
        }
      } catch (Exception ex) {

      }
    }
  }