Search in sources :

Example 1 with SerializerPlugin

use of org.bimserver.plugins.serializers.SerializerPlugin in project BIMserver by opensourceBIM.

the class GeometryGenerator method generateGeometry.

@SuppressWarnings("unchecked")
public GenerateGeometryResult generateGeometry(RenderEnginePool renderEnginePool, final PluginManager pluginManager, final DatabaseSession databaseSession, final IfcModelInterface model, final int pid, final int rid, final boolean store, GeometryCache geometryCache) throws BimserverDatabaseException, GeometryGeneratingException {
    GenerateGeometryResult generateGeometryResult = new GenerateGeometryResult();
    packageMetaData = model.getPackageMetaData();
    productClass = packageMetaData.getEClass("IfcProduct");
    productRepresentationClass = packageMetaData.getEClass("IfcProductRepresentation");
    geometryFeature = productClass.getEStructuralFeature("geometry");
    representationFeature = productClass.getEStructuralFeature("Representation");
    representationsFeature = productRepresentationClass.getEStructuralFeature("Representations");
    if (geometryCache != null && !geometryCache.isEmpty()) {
        returnCachedData(model, geometryCache, databaseSession, pid, rid);
        return null;
    }
    long start = System.nanoTime();
    String pluginName = "";
    if (model.getPackageMetaData().getSchema() == Schema.IFC4) {
        pluginName = "org.bimserver.ifc.step.serializer.Ifc4StepSerializerPlugin";
    } else if (model.getPackageMetaData().getSchema() == Schema.IFC2X3TC1) {
        pluginName = "org.bimserver.ifc.step.serializer.Ifc2x3tc1StepSerializerPlugin";
    }
    try {
        final SerializerPlugin ifcSerializerPlugin = (SerializerPlugin) pluginManager.getPlugin(pluginName, true);
        if (ifcSerializerPlugin == null) {
            throw new UserException("No IFC serializer found");
        }
        int maxSimultanousThreads = Math.min(bimServer.getServerSettingsCache().getServerSettings().getRenderEngineProcesses(), Runtime.getRuntime().availableProcessors());
        maxSimultanousThreads = 1;
        final RenderEngineSettings settings = new RenderEngineSettings();
        settings.setPrecision(Precision.SINGLE);
        settings.setIndexFormat(IndexFormat.AUTO_DETECT);
        settings.setGenerateNormals(true);
        settings.setGenerateTriangles(true);
        settings.setGenerateWireFrame(false);
        final RenderEngineFilter renderEngineFilter = new RenderEngineFilter();
        if (maxSimultanousThreads == 1) {
            Runner runner = new Runner(null, renderEnginePool, databaseSession, settings, store, model, ifcSerializerPlugin, model, pid, rid, null, renderEngineFilter, generateGeometryResult);
            runner.run();
        } else {
            Set<EClass> classes = new HashSet<>();
            for (IdEObject object : model.getAllWithSubTypes(packageMetaData.getEClass("IfcProduct"))) {
                IdEObject representation = (IdEObject) object.eGet(representationFeature);
                if (representation != null && ((List<?>) representation.eGet(representationsFeature)).size() > 0) {
                    classes.add(object.eClass());
                }
            }
            if (classes.size() == 0) {
                return null;
            }
            classes.remove(packageMetaData.getEClass("IfcAnnotation"));
            classes.remove(packageMetaData.getEClass("IfcOpeningElement"));
            LOGGER.debug("Using " + maxSimultanousThreads + " processes for geometry generation");
            ThreadPoolExecutor executor = new ThreadPoolExecutor(maxSimultanousThreads, maxSimultanousThreads, 24, TimeUnit.HOURS, new ArrayBlockingQueue<Runnable>(classes.size()));
            final Map<IdEObject, IdEObject> bigMap = new HashMap<IdEObject, IdEObject>();
            HideAllInversesObjectIDM idm = new HideAllInversesObjectIDM(CollectionUtils.singleSet(packageMetaData.getEPackage()), model.getPackageMetaData());
            OidProvider oidProvider = new OidProvider() {

                @Override
                public long newOid(EClass eClass) {
                    return databaseSession.newOid(eClass);
                }
            };
            for (final EClass eClass : classes) {
                final BasicIfcModel targetModel = new BasicIfcModel(model.getPackageMetaData(), null);
                ModelHelper modelHelper = new ModelHelper(bimServer.getMetaDataManager(), targetModel);
                modelHelper.setOidProvider(oidProvider);
                modelHelper.setObjectIDM(idm);
                IdEObject newOwnerHistory = modelHelper.copyBasicObjects(model, bigMap);
                for (IdEObject idEObject : model.getAll(eClass)) {
                    IdEObject newObject = modelHelper.copy(idEObject, false, ModelHelper.createObjectIdm(idEObject.eClass()));
                    modelHelper.copyDecomposes(idEObject, newOwnerHistory);
                    bigMap.put(newObject, idEObject);
                    if (packageMetaData.getEClass("IfcElement").isSuperTypeOf(eClass)) {
                        EStructuralFeature hasOpeningsFeature = idEObject.eClass().getEStructuralFeature("HasOpenings");
                        for (IdEObject ifcRelVoidsElement : ((List<IdEObject>) idEObject.eGet(hasOpeningsFeature))) {
                            bigMap.put(modelHelper.copy(ifcRelVoidsElement, false), ifcRelVoidsElement);
                            EStructuralFeature relatedOpeningElementFeature = ifcRelVoidsElement.eClass().getEStructuralFeature("RelatedOpeningElement");
                            IdEObject relatedOpeningElement = (IdEObject) ifcRelVoidsElement.eGet(relatedOpeningElementFeature);
                            if (relatedOpeningElement != null) {
                                bigMap.put(modelHelper.copy(relatedOpeningElement, false), relatedOpeningElement);
                            }
                        }
                    }
                }
                executor.submit(new Runner(eClass, renderEnginePool, databaseSession, settings, store, targetModel, ifcSerializerPlugin, model, pid, rid, bigMap, renderEngineFilter, generateGeometryResult));
            }
            executor.shutdown();
            executor.awaitTermination(24, TimeUnit.HOURS);
        }
        long end = System.nanoTime();
        LOGGER.info("Rendertime: " + ((end - start) / 1000000) + "ms, " + "Reused: " + Formatters.bytesToString(bytesSaved.get()) + ", Total: " + Formatters.bytesToString(totalBytes.get()) + ", Final: " + Formatters.bytesToString(totalBytes.get() - bytesSaved.get()));
    } catch (Exception e) {
        LOGGER.error("", e);
        throw new GeometryGeneratingException(e);
    }
    return generateGeometryResult;
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) EClass(org.eclipse.emf.ecore.EClass) OidProvider(org.bimserver.emf.OidProvider) List(java.util.List) UserException(org.bimserver.shared.exceptions.UserException) HashSet(java.util.HashSet) ModelHelper(org.bimserver.plugins.ModelHelper) IdEObject(org.bimserver.emf.IdEObject) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) BasicIfcModel(org.bimserver.ifc.BasicIfcModel) IfcModelInterfaceException(org.bimserver.emf.IfcModelInterfaceException) UserException(org.bimserver.shared.exceptions.UserException) EntityNotFoundException(org.bimserver.plugins.renderengine.EntityNotFoundException) ObjectAlreadyExistsException(org.bimserver.plugins.ObjectAlreadyExistsException) RenderEngineException(org.bimserver.plugins.renderengine.RenderEngineException) RenderEngineFilter(org.bimserver.plugins.renderengine.RenderEngineFilter) HideAllInversesObjectIDM(org.bimserver.plugins.objectidms.HideAllInversesObjectIDM) RenderEngineSettings(org.bimserver.plugins.renderengine.RenderEngineSettings) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Example 2 with SerializerPlugin

