コード例 #1
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;
  }
コード例 #2
0
 protected static String stageFromDocumentInformation(IfcDocumentInformation documentInformation) {
   String stage = documentInformation.getScope();
   if (COBieUtility.isNA(stage)) {
     stage = IfcToDocument.Stage;
   }
   return COBieUtility.getCOBieString(stage);
 }
コード例 #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 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);
 }
コード例 #6
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;
 }
コード例 #7
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));
    }
  }
コード例 #8
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;
 }
コード例 #9
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);
    }
  }