Search in sources :

Example 1 with SServerInfo

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);
}
Also used : Path(java.nio.file.Path) IfcProject(org.bimserver.models.ifc2x3tc1.IfcProject) ClientIfcModel(org.bimserver.client.ClientIfcModel) SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) SProject(org.bimserver.interfaces.objects.SProject) BimServerClient(org.bimserver.client.BimServerClient) SServerInfo(org.bimserver.interfaces.objects.SServerInfo) CheckinProgressHandler(org.bimserver.plugins.services.CheckinProgressHandler) IfcBuildingStorey(org.bimserver.models.ifc2x3tc1.IfcBuildingStorey) Test(org.junit.Test)

Example 2 with SServerInfo

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;
}
Also used : SBimServerInfo(org.bimserver.interfaces.objects.SBimServerInfo) ServerInfo(org.bimserver.models.store.ServerInfo) SServerInfo(org.bimserver.interfaces.objects.SServerInfo) SServerInfo(org.bimserver.interfaces.objects.SServerInfo)

Example 3 with SServerInfo

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);
}
Also used : SRevision(org.bimserver.interfaces.objects.SRevision) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) SServerInfo(org.bimserver.interfaces.objects.SServerInfo) TreeMap(java.util.TreeMap) SProject(org.bimserver.interfaces.objects.SProject) SimpleDateFormat(java.text.SimpleDateFormat) BimServerClient(org.bimserver.client.BimServerClient) Date(java.util.Date) Test(org.junit.Test)

Aggregations

SServerInfo (org.bimserver.interfaces.objects.SServerInfo)3 BimServerClient (org.bimserver.client.BimServerClient)2 JsonBimServerClientFactory (org.bimserver.client.json.JsonBimServerClientFactory)2 SProject (org.bimserver.interfaces.objects.SProject)2 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)2 Test (org.junit.Test)2 Path (java.nio.file.Path)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 TreeMap (java.util.TreeMap)1 ClientIfcModel (org.bimserver.client.ClientIfcModel)1 SBimServerInfo (org.bimserver.interfaces.objects.SBimServerInfo)1 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)1 SRevision (org.bimserver.interfaces.objects.SRevision)1 IfcBuildingStorey (org.bimserver.models.ifc2x3tc1.IfcBuildingStorey)1 IfcProject (org.bimserver.models.ifc2x3tc1.IfcProject)1 ServerInfo (org.bimserver.models.store.ServerInfo)1 CheckinProgressHandler (org.bimserver.plugins.services.CheckinProgressHandler)1