Search in sources :

Example 26 with BimServerClient

use of org.bimserver.client.BimServerClient 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)

Example 27 with BimServerClient

use of org.bimserver.client.BimServerClient in project BIMserver by opensourceBIM.

the class TestSimultaneousCheckin 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"))) {
            SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc2x3tc1");
            SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
            Path path = Paths.get("../../TestFiles/TestData/data/export1.ifc");
            client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, new CheckinProgressHandler() {

                @Override
                public void progress(String title, int progress) {
                    System.out.println(title + ": " + progress);
                }
            });
        }
        Thread.sleep(1000);
    }
}
Also used : Path(java.nio.file.Path) SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) SProject(org.bimserver.interfaces.objects.SProject) CheckinProgressHandler(org.bimserver.plugins.services.CheckinProgressHandler) BimServerClient(org.bimserver.client.BimServerClient) Test(org.junit.Test)

Aggregations

BimServerClient (org.bimserver.client.BimServerClient)27 JsonBimServerClientFactory (org.bimserver.client.json.JsonBimServerClientFactory)23 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)23 SProject (org.bimserver.interfaces.objects.SProject)20 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)15 Test (org.junit.Test)15 Path (java.nio.file.Path)14 ClientIfcModel (org.bimserver.client.ClientIfcModel)11 SLongCheckinActionState (org.bimserver.interfaces.objects.SLongCheckinActionState)9 BimServerClientException (org.bimserver.shared.exceptions.BimServerClientException)6 CheckinProgressHandler (org.bimserver.plugins.services.CheckinProgressHandler)5 GeometryInfo (org.bimserver.models.geometry.GeometryInfo)3 IfcWall (org.bimserver.models.ifc2x3tc1.IfcWall)3 PublicInterfaceNotFoundException (org.bimserver.shared.exceptions.PublicInterfaceNotFoundException)3 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 Query (org.bimserver.database.queries.om.Query)2 QueryPart (org.bimserver.database.queries.om.QueryPart)2 PackageMetaData (org.bimserver.emf.PackageMetaData)2