use of org.mifos.framework.components.fieldConfiguration.business.FieldConfigurationEntity in project head by mifos.
the class BaseActionForm method checkForMandatoryFields.
protected void checkForMandatoryFields(Short entityId, ActionErrors errors, HttpServletRequest request) {
Map<Short, List<FieldConfigurationEntity>> entityMandatoryFieldMap = (Map<Short, List<FieldConfigurationEntity>>) request.getSession().getServletContext().getAttribute(Constants.FIELD_CONFIGURATION);
List<FieldConfigurationEntity> mandatoryfieldList = entityMandatoryFieldMap.get(entityId);
for (FieldConfigurationEntity fieldConfigurationEntity : mandatoryfieldList) {
String propertyName = request.getParameter(fieldConfigurationEntity.getLabel());
if (propertyName != null && !propertyName.equals("")) {
String propertyValue = request.getParameter(propertyName);
UserContext userContext = ((UserContext) request.getSession().getAttribute(LoginConstants.USERCONTEXT));
if (propertyValue == null || propertyValue.equals("")) {
errors.add(fieldConfigurationEntity.getLabel(), new ActionMessage(FieldConfigurationConstant.EXCEPTION_MANDATORY, FieldConfigurationHelper.getLocalSpecificFieldNames(fieldConfigurationEntity.getLabel(), userContext)));
}
}
}
}
use of org.mifos.framework.components.fieldConfiguration.business.FieldConfigurationEntity in project head by mifos.
the class FieldConfig method isFieldHidden.
public boolean isFieldHidden(String labelName) {
if (labelName == null || labelName.equals("") || labelName.indexOf(".") == -1) {
return false;
}
labelName = labelName.trim();
String entityName = labelName.substring(0, labelName.indexOf("."));
String fieldName = labelName.substring(labelName.indexOf(".") + 1);
List<FieldConfigurationEntity> fieldList = getEntityFieldMap().get(getEntityMap().get(entityName));
if (fieldList != null && fieldList.size() > 0) {
for (FieldConfigurationEntity fieldConfigurationEntity : fieldList) {
FieldConfigurationEntity parentfieldConfigurationEntity = fieldConfigurationEntity.getParentFieldConfig();
if ((fieldConfigurationEntity.getHiddenFlag().equals(FieldConfigurationConstant.YES) || (parentfieldConfigurationEntity != null && parentfieldConfigurationEntity.getHiddenFlag().equals(FieldConfigurationConstant.YES))) && fieldConfigurationEntity.getFieldName().equals(fieldName)) {
return true;
}
}
}
return false;
}
use of org.mifos.framework.components.fieldConfiguration.business.FieldConfigurationEntity in project head by mifos.
the class FieldConfig method isFieldManadatory.
public boolean isFieldManadatory(String labelName) {
if (labelName == null || labelName.equals("") || labelName.indexOf(".") == -1) {
return false;
}
labelName = labelName.trim();
String entityName = labelName.substring(0, labelName.indexOf("."));
String fieldName = labelName.substring(labelName.indexOf(".") + 1);
List<FieldConfigurationEntity> fieldList = getEntityFieldMap().get(getEntityMap().get(entityName));
if (fieldList != null && fieldList.size() > 0) {
for (FieldConfigurationEntity fieldConfigurationEntity : fieldList) {
FieldConfigurationEntity parentfieldConfigurationEntity = fieldConfigurationEntity.getParentFieldConfig();
if (parentfieldConfigurationEntity == null) {
if (fieldConfigurationEntity.getMandatoryFlag().equals(FieldConfigurationConstant.YES) && fieldConfigurationEntity.getHiddenFlag().equals(FieldConfigurationConstant.NO) && fieldConfigurationEntity.getFieldName().equals(fieldName)) {
return true;
}
} else if ((parentfieldConfigurationEntity.getMandatoryFlag().equals(FieldConfigurationConstant.YES) && parentfieldConfigurationEntity.getHiddenFlag().equals(FieldConfigurationConstant.NO) && fieldConfigurationEntity.getFieldName().equals(fieldName) && fieldConfigurationEntity.getHiddenFlag().equals(FieldConfigurationConstant.NO)) || ((parentfieldConfigurationEntity.getMandatoryFlag().equals(FieldConfigurationConstant.NO) && parentfieldConfigurationEntity.getHiddenFlag().equals(FieldConfigurationConstant.NO) && fieldConfigurationEntity.getFieldName().equals(fieldName) && fieldConfigurationEntity.getHiddenFlag().equals(FieldConfigurationConstant.NO) && fieldConfigurationEntity.getMandatoryFlag().equals(FieldConfigurationConstant.YES)))) {
return true;
}
}
}
return false;
}
use of org.mifos.framework.components.fieldConfiguration.business.FieldConfigurationEntity in project head by mifos.
the class FieldConfig method getMandatoryFieldList.
private List<FieldConfigurationEntity> getMandatoryFieldList(Short entityId) {
List<FieldConfigurationEntity> fieldList = getEntityFieldMap().get(entityId);
List<FieldConfigurationEntity> mandatoryFieldList = new ArrayList<FieldConfigurationEntity>();
for (FieldConfigurationEntity fieldConfigurationEntity : fieldList) {
if (isFieldManadatory(fieldConfigurationEntity.getLabel())) {
mandatoryFieldList.add(fieldConfigurationEntity);
}
}
return mandatoryFieldList;
}
use of org.mifos.framework.components.fieldConfiguration.business.FieldConfigurationEntity in project head by mifos.
the class AdminServiceFacadeWebTier method updateHiddenMandatoryFields.
@Override
public void updateHiddenMandatoryFields(MandatoryHiddenFieldsDto dto) {
try {
List<FieldConfigurationEntity> confFieldList = legacyFieldConfigurationDao.getAllConfigurationFieldList();
mandatoryHiddenFieldService.updateMandatoryHiddenFields(dto, confFieldList);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations