use of org.hisp.dhis.dataset.comparator.LockExceptionNameComparator in project dhis2-core by dhis2.
the class GetLockExceptionListAction method execute.
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute() {
if (usePaging) {
paging = createPaging(dataSetService.getLockExceptionCount());
lockExceptions = new ArrayList<>(dataSetService.getLockExceptionsBetween(paging.getStartPos(), paging.getEndPos()));
} else {
lockExceptions = new ArrayList<>(dataSetService.getAllLockExceptions());
}
Collections.sort(lockExceptions, new LockExceptionNameComparator());
for (LockException lockException : lockExceptions) {
lockException.getPeriod().setName(format.formatPeriod(lockException.getPeriod()));
}
return SUCCESS;
}
use of org.hisp.dhis.dataset.comparator.LockExceptionNameComparator in project dhis2-core by dhis2.
the class PrepareBatchRemovalAction method execute.
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@Override
public String execute() throws Exception {
lockExceptions = new ArrayList<>(dataSetService.getLockExceptionCombinations());
for (LockException lockException : lockExceptions) {
lockException.getPeriod().setName(format.formatPeriod(lockException.getPeriod()));
}
Collections.sort(lockExceptions, new LockExceptionNameComparator());
return SUCCESS;
}
use of org.hisp.dhis.dataset.comparator.LockExceptionNameComparator in project dhis2-core by dhis2.
the class LockExceptionController method getLockExceptionCombinations.
@GetMapping(value = "/combinations", produces = ContextUtils.CONTENT_TYPE_JSON)
@ResponseBody
public RootNode getLockExceptionCombinations() {
List<String> fields = Lists.newArrayList(contextService.getParameterValues("fields"));
if (fields.isEmpty()) {
fields.addAll(Preset.ALL.getFields());
}
List<LockException> lockExceptions = this.dataSetService.getLockExceptionCombinations();
I18nFormat format = this.i18nManager.getI18nFormat();
for (LockException lockException : lockExceptions) {
lockException.getPeriod().setName(format.formatPeriod(lockException.getPeriod()));
}
Collections.sort(lockExceptions, new LockExceptionNameComparator());
RootNode rootNode = NodeUtils.createMetadata();
rootNode.addChild(fieldFilterService.toCollectionNode(LockException.class, new FieldFilterParams(lockExceptions, fields)));
return rootNode;
}
Aggregations