return forward();
}
public String save() {
Restriction restriction = getRestriction();
RestrictionHolder holder = new RestrictionHelper(entityDao).getHolder();
List<Restriction> myRestrictions = getMyRestrictions(restriction.getPattern(), holder);
Set<RestrictField> ignoreParams = getIgnoreParams(myRestrictions);
boolean isAdmin = isAdmin(getUser());
for (RestrictField param : restriction.getPattern().getObject().getFields()) {
String value = get(param.getName());
if ((ignoreParams.contains(param) || isAdmin) && getBool("ignoreParam" + param.getId())) {
restriction.setItem(param, "*");
} else {
if (StringUtils.isEmpty(value)) {
restriction.getItems().remove(param.getId());
} else {
restriction.setItem(param, value);
}
}
}
if (restriction.getItems().isEmpty()) {
holder.getRestrictions().remove(restriction);
entityDao.saveOrUpdate(holder);
return redirect("info", "info.save.success");
} else {
if (!restriction.isPersisted()) {
holder.getRestrictions().add(restriction);
entityDao.saveOrUpdate(holder);
} else {
entityDao.saveOrUpdate(
(String) RestrictionHelper.restrictionTypeMap.get(get("restrictionType")),
restriction);