use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllRepositoryModelCheckers.
@Override
public List<SModelCheckerInstance> getAllRepositoryModelCheckers() throws ServerException, UserException {
requireRealUserAuthentication();
try {
List<SModelCheckerInstance> modelCheckers = new ArrayList<SModelCheckerInstance>();
String content = NetUtils.getContent(new URL(getServiceMap().get(SettingsInterface.class).getServiceRepositoryUrl() + "/modelcheckers"), 5000);
JSONObject root = new JSONObject(new JSONTokener(content));
JSONArray modelCheckersJson = root.getJSONArray("modelcheckers");
for (int i = 0; i < modelCheckersJson.length(); i++) {
JSONObject modelCheckerJson = modelCheckersJson.getJSONObject(i);
SModelCheckerInstance sModelChecker = new SModelCheckerInstance();
sModelChecker.setName(modelCheckerJson.getString("name"));
sModelChecker.setCode(modelCheckerJson.getString("code"));
sModelChecker.setDescription(modelCheckerJson.getString("description"));
sModelChecker.setModelCheckerPluginClassName(modelCheckerJson.getString("modelCheckerPluginClassName"));
modelCheckers.add(sModelChecker);
}
return modelCheckers;
} catch (Exception e) {
return handleException(e);
}
}
use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllCheckoutsByUser.
@Override
public List<SCheckout> getAllCheckoutsByUser(Long uoid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<List<Checkout>> action = new GetAllCheckoutsByUserDatabaseAction(session, getInternalAccessMethod(), uoid);
List<Checkout> list = session.executeAndCommitAction(action);
Collections.sort(list, new CheckoutComparator());
return getBimServer().getSConverter().convertToSListCheckout(list);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class ServiceImpl method removeUserFromProject.
@Override
public Boolean removeUserFromProject(Long uoid, Long poid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Boolean> action = new RemoveUserFromProjectDatabaseAction(getBimServer(), session, getInternalAccessMethod(), uoid, poid, getAuthorization());
return session.executeAndCommitAction(action);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class ServiceImpl method getDeserializerById.
@Override
public SDeserializerPluginConfiguration getDeserializerById(Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetDeserializerByIdDatabaseAction(session, getInternalAccessMethod(), oid)));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
return null;
}
use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class ServiceImpl method getCheckoutWarnings.
@Override
public Set<String> getCheckoutWarnings(Long poid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Set<String>> action = new GetCheckoutWarningsDatabaseAction(session, getInternalAccessMethod(), poid, getAuthorization());
return session.executeAndCommitAction(action);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
Aggregations