ItEr42S05ValidacionEProbasFuncionaisItEr41S05 : add a more optimal filter and change the user messages by removing the null word.
This commit is contained in:
parent
5811527f45
commit
0b9bc3436f
2 changed files with 18 additions and 16 deletions
|
|
@ -382,7 +382,7 @@ public class QualityFormCRUDController extends GenericForwardComposer {
|
|||
throws WrongValueException {
|
||||
getQualityForm().setName((String) value);
|
||||
if(((String)value == null) || (((String)value)).isEmpty()){
|
||||
throw new WrongValueException(comp, _("cannot be null or empty"));
|
||||
throw new WrongValueException(comp, _("cannot be empty"));
|
||||
} else if (!qualityFormModel
|
||||
.checkConstraintUniqueQualityFormName()) {
|
||||
getQualityForm().setName(null);
|
||||
|
|
@ -404,7 +404,7 @@ public class QualityFormCRUDController extends GenericForwardComposer {
|
|||
if (((String) value == null) || (((String) value)).isEmpty()) {
|
||||
item.setName(null);
|
||||
throw new WrongValueException(comp,
|
||||
_("cannot be null or empty"));
|
||||
_("cannot be empty"));
|
||||
} else if (!qualityFormModel
|
||||
.checkConstraintUniqueQualityFormItemName()) {
|
||||
item.setName(null);
|
||||
|
|
@ -428,7 +428,7 @@ public class QualityFormCRUDController extends GenericForwardComposer {
|
|||
|
||||
if (newPercentage == null) {
|
||||
item.setPercentage(null);
|
||||
throw new WrongValueException(comp, _("cannot be null"));
|
||||
throw new WrongValueException(comp, _("cannot be empty"));
|
||||
}
|
||||
if (qualityFormModel
|
||||
.checkConstraintOutOfRangeQualityFormItemPercentage(item)) {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ public class QualityFormModel implements IQualityFormModel {
|
|||
|
||||
private QualityForm qualityForm;
|
||||
|
||||
private List<QualityForm> listQualityForms = new ArrayList<QualityForm>();
|
||||
|
||||
public QualityFormModel() {
|
||||
|
||||
}
|
||||
|
|
@ -54,23 +56,23 @@ public class QualityFormModel implements IQualityFormModel {
|
|||
@Override
|
||||
@Transactional(readOnly=true)
|
||||
public List<QualityForm> getQualityForms(String predicate) {
|
||||
List<QualityForm> listAll = qualityFormDAO.getAll();
|
||||
if ((predicate != null) && (!predicate.isEmpty())) {
|
||||
return filterQualityForms(listAll,predicate);
|
||||
}
|
||||
return listAll;
|
||||
listQualityForms.clear();
|
||||
listQualityForms = qualityFormDAO.getAll();
|
||||
return listQualityForms;
|
||||
}
|
||||
|
||||
private List<QualityForm> filterQualityForms(List<QualityForm> listAll,
|
||||
String predicate) {
|
||||
List<QualityForm> result = new ArrayList<QualityForm>();
|
||||
for (QualityForm qualityForm : listAll) {
|
||||
if (qualityForm.getName().toLowerCase().contains(
|
||||
predicate.toLowerCase())) {
|
||||
result.add(qualityForm);
|
||||
public List<QualityForm> filterQualityForms(String predicate) {
|
||||
if ((predicate != null) && (!predicate.isEmpty())) {
|
||||
List<QualityForm> result = new ArrayList<QualityForm>();
|
||||
for (QualityForm qualityForm : listQualityForms) {
|
||||
if (qualityForm.getName().toLowerCase().contains(
|
||||
predicate.toLowerCase())) {
|
||||
result.add(qualityForm);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
return listQualityForms;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue