Пример #1
0
 private static String descriptionFromConstructionEquipmentResource(
     IfcConstructionEquipmentResource equipmentResource) {
   String description = equipmentResource.getDescription();
   if ((description == null) || description.isEmpty()) {
     description = equipmentResource.getName();
   }
   return COBieUtility.getCOBieString(description);
 }
Пример #2
0
  public static void writeResources(COBIEType cType, IfcModelInterface model) {
    LogHandler loggerHandler = new LogHandler(sheetName, LOGGER);
    loggerHandler.sheetWriteBegin();
    COBIEType.Resources resources;
    String name;
    IfcOwnerHistory oh;
    String createdBy;
    Calendar createdOn;
    String category;
    String extSystem;
    String extObject;
    String extIdentifier;
    String description;
    try {
      resources = cType.getResources();
      if (resources == null) {
        resources = cType.addNewResources();
      }
    } catch (Exception ex) {
      resources = cType.addNewResources();
    }

    for (IfcConstructionEquipmentResource equipmentResource :
        model.getAll(IfcConstructionEquipmentResource.class)) {
      try {

        name = IfcToResource.nameFromConstructionEquipmentResource(equipmentResource);
        oh = equipmentResource.getOwnerHistory();
        createdBy = COBieUtility.getEmailFromOwnerHistory(oh);
        createdOn = IfcToContact.getCreatedOn(oh.getCreationDate());
        category = IfcToResource.categoryFromConstructionEquipmentResource(equipmentResource);
        extSystem = COBieUtility.getApplicationName(oh);
        extObject = COBieUtility.extObjectFromObjectDef(equipmentResource);
        extIdentifier = COBieUtility.extIdFromRoot(equipmentResource);
        description = IfcToResource.descriptionFromConstructionEquipmentResource(equipmentResource);

        ResourceType resource = resources.addNewResource();
        resource.setName(name);
        resource.setCreatedBy(createdBy);
        resource.setCreatedOn(createdOn);
        resource.setCategory(category);
        resource.setExtSystem(extSystem);
        resource.setExtObject(extObject);
        resource.setExtIdentifier(extIdentifier);
        resource.setDescription(description);
        loggerHandler.rowWritten();
      } catch (Exception ex) {
        loggerHandler.error(ex);
      }
    }
    loggerHandler.sheetWritten();
  }
Пример #3
0
 private static String nameFromConstructionEquipmentResource(
     IfcConstructionEquipmentResource equipmentResource) {
   String name = equipmentResource.getName();
   return COBieUtility.getCOBieString(name);
 }
Пример #4
0
 private static String categoryFromConstructionEquipmentResource(
     IfcConstructionEquipmentResource equipmentResource) {
   String category = equipmentResource.getObjectType();
   return COBieUtility.getCOBieString(category);
 }