use of org.bimserver.interfaces.objects.SModelComparePluginConfiguration in project BIMserver by opensourceBIM.
the class TestCompare method testIfc2x3tc1Name.
@Test
public void testIfc2x3tc1Name() {
try {
// Create a new BimServerClient with authentication
BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
// Create a new project
SProject newProject1 = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc2x3tc1");
SProject newProject2 = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc2x3tc1");
// Get the appropriate deserializer
SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", newProject1.getOid());
SSerializerPluginConfiguration serializer = bimServerClient.getServiceInterface().getSerializerByName("Ifc2x3tc1");
// Checkin the file
bimServerClient.checkin(newProject1.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/compare_by_guid_rev_1.ifc"));
bimServerClient.checkin(newProject2.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/compare_by_guid_rev_2.ifc"));
newProject1 = bimServerClient.getServiceInterface().getProjectByPoid(newProject1.getOid());
newProject2 = bimServerClient.getServiceInterface().getProjectByPoid(newProject2.getOid());
SModelComparePluginConfiguration defaultModelCompare = bimServerClient.getPluginInterface().getModelCompareByName("Name based");
bimServerClient.getServiceInterface().compare(newProject1.getLastRevisionId(), newProject2.getLastRevisionId(), SCompareType.ALL, defaultModelCompare.getOid());
Long topicId = bimServerClient.getServiceInterface().downloadCompareResults(serializer.getOid(), newProject1.getLastRevisionId(), newProject2.getLastRevisionId(), defaultModelCompare.getOid(), SCompareType.ALL, true);
bimServerClient.saveDownloadData(topicId, Paths.get("tmptestdata/ifc2x3tc1namecompare.ifc"));
} catch (Throwable e) {
e.printStackTrace();
if (e instanceof AssertionError) {
throw (AssertionError) e;
}
fail(e.getMessage());
}
}
use of org.bimserver.interfaces.objects.SModelComparePluginConfiguration in project BIMserver by opensourceBIM.
the class PluginServiceImpl method updateModelCompare.
@Override
public void updateModelCompare(SModelComparePluginConfiguration modelCompare) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
ModelComparePluginConfiguration convert = session.get(modelCompare.getOid(), OldQuery.getDefault());
getBimServer().getSConverter().convertFromSObject(modelCompare, convert, session);
session.executeAndCommitAction(new UpdateModelCompareDatabaseAction(session, getInternalAccessMethod(), convert));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.interfaces.objects.SModelComparePluginConfiguration in project BIMserver by opensourceBIM.
the class PluginServiceImpl method getAllModelCompares.
@Override
public List<SModelComparePluginConfiguration> getAllModelCompares(Boolean onlyEnabled) throws ServerException, UserException {
requireAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
UserSettings userSettings = getUserSettings(session);
List<SModelComparePluginConfiguration> modelCompares = getBimServer().getSConverter().convertToSListModelComparePluginConfiguration(userSettings.getModelCompares());
Collections.sort(modelCompares, new SPluginConfigurationComparator());
return modelCompares;
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.interfaces.objects.SModelComparePluginConfiguration in project BIMserver by opensourceBIM.
the class PluginServiceImpl method addModelCompare.
@Override
public Long addModelCompare(SModelComparePluginConfiguration modelCompare) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
ModelComparePluginConfiguration convert = getBimServer().getSConverter().convertFromSObject(modelCompare, session);
return session.executeAndCommitAction(new AddModelCompareDatabaseAction(session, getInternalAccessMethod(), getAuthorization(), convert));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.interfaces.objects.SModelComparePluginConfiguration in project BIMserver by opensourceBIM.
the class TestCompare method testIfc4Guid.
@Test
public void testIfc4Guid() {
try {
// Create a new BimServerClient with authentication
BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
// Create a new project
SProject newProject1 = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc4");
SProject newProject2 = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc4");
// Get the appropriate deserializer
SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", newProject1.getOid());
SSerializerPluginConfiguration serializer = bimServerClient.getServiceInterface().getSerializerByName("Ifc4");
// Checkin the file
bimServerClient.checkin(newProject1.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/compare_by_name_rev_1.ifc"));
bimServerClient.checkin(newProject2.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/compare_by_name_rev_2.ifc"));
newProject1 = bimServerClient.getServiceInterface().getProjectByPoid(newProject1.getOid());
newProject2 = bimServerClient.getServiceInterface().getProjectByPoid(newProject2.getOid());
SModelComparePluginConfiguration defaultModelCompare = bimServerClient.getPluginInterface().getModelCompareByName("GUID based");
bimServerClient.getServiceInterface().compare(newProject1.getLastRevisionId(), newProject2.getLastRevisionId(), SCompareType.ALL, defaultModelCompare.getOid());
long topicId = bimServerClient.getServiceInterface().downloadCompareResults(serializer.getOid(), newProject1.getLastRevisionId(), newProject2.getLastRevisionId(), defaultModelCompare.getOid(), SCompareType.ALL, true);
bimServerClient.saveDownloadData(topicId, Paths.get("tmptestdata/ifc4guidcompare.ifc"));
} catch (Throwable e) {
e.printStackTrace();
if (e instanceof AssertionError) {
throw (AssertionError) e;
}
fail(e.getMessage());
}
}
Aggregations