use of org.bimserver.interfaces.objects.SServerInfo in project BIMserver by opensourceBIM.
the class TestGetUuid method test.
@Test
public void test() throws Exception {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
SServerInfo serverInfo = client.getAdminInterface().getServerInfo();
System.out.println(serverInfo.getServerState());
System.out.println(serverInfo.getUuid());
SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc2x3tc1");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
Path path = Paths.get("../../TestFiles/TestData/data/AC11-Institute-Var-2-IFC.ifc");
client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, new CheckinProgressHandler() {
@Override
public void progress(String title, int progress) {
System.out.println(title + ": " + progress);
}
});
project = client.getServiceInterface().getProjectByPoid(project.getOid());
ClientIfcModel model = client.getModel(project, project.getLastRevisionId(), true, true);
for (IfcBuildingStorey ifcBuildingStorey : model.getAll(IfcBuildingStorey.class)) {
System.out.println(ifcBuildingStorey.getUuid() + ":" + ifcBuildingStorey.getRid());
}
System.out.println("Length unit: " + IfcUtils.getLengthUnitPrefix(model));
IfcProject ifcProject = model.getAll(IfcProject.class).iterator().next();
ifcProject.setName(ifcProject.getName() + " updated");
long newRoid = model.commit("commit message");
model = client.getModel(project, newRoid, true, true);
ifcProject = model.getAll(IfcProject.class).iterator().next();
System.out.println(ifcProject.getName());
}
}
Thread.sleep(1000);
}
use of org.bimserver.interfaces.objects.SServerInfo in project BIMserver by opensourceBIM.
the class AdminServiceImpl method getServerInfo.
@Override
public SServerInfo getServerInfo() {
ServerInfo serverInfo = getBimServer().getServerInfo();
SServerInfo convertToSObject = getBimServer().getSConverter().convertToSObject(serverInfo);
return convertToSObject;
}
use of org.bimserver.interfaces.objects.SServerInfo in project BIMserver by opensourceBIM.
the class TestListActivity method test.
@Test
public void test() throws Exception {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
SServerInfo serverInfo = client.getAdminInterface().getServerInfo();
Map<Date, SRevision> revisions = new TreeMap<>();
for (SProject sProject : client.getServiceInterface().getAllProjects(true, true)) {
for (Long roid : sProject.getRevisions()) {
SRevision revision = client.getServiceInterface().getRevision(roid);
Date date = revision.getDate();
revisions.put(date, revision);
}
}
DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd hh:mm");
for (SRevision revision : revisions.values()) {
System.out.println(dateFormatter.format(revision.getDate()) + " " + revision.getComment());
}
}
}
Thread.sleep(1000);
}
Aggregations