コード例 #1
0
 protected static String stageFromDocumentInformation(IfcDocumentInformation documentInformation) {
   String stage = documentInformation.getScope();
   if (COBieUtility.isNA(stage)) {
     stage = IfcToDocument.Stage;
   }
   return COBieUtility.getCOBieString(stage);
 }
コード例 #2
0
  protected static String fileFromDocumentInformation(IfcDocumentInformation documentInformation) {
    String fileName = "";
    try {
      if ((documentInformation != null)
          && (documentInformation.getDocumentReferences() != null)
          && (documentInformation.getDocumentReferences().size() > 0)) {
        IfcDocumentReference firstReference = documentInformation.getDocumentReferences().get(0);
        String itemReference = "";
        String name = "";
        if (firstReference.isSetItemReference()) {
          itemReference = firstReference.getItemReference();
        }
        if (firstReference.isSetName()) {
          name = firstReference.getName();
        }
        if (!COBieUtility.isNA(name) && !documentInformation.getName().equals(name)) {
          fileName = name;
        } else if (!COBieUtility.isNA(itemReference)) {
          fileName = itemReference;
        }
        fileName = documentInformation.getDocumentReferences().get(0).getItemReference();
      }
      if (COBieUtility.isNA(fileName)) {
        fileName = IfcToDocument.File;
      }
    } catch (Exception ex) {

    }

    return fileName;
  }
コード例 #3
0
 protected static String approvalByFromDocumentInformation(
     IfcDocumentInformation documentInformation) {
   String approvalBy = documentInformation.getIntendedUse();
   if (COBieUtility.isNA(approvalBy)) {
     approvalBy = IfcToDocument.ApprovalBy;
   }
   return COBieUtility.getCOBieString(approvalBy);
 }
コード例 #4
0
 protected static String referenceFromDocumentInformation(
     IfcDocumentInformation documentInformation) {
   String referenceString = "";
   if (!COBieUtility.isNA(documentInformation.getDescription())) {
     referenceString = documentInformation.getDescription();
   } else {
     referenceString = documentInformation.getName();
   }
   return COBieUtility.getCOBieString(referenceString);
 }
コード例 #5
0
 protected static String extObjectFromRelAssociatesDocument(
     IfcRelAssociatesDocument relAssociatesDocument) {
   String extObject = "";
   if ((relAssociatesDocument.getRelatedObjects() != null)
       && (relAssociatesDocument.getRelatedObjects().size() > 0)) {
     extObject = relAssociatesDocument.getRelatedObjects().get(0).getClass().getSimpleName();
   }
   extObject = COBieUtility.trimImplFromClassNameString(extObject);
   return COBieUtility.getCOBieString(extObject);
 }
コード例 #6
0
 protected static String bamieRowNameFromDistributionElement(
     IfcDistributionElement distributionElement) {
   String rowName = "";
   for (IfcRelDecomposes decomposeRelation : distributionElement.getIsDecomposedBy()) {
     if ((decomposeRelation instanceof IfcRelAggregates) && COBieUtility.isNA(rowName)) {
       IfcRelAggregates aggregates = (IfcRelAggregates) decomposeRelation;
       rowName = aggregates.getRelatingObject().getName();
     }
   }
   return COBieUtility.getCOBieString(rowName);
 }
コード例 #7
0
 protected static String sheetNameFromRelAssociatesDocument(
     IfcRelAssociatesDocument relAssociatesDocument) {
   String sheetName = "";
   if ((relAssociatesDocument.getRelatedObjects() != null)
       && (relAssociatesDocument.getRelatedObjects().size() > 0)) {
     sheetName = sheetNameFromRoot(relAssociatesDocument.getRelatedObjects().get(0));
   }
   return COBieUtility.getCOBieString(sheetName);
 }
コード例 #8
0
 protected static String extIdFromRelAssociatesDocument(
     IfcRelAssociatesDocument relAssociatesDocument) {
   String extId = "";
   if ((relAssociatesDocument.getRelatedObjects() != null)
       && (relAssociatesDocument.getRelatedObjects().size() > 0)) {
     extId = COBieIfcUtility.extIdFromRoot(relAssociatesDocument.getRelatedObjects().get(0));
   }
   return COBieUtility.getCOBieString(extId);
 }
コード例 #9
0
 @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;
 }
コード例 #10
0
  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));
    }
  }
コード例 #11
0
 protected static String directoryFromDocumentInformation(
     IfcDocumentInformation documentInformation) {
   String directoryName = "";
   if ((documentInformation != null)
       && (documentInformation.getDocumentReferences() != null)
       && (documentInformation.getDocumentReferences().size() > 0)) {
     directoryName = documentInformation.getDocumentReferences().get(0).getLocation();
   }
   if (COBieUtility.isNA(directoryName)) {
     directoryName = IfcToDocument.Directory;
   }
   return directoryName;
 }
コード例 #12
0
  private void assignFromWarranty(
      WarrantyType warrantyType,
      Pset_Warranty warranty,
      TypeType newType,
      boolean assignOnlyOnNulls) {
    IfcPropertySingleValue duration = warranty.getWarrantyPeriod();
    IfcPropertyReferenceValue guarantor = warranty.getPointOfContact();

    IfcSingleValueToCOBieString durationStrings = null;
    IfcSingleValueToCOBieString warrantyDescription = null;
    try {
      durationStrings = new IfcSingleValueToCOBieString(duration);
    } catch (Exception ex) {

    }
    try {
      warrantyDescription = new IfcSingleValueToCOBieString(warranty.getWarrantyContent());
    } catch (Exception ex) {

    }

    String durationValue = (durationStrings == null ? null : durationStrings.getValueString());
    String durationUnit = (durationStrings == null ? null : durationStrings.getUnitString());
    String guarantorEmail = "";
    String existingDuration, existingGuarantor, existingDescription;
    String description =
        (warrantyDescription == null ? null : warrantyDescription.getValueString());
    existingDescription = newType.getWarrantyDescription();
    if ((guarantor != null)
        && (guarantor.getPropertyReference() != null)
        && (guarantor.getPropertyReference() instanceof IfcOrganization)) {
      guarantorEmail =
          COBieIfcUtility.getEmailFromOrganization(
              (IfcOrganization) guarantor.getPropertyReference());
    }
    switch (warrantyType) {
      case LABOR:
        if (assignOnlyOnNulls) {
          existingDuration = newType.getWarrantyDurationLabor();
          existingGuarantor = newType.getWarrantyGuarantorLabor();

          if (COBieUtility.isNA(existingDuration)) {
            newType.setWarrantyDurationLabor(durationValue);
          }
          if (COBieUtility.isNA(existingGuarantor)) {
            newType.setWarrantyGuarantorLabor(guarantorEmail);
          }
        } else {
          newType.setWarrantyDurationLabor(durationValue);
          newType.setWarrantyGuarantorLabor(guarantorEmail);
        }
        break;
      case PARTS:
        if (assignOnlyOnNulls) {
          existingDuration = newType.getWarrantyDurationParts();
          existingGuarantor = newType.getWarrantyGuarantorParts();
          if (COBieUtility.isNA(existingDuration)) {
            newType.setWarrantyDurationParts(durationValue);
          }
          if (COBieUtility.isNA(existingGuarantor)) {
            newType.setWarrantyGuarantorParts(guarantorEmail);
          }
        } else {
          newType.setWarrantyDurationParts(durationValue);
          newType.setWarrantyGuarantorParts(guarantorEmail);
        }
        break;
      default:
        break;
    }
    if (assignOnlyOnNulls) {
      if (COBieUtility.isNA(newType.getWarrantyDurationUnit())) {
        newType.setDurationUnit(durationUnit);
      }
      if (COBieUtility.isNA(existingDescription)) {
        newType.setWarrantyDescription(existingDescription);
      }
    } else {
      newType.setDurationUnit(durationUnit);
      newType.setWarrantyDescription(description);
    }
  }
コード例 #13
0
 protected static String descriptionFromDocumentInformation(
     IfcDocumentInformation documentInformation) {
   String documentation = documentInformation.getDescription();
   return COBieUtility.getCOBieString(documentation);
 }
コード例 #14
0
 protected static String categoryFromDocumentInformation(
     IfcDocumentInformation documentInformation) {
   String category = "";
   category = documentInformation.getPurpose();
   return COBieUtility.getCOBieString(category);
 }
コード例 #15
0
 protected static String nameFromDocumentInformation(IfcDocumentInformation documentInformation) {
   String name = documentInformation.getName();
   return COBieUtility.getCOBieString(name);
 }
コード例 #16
0
  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) {

      }
    }
  }