use of org.bimserver.database.queries.om.Properties in project BIMserver by opensourceBIM.
the class QueryPropertiesAndTypesStackFrame method processPropertySet.
@SuppressWarnings("unchecked")
private void processPropertySet(DatabaseSession databaseSession, Set<String> propertyKeysMatched, Long ifcPropertySetDefinition) throws BimserverDatabaseException {
EClass eClassForOid = databaseSession.getEClassForOid(ifcPropertySetDefinition);
if (getPackageMetaData().getEClass("IfcPropertySet").isSuperTypeOf(eClassForOid)) {
HashMapVirtualObject ifcPropertySet = getByOid(ifcPropertySetDefinition);
String propertySetName = (String) ifcPropertySet.get("Name");
Properties propertiesObject = (Properties) properties.get(propertySetName);
if (propertiesObject != null) {
List<Long> properties = (List<Long>) ifcPropertySet.get("HasProperties");
for (long propertyOid : properties) {
if (getPackageMetaData().getEClass("IfcPropertySingleValue").isSuperTypeOf(databaseSession.getEClassForOid(propertyOid))) {
HashMapVirtualObject property = getByOid(propertyOid);
String name = (String) property.get("Name");
HashMapWrappedVirtualObject value = (HashMapWrappedVirtualObject) property.get("NominalValue");
if (propertiesObject.has(name)) {
Object queryPropertyValue = propertiesObject.get(name);
Object wrappedValue = value.eGet(value.eClass().getEStructuralFeature("wrappedValue"));
if (value.eClass().getName().equals("IfcBoolean")) {
Enumerator tristate = (Enumerator) wrappedValue;
if (tristate.getName().toLowerCase().equals(queryPropertyValue.toString())) {
propertyKeysMatched.add(propertySetName + "___" + name);
}
} else if (wrappedValue.equals(queryPropertyValue)) {
propertyKeysMatched.add(propertySetName + "___" + name);
}
}
}
}
}
} else if (getPackageMetaData().getEClass("IfcPropertySetDefinition").isSuperTypeOf(eClassForOid)) {
HashMapVirtualObject ifcPropertySet = getByOid(ifcPropertySetDefinition);
Properties propertiesObject = (Properties) properties.get(ifcPropertySet.eClass().getName());
if (propertiesObject != null) {
for (String key : propertiesObject.keys()) {
if (ifcPropertySet.has(key)) {
if (ifcPropertySet.get(key).toString().equals(propertiesObject.get(key))) {
propertyKeysMatched.add(ifcPropertySet.eClass().getName() + "___" + key);
}
}
}
}
} else {
LOGGER.info(eClassForOid.getName());
}
}
Aggregations