use of org.jaffa.datatypes.exceptions.MandatoryFieldException in project jaffa-framework by jaffa-projects.
the class FinderForm method doValidateForSaveQuery.
public boolean doValidateForSaveQuery(HttpServletRequest request) {
boolean retVal = true;
String value = null;
value = getDefaultQueryYnWM().getValue();
if (value != null && value.trim().length() == 0) {
setDefaultQueryYn(null);
} else {
setDefaultQueryYn(new Boolean(value));
}
value = getQueryHasShortcutYnWM().getValue();
if (value != null && value.trim().length() == 0) {
setQueryHasShortcutYn(null);
} else {
setQueryHasShortcutYn(new Boolean(value));
}
// Set the selectedQuery
value = getNewQueryNameWM().getValue();
if (value == null || value.trim().length() == 0) {
// setNewQueryName(null);
raiseError(request, "NewQueryName", new MandatoryFieldException("Query Name"));
retVal = false;
} else {
setNewQueryName(value.trim());
}
return retVal;
}
use of org.jaffa.datatypes.exceptions.MandatoryFieldException in project jaffa-framework by jaffa-projects.
the class UserTimeEntryViewerComponent method display.
// .//GEN-END:_UserTimeEntryViewerOutDto_1_be
// .//GEN-BEGIN:_display_1_be
/**
* This retrieves the details for the UserTimeEntry.
* @throws ApplicationExceptions This will be thrown in case any invalid data has been set, or if no data has been set.
* @throws FrameworkException Indicates some system error.
* @return The FormKey for the View screen.
*/
public FormKey display() throws ApplicationExceptions, FrameworkException {
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_display_2_be
if (getUserName() == null) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new MandatoryFieldException(UserTimeEntryMeta.META_USER_NAME.getLabelToken()));
}
if (getProjectCode() == null) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new MandatoryFieldException(UserTimeEntryMeta.META_PROJECT_CODE.getLabelToken()));
}
if (getTask() == null) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new MandatoryFieldException(UserTimeEntryMeta.META_TASK.getLabelToken()));
}
if (getPeriodStart() == null) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new MandatoryFieldException(UserTimeEntryMeta.META_PERIOD_START.getLabelToken()));
}
if (getPeriodEnd() == null) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new MandatoryFieldException(UserTimeEntryMeta.META_PERIOD_END.getLabelToken()));
}
if (appExps != null && appExps.size() > 0)
throw appExps;
doInquiry();
return getViewerFormKey();
}
use of org.jaffa.datatypes.exceptions.MandatoryFieldException in project jaffa-framework by jaffa-projects.
the class Attachment method validate.
// .//GEN-END:preUpdate_2_be
// All the custom code goes here//GEN-FIRST:custom
/**
* {@inheritDoc}
*/
@Override
public void validate() throws ApplicationExceptions, FrameworkException {
IAttachmentData attachmentDataImpl = AttachmentFactory.getAttachmentDataImpl();
// Ensure that the attachment is specified
if (attachmentDataImpl == null) {
if (getOriginalFileName() == null || ("E".equals(getAttachmentType()) && (getData() == null || getData().length == 0)))
throw new ApplicationExceptions(new MandatoryFieldException(AttachmentMeta.META_ORIGINAL_FILE_NAME.getLabelToken()));
// Blank out the uploaded data, if any, for a non-embedded attachment
if (!"E".equals(getAttachmentType()) && getData() != null) {
if (log.isDebugEnabled())
log.debug("Ensuring that the uploaded data, if any, is blanked out for a non-embedded attachment");
try {
setData(null);
} catch (ValidationException e) {
throw new ApplicationExceptions(e);
}
}
}
// Generate the technical-key, if required
if (getAttachmentId() == null) {
try {
IVoucherGenerator vg = VoucherGeneratorFactory.instance();
vg.setUow(getUOW());
vg.setDomainClassName(getClass().getName());
vg.setFieldName(AttachmentMeta.ATTACHMENT_ID);
vg.setLabelToken(AttachmentMeta.META_ATTACHMENT_ID.getLabelToken());
setAttachmentId(vg.generate());
} catch (ValidationException e) {
throw new ApplicationExceptions(e);
}
}
if (getDocumentReferenceId() == null && attachmentDataImpl != null) {
if (log.isDebugEnabled())
log.debug("Attachment is stored in external data repository");
try {
IVoucherGenerator vg = VoucherGeneratorFactory.instance();
vg.setUow(getUOW());
vg.setDomainClassName(getClass().getName());
vg.setFieldName(AttachmentMeta.DOCUMENT_REFERENCE_ID);
vg.setLabelToken(AttachmentMeta.META_DOCUMENT_REFERENCE_ID.getLabelToken());
setDocumentReferenceId(vg.generate());
} catch (ValidationException e) {
throw new ApplicationExceptions(e);
}
}
if (getDocumentReferenceId() != null && attachmentDataImpl != null) {
try {
setAttachmentType("D");
// Null out attachment data as it is stored in document repository
setData(null);
} catch (ValidationException e) {
throw new ApplicationExceptions(e);
}
}
super.validate();
}
use of org.jaffa.datatypes.exceptions.MandatoryFieldException in project jaffa-framework by jaffa-projects.
the class UserMaintenanceForm method passwordFieldCheck.
/**
* Perform password checks
*/
private boolean passwordFieldCheck(HttpServletRequest request) {
boolean valid = true;
String pass1 = getPassword1WM().getValue();
if (pass1 != null && pass1.length() == 0)
pass1 = null;
pass1 = Parser.parseString(pass1);
String pass2 = getPassword2WM().getValue();
if (pass2 != null && pass2.length() == 0)
pass2 = null;
pass2 = Parser.parseString(pass2);
if (pass1 == null && ((UserMaintenanceComponent) getComponent()).isCreateMode()) {
raiseError(request, UserMeta.META_PASSWORD.getLabelToken(), new MandatoryFieldException(UserMeta.META_PASSWORD.getLabelToken()));
valid = false;
}
if (pass2 == null && ((UserMaintenanceComponent) getComponent()).isCreateMode()) {
raiseError(request, "[label.Jaffa.Admin.User.VerifyPassword]", new MandatoryFieldException("[label.Jaffa.Admin.User.VerifyPassword]"));
valid = false;
}
if ((pass1 != null && !pass1.equals(pass2)) || (pass2 != null && !pass2.equals(pass1))) {
raiseError(request, UserMeta.META_PASSWORD.getLabelToken(), new ActionMessage("error.Jaffa.Admin.UserMaintenance.InvalidPassword.Different"));
valid = false;
}
return valid;
}
use of org.jaffa.datatypes.exceptions.MandatoryFieldException in project jaffa-framework by jaffa-projects.
the class UserViewerComponent method display.
// .//GEN-END:_UserViewerOutDto_1_be
// .//GEN-BEGIN:_display_1_be
/**
* This retrieves the details for the User.
* @throws ApplicationExceptions This will be thrown in case any invalid data has been set, or if no data has been set.
* @throws FrameworkException Indicates some system error.
* @return The FormKey for the View screen.
*/
public FormKey display() throws ApplicationExceptions, FrameworkException {
ApplicationExceptions appExps = null;
// .//GEN-BEGIN:_display_2_be
if (getUserName() == null) {
if (appExps == null)
appExps = new ApplicationExceptions();
appExps.add(new MandatoryFieldException(UserMeta.META_USER_NAME.getLabelToken()));
}
if (appExps != null && appExps.size() > 0)
throw appExps;
doInquiry();
return getViewerFormKey();
}
Aggregations