You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2014/08/05 13:20:02 UTC
svn commit: r1615910 [10/12] - in /syncope/trunk: ./
archetype/src/main/resources/
archetype/src/main/resources/archetype-resources/console/
archetype/src/main/resources/archetype-resources/core/
build-tools/src/main/resources/ client/src/main/java/org...
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/util/AttributableOperations.java Tue Aug 5 11:20:00 2014
@@ -1,495 +1,495 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.syncope.common.mod.AbstractAttributableMod;
-import org.apache.syncope.common.mod.AbstractSubjectMod;
-import org.apache.syncope.common.mod.AttributeMod;
-import org.apache.syncope.common.mod.MembershipMod;
-import org.apache.syncope.common.mod.ReferenceMod;
-import org.apache.syncope.common.mod.RoleMod;
-import org.apache.syncope.common.mod.UserMod;
-import org.apache.syncope.common.to.AbstractAttributableTO;
-import org.apache.syncope.common.to.AbstractSubjectTO;
-import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.MembershipTO;
-import org.apache.syncope.common.to.RoleTO;
-import org.apache.syncope.common.to.UserTO;
-
-/**
- * Utility class for manipulating classes extending AbstractAttributableTO and AbstractAttributableMod.
- *
- * @see AbstractAttributableTO
- * @see AbstractAttributableMod
- */
-public final class AttributableOperations {
-
- private AttributableOperations() {
- // empty constructor for static utility classes
- }
-
- private static void populate(final Map<String, AttributeTO> updatedAttrs,
- final Map<String, AttributeTO> originalAttrs, final AbstractAttributableMod result) {
-
- populate(updatedAttrs, originalAttrs, result, false);
- }
-
- private static void populate(final Map<String, AttributeTO> updatedAttrs,
- final Map<String, AttributeTO> originalAttrs, final AbstractAttributableMod result,
- final boolean virtuals) {
-
- for (Map.Entry<String, AttributeTO> entry : updatedAttrs.entrySet()) {
- AttributeMod mod = new AttributeMod();
- mod.setSchema(entry.getKey());
-
- Set<String> updatedValues = new HashSet<String>(entry.getValue().getValues());
-
- Set<String> originalValues = originalAttrs.containsKey(entry.getKey())
- ? new HashSet<String>(originalAttrs.get(entry.getKey()).getValues())
- : Collections.<String>emptySet();
-
- if (!originalAttrs.containsKey(entry.getKey())) {
- // SYNCOPE-459: take care of user virtual attributes without any value
- updatedValues.remove("");
- mod.getValuesToBeAdded().addAll(new ArrayList<String>(updatedValues));
-
- if (virtuals) {
- result.getVirAttrsToUpdate().add(mod);
- } else {
- result.getAttrsToUpdate().add(mod);
- }
- } else if (!updatedValues.equals(originalValues)) {
- // avoid unwanted inputs
- updatedValues.remove("");
- if (!entry.getValue().isReadonly()) {
- mod.getValuesToBeAdded().addAll(updatedValues);
-
- if (!mod.isEmpty()) {
- if (virtuals) {
- result.getVirAttrsToRemove().add(mod.getSchema());
- } else {
- result.getAttrsToRemove().add(mod.getSchema());
- }
- }
- }
-
- mod.getValuesToBeRemoved().addAll(originalValues);
-
- if (!mod.isEmpty()) {
- if (virtuals) {
- result.getVirAttrsToUpdate().add(mod);
- } else {
- result.getAttrsToUpdate().add(mod);
- }
- }
- }
- }
- }
-
- private static void diff(
- final AbstractAttributableTO updated,
- final AbstractAttributableTO original,
- final AbstractAttributableMod result,
- final boolean incremental) {
-
- // 1. check same id
- if (updated.getId() != original.getId()) {
- throw new IllegalArgumentException("AttributableTO's id must be the same");
- }
- result.setId(updated.getId());
-
- // 2. attributes
- Map<String, AttributeTO> updatedAttrs = new HashMap<String, AttributeTO>(updated.getAttrMap());
- Map<String, AttributeTO> originalAttrs = new HashMap<String, AttributeTO>(original.getAttrMap());
-
- Set<String> originalAttrNames = new HashSet<String>(originalAttrs.keySet());
- originalAttrNames.removeAll(updatedAttrs.keySet());
-
- if (!incremental) {
- result.getAttrsToRemove().clear();
- result.getAttrsToRemove().addAll(originalAttrNames);
- }
-
- Set<String> emptyUpdatedAttrs = new HashSet<String>();
- for (Map.Entry<String, AttributeTO> entry : updatedAttrs.entrySet()) {
- if (entry.getValue().getValues() == null || entry.getValue().getValues().isEmpty()) {
-
- emptyUpdatedAttrs.add(entry.getKey());
- }
- }
- for (String emptyUpdatedAttr : emptyUpdatedAttrs) {
- updatedAttrs.remove(emptyUpdatedAttr);
- result.getAttrsToRemove().add(emptyUpdatedAttr);
- }
-
- populate(updatedAttrs, originalAttrs, result);
-
- // 3. derived attributes
- updatedAttrs = updated.getDerAttrMap();
- originalAttrs = original.getDerAttrMap();
-
- originalAttrNames = new HashSet<String>(originalAttrs.keySet());
- originalAttrNames.removeAll(updatedAttrs.keySet());
-
- if (!incremental) {
- result.getDerAttrsToRemove().clear();
- result.getDerAttrsToRemove().addAll(originalAttrNames);
- }
-
- Set<String> updatedAttrNames = new HashSet<String>(updatedAttrs.keySet());
- updatedAttrNames.removeAll(originalAttrs.keySet());
- result.getDerAttrsToAdd().clear();
- result.getDerAttrsToAdd().addAll(updatedAttrNames);
-
- // 4. virtual attributes
- updatedAttrs = updated.getVirAttrMap();
- originalAttrs = original.getVirAttrMap();
-
- originalAttrNames = new HashSet<String>(originalAttrs.keySet());
- originalAttrNames.removeAll(updatedAttrs.keySet());
-
- if (!incremental) {
- result.getVirAttrsToRemove().clear();
- result.getVirAttrsToRemove().addAll(originalAttrNames);
- }
-
- populate(updatedAttrs, originalAttrs, result, true);
-
- // 5. resources
- if (original instanceof AbstractSubjectTO && updated instanceof AbstractSubjectTO
- && result instanceof AbstractSubjectMod) {
-
- Set<String> updatedRes = new HashSet<String>(((AbstractSubjectTO) updated).getResources());
- Set<String> originalRes = new HashSet<String>(((AbstractSubjectTO) original).getResources());
-
- updatedRes.removeAll(originalRes);
- ((AbstractSubjectMod) result).getResourcesToAdd().clear();
- ((AbstractSubjectMod) result).getResourcesToAdd().addAll(updatedRes);
-
- originalRes.removeAll(((AbstractSubjectTO) updated).getResources());
-
- if (!incremental) {
- ((AbstractSubjectMod) result).getResourcesToRemove().clear();
- ((AbstractSubjectMod) result).getResourcesToRemove().addAll(originalRes);
- }
- }
- }
-
- /**
- * Calculate modifications needed by first in order to be equal to second.
- *
- * @param updated updated UserTO
- * @param original original UserTO
- * @return UserMod containing differences
- */
- public static UserMod diff(final UserTO updated, final UserTO original) {
- return diff(updated, original, false);
- }
-
- /**
- * Calculate modifications needed by first in order to be equal to second.
- *
- * @param updated updated UserTO
- * @param original original UserTO
- * @param incremental perform incremental diff (without removing existing info)
- * @return UserMod containing differences
- */
- public static UserMod diff(final UserTO updated, final UserTO original, final boolean incremental) {
- UserMod result = new UserMod();
-
- diff(updated, original, result, incremental);
-
- // 1. password
- if (updated.getPassword() != null && (original.getPassword() == null || !original.getPassword().
- equals(updated.getPassword()))) {
- result.setPassword(updated.getPassword());
- }
-
- // 2. username
- if (original.getUsername() != null && !original.getUsername().equals(updated.getUsername())) {
- result.setUsername(updated.getUsername());
- }
-
- // 3. memberships
- Map<Long, MembershipTO> updatedMembs = updated.getMembershipMap();
- Map<Long, MembershipTO> originalMembs = original.getMembershipMap();
-
- for (Map.Entry<Long, MembershipTO> entry : updatedMembs.entrySet()) {
- MembershipMod membMod = new MembershipMod();
- membMod.setRole(entry.getValue().getRoleId());
-
- if (originalMembs.containsKey(entry.getKey())) {
- // if memberships are actually same, just make the isEmpty() call below succeed
- if (entry.getValue().equals(originalMembs.get(entry.getKey()))) {
- membMod.setRole(0);
- } else {
- diff(entry.getValue(), originalMembs.get(entry.getKey()), membMod, false);
- }
- } else {
- for (AttributeTO attr : entry.getValue().getAttrs()) {
- AttributeMod attrMod = new AttributeMod();
- attrMod.setSchema(attr.getSchema());
- attrMod.getValuesToBeAdded().addAll(attr.getValues());
-
- if (!attrMod.isEmpty()) {
- membMod.getAttrsToUpdate().add(attrMod);
- membMod.getAttrsToRemove().add(attrMod.getSchema());
- }
- }
- for (AttributeTO attr : entry.getValue().getDerAttrs()) {
- membMod.getDerAttrsToAdd().add(attr.getSchema());
- }
- for (AttributeTO attr : entry.getValue().getVirAttrs()) {
- AttributeMod attrMod = new AttributeMod();
- attrMod.setSchema(attr.getSchema());
- attrMod.getValuesToBeAdded().addAll(attr.getValues());
-
- if (!attrMod.isEmpty()) {
- membMod.getVirAttrsToUpdate().add(attrMod);
- membMod.getAttrsToRemove().add(attrMod.getSchema());
- }
- }
- }
-
- if (!membMod.isEmpty()) {
- result.getMembershipsToAdd().add(membMod);
- }
- }
-
- if (!incremental) {
- Set<Long> originalRoles = new HashSet<Long>(originalMembs.keySet());
- originalRoles.removeAll(updatedMembs.keySet());
- for (Long roleId : originalRoles) {
- result.getMembershipsToRemove().add(originalMembs.get(roleId).getId());
- }
- }
-
- return result;
- }
-
- /**
- * Calculate modifications needed by first in order to be equal to second.
- *
- * @param updated updated RoleTO
- * @param original original RoleTO
- * @return RoleMod containing differences
- */
- public static RoleMod diff(final RoleTO updated, final RoleTO original) {
- return diff(updated, original, false);
- }
-
- /**
- * Calculate modifications needed by first in order to be equal to second.
- *
- * @param updated updated RoleTO
- * @param original original RoleTO
- * @param incremental perform incremental diff (without removing existing info)
- * @return RoleMod containing differences
- */
- public static RoleMod diff(final RoleTO updated, final RoleTO original, final boolean incremental) {
- RoleMod result = new RoleMod();
-
- diff(updated, original, result, incremental);
-
- // 1. inheritance
- result.setInheritOwner(updated.isInheritOwner());
- result.setInheritTemplates(updated.isInheritTemplates());
- result.setInheritAccountPolicy(updated.isInheritAccountPolicy());
- result.setInheritPasswordPolicy(updated.isInheritPasswordPolicy());
- result.setInheritAttributes(updated.isInheritAttrs());
- result.setInheritDerAttrs(updated.isInheritDerAttrs());
- result.setInheritVirAttrs(updated.isInheritVirAttrs());
-
- // 2. policies
- result.setAccountPolicy(new ReferenceMod(updated.getAccountPolicy()));
- result.setPasswordPolicy(new ReferenceMod(updated.getPasswordPolicy()));
-
- // 3. name
- if (!original.getName().equals(updated.getName())) {
- result.setName(updated.getName());
- }
-
- // 4. entitlements
- Set<String> updatedEnts = new HashSet<String>(updated.getEntitlements());
- Set<String> originalEnts = new HashSet<String>(original.getEntitlements());
- if (updatedEnts.equals(originalEnts)) {
- result.setModEntitlements(false);
- result.getEntitlements().clear();
- } else {
- result.setModEntitlements(true);
- result.getEntitlements().addAll(updated.getEntitlements());
- }
-
- // 5. templates
- Set<String> updatedTemplates = new HashSet<String>(updated.getRAttrTemplates());
- Set<String> originalTemplates = new HashSet<String>(original.getRAttrTemplates());
- if (updatedTemplates.equals(originalTemplates)) {
- result.setModRAttrTemplates(false);
- result.getRAttrTemplates().clear();
- } else {
- result.setModRAttrTemplates(true);
- result.getRAttrTemplates().addAll(updated.getRAttrTemplates());
- }
- updatedTemplates = new HashSet<String>(updated.getRDerAttrTemplates());
- originalTemplates = new HashSet<String>(original.getRDerAttrTemplates());
- if (updatedTemplates.equals(originalTemplates)) {
- result.setModRDerAttrTemplates(false);
- result.getRDerAttrTemplates().clear();
- } else {
- result.setModRDerAttrTemplates(true);
- result.getRDerAttrTemplates().addAll(updated.getRDerAttrTemplates());
- }
- updatedTemplates = new HashSet<String>(updated.getRVirAttrTemplates());
- originalTemplates = new HashSet<String>(original.getRVirAttrTemplates());
- if (updatedTemplates.equals(originalTemplates)) {
- result.setModRVirAttrTemplates(false);
- result.getRVirAttrTemplates().clear();
- } else {
- result.setModRVirAttrTemplates(true);
- result.getRVirAttrTemplates().addAll(updated.getRVirAttrTemplates());
- }
- updatedTemplates = new HashSet<String>(updated.getMAttrTemplates());
- originalTemplates = new HashSet<String>(original.getMAttrTemplates());
- if (updatedTemplates.equals(originalTemplates)) {
- result.setModMAttrTemplates(false);
- result.getMAttrTemplates().clear();
- } else {
- result.setModMAttrTemplates(true);
- result.getMAttrTemplates().addAll(updated.getMAttrTemplates());
- }
- updatedTemplates = new HashSet<String>(updated.getMDerAttrTemplates());
- originalTemplates = new HashSet<String>(original.getMDerAttrTemplates());
- if (updatedTemplates.equals(originalTemplates)) {
- result.setModMDerAttrTemplates(false);
- result.getMDerAttrTemplates().clear();
- } else {
- result.setModMDerAttrTemplates(true);
- result.getMDerAttrTemplates().addAll(updated.getMDerAttrTemplates());
- }
- updatedTemplates = new HashSet<String>(updated.getMVirAttrTemplates());
- originalTemplates = new HashSet<String>(original.getMVirAttrTemplates());
- if (updatedTemplates.equals(originalTemplates)) {
- result.setModMVirAttrTemplates(false);
- result.getMVirAttrTemplates().clear();
- } else {
- result.setModMVirAttrTemplates(true);
- result.getMVirAttrTemplates().addAll(updated.getMVirAttrTemplates());
- }
-
- // 6. owner
- result.setUserOwner(new ReferenceMod(updated.getUserOwner()));
- result.setRoleOwner(new ReferenceMod(updated.getRoleOwner()));
-
- return result;
- }
-
- private static List<AttributeTO> getUpdateValues(final Map<String, AttributeTO> attrs,
- final Set<String> attrsToBeRemoved, final Set<AttributeMod> attrsToBeUpdated) {
-
- Map<String, AttributeTO> rwattrs = new HashMap<String, AttributeTO>(attrs);
- for (String attrName : attrsToBeRemoved) {
- rwattrs.remove(attrName);
- }
- for (AttributeMod attrMod : attrsToBeUpdated) {
- if (rwattrs.containsKey(attrMod.getSchema())) {
- AttributeTO attrTO = rwattrs.get(attrMod.getSchema());
- attrTO.getValues().removeAll(attrMod.getValuesToBeRemoved());
- attrTO.getValues().addAll(attrMod.getValuesToBeAdded());
- } else {
- AttributeTO attrTO = new AttributeTO();
- attrTO.setSchema(attrMod.getSchema());
- attrTO.getValues().addAll(attrMod.getValuesToBeAdded());
-
- rwattrs.put(attrMod.getSchema(), attrTO);
- }
- }
-
- return new ArrayList<AttributeTO>(rwattrs.values());
- }
-
- private static <T extends AbstractAttributableTO, K extends AbstractAttributableMod> void apply(final T to,
- final K mod, final T result) {
-
- // 1. attributes
- result.getAttrs().addAll(getUpdateValues(to.getAttrMap(),
- mod.getAttrsToRemove(), mod.getAttrsToUpdate()));
-
- // 2. derived attributes
- Map<String, AttributeTO> attrs = to.getDerAttrMap();
- for (String attrName : mod.getDerAttrsToRemove()) {
- attrs.remove(attrName);
- }
- for (String attrName : mod.getDerAttrsToAdd()) {
- AttributeTO attrTO = new AttributeTO();
- attrTO.setSchema(attrName);
-
- attrs.put(attrName, attrTO);
- }
- result.getDerAttrs().addAll(attrs.values());
-
- // 3. virtual attributes
- result.getVirAttrs().addAll(getUpdateValues(to.getVirAttrMap(),
- mod.getVirAttrsToRemove(), mod.getVirAttrsToUpdate()));
-
- // 4. resources
- if (result instanceof AbstractSubjectTO && mod instanceof AbstractSubjectMod) {
- ((AbstractSubjectTO) result).getResources().removeAll(((AbstractSubjectMod) mod).getResourcesToRemove());
- ((AbstractSubjectTO) result).getResources().addAll(((AbstractSubjectMod) mod).getResourcesToAdd());
- }
- }
-
- public static UserTO apply(final UserTO userTO, final UserMod userMod) {
- // 1. check same id
- if (userTO.getId() != userMod.getId()) {
- throw new IllegalArgumentException("UserTO and UserMod ids must be the same");
- }
-
- UserTO result = SerializationUtils.clone(userTO);
- apply(userTO, userMod, result);
-
- // 1. password
- result.setPassword(userMod.getPassword());
-
- // 2. username
- if (userMod.getUsername() != null) {
- result.setUsername(userMod.getUsername());
- }
- // 3. memberships
- Map<Long, MembershipTO> membs = result.getMembershipMap();
- for (Long membId : userMod.getMembershipsToRemove()) {
- result.getMemberships().remove(membs.get(membId));
- }
- for (MembershipMod membMod : userMod.getMembershipsToAdd()) {
- MembershipTO membTO = new MembershipTO();
- membTO.setRoleId(membMod.getRole());
-
- apply(membTO, membMod, membTO);
- }
-
- return result;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.syncope.common.mod.AbstractAttributableMod;
+import org.apache.syncope.common.mod.AbstractSubjectMod;
+import org.apache.syncope.common.mod.AttributeMod;
+import org.apache.syncope.common.mod.MembershipMod;
+import org.apache.syncope.common.mod.ReferenceMod;
+import org.apache.syncope.common.mod.RoleMod;
+import org.apache.syncope.common.mod.UserMod;
+import org.apache.syncope.common.to.AbstractAttributableTO;
+import org.apache.syncope.common.to.AbstractSubjectTO;
+import org.apache.syncope.common.to.AttributeTO;
+import org.apache.syncope.common.to.MembershipTO;
+import org.apache.syncope.common.to.RoleTO;
+import org.apache.syncope.common.to.UserTO;
+
+/**
+ * Utility class for manipulating classes extending AbstractAttributableTO and AbstractAttributableMod.
+ *
+ * @see AbstractAttributableTO
+ * @see AbstractAttributableMod
+ */
+public final class AttributableOperations {
+
+ private AttributableOperations() {
+ // empty constructor for static utility classes
+ }
+
+ private static void populate(final Map<String, AttributeTO> updatedAttrs,
+ final Map<String, AttributeTO> originalAttrs, final AbstractAttributableMod result) {
+
+ populate(updatedAttrs, originalAttrs, result, false);
+ }
+
+ private static void populate(final Map<String, AttributeTO> updatedAttrs,
+ final Map<String, AttributeTO> originalAttrs, final AbstractAttributableMod result,
+ final boolean virtuals) {
+
+ for (Map.Entry<String, AttributeTO> entry : updatedAttrs.entrySet()) {
+ AttributeMod mod = new AttributeMod();
+ mod.setSchema(entry.getKey());
+
+ Set<String> updatedValues = new HashSet<String>(entry.getValue().getValues());
+
+ Set<String> originalValues = originalAttrs.containsKey(entry.getKey())
+ ? new HashSet<String>(originalAttrs.get(entry.getKey()).getValues())
+ : Collections.<String>emptySet();
+
+ if (!originalAttrs.containsKey(entry.getKey())) {
+ // SYNCOPE-459: take care of user virtual attributes without any value
+ updatedValues.remove("");
+ mod.getValuesToBeAdded().addAll(new ArrayList<String>(updatedValues));
+
+ if (virtuals) {
+ result.getVirAttrsToUpdate().add(mod);
+ } else {
+ result.getAttrsToUpdate().add(mod);
+ }
+ } else if (!updatedValues.equals(originalValues)) {
+ // avoid unwanted inputs
+ updatedValues.remove("");
+ if (!entry.getValue().isReadonly()) {
+ mod.getValuesToBeAdded().addAll(updatedValues);
+
+ if (!mod.isEmpty()) {
+ if (virtuals) {
+ result.getVirAttrsToRemove().add(mod.getSchema());
+ } else {
+ result.getAttrsToRemove().add(mod.getSchema());
+ }
+ }
+ }
+
+ mod.getValuesToBeRemoved().addAll(originalValues);
+
+ if (!mod.isEmpty()) {
+ if (virtuals) {
+ result.getVirAttrsToUpdate().add(mod);
+ } else {
+ result.getAttrsToUpdate().add(mod);
+ }
+ }
+ }
+ }
+ }
+
+ private static void diff(
+ final AbstractAttributableTO updated,
+ final AbstractAttributableTO original,
+ final AbstractAttributableMod result,
+ final boolean incremental) {
+
+ // 1. check same id
+ if (updated.getId() != original.getId()) {
+ throw new IllegalArgumentException("AttributableTO's id must be the same");
+ }
+ result.setId(updated.getId());
+
+ // 2. attributes
+ Map<String, AttributeTO> updatedAttrs = new HashMap<String, AttributeTO>(updated.getAttrMap());
+ Map<String, AttributeTO> originalAttrs = new HashMap<String, AttributeTO>(original.getAttrMap());
+
+ Set<String> originalAttrNames = new HashSet<String>(originalAttrs.keySet());
+ originalAttrNames.removeAll(updatedAttrs.keySet());
+
+ if (!incremental) {
+ result.getAttrsToRemove().clear();
+ result.getAttrsToRemove().addAll(originalAttrNames);
+ }
+
+ Set<String> emptyUpdatedAttrs = new HashSet<String>();
+ for (Map.Entry<String, AttributeTO> entry : updatedAttrs.entrySet()) {
+ if (entry.getValue().getValues() == null || entry.getValue().getValues().isEmpty()) {
+
+ emptyUpdatedAttrs.add(entry.getKey());
+ }
+ }
+ for (String emptyUpdatedAttr : emptyUpdatedAttrs) {
+ updatedAttrs.remove(emptyUpdatedAttr);
+ result.getAttrsToRemove().add(emptyUpdatedAttr);
+ }
+
+ populate(updatedAttrs, originalAttrs, result);
+
+ // 3. derived attributes
+ updatedAttrs = updated.getDerAttrMap();
+ originalAttrs = original.getDerAttrMap();
+
+ originalAttrNames = new HashSet<String>(originalAttrs.keySet());
+ originalAttrNames.removeAll(updatedAttrs.keySet());
+
+ if (!incremental) {
+ result.getDerAttrsToRemove().clear();
+ result.getDerAttrsToRemove().addAll(originalAttrNames);
+ }
+
+ Set<String> updatedAttrNames = new HashSet<String>(updatedAttrs.keySet());
+ updatedAttrNames.removeAll(originalAttrs.keySet());
+ result.getDerAttrsToAdd().clear();
+ result.getDerAttrsToAdd().addAll(updatedAttrNames);
+
+ // 4. virtual attributes
+ updatedAttrs = updated.getVirAttrMap();
+ originalAttrs = original.getVirAttrMap();
+
+ originalAttrNames = new HashSet<String>(originalAttrs.keySet());
+ originalAttrNames.removeAll(updatedAttrs.keySet());
+
+ if (!incremental) {
+ result.getVirAttrsToRemove().clear();
+ result.getVirAttrsToRemove().addAll(originalAttrNames);
+ }
+
+ populate(updatedAttrs, originalAttrs, result, true);
+
+ // 5. resources
+ if (original instanceof AbstractSubjectTO && updated instanceof AbstractSubjectTO
+ && result instanceof AbstractSubjectMod) {
+
+ Set<String> updatedRes = new HashSet<String>(((AbstractSubjectTO) updated).getResources());
+ Set<String> originalRes = new HashSet<String>(((AbstractSubjectTO) original).getResources());
+
+ updatedRes.removeAll(originalRes);
+ ((AbstractSubjectMod) result).getResourcesToAdd().clear();
+ ((AbstractSubjectMod) result).getResourcesToAdd().addAll(updatedRes);
+
+ originalRes.removeAll(((AbstractSubjectTO) updated).getResources());
+
+ if (!incremental) {
+ ((AbstractSubjectMod) result).getResourcesToRemove().clear();
+ ((AbstractSubjectMod) result).getResourcesToRemove().addAll(originalRes);
+ }
+ }
+ }
+
+ /**
+ * Calculate modifications needed by first in order to be equal to second.
+ *
+ * @param updated updated UserTO
+ * @param original original UserTO
+ * @return UserMod containing differences
+ */
+ public static UserMod diff(final UserTO updated, final UserTO original) {
+ return diff(updated, original, false);
+ }
+
+ /**
+ * Calculate modifications needed by first in order to be equal to second.
+ *
+ * @param updated updated UserTO
+ * @param original original UserTO
+ * @param incremental perform incremental diff (without removing existing info)
+ * @return UserMod containing differences
+ */
+ public static UserMod diff(final UserTO updated, final UserTO original, final boolean incremental) {
+ UserMod result = new UserMod();
+
+ diff(updated, original, result, incremental);
+
+ // 1. password
+ if (updated.getPassword() != null && (original.getPassword() == null || !original.getPassword().
+ equals(updated.getPassword()))) {
+ result.setPassword(updated.getPassword());
+ }
+
+ // 2. username
+ if (original.getUsername() != null && !original.getUsername().equals(updated.getUsername())) {
+ result.setUsername(updated.getUsername());
+ }
+
+ // 3. memberships
+ Map<Long, MembershipTO> updatedMembs = updated.getMembershipMap();
+ Map<Long, MembershipTO> originalMembs = original.getMembershipMap();
+
+ for (Map.Entry<Long, MembershipTO> entry : updatedMembs.entrySet()) {
+ MembershipMod membMod = new MembershipMod();
+ membMod.setRole(entry.getValue().getRoleId());
+
+ if (originalMembs.containsKey(entry.getKey())) {
+ // if memberships are actually same, just make the isEmpty() call below succeed
+ if (entry.getValue().equals(originalMembs.get(entry.getKey()))) {
+ membMod.setRole(0);
+ } else {
+ diff(entry.getValue(), originalMembs.get(entry.getKey()), membMod, false);
+ }
+ } else {
+ for (AttributeTO attr : entry.getValue().getAttrs()) {
+ AttributeMod attrMod = new AttributeMod();
+ attrMod.setSchema(attr.getSchema());
+ attrMod.getValuesToBeAdded().addAll(attr.getValues());
+
+ if (!attrMod.isEmpty()) {
+ membMod.getAttrsToUpdate().add(attrMod);
+ membMod.getAttrsToRemove().add(attrMod.getSchema());
+ }
+ }
+ for (AttributeTO attr : entry.getValue().getDerAttrs()) {
+ membMod.getDerAttrsToAdd().add(attr.getSchema());
+ }
+ for (AttributeTO attr : entry.getValue().getVirAttrs()) {
+ AttributeMod attrMod = new AttributeMod();
+ attrMod.setSchema(attr.getSchema());
+ attrMod.getValuesToBeAdded().addAll(attr.getValues());
+
+ if (!attrMod.isEmpty()) {
+ membMod.getVirAttrsToUpdate().add(attrMod);
+ membMod.getAttrsToRemove().add(attrMod.getSchema());
+ }
+ }
+ }
+
+ if (!membMod.isEmpty()) {
+ result.getMembershipsToAdd().add(membMod);
+ }
+ }
+
+ if (!incremental) {
+ Set<Long> originalRoles = new HashSet<Long>(originalMembs.keySet());
+ originalRoles.removeAll(updatedMembs.keySet());
+ for (Long roleId : originalRoles) {
+ result.getMembershipsToRemove().add(originalMembs.get(roleId).getId());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Calculate modifications needed by first in order to be equal to second.
+ *
+ * @param updated updated RoleTO
+ * @param original original RoleTO
+ * @return RoleMod containing differences
+ */
+ public static RoleMod diff(final RoleTO updated, final RoleTO original) {
+ return diff(updated, original, false);
+ }
+
+ /**
+ * Calculate modifications needed by first in order to be equal to second.
+ *
+ * @param updated updated RoleTO
+ * @param original original RoleTO
+ * @param incremental perform incremental diff (without removing existing info)
+ * @return RoleMod containing differences
+ */
+ public static RoleMod diff(final RoleTO updated, final RoleTO original, final boolean incremental) {
+ RoleMod result = new RoleMod();
+
+ diff(updated, original, result, incremental);
+
+ // 1. inheritance
+ result.setInheritOwner(updated.isInheritOwner());
+ result.setInheritTemplates(updated.isInheritTemplates());
+ result.setInheritAccountPolicy(updated.isInheritAccountPolicy());
+ result.setInheritPasswordPolicy(updated.isInheritPasswordPolicy());
+ result.setInheritAttributes(updated.isInheritAttrs());
+ result.setInheritDerAttrs(updated.isInheritDerAttrs());
+ result.setInheritVirAttrs(updated.isInheritVirAttrs());
+
+ // 2. policies
+ result.setAccountPolicy(new ReferenceMod(updated.getAccountPolicy()));
+ result.setPasswordPolicy(new ReferenceMod(updated.getPasswordPolicy()));
+
+ // 3. name
+ if (!original.getName().equals(updated.getName())) {
+ result.setName(updated.getName());
+ }
+
+ // 4. entitlements
+ Set<String> updatedEnts = new HashSet<String>(updated.getEntitlements());
+ Set<String> originalEnts = new HashSet<String>(original.getEntitlements());
+ if (updatedEnts.equals(originalEnts)) {
+ result.setModEntitlements(false);
+ result.getEntitlements().clear();
+ } else {
+ result.setModEntitlements(true);
+ result.getEntitlements().addAll(updated.getEntitlements());
+ }
+
+ // 5. templates
+ Set<String> updatedTemplates = new HashSet<String>(updated.getRAttrTemplates());
+ Set<String> originalTemplates = new HashSet<String>(original.getRAttrTemplates());
+ if (updatedTemplates.equals(originalTemplates)) {
+ result.setModRAttrTemplates(false);
+ result.getRAttrTemplates().clear();
+ } else {
+ result.setModRAttrTemplates(true);
+ result.getRAttrTemplates().addAll(updated.getRAttrTemplates());
+ }
+ updatedTemplates = new HashSet<String>(updated.getRDerAttrTemplates());
+ originalTemplates = new HashSet<String>(original.getRDerAttrTemplates());
+ if (updatedTemplates.equals(originalTemplates)) {
+ result.setModRDerAttrTemplates(false);
+ result.getRDerAttrTemplates().clear();
+ } else {
+ result.setModRDerAttrTemplates(true);
+ result.getRDerAttrTemplates().addAll(updated.getRDerAttrTemplates());
+ }
+ updatedTemplates = new HashSet<String>(updated.getRVirAttrTemplates());
+ originalTemplates = new HashSet<String>(original.getRVirAttrTemplates());
+ if (updatedTemplates.equals(originalTemplates)) {
+ result.setModRVirAttrTemplates(false);
+ result.getRVirAttrTemplates().clear();
+ } else {
+ result.setModRVirAttrTemplates(true);
+ result.getRVirAttrTemplates().addAll(updated.getRVirAttrTemplates());
+ }
+ updatedTemplates = new HashSet<String>(updated.getMAttrTemplates());
+ originalTemplates = new HashSet<String>(original.getMAttrTemplates());
+ if (updatedTemplates.equals(originalTemplates)) {
+ result.setModMAttrTemplates(false);
+ result.getMAttrTemplates().clear();
+ } else {
+ result.setModMAttrTemplates(true);
+ result.getMAttrTemplates().addAll(updated.getMAttrTemplates());
+ }
+ updatedTemplates = new HashSet<String>(updated.getMDerAttrTemplates());
+ originalTemplates = new HashSet<String>(original.getMDerAttrTemplates());
+ if (updatedTemplates.equals(originalTemplates)) {
+ result.setModMDerAttrTemplates(false);
+ result.getMDerAttrTemplates().clear();
+ } else {
+ result.setModMDerAttrTemplates(true);
+ result.getMDerAttrTemplates().addAll(updated.getMDerAttrTemplates());
+ }
+ updatedTemplates = new HashSet<String>(updated.getMVirAttrTemplates());
+ originalTemplates = new HashSet<String>(original.getMVirAttrTemplates());
+ if (updatedTemplates.equals(originalTemplates)) {
+ result.setModMVirAttrTemplates(false);
+ result.getMVirAttrTemplates().clear();
+ } else {
+ result.setModMVirAttrTemplates(true);
+ result.getMVirAttrTemplates().addAll(updated.getMVirAttrTemplates());
+ }
+
+ // 6. owner
+ result.setUserOwner(new ReferenceMod(updated.getUserOwner()));
+ result.setRoleOwner(new ReferenceMod(updated.getRoleOwner()));
+
+ return result;
+ }
+
+ private static List<AttributeTO> getUpdateValues(final Map<String, AttributeTO> attrs,
+ final Set<String> attrsToBeRemoved, final Set<AttributeMod> attrsToBeUpdated) {
+
+ Map<String, AttributeTO> rwattrs = new HashMap<String, AttributeTO>(attrs);
+ for (String attrName : attrsToBeRemoved) {
+ rwattrs.remove(attrName);
+ }
+ for (AttributeMod attrMod : attrsToBeUpdated) {
+ if (rwattrs.containsKey(attrMod.getSchema())) {
+ AttributeTO attrTO = rwattrs.get(attrMod.getSchema());
+ attrTO.getValues().removeAll(attrMod.getValuesToBeRemoved());
+ attrTO.getValues().addAll(attrMod.getValuesToBeAdded());
+ } else {
+ AttributeTO attrTO = new AttributeTO();
+ attrTO.setSchema(attrMod.getSchema());
+ attrTO.getValues().addAll(attrMod.getValuesToBeAdded());
+
+ rwattrs.put(attrMod.getSchema(), attrTO);
+ }
+ }
+
+ return new ArrayList<AttributeTO>(rwattrs.values());
+ }
+
+ private static <T extends AbstractAttributableTO, K extends AbstractAttributableMod> void apply(final T to,
+ final K mod, final T result) {
+
+ // 1. attributes
+ result.getAttrs().addAll(getUpdateValues(to.getAttrMap(),
+ mod.getAttrsToRemove(), mod.getAttrsToUpdate()));
+
+ // 2. derived attributes
+ Map<String, AttributeTO> attrs = to.getDerAttrMap();
+ for (String attrName : mod.getDerAttrsToRemove()) {
+ attrs.remove(attrName);
+ }
+ for (String attrName : mod.getDerAttrsToAdd()) {
+ AttributeTO attrTO = new AttributeTO();
+ attrTO.setSchema(attrName);
+
+ attrs.put(attrName, attrTO);
+ }
+ result.getDerAttrs().addAll(attrs.values());
+
+ // 3. virtual attributes
+ result.getVirAttrs().addAll(getUpdateValues(to.getVirAttrMap(),
+ mod.getVirAttrsToRemove(), mod.getVirAttrsToUpdate()));
+
+ // 4. resources
+ if (result instanceof AbstractSubjectTO && mod instanceof AbstractSubjectMod) {
+ ((AbstractSubjectTO) result).getResources().removeAll(((AbstractSubjectMod) mod).getResourcesToRemove());
+ ((AbstractSubjectTO) result).getResources().addAll(((AbstractSubjectMod) mod).getResourcesToAdd());
+ }
+ }
+
+ public static UserTO apply(final UserTO userTO, final UserMod userMod) {
+ // 1. check same id
+ if (userTO.getId() != userMod.getId()) {
+ throw new IllegalArgumentException("UserTO and UserMod ids must be the same");
+ }
+
+ UserTO result = SerializationUtils.clone(userTO);
+ apply(userTO, userMod, result);
+
+ // 1. password
+ result.setPassword(userMod.getPassword());
+
+ // 2. username
+ if (userMod.getUsername() != null) {
+ result.setUsername(userMod.getUsername());
+ }
+ // 3. memberships
+ Map<Long, MembershipTO> membs = result.getMembershipMap();
+ for (Long membId : userMod.getMembershipsToRemove()) {
+ result.getMemberships().remove(membs.get(membId));
+ }
+ for (MembershipMod membMod : userMod.getMembershipsToAdd()) {
+ MembershipTO membTO = new MembershipTO();
+ membTO.setRoleId(membMod.getRole());
+
+ apply(membTO, membMod, membTO);
+ }
+
+ return result;
+ }
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java Tue Aug 5 11:20:00 2014
@@ -1,80 +1,80 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.common.wrap.AbstractWrappable;
-import org.apache.syncope.common.to.LoggerTO;
-import org.apache.syncope.common.types.AuditLoggerName;
-import org.apache.syncope.common.types.LoggerLevel;
-
-public final class CollectionWrapper {
-
- private CollectionWrapper() {
- // empty constructor for static utility class
- }
-
- public static <E, T extends AbstractWrappable<E>> List<T> wrap(final E element, final Class<T> reference) {
- return Collections.singletonList(AbstractWrappable.getInstance(reference, element));
- }
-
- public static <E, T extends AbstractWrappable<E>> List<T> wrap(
- final Collection<E> collection, final Class<T> reference) {
-
- List<T> response = new ArrayList<T>();
- for (E element : collection) {
- response.add(AbstractWrappable.getInstance(reference, element));
- }
- return response;
- }
-
- public static <E, T extends AbstractWrappable<E>> List<E> unwrap(final Collection<T> collection) {
- List<E> response = new ArrayList<E>();
- for (T item : collection) {
- response.add(item.getElement());
- }
- return response;
- }
-
- public static List<AuditLoggerName> wrapLogger(final Collection<LoggerTO> logger) {
- List<AuditLoggerName> respons = new ArrayList<AuditLoggerName>();
- for (LoggerTO l : logger) {
- try {
- respons.add(AuditLoggerName.fromLoggerName(l.getName()));
- } catch (Exception ignore) {
- // ignore
- }
- }
- return respons;
- }
-
- public static List<LoggerTO> unwrapLogger(final Collection<AuditLoggerName> auditNames) {
- List<LoggerTO> respons = new ArrayList<LoggerTO>();
- for (AuditLoggerName l : auditNames) {
- LoggerTO loggerTO = new LoggerTO();
- loggerTO.setName(l.toLoggerName());
- loggerTO.setLevel(LoggerLevel.DEBUG);
- respons.add(loggerTO);
- }
- return respons;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.wrap.AbstractWrappable;
+import org.apache.syncope.common.to.LoggerTO;
+import org.apache.syncope.common.types.AuditLoggerName;
+import org.apache.syncope.common.types.LoggerLevel;
+
+public final class CollectionWrapper {
+
+ private CollectionWrapper() {
+ // empty constructor for static utility class
+ }
+
+ public static <E, T extends AbstractWrappable<E>> List<T> wrap(final E element, final Class<T> reference) {
+ return Collections.singletonList(AbstractWrappable.getInstance(reference, element));
+ }
+
+ public static <E, T extends AbstractWrappable<E>> List<T> wrap(
+ final Collection<E> collection, final Class<T> reference) {
+
+ List<T> response = new ArrayList<T>();
+ for (E element : collection) {
+ response.add(AbstractWrappable.getInstance(reference, element));
+ }
+ return response;
+ }
+
+ public static <E, T extends AbstractWrappable<E>> List<E> unwrap(final Collection<T> collection) {
+ List<E> response = new ArrayList<E>();
+ for (T item : collection) {
+ response.add(item.getElement());
+ }
+ return response;
+ }
+
+ public static List<AuditLoggerName> wrapLogger(final Collection<LoggerTO> logger) {
+ List<AuditLoggerName> respons = new ArrayList<AuditLoggerName>();
+ for (LoggerTO l : logger) {
+ try {
+ respons.add(AuditLoggerName.fromLoggerName(l.getName()));
+ } catch (Exception ignore) {
+ // ignore
+ }
+ }
+ return respons;
+ }
+
+ public static List<LoggerTO> unwrapLogger(final Collection<AuditLoggerName> auditNames) {
+ List<LoggerTO> respons = new ArrayList<LoggerTO>();
+ for (AuditLoggerName l : auditNames) {
+ LoggerTO loggerTO = new LoggerTO();
+ loggerTO.setName(l.toLoggerName());
+ loggerTO.setLevel(LoggerLevel.DEBUG);
+ respons.add(loggerTO);
+ }
+ return respons;
+ }
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/CorrelationRuleClass.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/CorrelationRuleClass.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/CorrelationRuleClass.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/CorrelationRuleClass.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "correlationRuleClass")
-@XmlType
-public class CorrelationRuleClass extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = -6715106427060816725L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "correlationRuleClass")
+@XmlType
+public class CorrelationRuleClass extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = -6715106427060816725L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/EntitlementTO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/EntitlementTO.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/EntitlementTO.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/EntitlementTO.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "entitlement")
-@XmlType
-public class EntitlementTO extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 7133614577172038452L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "entitlement")
+@XmlType
+public class EntitlementTO extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = 7133614577172038452L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/JobClass.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/JobClass.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/JobClass.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/JobClass.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "jobClass")
-@XmlType
-public class JobClass extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = -1953799905627918822L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "jobClass")
+@XmlType
+public class JobClass extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = -1953799905627918822L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/MailTemplate.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/MailTemplate.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/MailTemplate.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/MailTemplate.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "mailTemplate")
-@XmlType
-public class MailTemplate extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 7232619557172031478L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "mailTemplate")
+@XmlType
+public class MailTemplate extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = 7232619557172031478L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PropagationActionClass.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PropagationActionClass.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PropagationActionClass.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PropagationActionClass.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "propagationActionClass")
-@XmlType
-public class PropagationActionClass extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 2187654394121198308L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "propagationActionClass")
+@XmlType
+public class PropagationActionClass extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = 2187654394121198308L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PushActionClass.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PushActionClass.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PushActionClass.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/PushActionClass.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "pushActionClass")
-@XmlType
-public class PushActionClass extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 1669581609310071906L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "pushActionClass")
+@XmlType
+public class PushActionClass extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = 1669581609310071906L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/ReportletConfClass.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/ReportletConfClass.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/ReportletConfClass.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/ReportletConfClass.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "reportletConfClass")
-@XmlType
-public class ReportletConfClass extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 1343357929074360450L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "reportletConfClass")
+@XmlType
+public class ReportletConfClass extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = 1343357929074360450L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/SyncActionClass.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/SyncActionClass.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/SyncActionClass.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/SyncActionClass.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "syncActionClass")
-@XmlType
-public class SyncActionClass extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 1669581609310071905L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "syncActionClass")
+@XmlType
+public class SyncActionClass extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = 1669581609310071905L;
+
+}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/Validator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/Validator.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/Validator.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/wrap/Validator.java Tue Aug 5 11:20:00 2014
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "validator")
-@XmlType
-public class Validator extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 7233619557177034453L;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "validator")
+@XmlType
+public class Validator extends AbstractWrappable<String> {
+
+ private static final long serialVersionUID = 7233619557177034453L;
+
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AbstractSearchCond.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AbstractSearchCond.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AbstractSearchCond.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AbstractSearchCond.java Tue Aug 5 11:20:00 2014
@@ -1,48 +1,48 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.dao.search;
-
-import java.io.Serializable;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-public abstract class AbstractSearchCond implements Serializable {
-
- private static final long serialVersionUID = 5376869884544910804L;
-
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
-
- public abstract boolean isValid();
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.dao.search;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public abstract class AbstractSearchCond implements Serializable {
+
+ private static final long serialVersionUID = 5376869884544910804L;
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ public abstract boolean isValid();
+
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AttributeCond.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AttributeCond.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AttributeCond.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/AttributeCond.java Tue Aug 5 11:20:00 2014
@@ -1,84 +1,84 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.dao.search;
-
-/**
- * Search condition to be applied when comparing attribute values.
- */
-public class AttributeCond extends AbstractSearchCond {
-
- private static final long serialVersionUID = 3275277728404021417L;
-
- public enum Type {
-
- LIKE,
- EQ,
- GT,
- LT,
- GE,
- LE,
- ISNULL,
- ISNOTNULL
-
- }
-
- private Type type;
-
- private String schema;
-
- private String expression;
-
- public AttributeCond() {
- super();
- }
-
- public AttributeCond(final Type conditionType) {
- super();
- this.type = conditionType;
- }
-
- public final String getExpression() {
- return expression;
- }
-
- public final void setExpression(final String conditionExpression) {
- this.expression = conditionExpression;
- }
-
- public final String getSchema() {
- return schema;
- }
-
- public final void setSchema(final String conditionSchema) {
- this.schema = conditionSchema;
- }
-
- public final Type getType() {
- return type;
- }
-
- public final void setType(final Type conditionType) {
- this.type = conditionType;
- }
-
- @Override
- public final boolean isValid() {
- return type != null && schema != null && (type == Type.ISNULL || type == Type.ISNOTNULL || expression != null);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.dao.search;
+
+/**
+ * Search condition to be applied when comparing attribute values.
+ */
+public class AttributeCond extends AbstractSearchCond {
+
+ private static final long serialVersionUID = 3275277728404021417L;
+
+ public enum Type {
+
+ LIKE,
+ EQ,
+ GT,
+ LT,
+ GE,
+ LE,
+ ISNULL,
+ ISNOTNULL
+
+ }
+
+ private Type type;
+
+ private String schema;
+
+ private String expression;
+
+ public AttributeCond() {
+ super();
+ }
+
+ public AttributeCond(final Type conditionType) {
+ super();
+ this.type = conditionType;
+ }
+
+ public final String getExpression() {
+ return expression;
+ }
+
+ public final void setExpression(final String conditionExpression) {
+ this.expression = conditionExpression;
+ }
+
+ public final String getSchema() {
+ return schema;
+ }
+
+ public final void setSchema(final String conditionSchema) {
+ this.schema = conditionSchema;
+ }
+
+ public final Type getType() {
+ return type;
+ }
+
+ public final void setType(final Type conditionType) {
+ this.type = conditionType;
+ }
+
+ @Override
+ public final boolean isValid() {
+ return type != null && schema != null && (type == Type.ISNULL || type == Type.ISNOTNULL || expression != null);
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/EntitlementCond.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/EntitlementCond.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/EntitlementCond.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/EntitlementCond.java Tue Aug 5 11:20:00 2014
@@ -1,39 +1,39 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.persistence.dao.search;
-
-public class EntitlementCond extends AbstractSearchCond {
-
- private static final long serialVersionUID = -4077781080368377428L;
-
- private String expression;
-
- public String getExpression() {
- return expression;
- }
-
- public void setExpression(final String expression) {
- this.expression = expression;
- }
-
- @Override
- public boolean isValid() {
- return expression != null;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.dao.search;
+
+public class EntitlementCond extends AbstractSearchCond {
+
+ private static final long serialVersionUID = -4077781080368377428L;
+
+ private String expression;
+
+ public String getExpression() {
+ return expression;
+ }
+
+ public void setExpression(final String expression) {
+ this.expression = expression;
+ }
+
+ @Override
+ public boolean isValid() {
+ return expression != null;
+ }
+}