Search in sources :

Example 11 with SExtendedData

use of org.bimserver.interfaces.objects.SExtendedData in project BIMserver by opensourceBIM.

the class TestAddExtendedData method start.

private void start() {
    try {
        BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
        SFile file = new SFile();
        file.setData("test".getBytes(Charsets.UTF_8));
        file.setMime("text");
        file.setFilename("test.txt");
        long fileId = client.getServiceInterface().uploadFile(file);
        System.out.println(client.getServiceInterface().getFile(fileId));
        SProject project = client.getServiceInterface().addProject("test23", "ifc2x3tc1");
        SDeserializerPluginConfiguration deserializerForExtension = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
        client.checkin(project.getOid(), "initial", deserializerForExtension.getOid(), false, Flow.SYNC, Paths.get("../TestData/data/AC11-FZK-Haus-IFC.ifc"));
        project = client.getServiceInterface().getProjectByPoid(project.getOid());
        SExtendedDataSchema extendedDataSchemaByNamespace = client.getServiceInterface().getExtendedDataSchemaByName("http://extend.bimserver.org/validationreport");
        SExtendedData extendedData = new SExtendedData();
        extendedData.setFileId(fileId);
        extendedData.setTitle("test3");
        extendedData.setSchemaId(extendedDataSchemaByNamespace.getOid());
        client.getServiceInterface().addExtendedDataToRevision(project.getLastRevisionId(), extendedData);
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (PublicInterfaceNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) SExtendedData(org.bimserver.interfaces.objects.SExtendedData) ServiceException(org.bimserver.shared.exceptions.ServiceException) PublicInterfaceNotFoundException(org.bimserver.shared.exceptions.PublicInterfaceNotFoundException) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) IOException(java.io.IOException) SFile(org.bimserver.interfaces.objects.SFile) SProject(org.bimserver.interfaces.objects.SProject) SExtendedDataSchema(org.bimserver.interfaces.objects.SExtendedDataSchema)

Aggregations

SExtendedData (org.bimserver.interfaces.objects.SExtendedData)11 IOException (java.io.IOException)7 SFile (org.bimserver.interfaces.objects.SFile)7 ServerException (org.bimserver.shared.exceptions.ServerException)7 UserException (org.bimserver.shared.exceptions.UserException)7 BcfException (org.opensourcebim.bcf.BcfException)7 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)6 DatabaseSession (org.bimserver.database.DatabaseSession)6 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)6 SerializerException (org.bimserver.plugins.serializers.SerializerException)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 MalformedURLException (java.net.MalformedURLException)5 MessagingException (javax.mail.MessagingException)5 AddressException (javax.mail.internet.AddressException)5 CannotBeScheduledException (org.bimserver.longaction.CannotBeScheduledException)5 StoreExtendedData (org.bimserver.models.store.StoreExtendedData)5 SExtendedDataSchema (org.bimserver.interfaces.objects.SExtendedDataSchema)4 SProject (org.bimserver.interfaces.objects.SProject)4 ExtendedData (org.bimserver.models.store.ExtendedData)4 Revision (org.bimserver.models.store.Revision)4