use of org.motechproject.tasks.domain.ManipulationType in project motech by motech.
the class TaskValidator method validateDateManipulation.
private TaskError validateDateManipulation(String manipulation, ParameterType fieldType, String foundAt) {
TaskError error = null;
ManipulationType type = ManipulationType.fromString(manipulation.replaceAll("\\((.*?)\\)", ""));
if (type.getTarget() != ManipulationTarget.DATE) {
if (type.getTarget() == ManipulationTarget.ALL) {
error = new TaskError("task.validation.error.wrongAnotherManipulation", manipulation, foundAt);
} else {
error = new TaskError("task.validation.error.wrongDateManipulation", manipulation, foundAt);
}
} else if (fieldType.equals(ParameterType.DATE) && !type.allowResultType(ManipulationTarget.DATE)) {
error = new TaskError("task.validation.error.wrongDateManipulationTarget", manipulation, foundAt);
}
return error;
}
use of org.motechproject.tasks.domain.ManipulationType in project motech by motech.
the class TaskValidator method validateStringManipulation.
private TaskError validateStringManipulation(String manipulation, String foundAt) {
TaskError error = null;
ManipulationType type = ManipulationType.fromString(manipulation.replaceAll("\\((.*?)\\)", ""));
if (type.getTarget() != ManipulationTarget.STRING) {
if (type.getTarget() == ManipulationTarget.ALL) {
error = new TaskError("task.validation.error.wrongAnotherManipulation", manipulation, foundAt);
} else {
error = new TaskError("task.validation.error.wrongStringManipulation", manipulation, foundAt);
}
}
return error;
}
Aggregations