use of org.bimserver.plugins.objectidms.ObjectIDM in project BIMserver by opensourceBIM.
the class LongDownloadAction method init.
public void init(Thread thread) {
super.init(thread);
if (getBimServer().getServerSettingsCache().getServerSettings().getCacheOutputFiles() && getBimServer().getDiskCacheManager().contains(downloadParameters)) {
return;
}
ObjectIDM objectIDM = null;
if (downloadParameters.getUseObjectIDM()) {
session = getBimServer().getDatabase().createSession();
try {
SerializerPluginConfiguration serializerPluginConfiguration = session.get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(), downloadParameters.getSerializerOid(), OldQuery.getDefault());
if (serializerPluginConfiguration != null) {
ObjectIDMPluginConfiguration objectIdm = serializerPluginConfiguration.getObjectIDM();
if (objectIdm != null) {
ObjectIDMPlugin objectIDMPlugin = getBimServer().getPluginManager().getObjectIDMByName(objectIdm.getPluginDescriptor().getPluginClassName(), true);
if (objectIDMPlugin != null) {
objectIDM = objectIDMPlugin.getObjectIDM(new PluginConfiguration());
}
}
}
} catch (BimserverDatabaseException e) {
LOGGER.error("", e);
} finally {
session.close();
}
}
session = getBimServer().getDatabase().createSession();
switch(downloadParameters.getDownloadType()) {
case DOWNLOAD_BY_NEW_JSON_QUERY:
action = new DownloadByNewJsonQueryDatabaseAction(getBimServer(), session, accessMethod, downloadParameters.getRoids(), downloadParameters.getJsonQuery(), downloadParameters.getSerializerOid(), getAuthorization());
break;
case DOWNLOAD_PROJECTS:
action = new DownloadProjectsDatabaseAction(getBimServer(), session, accessMethod, downloadParameters.getRoids(), downloadParameters.getSerializerOid(), getAuthorization(), objectIDM);
break;
case DOWNLOAD_COMPARE:
action = new DownloadCompareDatabaseAction(getBimServer(), session, accessMethod, downloadParameters.getRoids(), downloadParameters.getModelCompareIdentifier(), downloadParameters.getCompareType(), getAuthorization(), objectIDM);
break;
}
action.addProgressListener(this);
}
use of org.bimserver.plugins.objectidms.ObjectIDM in project BIMserver by opensourceBIM.
the class ModelHelper method initObjectIdmCache.
private static void initObjectIdmCache(final MetaDataManager metaDataManager) {
hideAllInverseMap = new HashMap<EPackage, HideAllInversesObjectIDM>();
objectIdmCache = new HashMap<EClass, ObjectIDM>();
for (PackageMetaData packageMetaData : metaDataManager.getAllIfc()) {
final HideAllInversesObjectIDM hideAllInverse = new HideAllInversesObjectIDM(Collections.singleton(packageMetaData.getEPackage()), packageMetaData);
hideAllInverseMap.put(packageMetaData.getEPackage(), hideAllInverse);
for (final EClass onlyIncludeRepresentationForThisClass : packageMetaData.getAllSubClasses(packageMetaData.getEClass("IfcProduct"))) {
ObjectIDM objectIdm = new ObjectIDM() {
@Override
public boolean shouldIncludeClass(EClass originalClass, EClass eClass) {
return hideAllInverse.shouldIncludeClass(originalClass, eClass);
}
@Override
public boolean shouldFollowReference(EClass originalClass, EClass eClass, EStructuralFeature eStructuralFeature) {
if (eStructuralFeature.getName().equals("Representation") && onlyIncludeRepresentationForThisClass != eClass) {
return false;
} else {
if (eStructuralFeature.getName().equals("StyledByItem")) {
return true;
}
return hideAllInverse.shouldFollowReference(originalClass, eClass, eStructuralFeature);
}
}
};
objectIdmCache.put(onlyIncludeRepresentationForThisClass, objectIdm);
}
}
skipRepresentation = new ObjectIDM() {
private ObjectIDM hideAllInverse = new HideAllInversesObjectIDM(hideAllInverseMap.keySet(), metaDataManager.getPackageMetaData("ifc2x3tc1"));
@Override
public boolean shouldIncludeClass(EClass originalClass, EClass eClass) {
return hideAllInverse.shouldIncludeClass(originalClass, eClass);
}
@Override
public boolean shouldFollowReference(EClass originalClass, EClass eClass, EStructuralFeature eStructuralFeature) {
if (eStructuralFeature.getName().equals("Representation")) {
return false;
} else {
return hideAllInverse.shouldFollowReference(originalClass, eClass, eStructuralFeature);
}
}
};
}
Aggregations