use of org.openforis.collect.remoting.service.concurrency.proxy.SurveyLockingJobProxy in project collect by openforis.
the class DataService method moveRecords.
@Secured(CLEANSING)
public SurveyLockingJobProxy moveRecords(String rootEntity, int fromStepNumber, final boolean promote) {
BulkRecordMoveJob job = collectJobManager.createJob(BulkRecordMoveJob.class);
SessionState sessionState = getSessionState();
final String userName = sessionState.getUser().getUsername();
job.setSurvey(sessionState.getActiveSurvey());
job.setRootEntity(rootEntity);
job.setPromote(promote);
final Step fromStep = Step.valueOf(fromStepNumber);
job.setFromStep(fromStep);
job.setUser(sessionState.getUser());
job.setRecordMovedCallback(new BulkRecordMoveJob.Callback() {
@Override
public void recordMoved(CollectRecord record) {
if (promote) {
publishRecordPromotedEvents(record, userName);
} else {
publishRecordDeletedEvent(record, fromStep.toRecordStep(), userName);
}
}
});
collectJobManager.startSurveyJob(job);
return new SurveyLockingJobProxy(job);
}
Aggregations