use of org.bimserver.models.store.RevisionSummaryType in project BIMserver by opensourceBIM.
the class SummaryMap method toRevisionSummary.
public RevisionSummary toRevisionSummary(DatabaseSession databaseSession) throws BimserverDatabaseException {
RevisionSummary revisionSummary = databaseSession.create(RevisionSummary.class);
RevisionSummaryContainer revisionSummaryContainerEntities = databaseSession.create(RevisionSummaryContainer.class);
revisionSummaryContainerEntities.setName("IFC Entities");
revisionSummary.getList().add(revisionSummaryContainerEntities);
RevisionSummaryContainer revisionSummaryContainerRelations = databaseSession.create(RevisionSummaryContainer.class);
revisionSummaryContainerRelations.setName("IFC Relations");
revisionSummary.getList().add(revisionSummaryContainerRelations);
RevisionSummaryContainer revisionSummaryContainerPrimitives = databaseSession.create(RevisionSummaryContainer.class);
revisionSummaryContainerPrimitives.setName("IFC Primitives");
revisionSummary.getList().add(revisionSummaryContainerPrimitives);
RevisionSummaryContainer revisionSummaryContainerOther = databaseSession.create(RevisionSummaryContainer.class);
revisionSummaryContainerOther.setName("Rest");
revisionSummary.getList().add(revisionSummaryContainerOther);
for (EClass eClass : summaryMap.keySet()) {
RevisionSummaryContainer subMap = null;
if (((EClass) packageMetaData.getEPackage().getEClassifier("IfcObject")).isSuperTypeOf(eClass)) {
subMap = revisionSummaryContainerEntities;
} else if (((EClass) packageMetaData.getEPackage().getEClassifier("IfcRelationship")).isSuperTypeOf(eClass)) {
subMap = revisionSummaryContainerRelations;
} else if (eClass.getEAnnotation("wrapped") != null) {
subMap = revisionSummaryContainerPrimitives;
} else {
subMap = revisionSummaryContainerOther;
}
RevisionSummaryType createRevisionSummaryType = databaseSession.create(RevisionSummaryType.class);
createRevisionSummaryType.setSchema(eClass.getEPackage().getName());
createRevisionSummaryType.setCount(summaryMap.get(eClass));
createRevisionSummaryType.setName(eClass.getName());
subMap.getTypes().add(createRevisionSummaryType);
}
return revisionSummary;
}
use of org.bimserver.models.store.RevisionSummaryType in project BIMserver by opensourceBIM.
the class GetRevisionSummaryDatabaseAction method createSummary.
private RevisionSummary createSummary() {
RevisionSummary revisionSummary = StoreFactory.eINSTANCE.createRevisionSummary();
revisionSummaryContainerEntities = StoreFactory.eINSTANCE.createRevisionSummaryContainer();
revisionSummaryContainerEntities.setName("IFC Entities");
revisionSummary.getList().add(revisionSummaryContainerEntities);
revisionSummaryContainerRelations = StoreFactory.eINSTANCE.createRevisionSummaryContainer();
revisionSummaryContainerRelations.setName("IFC Relations");
revisionSummary.getList().add(revisionSummaryContainerRelations);
revisionSummaryContainerPrimitives = StoreFactory.eINSTANCE.createRevisionSummaryContainer();
revisionSummaryContainerPrimitives.setName("IFC Primitives");
revisionSummary.getList().add(revisionSummaryContainerPrimitives);
revisionSummaryContainerOther = StoreFactory.eINSTANCE.createRevisionSummaryContainer();
revisionSummaryContainerOther.setName("Rest");
revisionSummary.getList().add(revisionSummaryContainerOther);
for (EClass eClass : map.keySet()) {
RevisionSummaryContainer subMap = null;
if (Ifc2x3tc1Package.eINSTANCE.getIfcObject().isSuperTypeOf(eClass)) {
subMap = revisionSummaryContainerEntities;
} else if (Ifc2x3tc1Package.eINSTANCE.getIfcRelationship().isSuperTypeOf(eClass)) {
subMap = revisionSummaryContainerRelations;
} else if (eClass.getEAnnotation("wrapped") != null) {
subMap = revisionSummaryContainerPrimitives;
} else {
subMap = revisionSummaryContainerOther;
}
RevisionSummaryType createRevisionSummaryType = StoreFactory.eINSTANCE.createRevisionSummaryType();
createRevisionSummaryType.setSchema(eClass.getEPackage().getName());
createRevisionSummaryType.setCount(map.get(eClass));
createRevisionSummaryType.setName(eClass.getName());
subMap.getTypes().add(createRevisionSummaryType);
}
return revisionSummary;
}
Aggregations