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)); }
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); }
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); } }
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 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 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) { } } }