use of org.jaffa.exceptions.DuplicateKeyException in project jaffa-framework by jaffa-projects.
the class FormEventMaintenanceTx method duplicateCheck.
// .//GEN-END:_preprocessCreate_2_be
// .//GEN-BEGIN:_duplicateCheck_1_be
/**
* Ensure that a duplicate record is not created.
*/
private void duplicateCheck(UOW uow, FormEventMaintenanceCreateInDto input) throws FrameworkException, ApplicationExceptions {
// .//GEN-BEGIN:_duplicateCheck_2_be
if (input.getEventName() == null)
return;
Criteria criteria = new Criteria();
criteria.setTable(FormEventMeta.getName());
// .//GEN-END:_duplicateCheck_2_be
// Add custom criteria//GEN-FIRST:_duplicateCheck_2
// .//GEN-LAST:_duplicateCheck_2
// .//GEN-BEGIN:_duplicateCheck_3_be
criteria.addCriteria(FormEventMeta.EVENT_NAME, input.getEventName());
Collection col = uow.query(criteria);
// .//GEN-BEGIN:_duplicateCheck_4_be
if (col != null && !col.isEmpty()) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DuplicateKeyException(FormEventMeta.getLabelToken()));
throw appExps;
}
}
use of org.jaffa.exceptions.DuplicateKeyException in project jaffa-framework by jaffa-projects.
the class UserTimeEntryMaintenanceTx method duplicateCheck.
// .//GEN-END:_preprocessCreate_2_be
// .//GEN-BEGIN:_duplicateCheck_1_be
/**
* Ensure that a duplicate record is not created.
*/
private void duplicateCheck(UOW uow, UserTimeEntryMaintenanceCreateInDto input) throws FrameworkException, ApplicationExceptions {
// .//GEN-BEGIN:_duplicateCheck_2_be
if (input.getUserName() == null || input.getProjectCode() == null || input.getTask() == null || input.getPeriodStart() == null || input.getPeriodEnd() == null)
return;
Criteria criteria = new Criteria();
criteria.setTable(UserTimeEntryMeta.getName());
// .//GEN-END:_duplicateCheck_2_be
// Add custom criteria //GEN-FIRST:_duplicateCheck_2
// .//GEN-LAST:_duplicateCheck_2
// .//GEN-BEGIN:_duplicateCheck_3_be
criteria.addCriteria(UserTimeEntryMeta.USER_NAME, input.getUserName());
criteria.addCriteria(UserTimeEntryMeta.PROJECT_CODE, input.getProjectCode());
criteria.addCriteria(UserTimeEntryMeta.TASK, input.getTask());
criteria.addCriteria(UserTimeEntryMeta.PERIOD_START, input.getPeriodStart());
criteria.addCriteria(UserTimeEntryMeta.PERIOD_END, input.getPeriodEnd());
Collection col = uow.query(criteria);
// .//GEN-BEGIN:_duplicateCheck_4_be
if (col != null && !col.isEmpty()) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DuplicateKeyException(UserTimeEntryMeta.getLabelToken()));
throw appExps;
}
}
use of org.jaffa.exceptions.DuplicateKeyException in project jaffa-framework by jaffa-projects.
the class AttachmentMaintenanceTx method duplicateCheck.
// .//GEN-END:_preprocessCreate_2_be
// .//GEN-BEGIN:_duplicateCheck_1_be
/**
* Ensure that a duplicate record is not created.
*/
private void duplicateCheck(UOW uow, AttachmentMaintenanceCreateInDto input) throws FrameworkException, ApplicationExceptions {
// .//GEN-BEGIN:_duplicateCheck_2_be
if (input.getAttachmentId() == null)
return;
Criteria criteria = new Criteria();
criteria.setTable(AttachmentMeta.getName());
// .//GEN-END:_duplicateCheck_2_be
// Add custom criteria //GEN-FIRST:_duplicateCheck_2
// .//GEN-LAST:_duplicateCheck_2
// .//GEN-BEGIN:_duplicateCheck_3_be
criteria.addCriteria(AttachmentMeta.ATTACHMENT_ID, input.getAttachmentId());
Collection col = uow.query(criteria);
// .//GEN-BEGIN:_duplicateCheck_4_be
if (col != null && !col.isEmpty()) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DuplicateKeyException(AttachmentMeta.getLabelToken()));
throw appExps;
}
}
use of org.jaffa.exceptions.DuplicateKeyException in project jaffa-framework by jaffa-projects.
the class UserMaintenanceTx method duplicateCheck.
// .//GEN-END:_preprocessCreate_2_be
// .//GEN-BEGIN:_duplicateCheck_1_be
/**
* Ensure that a duplicate record is not created.
*/
private void duplicateCheck(UOW uow, UserMaintenanceCreateInDto input) throws FrameworkException, ApplicationExceptions {
// .//GEN-BEGIN:_duplicateCheck_2_be
if (input.getUserName() == null)
return;
Criteria criteria = new Criteria();
criteria.setTable(UserMeta.getName());
// .//GEN-END:_duplicateCheck_2_be
// Add custom criteria //GEN-FIRST:_duplicateCheck_2
// .//GEN-LAST:_duplicateCheck_2
// .//GEN-BEGIN:_duplicateCheck_3_be
criteria.addCriteria(UserMeta.USER_NAME, input.getUserName());
Collection col = uow.query(criteria);
// .//GEN-BEGIN:_duplicateCheck_4_be
if (col != null && !col.isEmpty()) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DuplicateKeyException(UserMeta.getLabelToken()));
throw appExps;
}
}
use of org.jaffa.exceptions.DuplicateKeyException in project jaffa-framework by jaffa-projects.
the class UserRequestMaintenanceTx method duplicateCheck.
// .//GEN-END:_preprocessCreate_2_be
// .//GEN-BEGIN:_duplicateCheck_1_be
/**
* Ensure that a duplicate record is not created.
*/
private void duplicateCheck(UOW uow, UserRequestMaintenanceCreateInDto input) throws FrameworkException, ApplicationExceptions {
// .//GEN-BEGIN:_duplicateCheck_2_be
if (input.getRequestId() == null)
return;
Criteria criteria = new Criteria();
criteria.setTable(UserRequestMeta.getName());
// .//GEN-END:_duplicateCheck_2_be
// Add custom criteria //GEN-FIRST:_duplicateCheck_2
// .//GEN-LAST:_duplicateCheck_2
// .//GEN-BEGIN:_duplicateCheck_3_be
criteria.addCriteria(UserRequestMeta.REQUEST_ID, input.getRequestId());
Collection col = uow.query(criteria);
// .//GEN-BEGIN:_duplicateCheck_4_be
if (col != null && !col.isEmpty()) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DuplicateKeyException(UserRequestMeta.getLabelToken()));
throw appExps;
}
}
Aggregations