private void handleCommonFields(IfcTypeObject type, IfcOwnerHistory oh, TypeType newType) {
   newType.setName(IfcToType.nameFromTypeObject(type));
   newType.setCreatedBy(COBieIfcUtility.getEmailFromOwnerHistory(oh));
   newType.setCreatedOn(IfcToContact.getCreatedOn(oh.getCreationDate()));
   newType.setCategory(IfcToType.categoryFromTypeObject(type));
   newType.setDescription(IfcToType.descriptionFromTypeObject(type));
   newType.setExtSystem(COBieIfcUtility.getApplicationName(oh));
   newType.setExtObject(IfcToType.extObjectFromTypeObject(type));
   newType.setExtIdentifier(COBieIfcUtility.identifierFromObjectDefinition(type));
 }
  @Override
  protected List<TypeType> serializeModelObject(IfcTypeObject type) {
    List<TypeType> newTypes = new ArrayList<TypeType>();

    IfcOwnerHistory oh = type.getOwnerHistory();
    if (type != null && (!ignoreNonAssets || IfcToType.isAssetType(type))) {
      TypeType newType = cobieSection.addNewType();
      handleCommonFields(type, oh, newType);
      newType.setAssetType(IfcToType.assetTypeFromTypeObject(type));
      handleManufacturerInfo(type, newType);
      handleWarrantyFields(type, newType);
      handleServiceLife(type, newType);
      handleExtendedAttributes(type, newType);
      newTypes.add(newType);
    }
    return newTypes;
  }
 private void handleServiceLife(IfcTypeObject type, TypeType newType) {
   newType.setReplacementCost(IfcToType.replacementCostFromTypeObject(type));
   newType.setExpectedLife(IfcToType.expectedLifeFromTypeObject(type));
   newType.setDurationUnit(IfcToType.durationUnitsFromTypeObject(type, model));
 }
 private void handleManufacturerInfo(IfcTypeObject type, TypeType newType) {
   newType.setManufacturer(IfcToType.manufacturerFromTypeObject(type));
   newType.setModelNumber(IfcToType.modelNumberFromTypeObject(type));
 }
 private void handleExtendedAttributes(IfcTypeObject type, TypeType newType) {
   newType.setNominalLength(IfcToType.nominalLengthFromTypeObject(type));
   newType.setNominalWidth(IfcToType.nominalWidthFromTypeObject(type));
   newType.setNominalHeight(IfcToType.nominalHeightFromTypeObject(type));
   newType.setModelReference(IfcToType.modelReferenceFromTypeObject(type));
   newType.setShape(IfcToType.shapeFromTypeObject(type));
   newType.setSize(IfcToType.sizeFromTypeObject(type));
   newType.setColor(IfcToType.colorFromTypeObject(type));
   newType.setFinish(IfcToType.finishFromTypeObject(type));
   newType.setGrade(IfcToType.gradeFromTypeObject(type));
   newType.setMaterial(IfcToType.materialFromTypeObject(type));
   newType.setConstituents(IfcToType.constituentsStringFromTypeObject(type));
   newType.setFeatures(IfcToType.featuresFromTypeObject(type));
   newType.setAccessibilityPerformance(IfcToType.accessibilityPerformanceFromTypeObject(type));
   newType.setCodePerformance(IfcToType.codePerformanceFromTypeObject(type));
   newType.setSustainabilityPerformance(IfcToType.sustainabilityPerformanceFromTypeObject(type));
 }
  private void assignWarrantyInformationByPropertyNames(
      IfcTypeObject type, TypeType newType, boolean assignOnlyOnNulls) {

    if (assignOnlyOnNulls) {
      if (COBieUtility.isNA(newType.getWarrantyGuarantorParts())) {
        newType.setWarrantyGuarantorParts(IfcToType.warrantyGuarantorPartsFromTypeObject(type));
      }
      if (COBieUtility.isNA(newType.getWarrantyDurationParts())) {
        newType.setWarrantyDurationParts(IfcToType.warrantyDurationPartsFromTypeObject(type));
      }
      if (COBieUtility.isNA(newType.getWarrantyGuarantorLabor())) {
        newType.setWarrantyGuarantorLabor(IfcToType.warrantyGuarantorLaborFromTypeObject(type));
      }
      if (COBieUtility.isNA(newType.getWarrantyDurationLabor())) {
        newType.setWarrantyDurationLabor(IfcToType.warrantyDurationLaborFromTypeObject(type));
      }
      if (COBieUtility.isNA(newType.getWarrantyDurationUnit())) {
        newType.setWarrantyDurationUnit(IfcToType.warrantyDurationUnitsFromTypeObject(type, model));
      }
      if (COBieUtility.isNA(newType.getWarrantyDescription())) {
        newType.setWarrantyDescription(IfcToType.warrantyDescriptionFromTypeObject(type));
      }
    } else {
      newType.setWarrantyGuarantorParts(IfcToType.warrantyGuarantorPartsFromTypeObject(type));
      newType.setWarrantyDurationParts(IfcToType.warrantyDurationPartsFromTypeObject(type));
      newType.setWarrantyGuarantorLabor(IfcToType.warrantyGuarantorLaborFromTypeObject(type));
      newType.setWarrantyDurationLabor(IfcToType.warrantyDurationLaborFromTypeObject(type));
      newType.setWarrantyDurationUnit(IfcToType.warrantyDurationUnitsFromTypeObject(type, model));
      newType.setWarrantyDescription(IfcToType.warrantyDescriptionFromTypeObject(type));
    }
  }
 protected static String nameFromTypeObject(IfcTypeObject type) {
   String name = IfcToType.nameFromTypeObject(type) + TypeNameSuffix;
   return name;
 }
  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);
        }
      }
    }
  }
 protected static String descriptionFromTypeObject(IfcTypeObject type) {
   return IfcToType.descriptionFromTypeObject(type);
 }