use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceTx method update.
// .//GEN-END:_prevalidateUpdate_1_be
// .//GEN-BEGIN:_update_1_be
/**
* Updates an existing instance of FormGroup.
* @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 FormGroupMaintenanceRetrieveOutDto update(FormGroupMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
UOW uow = null;
try {
// Print Debug Information for the input
if (log.isDebugEnabled())
log.debug("Input: " + input);
// create the UOW
uow = new UOW();
// Preprocess the input
preprocess(uow, input);
// Retrieve the object
FormGroup domain = load(uow, input);
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, false);
uow.update(domain);
// Commit the changes
uow.commit();
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("Successfully updated the domain object. Now retrieving the object details.");
// Build the outbound dto by performing a retrieve
FormGroupMaintenanceRetrieveInDto retrieveInDto = new FormGroupMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setFormName(input.getFormName());
FormGroupMaintenanceRetrieveOutDto output = retrieve(retrieveInDto);
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();
}
}
use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceComponent method removeFormUsageEntry.
// .//GEN-END:_loadPrevalidateOutDto_2_be
// All the custom code goes here//GEN-FIRST:_custom
// Remove the select FormUsage rows from the grid
public void removeFormUsageEntry(ArrayList arr, GridModel model) throws FrameworkException, ApplicationExceptions {
for (Iterator itr = model.getRows().iterator(); itr.hasNext(); ) {
GridModelRow row = (GridModelRow) itr.next();
for (int j = 0; j < m_relatedObjectFormUsageDto.length; j++) {
if (m_relatedObjectFormUsageDto[j].getEventName().equals(((String) row.getElement("eventName")))) {
m_relatedObjectFormUsageDto[j].setFormAlternate(((EditBoxModel) row.getElement("formAlternate")).getValue());
try {
EditBoxModel copiesElement = (EditBoxModel) row.getElement("copies");
if (copiesElement == null) {
throw new ApplicationExceptions(new ApplicationException("exception.Jaffa.Printing.FormGroupMaintenance.copiesValidation") {
});
}
String copies = copiesElement.getValue();
if (copies == null) {
throw new ApplicationExceptions(new ApplicationException("exception.Jaffa.Printing.FormGroupMaintenance.copiesValidation") {
});
}
m_relatedObjectFormUsageDto[j].setCopies(Long.valueOf(copies));
} catch (NumberFormatException ne) {
throw new ApplicationExceptions(new ApplicationException("exception.Jaffa.Printing.FormGroupMaintenance.copiesValidation") {
});
}
break;
}
}
}
ArrayList relatedFormUsageEntryDto = new ArrayList(Arrays.asList(m_relatedObjectFormUsageDto));
String tc = null;
for (int i = 0; i < arr.size(); i++) {
tc = (String) arr.get(i);
for (int j = 0; j < relatedFormUsageEntryDto.size(); j++) {
FormUsageDto usageDto = (FormUsageDto) relatedFormUsageEntryDto.get(j);
if ((usageDto.getEventName()).equals(tc)) {
relatedFormUsageEntryDto.remove(j);
break;
}
}
}
m_relatedObjectFormUsageDto = (FormUsageDto[]) relatedFormUsageEntryDto.toArray(new FormUsageDto[0]);
uncacheWidgetModels();
}
use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.
the class FormGroupMaintenanceTx method preprocess.
// .//GEN-END:_updateDomain_3_be
// .//GEN-BEGIN:_preprocessDelete_1_be
/**
* Preprocess the input for the delete method.
*/
private void preprocess(UOW uow, FormGroupMaintenanceDeleteInDto input) throws FrameworkException, ApplicationExceptions {
if (input.getFormName() != null) {
Criteria criteria = new Criteria();
criteria.setTable(FormDefinitionMeta.getName());
criteria.addCriteria(FormDefinitionMeta.FORM_NAME, input.getFormName());
Collection col = uow.query(criteria);
Iterator itr = col.iterator();
if (itr.hasNext()) {
throw new ApplicationExceptions(new ApplicationException("exception.Jaffa.Printing.FormGroupMaintenance.formNameExistInFormDefinitions") {
});
}
}
// .//GEN-LAST:_preprocessDelete_1
// .//GEN-BEGIN:_preprocessDelete_2_be
}
use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.
the class UserMaintenanceTx method update.
// .//GEN-END:_prevalidateUpdate_1_be
// .//GEN-BEGIN:_update_1_be
/**
* Updates an existing instance of User.
* @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 UserMaintenanceRetrieveOutDto update(UserMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
UOW uow = null;
try {
// Print Debug Information for the input
if (log.isDebugEnabled())
log.debug("Input: " + input);
// create the UOW
uow = new UOW();
// Preprocess the input
preprocess(uow, input);
// Retrieve the object
User domain = load(uow, input);
// Ensure the domain object has not been modified
domainObjectChangedTest(input.getPerformDirtyReadCheck(), domain, input.getLastUpdatedOn());
// Validate the foreign objects
validateForeignObjects(uow, input);
// Update the domain object
updateDomain(uow, input, domain, false);
uow.update(domain);
// Commit the changes
uow.commit();
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("Successfully updated the domain object. Now retrieving the object details.");
// Build the outbound dto by performing a retrieve
UserMaintenanceRetrieveInDto retrieveInDto = new UserMaintenanceRetrieveInDto();
retrieveInDto.setHeaderDto(input.getHeaderDto());
retrieveInDto.setUserName(input.getUserName());
UserMaintenanceRetrieveOutDto output = retrieve(retrieveInDto);
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();
}
}
use of org.jaffa.exceptions.ApplicationException in project jaffa-framework by jaffa-projects.
the class UserMaintenanceTx method retrieve.
// .//GEN-END:_create_1_be
// .//GEN-BEGIN:_retrieve_1_be
/**
* Returns the details for User.
* @param input The criteria based on which an object will be retrieved.
* @throws ApplicationExceptions This will be thrown if the criteria contains invalid data.
* @throws FrameworkException Indicates some system error.
* @return The object details. A null indicates, the object was not found.
*/
public UserMaintenanceRetrieveOutDto retrieve(UserMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
UOW uow = null;
try {
// Print Debug Information for the input
if (log.isDebugEnabled())
log.debug("Input: " + input);
// create the UOW
uow = new UOW();
// Preprocess the input
preprocess(uow, input);
// Retrieve the object
User domain = load(uow, input);
// Convert the domain objects into the outbound dto
UserMaintenanceRetrieveOutDto output = buildRetrieveOutDto(uow, input, domain);
// Print Debug Information for the output
if (log.isDebugEnabled())
log.debug("Output: " + output);
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