use of org.jaffa.applications.test.modules.time.domain.UserTimeEntry in project jaffa-framework by jaffa-projects.
the class UserTimeEntryFinderTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private UserTimeEntryFinderOutDto buildDto(UOW uow, Collection results, UserTimeEntryFinderInDto input) throws UOWException {
UserTimeEntryFinderOutDto output = new UserTimeEntryFinderOutDto();
int maxRecords = input.getMaxRecords() != null ? input.getMaxRecords().intValue() : 0;
int counter = 0;
for (Iterator i = results.iterator(); i.hasNext(); ) {
if (++counter > maxRecords && maxRecords > 0) {
output.setMoreRecordsExist(Boolean.TRUE);
break;
}
UserTimeEntryFinderOutRowDto row = new UserTimeEntryFinderOutRowDto();
UserTimeEntry userTimeEntry = (UserTimeEntry) i.next();
// .//GEN-END:_buildDto_1_be
// Add custom code before all the setters //GEN-FIRST:_buildDto_1
// .//GEN-LAST:_buildDto_1
// .//GEN-BEGIN:_buildDto_UserName_1_be
row.setUserName(userTimeEntry.getUserName());
// .//GEN-END:_buildDto_UserName_1_be
// .//GEN-BEGIN:_buildDto_ProjectCode_1_be
row.setProjectCode(userTimeEntry.getProjectCode());
// .//GEN-END:_buildDto_ProjectCode_1_be
// .//GEN-BEGIN:_buildDto_Activity_1_be
row.setActivity(userTimeEntry.getActivity());
// .//GEN-END:_buildDto_Activity_1_be
// .//GEN-BEGIN:_buildDto_Task_1_be
row.setTask(userTimeEntry.getTask());
// .//GEN-END:_buildDto_Task_1_be
// .//GEN-BEGIN:_buildDto_PeriodStart_1_be
row.setPeriodStart(userTimeEntry.getPeriodStart());
// .//GEN-END:_buildDto_PeriodStart_1_be
// .//GEN-BEGIN:_buildDto_PeriodEnd_1_be
row.setPeriodEnd(userTimeEntry.getPeriodEnd());
// .//GEN-END:_buildDto_PeriodEnd_1_be
// Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
output.addRows(row);
}
return output;
}
use of org.jaffa.applications.test.modules.time.domain.UserTimeEntry in project jaffa-framework by jaffa-projects.
the class UserTimeEntryLookupTx method buildDto.
// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private UserTimeEntryLookupOutDto buildDto(UOW uow, Collection results, UserTimeEntryLookupInDto input) throws UOWException {
UserTimeEntryLookupOutDto output = new UserTimeEntryLookupOutDto();
int maxRecords = input.getMaxRecords() != null ? input.getMaxRecords().intValue() : 0;
int counter = 0;
for (Iterator i = results.iterator(); i.hasNext(); ) {
if (++counter > maxRecords && maxRecords > 0) {
output.setMoreRecordsExist(Boolean.TRUE);
break;
}
UserTimeEntryLookupOutRowDto row = new UserTimeEntryLookupOutRowDto();
UserTimeEntry userTimeEntry = (UserTimeEntry) i.next();
// .//GEN-END:_buildDto_1_be
// Add custom code before all the setters //GEN-FIRST:_buildDto_1
// .//GEN-LAST:_buildDto_1
// .//GEN-BEGIN:_buildDto_UserName_1_be
row.setUserName(userTimeEntry.getUserName());
// .//GEN-END:_buildDto_UserName_1_be
// .//GEN-BEGIN:_buildDto_ProjectCode_1_be
row.setProjectCode(userTimeEntry.getProjectCode());
// .//GEN-END:_buildDto_ProjectCode_1_be
// .//GEN-BEGIN:_buildDto_Activity_1_be
row.setActivity(userTimeEntry.getActivity());
// .//GEN-END:_buildDto_Activity_1_be
// .//GEN-BEGIN:_buildDto_Task_1_be
row.setTask(userTimeEntry.getTask());
// .//GEN-END:_buildDto_Task_1_be
// .//GEN-BEGIN:_buildDto_PeriodStart_1_be
row.setPeriodStart(userTimeEntry.getPeriodStart());
// .//GEN-END:_buildDto_PeriodStart_1_be
// .//GEN-BEGIN:_buildDto_PeriodEnd_1_be
row.setPeriodEnd(userTimeEntry.getPeriodEnd());
// .//GEN-END:_buildDto_PeriodEnd_1_be
// Add custom code to pass values to the dto //GEN-FIRST:_buildDto_2
// .//GEN-LAST:_buildDto_2
// .//GEN-BEGIN:_buildDto_3_be
output.addRows(row);
}
return output;
}
use of org.jaffa.applications.test.modules.time.domain.UserTimeEntry in project jaffa-framework by jaffa-projects.
the class UserTimeEntryMaintenanceTx method createDomain.
// .//GEN-END:_duplicateCheck_4_be
// .//GEN-BEGIN:_createDomain_1_be
/**
* Create the domain object.
*/
private UserTimeEntry createDomain(UOW uow, UserTimeEntryMaintenanceCreateInDto input, boolean fromPrevalidate) throws FrameworkException, ApplicationExceptions {
UserTimeEntry domain = new UserTimeEntry();
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_createDomain_2_be
try {
domain.updateUserName(input.getUserName());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateProjectCode(input.getProjectCode());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateActivity(input.getActivity());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updateTask(input.getTask());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updatePeriodStart(input.getPeriodStart());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
try {
domain.updatePeriodEnd(input.getPeriodEnd());
} catch (ValidationException e) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(e);
}
// .//GEN-BEGIN:_createDomain_3_be
if (appExps != null && appExps.size() > 0)
throw appExps;
return domain;
}
use of org.jaffa.applications.test.modules.time.domain.UserTimeEntry in project jaffa-framework by jaffa-projects.
the class UserTimeEntryMaintenanceTx method load.
// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
* Retrieve the domain object.
*/
private UserTimeEntry load(UOW uow, UserTimeEntryMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
UserTimeEntry domain = null;
Criteria criteria = new Criteria();
criteria.setTable(UserTimeEntryMeta.getName());
// .//GEN-END:_loadRetrieve_1_be
// Add custom criteria //GEN-FIRST:_loadRetrieve_1
// .//GEN-LAST:_loadRetrieve_1
// .//GEN-BEGIN:_loadRetrieve_2_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());
Iterator itr = uow.query(criteria).iterator();
if (itr.hasNext())
domain = (UserTimeEntry) itr.next();
// .//GEN-BEGIN:_loadRetrieve_3_be
if (domain == null) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add(new DomainObjectNotFoundException(UserTimeEntryMeta.getLabelToken()));
throw appExps;
}
return domain;
}
use of org.jaffa.applications.test.modules.time.domain.UserTimeEntry in project jaffa-framework by jaffa-projects.
the class UserTimeEntryMaintenanceTx method prevalidateUpdate.
// .//GEN-END:_retrieve_1_be
// .//GEN-BEGIN:_prevalidateUpdate_1_be
/**
* This method is used to perform prevalidations before updating an existing instance of UserTimeEntry.
* @param input The new values for the domain object.
* @throws ApplicationExceptions This will be thrown if the input contains invalid data.
* @throws FrameworkException Indicates some system error.
* @return The object details.
*/
public UserTimeEntryMaintenancePrevalidateOutDto prevalidateUpdate(UserTimeEntryMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
UOW uow = null;
try {
// Print Debug Information for the input
if (log.isDebugEnabled())
log.debug("Input: " + (input != null ? input.toString() : null));
// create the UOW
uow = new UOW();
// Preprocess the input
preprocess(uow, input);
// Retrieve the object
UserTimeEntry domain = load(uow, input);
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, true);
// Build the outbound dto
UserTimeEntryMaintenancePrevalidateOutDto output = createPrevalidateOutDto(uow, domain, input);
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("Output: " + (output != null ? output.toString() : null));
return output;
} catch (FrameworkException e) {
// If it is, then re-throw as ApplicationsExceptions, else throw the FrameworkException.
if (e.getCause() != null && e.getCause() instanceof ApplicationExceptions) {
throw (ApplicationExceptions) e.getCause();
} else if (e.getCause() != null && e.getCause() instanceof ApplicationException) {
ApplicationExceptions appExps = new ApplicationExceptions();
appExps.add((ApplicationException) e.getCause());
throw appExps;
} else
throw e;
} finally {
if (uow != null)
uow.rollback();
}
}
Aggregations