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();
}
}
Aggregations