}
}
}
private void fill(final SyncTask task, final SyncTaskTO taskTO) {
SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidSyncTask);
// 1. validate JEXL expressions in user and role templates
if (taskTO.getUserTemplate() != null) {
UserTO template = taskTO.getUserTemplate();
if (StringUtils.isNotBlank(template.getUsername()) && !jexlUtil.isExpressionValid(template.getUsername())) {
sce.addElement("Invalid JEXL: " + template.getUsername());
}
if (StringUtils.isNotBlank(template.getPassword()) && !jexlUtil.isExpressionValid(template.getPassword())) {
sce.addElement("Invalid JEXL: " + template.getPassword());
}
checkJexl(template, sce);
for (MembershipTO memb : template.getMemberships()) {
checkJexl(memb, sce);
}
}
if (taskTO.getRoleTemplate() != null) {
RoleTO template = taskTO.getRoleTemplate();
if (StringUtils.isNotBlank(template.getName()) && !jexlUtil.isExpressionValid(template.getName())) {
sce.addElement("Invalid JEXL: " + template.getName());
}
checkJexl(template, sce);
}
if (!sce.isEmpty()) {
SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(
HttpStatus.BAD_REQUEST);
scce.addException(sce);
throw scce;
}