use of org.bimserver.database.actions.BranchToNewProjectDatabaseAction in project BIMserver by opensourceBIM.
the class ServiceImpl method branchToNewProject.
@Override
public Long branchToNewProject(Long roid, String projectName, String comment, Boolean sync) throws UserException, ServerException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.POSSIBLY_WRITE);
try {
BranchToNewProjectDatabaseAction action = new BranchToNewProjectDatabaseAction(session, getInternalAccessMethod(), getBimServer(), getAuthorization(), roid, projectName, comment);
User user = (User) session.get(StorePackage.eINSTANCE.getUser(), getAuthorization().getUoid(), OldQuery.getDefault());
String username = user.getName();
String userUsername = user.getUsername();
LongBranchAction longAction = new LongBranchAction(getBimServer(), username, userUsername, getAuthorization(), action);
getBimServer().getLongActionManager().start(longAction);
if (sync) {
longAction.waitForCompletion();
}
return longAction.getProgressTopic().getKey().getId();
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
Aggregations