diff --git a/BimServer/pom.xml b/BimServer/pom.xml index bfca5d1360..4632452b01 100644 --- a/BimServer/pom.xml +++ b/BimServer/pom.xml @@ -5,7 +5,7 @@ de.weltweitbau parent - 1.0.0 + 1.1.0 src diff --git a/BimServer/src/org/bimserver/database/queries/DatabaseReadingStackFrame.java b/BimServer/src/org/bimserver/database/queries/DatabaseReadingStackFrame.java index 3a2434145e..e418e22e85 100644 --- a/BimServer/src/org/bimserver/database/queries/DatabaseReadingStackFrame.java +++ b/BimServer/src/org/bimserver/database/queries/DatabaseReadingStackFrame.java @@ -606,56 +606,155 @@ private void includeProperties(HashMapVirtualObject object) throws BimserverData * Added by WWB. * * Searches a PropertySet for properties to be included in the current HashMapVirtualObject + * * @param databaseSession * @param includedProperties * @param ifcPropertySetDefinition * @throws BimserverDatabaseException */ @SuppressWarnings("unchecked") - private void processPropertySet(DatabaseSession databaseSession, HashMap includedProperties, Long ifcPropertySetDefinition) throws BimserverDatabaseException { + private void processPropertySet(DatabaseSession databaseSession, HashMap includedProperties, + Long ifcPropertySetDefinition) throws BimserverDatabaseException { Map> includeProperties = getQueryPart().getIncludeProperties(); - Set propertiesToIncludeAll = includeProperties.get("ALL"); - EClass eClassForOid = databaseSession.getEClassForOid(ifcPropertySetDefinition); - if (getPackageMetaData().getEClass("IfcPropertySet").isSuperTypeOf(eClassForOid)) { - HashMapVirtualObject ifcPropertySet = getByOid(ifcPropertySetDefinition); - String propertySetName = (String) ifcPropertySet.get("Name"); - - Set propertiesToInclude = includeProperties.get(propertySetName); - - if(propertiesToInclude == null && propertiesToIncludeAll == null) { - return; - } else if(propertiesToInclude == null) { - propertiesToInclude = propertiesToIncludeAll; + + HashMapVirtualObject ifcPropertySet = getByOid(ifcPropertySetDefinition); + if(ifcPropertySet.has("Name") == false) { + return; + } + + String propertySetName = (String) ifcPropertySet.get("Name"); + Set propertiesToInclude = includeProperties.get(propertySetName); + + if (propertiesToInclude == null && propertiesToIncludeAll == null) { + return; + } else if (propertiesToInclude == null) { + propertiesToInclude = propertiesToIncludeAll; + propertySetName = "ALL"; + } + + if (matchesType(eClassForOid, "IfcElementQuantity")) { + processQuantities(databaseSession, includedProperties, ifcPropertySet, propertySetName, propertiesToInclude); + return; + } + + if (matchesType(eClassForOid, "IfcPropertySet") == false) { + return; + } + + List properties = (List) ifcPropertySet.get("HasProperties"); + for (long propertyOid : properties) { + eClassForOid = databaseSession.getEClassForOid(propertyOid); + if (matchesType(eClassForOid, "IfcPropertySingleValue") == false) { + LOGGER.info("processPropertySet: Type not supported! - " + eClassForOid.getName()); + continue; } - List properties = (List) ifcPropertySet.get("HasProperties"); - for (long propertyOid : properties) { - if (getPackageMetaData().getEClass("IfcPropertySingleValue").isSuperTypeOf(databaseSession.getEClassForOid(propertyOid)) == false) { - continue; - } - HashMapVirtualObject property = getByOid(propertyOid); - String name = (String) property.get("Name"); + HashMapVirtualObject property = getByOid(propertyOid); + includePropertySingleValue(property, propertySetName, propertiesToInclude, includedProperties); + } + } + + /** + * Added by WWB. + * + * add a IfcPropertySingleValue to the included properties + * + * @param property + * @param propertySetName + * @param propertiesToInclude + * @param includedProperties + */ + private void includePropertySingleValue(HashMapVirtualObject property, String propertySetName, Set propertiesToInclude, HashMap includedProperties) { + String name = (String) property.get("Name"); - if (propertiesToInclude.contains(name) == false) { - continue; - } + if (propertiesToInclude.contains(name) == false) { + return; + } - HashMapWrappedVirtualObject value = (HashMapWrappedVirtualObject) property.get("NominalValue"); - - if(value == null) { - continue; - } + HashMapWrappedVirtualObject value = (HashMapWrappedVirtualObject) property.get("NominalValue"); - Object wrappedValue = value.eGet(value.eClass().getEStructuralFeature("wrappedValue")); - if (value.eClass().getName().equals("IfcBoolean")) { - Enumerator tristate = (Enumerator) wrappedValue; - includedProperties.put(name, tristate.getName().toLowerCase()); - } else { - includedProperties.put(name, wrappedValue.toString()); - } + if (value == null) { + return; + } + + Object wrappedValue = value.eGet(value.eClass().getEStructuralFeature("wrappedValue")); + if (value.eClass().getName().equals("IfcBoolean")) { + Enumerator tristate = (Enumerator) wrappedValue; + includedProperties.put(propertySetName + ":" + name, tristate.getName().toLowerCase()); + } else { + includedProperties.put(propertySetName + ":" + name, wrappedValue.toString()); + } + } + + /** + * Added by WWB. + * + * Searches a Quantity Set for quantities to be included in the current HashMapVirtualObject + * + * @param databaseSession + * @param includedProperties + * @param ifcQuantities + * @param quantitySetName + * @param propertiesToInclude + * @throws BimserverDatabaseException + */ + @SuppressWarnings("unchecked") + private void processQuantities(DatabaseSession databaseSession, HashMap includedProperties, + HashMapVirtualObject ifcQuantities, String quantitySetName, Set propertiesToInclude) + throws BimserverDatabaseException { + EClass eClassForOid = null; + List quantities = (List) ifcQuantities.get("Quantities"); + for (long quantityOid : quantities) { + eClassForOid = databaseSession.getEClassForOid(quantityOid); + if (matchesType(eClassForOid, "IfcPhysicalQuantity") == false) { + LOGGER.info("processQuantities: Type not supported! - " + eClassForOid.getName()); + continue; } + + HashMapVirtualObject quantity = getByOid(quantityOid); + includeQuantity(quantity, quantitySetName, propertiesToInclude, includedProperties); } + } + + /** + * Added by WWB. + * + * add a IfcPhysicalQuantity value to the included properties + * + * @param quantity + * @param quantitySetName + * @param propertiesToInclude + * @param includedProperties + */ + private void includeQuantity(HashMapVirtualObject quantity, String quantitySetName, Set propertiesToInclude, HashMap includedProperties) { + String name = (String) quantity.get("Name"); + + if (propertiesToInclude.contains(name) == false) { + return; + } + + String strQuantityType = quantity.eClass().getName().replace("IfcQuantity", ""); + Object value = quantity.get(strQuantityType + "Value"); + + if (value == null) { + return; + } + + includedProperties.put(quantitySetName + ":" + name, value.toString()); + } + + /** + * Added by WWB. + * + * is subClass the same or a child of strSuper? + * + * @param subClass + * @param strSuper + * @return true if subClass inherits from strSuper or is the same as strSuper + */ + private boolean matchesType(EClass subClass, String strSuper) { + return getPackageMetaData().getEClass(strSuper).isSuperTypeOf(subClass); } } \ No newline at end of file diff --git a/BimServerClientLib/pom.xml b/BimServerClientLib/pom.xml index f610fac5bd..253e4b55b9 100644 --- a/BimServerClientLib/pom.xml +++ b/BimServerClientLib/pom.xml @@ -6,7 +6,7 @@ de.weltweitbau parent - 1.0.0 + 1.1.0 9.4.19.v20190610 diff --git a/BimServerJar/pom.xml b/BimServerJar/pom.xml index e8a27db7e9..ab6ad39677 100644 --- a/BimServerJar/pom.xml +++ b/BimServerJar/pom.xml @@ -7,7 +7,7 @@ de.weltweitbau parent - 1.0.0 + 1.1.0 9.4.19.v20190610 diff --git a/BimServerWar/pom.xml b/BimServerWar/pom.xml index 90adc9b9db..24732fb6d5 100644 --- a/BimServerWar/pom.xml +++ b/BimServerWar/pom.xml @@ -7,7 +7,7 @@ de.weltweitbau parent - 1.0.0 + 1.1.0 src diff --git a/PluginBase/pom.xml b/PluginBase/pom.xml index b5c9a46ebb..0b1e86ac01 100644 --- a/PluginBase/pom.xml +++ b/PluginBase/pom.xml @@ -7,7 +7,7 @@ de.weltweitbau parent - 1.0.0 + 1.1.0 src diff --git a/Shared/pom.xml b/Shared/pom.xml index ac0976cbe9..5a69378080 100644 --- a/Shared/pom.xml +++ b/Shared/pom.xml @@ -6,7 +6,7 @@ de.weltweitbau parent - 1.0.0 + 1.1.0 src diff --git a/Tests/pom.xml b/Tests/pom.xml index 083a315dc5..0d44bcbf06 100644 --- a/Tests/pom.xml +++ b/Tests/pom.xml @@ -4,7 +4,7 @@ de.weltweitbau parent - 1.0.0 + 1.1.0 src @@ -45,7 +45,7 @@ de.weltweitbau bimserverjar - 1.0.0 + ${project.version} org.slf4j diff --git a/pom.xml b/pom.xml index 8b897451d3..35ff1ed35c 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 de.weltweitbau parent - 1.0.0 + 1.1.0 pom This is the parent pom, no idea why this is being released