/** * Reload data if the realm changes (see SYNCOPE-1135). */ private void reload() { boolean reload; if (Groups.this.templateMode) { reload = realm == null; realm = SyncopeConstants.ROOT_REALM; } else { reload = !Groups.this.anyTO.getRealm().equalsIgnoreCase(realm); realm = Groups.this.anyTO.getRealm(); } if (reload) { reloadObject(); reloadMemberships(); reloadDynMemberships(); } } }
protected Pair<TO, List<LogicActions>> beforeDelete(final TO input) { Realm realm = realmDAO.findByFullPath(input.getRealm()); if (realm == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm); sce.getElements().add(input.getRealm()); throw sce; } TO any = input; List<LogicActions> actions = getActions(realm); for (LogicActions action : actions) { any = action.beforeDelete(any); } LOG.debug("Input: {}\nOutput: {}\n", input, any); return ImmutablePair.of(any, actions); }
protected Pair<TO, List<LogicActions>> beforeCreate(final TO input) { Realm realm = realmDAO.findByFullPath(input.getRealm()); if (realm == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm); sce.getElements().add(input.getRealm()); throw sce; } AnyType anyType = input instanceof UserTO ? anyTypeDAO.findUser() : input instanceof GroupTO ? anyTypeDAO.findGroup() : anyTypeDAO.find(input.getType()); if (anyType == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType); sce.getElements().add(input.getType()); throw sce; } TO any = input; templateUtils.apply(any, realm.getTemplate(anyType)); List<LogicActions> actions = getActions(realm); for (LogicActions action : actions) { any = action.beforeCreate(any); } LOG.debug("Input: {}\nOutput: {}\n", input, any); return ImmutablePair.of(any, actions); }
public static <A extends AnyTO, C extends AnyCR> void toAnyCR(final A anyTO, final C anyCR) { anyCR.setRealm(anyTO.getRealm()); anyCR.getAuxClasses().addAll(anyTO.getAuxClasses()); anyCR.getPlainAttrs().addAll(anyTO.getPlainAttrs());