Skip to content

Commit

Permalink
limit journal entry count queries - lazy data model
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrenn committed Jun 19, 2024
1 parent a688abf commit fdf2798
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.phoenixctms.ctsms.exception.AuthenticationException;
import org.phoenixctms.ctsms.exception.AuthorisationException;
import org.phoenixctms.ctsms.exception.ServiceException;
import org.phoenixctms.ctsms.util.CommonUtil;
import org.phoenixctms.ctsms.vo.JournalEntryOutVO;
import org.phoenixctms.ctsms.vo.PSFVO;
import org.phoenixctms.ctsms.web.model.LazyDataModelBase;
Expand All @@ -24,16 +25,24 @@ public Long getEntityId() {
@Override
protected Collection<JournalEntryOutVO> getLazyResult(PSFVO psf) {
if (module != null && entityId != null) {
if (psf != null) {
psf.setUpdateRowCount(false);
}
try {
return WebUtil.getServiceLocator().getJournalService().getJournal(WebUtil.getAuthentication(), module, entityId, psf);
} catch (ServiceException|AuthorisationException|IllegalArgumentException e) {
} catch (ServiceException | AuthorisationException | IllegalArgumentException e) {
} catch (AuthenticationException e) {
WebUtil.publishException(e);
}
}
return new ArrayList<JournalEntryOutVO>();
}

@Override
public void updateRowCount() {
setRowCount(CommonUtil.safeLongToInt(CommonUtil.fromCountLimitExceeded(WebUtil.getJournalCountSafe(module, entityId))));
}

public JournalModule getModule() {
return module;
}
Expand Down

0 comments on commit fdf2798

Please sign in to comment.