use of org.bimserver.models.store.Checkout in project BIMserver by opensourceBIM.
the class GetAllCheckoutsOfProjectDatabaseAction method execute.
@Override
public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
Project project = getProjectByPoid(poid);
Set<Project> projects = new HashSet<Project>();
if (checkSubProjects) {
getSubProjects(project, projects);
} else {
projects.add(project);
}
Condition condition = new HasReferenceToInCondition(StorePackage.eINSTANCE.getCheckout_Project(), projects);
Map<Long, Checkout> query = getDatabaseSession().query(condition, Checkout.class, OldQuery.getDefault());
return CollectionUtils.mapToList(query);
}
use of org.bimserver.models.store.Checkout in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllCheckoutsOfProjectAndSubProjects.
@Override
public List<SCheckout> getAllCheckoutsOfProjectAndSubProjects(Long poid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
BimDatabaseAction<List<Checkout>> action = new GetAllCheckoutsOfProjectDatabaseAction(session, getInternalAccessMethod(), poid, true);
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.models.store.Checkout in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllCheckoutsOfRevision.
@Override
public List<SCheckout> getAllCheckoutsOfRevision(Long roid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
BimDatabaseAction<List<Checkout>> action = new GetAllCheckoutsOfRevisionDatabaseAction(session, getInternalAccessMethod(), roid);
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.models.store.Checkout 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(OperationType.READ_ONLY);
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.models.store.Checkout in project BIMserver by opensourceBIM.
the class GetCheckinWarningsDatabaseAction method checkInterleavingCommits.
private void checkInterleavingCommits(Project project, User user, Set<String> warnings) {
Checkout lastOwnActiveCheckout = null;
for (Checkout checkout : project.getCheckouts()) {
if (checkout.getUser() == user && checkout.getActive()) {
lastOwnActiveCheckout = checkout;
}
}
if (lastOwnActiveCheckout != null) {
Project mainProject = project;
while (mainProject.getParent() != null) {
mainProject = mainProject.getParent();
}
int newRevisionsAfterCheckout = 0;
for (Revision virtualRevision : mainProject.getRevisions()) {
if (lastOwnActiveCheckout.getDate().before(virtualRevision.getDate()) && lastOwnActiveCheckout.getRevision() != virtualRevision) {
newRevisionsAfterCheckout++;
}
}
if (newRevisionsAfterCheckout == 1) {
warnings.add("Warning, after your last checkout of this project (revision " + lastOwnActiveCheckout.getRevision().getId() + "), a new revision has been checked-in");
} else if (newRevisionsAfterCheckout > 1) {
warnings.add("Warning, after your last checkout of this project (revision " + lastOwnActiveCheckout.getRevision().getId() + "), " + newRevisionsAfterCheckout + " new revisions have been checked-in");
}
}
}
Aggregations