use of org.bimserver.plugins.serializers.SerializerPlugin in project BIMserver by opensourceBIM.

the class AddFurniture method main.

public static void main(String[] args) {
    try {
        PluginManager pluginManager = LocalDevPluginLoader.createPluginManager(Paths.get("home"));
        DeserializerPlugin deserializerPlugin = pluginManager.getFirstDeserializer("ifc", Schema.IFC2X3TC1, true);
        Deserializer deserializer = deserializerPlugin.createDeserializer(null);
        deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
        IfcModelInterface model = DeserializerUtils.readFromFile(deserializer, Paths.get("../TestData/data/AC9R1-Haus-G-H-Ver2-2x3.ifc"));
        deserializer = deserializerPlugin.createDeserializer(null);
        deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
        IfcModelInterface furnishingModel = DeserializerUtils.readFromFile(deserializer, Paths.get("test.ifc"));
        model.fixOids(new IncrementingOidProvider());
        long oid = model.getHighestOid();
        IncrementingOidProvider oidProvider = new IncrementingOidProvider(oid + 1);
        IfcFurnishingElement picknick = (IfcFurnishingElement) furnishingModel.getByName(Ifc2x3tc1Package.eINSTANCE.getIfcFurnishingElement(), "Picknik Bank");
        ModelHelper modelHelper = new ModelHelper(pluginManager.getMetaDataManager(), new HideAllInversesObjectIDM(CollectionUtils.singleSet(Ifc2x3tc1Package.eINSTANCE), pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1")), model);
        IfcProductDefinitionShape representation = (IfcProductDefinitionShape) picknick.getRepresentation();
        IfcRepresentation surfaceModel = null;
        IfcRepresentation boundingBox = null;
        for (IfcRepresentation ifcRepresentation : representation.getRepresentations()) {
            IfcShapeRepresentation ifcShapeRepresentation = (IfcShapeRepresentation) ifcRepresentation;
            if (ifcShapeRepresentation.getRepresentationType().equals("SurfaceModel")) {
                surfaceModel = (IfcRepresentation) modelHelper.copy(ifcShapeRepresentation, false);
            } else if (ifcShapeRepresentation.getRepresentationType().equals("BoundingBox")) {
                boundingBox = (IfcRepresentation) modelHelper.copy(ifcShapeRepresentation, false);
            }
        }
        IfcOwnerHistory ownerHistory = null;
        List<IfcOwnerHistory> all = model.getAll(IfcOwnerHistory.class);
        if (all.size() > 0) {
            ownerHistory = all.get(0);
        }
        for (IfcBuildingStorey ifcBuildingStorey : model.getAll(IfcBuildingStorey.class)) {
            for (IfcRelDecomposes ifcRelDecomposes : ifcBuildingStorey.getIsDecomposedBy()) {
                for (IfcObjectDefinition ifcObjectDefinition : ifcRelDecomposes.getRelatedObjects()) {
                    if (ifcObjectDefinition instanceof IfcSpace) {
                        IfcSpace ifcSpace = (IfcSpace) ifcObjectDefinition;
                        // IfcProductDefinitionShape slabRepr = (IfcProductDefinitionShape) ifcSpace.getRepresentation();
                        // IfcBoundingBox box = null;
                        // for (IfcRepresentation representation2 : slabRepr.getRepresentations()) {
                        // IfcShapeRepresentation shapeRepresentation = (IfcShapeRepresentation)representation2;
                        // if (shapeRepresentation.getRepresentationType().equals("BoundingBox")) {
                        // for (IfcRepresentationItem i2 : shapeRepresentation.getItems()) {
                        // box = (IfcBoundingBox)i2;
                        // }
                        // }
                        // }
                        IfcFurnishingElement newFurnishing = model.create(IfcFurnishingElement.class, oidProvider);
                        IfcRelContainedInSpatialStructure containedInSpatialStructure2 = model.create(IfcRelContainedInSpatialStructure.class, oidProvider);
                        containedInSpatialStructure2.setRelatingStructure(ifcBuildingStorey);
                        containedInSpatialStructure2.getRelatedElements().add(newFurnishing);
                        newFurnishing.setName("Generated");
                        newFurnishing.setGlobalId("TEST");
                        newFurnishing.setOwnerHistory(ownerHistory);
                        IfcProductDefinitionShape definitionShape = model.create(IfcProductDefinitionShape.class, oidProvider);
                        newFurnishing.setRepresentation(definitionShape);
                        definitionShape.getRepresentations().add(boundingBox);
                        definitionShape.getRepresentations().add(surfaceModel);
                        IfcLocalPlacement localPlacement = model.create(IfcLocalPlacement.class, oidProvider);
                        localPlacement.setPlacementRelTo(ifcSpace.getObjectPlacement());
                        IfcAxis2Placement3D axis2Placement3D = model.create(IfcAxis2Placement3D.class, oidProvider);
                        localPlacement.setRelativePlacement(axis2Placement3D);
                        IfcCartesianPoint pos = model.create(IfcCartesianPoint.class, oidProvider);
                        pos.getCoordinates().add(-3d);
                        pos.getCoordinates().add(+0.5d);
                        pos.getCoordinates().add(0d);
                        axis2Placement3D.setLocation(pos);
                        newFurnishing.setObjectPlacement(localPlacement);
                    }
                }
            }
        }
        model.resetExpressIds();
        SerializerPlugin serializerPlugin = pluginManager.getSerializerPlugin("org.bimserver.ifc.step.serializer.IfcStepSerializerPlugin", true);
        Serializer serializer = serializerPlugin.createSerializer(null);
        serializer.init(model, null, true);
        SerializerUtils.writeToFile(serializer, Paths.get("withfurn.ifc"));
    } catch (PluginException e) {
        e.printStackTrace();
    } catch (DeserializeException e) {
        e.printStackTrace();
    } catch (IfcModelInterfaceException e) {
        e.printStackTrace();
    } catch (SerializerException e) {
        e.printStackTrace();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : IfcModelInterface(org.bimserver.emf.IfcModelInterface) IfcObjectDefinition(org.bimserver.models.ifc2x3tc1.IfcObjectDefinition) IfcSpace(org.bimserver.models.ifc2x3tc1.IfcSpace) FileNotFoundException(java.io.FileNotFoundException) IfcOwnerHistory(org.bimserver.models.ifc2x3tc1.IfcOwnerHistory) PluginManager(org.bimserver.plugins.PluginManager) IfcModelInterfaceException(org.bimserver.emf.IfcModelInterfaceException) IfcProductDefinitionShape(org.bimserver.models.ifc2x3tc1.IfcProductDefinitionShape) IfcAxis2Placement3D(org.bimserver.models.ifc2x3tc1.IfcAxis2Placement3D) IfcLocalPlacement(org.bimserver.models.ifc2x3tc1.IfcLocalPlacement) IncrementingOidProvider(org.bimserver.shared.IncrementingOidProvider) IfcShapeRepresentation(org.bimserver.models.ifc2x3tc1.IfcShapeRepresentation) IfcRepresentation(org.bimserver.models.ifc2x3tc1.IfcRepresentation) IfcBuildingStorey(org.bimserver.models.ifc2x3tc1.IfcBuildingStorey) Serializer(org.bimserver.plugins.serializers.Serializer) ModelHelper(org.bimserver.plugins.ModelHelper) IfcFurnishingElement(org.bimserver.models.ifc2x3tc1.IfcFurnishingElement) PluginException(org.bimserver.shared.exceptions.PluginException) DeserializerPlugin(org.bimserver.plugins.deserializers.DeserializerPlugin) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) IOException(java.io.IOException) SerializerException(org.bimserver.plugins.serializers.SerializerException) IfcRelDecomposes(org.bimserver.models.ifc2x3tc1.IfcRelDecomposes) Deserializer(org.bimserver.plugins.deserializers.Deserializer) HideAllInversesObjectIDM(org.bimserver.plugins.objectidms.HideAllInversesObjectIDM) IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint) IfcRelContainedInSpatialStructure(org.bimserver.models.ifc2x3tc1.IfcRelContainedInSpatialStructure)

Example 3 with SerializerPlugin

use of org.bimserver.plugins.serializers.SerializerPlugin in project BIMserver by opensourceBIM.

the class Visualise method main.

public static void main(String[] args) {
    PluginManager pluginManager;
    try {
        pluginManager = LocalDevPluginLoader.createPluginManager(Paths.get("home"));
        DeserializerPlugin deserializerPlugin = pluginManager.requireDeserializer("application/ifc");
        Deserializer deserializer = deserializerPlugin.createDeserializer(new PluginConfiguration());
        deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
        IfcModelInterface model1 = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        IfcModelInterface model1b = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        IfcModelInterface model2 = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        IfcModelInterface model2b = DeserializerUtils.readFromFile(deserializer, TestFile.EXPORT3.getFile());
        model1.setObjectOids();
        model1b.setObjectOids();
        model2.setObjectOids();
        model2b.setObjectOids();
        model1.indexGuids();
        model2.indexGuids();
        model2.fixOids(new IncrementingOidProvider(model1.getHighestOid() + 1));
        IfcModel merged = new RevisionMerger(model1, model2).merge();
        SerializerPlugin serializerPlugin = pluginManager.getSerializerPlugin("org.bimserver.ifc.step.serializer.IfcStepSerializerPlugin", true);
        Serializer serializer = serializerPlugin.createSerializer(new PluginConfiguration());
        serializer.init(merged, null, false);
        SerializerUtils.writeToFile(serializer, Paths.get("merged.ifc"));
        new Visualise().start(model1b, "Model 1");
        new Visualise().start(model2b, "Model 2");
        new Visualise().start(merged, "Merged");
    } catch (PluginException e1) {
        e1.printStackTrace();
    } catch (SerializerException e) {
        e.printStackTrace();
    } catch (DeserializeException e) {
        e.printStackTrace();
    } catch (IfcModelInterfaceException e) {
        e.printStackTrace();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : RevisionMerger(org.bimserver.merging.RevisionMerger) IfcModelInterface(org.bimserver.emf.IfcModelInterface) PluginException(org.bimserver.shared.exceptions.PluginException) DeserializerPlugin(org.bimserver.plugins.deserializers.DeserializerPlugin) FileNotFoundException(java.io.FileNotFoundException) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) IOException(java.io.IOException) SerializerException(org.bimserver.plugins.serializers.SerializerException) PluginManager(org.bimserver.plugins.PluginManager) IfcModel(org.bimserver.ifc.IfcModel) IfcModelInterfaceException(org.bimserver.emf.IfcModelInterfaceException) Deserializer(org.bimserver.plugins.deserializers.Deserializer) PluginConfiguration(org.bimserver.plugins.PluginConfiguration) IncrementingOidProvider(org.bimserver.shared.IncrementingOidProvider) Serializer(org.bimserver.plugins.serializers.Serializer)

Example 4 with SerializerPlugin

use of org.bimserver.plugins.serializers.SerializerPlugin in project BIMserver by opensourceBIM.

the class AbstractDownloadDatabaseAction method checkGeometry.

protected void checkGeometry(PluginConfiguration serializerPluginConfiguration, PluginManager pluginManager, IfcModelInterface model, Project project, ConcreteRevision concreteRevision, Revision revision) throws BimserverDatabaseException, GeometryGeneratingException {
    boolean needsGeometry = false;
    Plugin plugin = pluginManager.getPlugin(serializerPluginConfiguration.getPluginDescriptor().getPluginClassName(), true);
    if (plugin instanceof SerializerPlugin) {
        needsGeometry = ((SerializerPlugin) plugin).needsGeometry();
    }
    if (needsGeometry) {
        if (!revision.isHasGeometry()) {
        // setProgress("Generating geometry...", -1);
        // TODO When generating geometry for a partial model download (by types for example), this will fail (for example walls have no openings)
        // new GeometryGenerator(bimServer).generateGeometry(authorization.getUoid(), pluginManager, getDatabaseSession(), model, project.getId(), concreteRevision.getId(), false, null);
        } else {
            EClass productClass = model.getPackageMetaData().getEClass("IfcProduct");
            List<IdEObject> allWithSubTypes = new ArrayList<>(model.getAllWithSubTypes(productClass));
            for (IdEObject ifcProduct : allWithSubTypes) {
                ifcProduct.forceLoad();
                GeometryInfo geometryInfo = (GeometryInfo) ifcProduct.eGet(productClass.getEStructuralFeature("geometry"));
                if (geometryInfo != null) {
                    geometryInfo.forceLoad();
                    geometryInfo.getData().forceLoad();
                    geometryInfo.getTransformation();
                    geometryInfo.getMinBounds().forceLoad();
                    geometryInfo.getMaxBounds().forceLoad();
                }
            }
        }
    }
}
Also used : EClass(org.eclipse.emf.ecore.EClass) IdEObject(org.bimserver.emf.IdEObject) ArrayList(java.util.ArrayList) GeometryInfo(org.bimserver.models.geometry.GeometryInfo) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) Plugin(org.bimserver.plugins.Plugin)

Example 5 with SerializerPlugin

use of org.bimserver.plugins.serializers.SerializerPlugin in project BIMserver by opensourceBIM.

the class PluginServiceImpl method getAllSerializersForPoids.

@Override
public List<SSerializerPluginConfiguration> getAllSerializersForPoids(Boolean onlyEnabled, Set<Long> poids) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        Set<Schema> uniqueSchemas = new HashSet<>();
        for (Long poid : poids) {
            Project project = session.get(poid, OldQuery.getDefault());
            uniqueSchemas.add(Schema.valueOf(project.getSchema().toUpperCase()));
        }
        Set<Schema> schemaOr = new HashSet<>();
        if (uniqueSchemas.size() == 0) {
        // Weird, no schemas
        } else if (uniqueSchemas.size() == 1) {
            // Easy, just add it, and see if there are converter targets and add those too
            Schema schema = uniqueSchemas.iterator().next();
            schemaOr.add(schema);
            // TODO make recursive
            for (Schema target : getBimServer().getSchemaConverterManager().getSchemaTargets(schema)) {
                schemaOr.add(target);
            }
        } else if (uniqueSchemas.size() == 2) {
            // This is harder, if we have 2 schema, we must figure out a way to convert to 1 schema, and then filter the allowed source schemas
            Iterator<Schema> iterator = uniqueSchemas.iterator();
            Schema schema1 = iterator.next();
            Schema schema2 = iterator.next();
            SchemaConverterFactory converter1 = getBimServer().getSchemaConverterManager().getSchemaConverterFactory(schema1, schema2);
            SchemaConverterFactory converter2 = getBimServer().getSchemaConverterManager().getSchemaConverterFactory(schema2, schema1);
            if (converter1 != null) {
                schemaOr.add(schema1);
            }
            if (converter2 != null) {
                schemaOr.add(schema2);
            }
        } else {
            throw new ServerException("Unimplemented, no support for > 2 schemas");
        }
        UserSettings userSettings = getUserSettings(session);
        List<SSerializerPluginConfiguration> sSerializers = new ArrayList<SSerializerPluginConfiguration>();
        for (SerializerPluginConfiguration serializerPluginConfiguration : userSettings.getSerializers()) {
            Plugin plugin = getBimServer().getPluginManager().getPlugin(serializerPluginConfiguration.getPluginDescriptor().getPluginClassName(), true);
            if (plugin instanceof SerializerPlugin) {
                SerializerPlugin serializerPlugin = getBimServer().getPluginManager().getSerializerPlugin(serializerPluginConfiguration.getPluginDescriptor().getPluginClassName(), true);
                for (Schema schema : serializerPlugin.getSupportedSchemas()) {
                    if (schemaOr.contains(schema)) {
                        if (!onlyEnabled || (serializerPluginConfiguration.getEnabled() && serializerPluginConfiguration.getPluginDescriptor().getEnabled())) {
                            sSerializers.add(getBimServer().getSConverter().convertToSObject(serializerPluginConfiguration));
                            break;
                        }
                    }
                }
            } else if (plugin instanceof StreamingSerializerPlugin) {
                StreamingSerializerPlugin streamingSerializerPlugin = (StreamingSerializerPlugin) plugin;
                for (Schema schema : streamingSerializerPlugin.getSupportedSchemas()) {
                    if (schemaOr.contains(schema)) {
                        if (!onlyEnabled || (serializerPluginConfiguration.getEnabled() && serializerPluginConfiguration.getPluginDescriptor().getEnabled())) {
                            sSerializers.add(getBimServer().getSConverter().convertToSObject(serializerPluginConfiguration));
                            break;
                        }
                    }
                }
            }
        }
        Collections.sort(sSerializers, new SPluginConfigurationComparator());
        return sSerializers;
    } catch (Exception e) {
        handleException(e);
    } finally {
        session.close();
    }
    return null;
}
Also used : ServerException(org.bimserver.shared.exceptions.ServerException) DatabaseSession(org.bimserver.database.DatabaseSession) UserSettings(org.bimserver.models.store.UserSettings) Schema(org.bimserver.emf.Schema) ArrayList(java.util.ArrayList) StreamingSerializerPlugin(org.bimserver.plugins.serializers.StreamingSerializerPlugin) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) StreamingSerializerPlugin(org.bimserver.plugins.serializers.StreamingSerializerPlugin) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) UserException(org.bimserver.shared.exceptions.UserException) SPluginConfigurationComparator(org.bimserver.webservices.SPluginConfigurationComparator) Project(org.bimserver.models.store.Project) SerializerPluginConfiguration(org.bimserver.models.store.SerializerPluginConfiguration) SSerializerPluginConfiguration(org.bimserver.interfaces.objects.SSerializerPluginConfiguration) SSerializerPluginConfiguration(org.bimserver.interfaces.objects.SSerializerPluginConfiguration) HashSet(java.util.HashSet) SchemaConverterFactory(org.bimserver.schemaconverter.SchemaConverterFactory) ModelCheckerPlugin(org.bimserver.plugins.modelchecker.ModelCheckerPlugin) StreamingDeserializerPlugin(org.bimserver.plugins.deserializers.StreamingDeserializerPlugin) ModelComparePlugin(org.bimserver.plugins.modelcompare.ModelComparePlugin) ObjectIDMPlugin(org.bimserver.plugins.objectidms.ObjectIDMPlugin) DeserializerPlugin(org.bimserver.plugins.deserializers.DeserializerPlugin) ServicePlugin(org.bimserver.plugins.services.ServicePlugin) WebModulePlugin(org.bimserver.plugins.web.WebModulePlugin) RenderEnginePlugin(org.bimserver.plugins.renderengine.RenderEnginePlugin) StreamingSerializerPlugin(org.bimserver.plugins.serializers.StreamingSerializerPlugin) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) QueryEnginePlugin(org.bimserver.plugins.queryengine.QueryEnginePlugin) ModelMergerPlugin(org.bimserver.plugins.modelmerger.ModelMergerPlugin) Plugin(org.bimserver.plugins.Plugin)

Aggregations

SerializerPlugin (org.bimserver.plugins.serializers.SerializerPlugin)8 IOException (java.io.IOException)5 IfcModelInterfaceException (org.bimserver.emf.IfcModelInterfaceException)5 DeserializerPlugin (org.bimserver.plugins.deserializers.DeserializerPlugin)5 SerializerException (org.bimserver.plugins.serializers.SerializerException)5 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)4 Serializer (org.bimserver.plugins.serializers.Serializer)4 FileNotFoundException (java.io.FileNotFoundException)3 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)3 DatabaseSession (org.bimserver.database.DatabaseSession)3 IfcModelInterface (org.bimserver.emf.IfcModelInterface)3 BasicIfcModel (org.bimserver.ifc.BasicIfcModel)3 SerializerPluginConfiguration (org.bimserver.models.store.SerializerPluginConfiguration)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 IdEObject (org.bimserver.emf.IdEObject)2 Schema (org.bimserver.emf.Schema)2 IfcModel (org.bimserver.ifc.IfcModel)2 SSerializerPluginConfiguration (org.bimserver.interfaces.objects.SSerializerPluginConfiguration)2 IfcFurnishingElement (org.bimserver.models.ifc2x3tc1.IfcFurnishingElement)2