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 [11/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/core/src/main/java/org/apache/syncope/core/persistence/dao/search/MembershipCond.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/MembershipCond.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/MembershipCond.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/MembershipCond.java Tue Aug 5 11:20:00 2014
@@ -1,46 +1,46 @@
-/*
- * 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 searching for memberships.
- */
-public class MembershipCond extends AbstractSearchCond {
-
- private static final long serialVersionUID = -728155256293925989L;
-
- private Long roleId;
-
- public MembershipCond() {
- super();
- }
-
- public Long getRoleId() {
- return roleId;
- }
-
- public void setRoleId(final Long roleId) {
- this.roleId = roleId;
- }
-
- @Override
- public final boolean isValid() {
- return roleId != 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 searching for memberships.
+ */
+public class MembershipCond extends AbstractSearchCond {
+
+ private static final long serialVersionUID = -728155256293925989L;
+
+ private Long roleId;
+
+ public MembershipCond() {
+ super();
+ }
+
+ public Long getRoleId() {
+ return roleId;
+ }
+
+ public void setRoleId(final Long roleId) {
+ this.roleId = roleId;
+ }
+
+ @Override
+ public final boolean isValid() {
+ return roleId != null;
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/ResourceCond.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/ResourceCond.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/ResourceCond.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/ResourceCond.java Tue Aug 5 11:20:00 2014
@@ -1,42 +1,42 @@
-/*
- * 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 searching for associated resources.
- */
-public class ResourceCond extends AbstractSearchCond {
-
- private static final long serialVersionUID = 466054166309460002L;
-
- private String resourceName;
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(final String resourceName) {
- this.resourceName = resourceName;
- }
-
- @Override
- public final boolean isValid() {
- return resourceName != 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 searching for associated resources.
+ */
+public class ResourceCond extends AbstractSearchCond {
+
+ private static final long serialVersionUID = 466054166309460002L;
+
+ private String resourceName;
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(final String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ @Override
+ public final boolean isValid() {
+ return resourceName != null;
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SearchCond.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SearchCond.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SearchCond.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SearchCond.java Tue Aug 5 11:20:00 2014
@@ -1,254 +1,254 @@
-/*
- * 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.util.List;
-
-public class SearchCond extends AbstractSearchCond {
-
- private static final long serialVersionUID = 661560782247499526L;
-
- public enum Type {
-
- LEAF,
- NOT_LEAF,
- AND,
- OR
-
- }
-
- private Type type;
-
- private SubjectCond subjectCond;
-
- private AttributeCond attributeCond;
-
- private MembershipCond membershipCond;
-
- private ResourceCond resourceCond;
-
- private EntitlementCond entitlementCond;
-
- private SearchCond leftNodeCond;
-
- private SearchCond rightNodeCond;
-
- public static SearchCond getLeafCond(final AttributeCond attributeCond) {
- SearchCond nodeCond = new SearchCond();
-
- nodeCond.type = Type.LEAF;
- if (attributeCond instanceof SubjectCond) {
- nodeCond.subjectCond = (SubjectCond) attributeCond;
- } else {
- nodeCond.attributeCond = attributeCond;
- }
-
- return nodeCond;
- }
-
- public static SearchCond getLeafCond(final MembershipCond membershipCond) {
- SearchCond nodeCond = new SearchCond();
-
- nodeCond.type = Type.LEAF;
- nodeCond.membershipCond = membershipCond;
-
- return nodeCond;
- }
-
- public static SearchCond getLeafCond(final ResourceCond resourceCond) {
- SearchCond nodeCond = new SearchCond();
-
- nodeCond.type = Type.LEAF;
- nodeCond.resourceCond = resourceCond;
-
- return nodeCond;
- }
-
- public static SearchCond getLeafCond(final EntitlementCond entitlementCond) {
- SearchCond nodeCond = new SearchCond();
-
- nodeCond.type = Type.LEAF;
- nodeCond.entitlementCond = entitlementCond;
-
- return nodeCond;
- }
-
- public static SearchCond getNotLeafCond(final AttributeCond attributeCond) {
- SearchCond nodeCond = getLeafCond(attributeCond);
- nodeCond.type = Type.NOT_LEAF;
- return nodeCond;
- }
-
- public static SearchCond getNotLeafCond(final MembershipCond membershipCond) {
- SearchCond nodeCond = getLeafCond(membershipCond);
- nodeCond.type = Type.NOT_LEAF;
- return nodeCond;
- }
-
- public static SearchCond getNotLeafCond(final ResourceCond resourceCond) {
- SearchCond nodeCond = getLeafCond(resourceCond);
- nodeCond.type = Type.NOT_LEAF;
- return nodeCond;
- }
-
- public static SearchCond getNotLeafCond(final EntitlementCond entitlementCond) {
- SearchCond nodeCond = getLeafCond(entitlementCond);
- nodeCond.type = Type.NOT_LEAF;
- return nodeCond;
- }
-
- public static SearchCond getNotLeafCond(final SearchCond nodeCond) {
- nodeCond.type = Type.NOT_LEAF;
- return nodeCond;
- }
-
- public static SearchCond getAndCond(final SearchCond leftCond, final SearchCond rightCond) {
- SearchCond nodeCond = new SearchCond();
-
- nodeCond.type = Type.AND;
- nodeCond.leftNodeCond = leftCond;
- nodeCond.rightNodeCond = rightCond;
-
- return nodeCond;
- }
-
- public static SearchCond getAndCond(final List<SearchCond> conditions) {
- if (conditions.size() > 2) {
- SearchCond removed = conditions.remove(0);
- return getAndCond(removed, getAndCond(conditions));
- } else {
- return getAndCond(conditions.get(0), conditions.get(1));
- }
- }
-
- public static SearchCond getOrCond(final SearchCond leftCond, final SearchCond rightCond) {
- SearchCond nodeCond = new SearchCond();
-
- nodeCond.type = Type.OR;
- nodeCond.leftNodeCond = leftCond;
- nodeCond.rightNodeCond = rightCond;
-
- return nodeCond;
- }
-
- public static SearchCond getOrCond(final List<SearchCond> conditions) {
- if (conditions.size() > 2) {
- SearchCond removed = conditions.remove(0);
- return getOrCond(removed, getOrCond(conditions));
- } else {
- return getOrCond(conditions.get(0), conditions.get(1));
- }
- }
-
- public SubjectCond getSubjectCond() {
- return subjectCond;
- }
-
- public void setSubjectCond(final SubjectCond subjectCond) {
- this.subjectCond = subjectCond;
- }
-
- public AttributeCond getAttributeCond() {
- return attributeCond;
- }
-
- public void setAttributeCond(final AttributeCond attributeCond) {
- this.attributeCond = attributeCond;
- }
-
- public MembershipCond getMembershipCond() {
- return membershipCond;
- }
-
- public void setMembershipCond(final MembershipCond membershipCond) {
- this.membershipCond = membershipCond;
- }
-
- public ResourceCond getResourceCond() {
- return resourceCond;
- }
-
- public void setResourceCond(final ResourceCond resourceCond) {
- this.resourceCond = resourceCond;
- }
-
- public EntitlementCond getEntitlementCond() {
- return entitlementCond;
- }
-
- public void setEntitlementCond(final EntitlementCond entitlementCond) {
- this.entitlementCond = entitlementCond;
- }
-
- public SearchCond getLeftNodeCond() {
- return leftNodeCond;
- }
-
- public void setLeftNodeCond(final SearchCond leftNodeCond) {
- this.leftNodeCond = leftNodeCond;
- }
-
- public SearchCond getRightNodeCond() {
- return rightNodeCond;
- }
-
- public void setRightNodeCond(final SearchCond rightNodeCond) {
- this.rightNodeCond = rightNodeCond;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setType(final Type type) {
- this.type = type;
- }
-
- public boolean isValid() {
- boolean isValid = false;
-
- if (type == null) {
- return isValid;
- }
-
- switch (type) {
- case LEAF:
- case NOT_LEAF:
- isValid = (subjectCond != null || attributeCond != null || membershipCond != null
- || resourceCond != null || entitlementCond != null)
- && (subjectCond == null || subjectCond.isValid())
- && (attributeCond == null || attributeCond.isValid())
- && (membershipCond == null || membershipCond.isValid())
- && (resourceCond == null || resourceCond.isValid())
- && (entitlementCond == null || entitlementCond.isValid());
- break;
-
- case AND:
- case OR:
- isValid = (leftNodeCond == null || rightNodeCond == null)
- ? false
- : leftNodeCond.isValid() && rightNodeCond.isValid();
- break;
-
- default:
- }
-
- return 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.util.List;
+
+public class SearchCond extends AbstractSearchCond {
+
+ private static final long serialVersionUID = 661560782247499526L;
+
+ public enum Type {
+
+ LEAF,
+ NOT_LEAF,
+ AND,
+ OR
+
+ }
+
+ private Type type;
+
+ private SubjectCond subjectCond;
+
+ private AttributeCond attributeCond;
+
+ private MembershipCond membershipCond;
+
+ private ResourceCond resourceCond;
+
+ private EntitlementCond entitlementCond;
+
+ private SearchCond leftNodeCond;
+
+ private SearchCond rightNodeCond;
+
+ public static SearchCond getLeafCond(final AttributeCond attributeCond) {
+ SearchCond nodeCond = new SearchCond();
+
+ nodeCond.type = Type.LEAF;
+ if (attributeCond instanceof SubjectCond) {
+ nodeCond.subjectCond = (SubjectCond) attributeCond;
+ } else {
+ nodeCond.attributeCond = attributeCond;
+ }
+
+ return nodeCond;
+ }
+
+ public static SearchCond getLeafCond(final MembershipCond membershipCond) {
+ SearchCond nodeCond = new SearchCond();
+
+ nodeCond.type = Type.LEAF;
+ nodeCond.membershipCond = membershipCond;
+
+ return nodeCond;
+ }
+
+ public static SearchCond getLeafCond(final ResourceCond resourceCond) {
+ SearchCond nodeCond = new SearchCond();
+
+ nodeCond.type = Type.LEAF;
+ nodeCond.resourceCond = resourceCond;
+
+ return nodeCond;
+ }
+
+ public static SearchCond getLeafCond(final EntitlementCond entitlementCond) {
+ SearchCond nodeCond = new SearchCond();
+
+ nodeCond.type = Type.LEAF;
+ nodeCond.entitlementCond = entitlementCond;
+
+ return nodeCond;
+ }
+
+ public static SearchCond getNotLeafCond(final AttributeCond attributeCond) {
+ SearchCond nodeCond = getLeafCond(attributeCond);
+ nodeCond.type = Type.NOT_LEAF;
+ return nodeCond;
+ }
+
+ public static SearchCond getNotLeafCond(final MembershipCond membershipCond) {
+ SearchCond nodeCond = getLeafCond(membershipCond);
+ nodeCond.type = Type.NOT_LEAF;
+ return nodeCond;
+ }
+
+ public static SearchCond getNotLeafCond(final ResourceCond resourceCond) {
+ SearchCond nodeCond = getLeafCond(resourceCond);
+ nodeCond.type = Type.NOT_LEAF;
+ return nodeCond;
+ }
+
+ public static SearchCond getNotLeafCond(final EntitlementCond entitlementCond) {
+ SearchCond nodeCond = getLeafCond(entitlementCond);
+ nodeCond.type = Type.NOT_LEAF;
+ return nodeCond;
+ }
+
+ public static SearchCond getNotLeafCond(final SearchCond nodeCond) {
+ nodeCond.type = Type.NOT_LEAF;
+ return nodeCond;
+ }
+
+ public static SearchCond getAndCond(final SearchCond leftCond, final SearchCond rightCond) {
+ SearchCond nodeCond = new SearchCond();
+
+ nodeCond.type = Type.AND;
+ nodeCond.leftNodeCond = leftCond;
+ nodeCond.rightNodeCond = rightCond;
+
+ return nodeCond;
+ }
+
+ public static SearchCond getAndCond(final List<SearchCond> conditions) {
+ if (conditions.size() > 2) {
+ SearchCond removed = conditions.remove(0);
+ return getAndCond(removed, getAndCond(conditions));
+ } else {
+ return getAndCond(conditions.get(0), conditions.get(1));
+ }
+ }
+
+ public static SearchCond getOrCond(final SearchCond leftCond, final SearchCond rightCond) {
+ SearchCond nodeCond = new SearchCond();
+
+ nodeCond.type = Type.OR;
+ nodeCond.leftNodeCond = leftCond;
+ nodeCond.rightNodeCond = rightCond;
+
+ return nodeCond;
+ }
+
+ public static SearchCond getOrCond(final List<SearchCond> conditions) {
+ if (conditions.size() > 2) {
+ SearchCond removed = conditions.remove(0);
+ return getOrCond(removed, getOrCond(conditions));
+ } else {
+ return getOrCond(conditions.get(0), conditions.get(1));
+ }
+ }
+
+ public SubjectCond getSubjectCond() {
+ return subjectCond;
+ }
+
+ public void setSubjectCond(final SubjectCond subjectCond) {
+ this.subjectCond = subjectCond;
+ }
+
+ public AttributeCond getAttributeCond() {
+ return attributeCond;
+ }
+
+ public void setAttributeCond(final AttributeCond attributeCond) {
+ this.attributeCond = attributeCond;
+ }
+
+ public MembershipCond getMembershipCond() {
+ return membershipCond;
+ }
+
+ public void setMembershipCond(final MembershipCond membershipCond) {
+ this.membershipCond = membershipCond;
+ }
+
+ public ResourceCond getResourceCond() {
+ return resourceCond;
+ }
+
+ public void setResourceCond(final ResourceCond resourceCond) {
+ this.resourceCond = resourceCond;
+ }
+
+ public EntitlementCond getEntitlementCond() {
+ return entitlementCond;
+ }
+
+ public void setEntitlementCond(final EntitlementCond entitlementCond) {
+ this.entitlementCond = entitlementCond;
+ }
+
+ public SearchCond getLeftNodeCond() {
+ return leftNodeCond;
+ }
+
+ public void setLeftNodeCond(final SearchCond leftNodeCond) {
+ this.leftNodeCond = leftNodeCond;
+ }
+
+ public SearchCond getRightNodeCond() {
+ return rightNodeCond;
+ }
+
+ public void setRightNodeCond(final SearchCond rightNodeCond) {
+ this.rightNodeCond = rightNodeCond;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public boolean isValid() {
+ boolean isValid = false;
+
+ if (type == null) {
+ return isValid;
+ }
+
+ switch (type) {
+ case LEAF:
+ case NOT_LEAF:
+ isValid = (subjectCond != null || attributeCond != null || membershipCond != null
+ || resourceCond != null || entitlementCond != null)
+ && (subjectCond == null || subjectCond.isValid())
+ && (attributeCond == null || attributeCond.isValid())
+ && (membershipCond == null || membershipCond.isValid())
+ && (resourceCond == null || resourceCond.isValid())
+ && (entitlementCond == null || entitlementCond.isValid());
+ break;
+
+ case AND:
+ case OR:
+ isValid = (leftNodeCond == null || rightNodeCond == null)
+ ? false
+ : leftNodeCond.isValid() && rightNodeCond.isValid();
+ break;
+
+ default:
+ }
+
+ return isValid;
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SubjectCond.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SubjectCond.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SubjectCond.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/search/SubjectCond.java Tue Aug 5 11:20:00 2014
@@ -1,34 +1,34 @@
-/*
- * 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 bean field values.
- */
-public class SubjectCond extends AttributeCond {
-
- private static final long serialVersionUID = -1880319220462653955L;
-
- public SubjectCond() {
- }
-
- public SubjectCond(final Type conditionType) {
- super(conditionType);
- }
-}
+/*
+ * 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 bean field values.
+ */
+public class SubjectCond extends AttributeCond {
+
+ private static final long serialVersionUID = -1880319220462653955L;
+
+ public SubjectCond() {
+ }
+
+ public SubjectCond(final Type conditionType) {
+ super(conditionType);
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/QueryResourceInfoComparator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/QueryResourceInfoComparator.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/QueryResourceInfoComparator.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/QueryResourceInfoComparator.java Tue Aug 5 11:20:00 2014
@@ -1,114 +1,114 @@
-/*
- * 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.rest.utils;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.jaxrs.ext.ResourceComparator;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
-import org.apache.cxf.jaxrs.model.OperationResourceInfo;
-import org.apache.cxf.jaxrs.model.OperationResourceInfoComparator;
-import org.apache.cxf.jaxrs.model.Parameter;
-import org.apache.cxf.jaxrs.utils.JAXRSUtils;
-import org.apache.cxf.message.Message;
-
-public class QueryResourceInfoComparator extends OperationResourceInfoComparator implements ResourceComparator {
-
- public QueryResourceInfoComparator() {
- super(null, null);
- }
-
- @Override
- public int compare(final ClassResourceInfo cri1, final ClassResourceInfo cri2, final Message message) {
- // Leave Class selection to CXF
- return 0;
- }
-
- @Override
- public int compare(final OperationResourceInfo oper1, final OperationResourceInfo oper2, final Message message) {
- // Check if CXF can make a decision
- int cxfResult = super.compare(oper1, oper2);
- if (cxfResult != 0) {
- return cxfResult;
- }
-
- int op1Counter = getMatchingRate(oper1, message);
- int op2Counter = getMatchingRate(oper2, message);
-
- return op1Counter == op2Counter
- ? 0
- : op1Counter < op2Counter
- ? 1
- : -1;
- }
-
- /**
- * This method calculates a number indicating a good or bad match between values provided within the request and
- * expected method parameters. A higher number means a better match.
- *
- * @param operation The operation to be rated, based on contained parameterInfo values.
- * @param message A message containing query and header values from user request
- * @return A positive or negative number, indicating a good match between query and method
- */
- protected int getMatchingRate(final OperationResourceInfo operation, final Message message) {
- List<Parameter> params = operation.getParameters();
- if (params == null || params.isEmpty()) {
- return 0;
- }
-
- // Get Request QueryParams
- String query = (String) message.get(Message.QUERY_STRING);
- String path = (String) message.get(Message.REQUEST_URI);
- Map<String, List<String>> qParams = JAXRSUtils.getStructuredParams(query, "&", true, false);
- Map<String, List<String>> mParams = JAXRSUtils.getMatrixParams(path, true);
- // Get Request Headers
- Map<?, ?> qHeader = (java.util.Map<?, ?>) message.get(Message.PROTOCOL_HEADERS);
-
- int rate = 0;
- for (Parameter p : params) {
- switch (p.getType()) {
- case QUERY:
- if (qParams.containsKey(p.getName())) {
- rate += 2;
- } else if (p.getDefaultValue() == null) {
- rate -= 1;
- }
- break;
- case MATRIX:
- if (mParams.containsKey(p.getName())) {
- rate += 2;
- } else if (p.getDefaultValue() == null) {
- rate -= 1;
- }
- break;
- case HEADER:
- if (qHeader.containsKey(p.getName())) {
- rate += 2;
- } else if (p.getDefaultValue() == null) {
- rate -= 1;
- }
- break;
- default:
- break;
- }
- }
- return rate;
- }
-}
+/*
+ * 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.rest.utils;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.jaxrs.ext.ResourceComparator;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+import org.apache.cxf.jaxrs.model.OperationResourceInfoComparator;
+import org.apache.cxf.jaxrs.model.Parameter;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.message.Message;
+
+public class QueryResourceInfoComparator extends OperationResourceInfoComparator implements ResourceComparator {
+
+ public QueryResourceInfoComparator() {
+ super(null, null);
+ }
+
+ @Override
+ public int compare(final ClassResourceInfo cri1, final ClassResourceInfo cri2, final Message message) {
+ // Leave Class selection to CXF
+ return 0;
+ }
+
+ @Override
+ public int compare(final OperationResourceInfo oper1, final OperationResourceInfo oper2, final Message message) {
+ // Check if CXF can make a decision
+ int cxfResult = super.compare(oper1, oper2);
+ if (cxfResult != 0) {
+ return cxfResult;
+ }
+
+ int op1Counter = getMatchingRate(oper1, message);
+ int op2Counter = getMatchingRate(oper2, message);
+
+ return op1Counter == op2Counter
+ ? 0
+ : op1Counter < op2Counter
+ ? 1
+ : -1;
+ }
+
+ /**
+ * This method calculates a number indicating a good or bad match between values provided within the request and
+ * expected method parameters. A higher number means a better match.
+ *
+ * @param operation The operation to be rated, based on contained parameterInfo values.
+ * @param message A message containing query and header values from user request
+ * @return A positive or negative number, indicating a good match between query and method
+ */
+ protected int getMatchingRate(final OperationResourceInfo operation, final Message message) {
+ List<Parameter> params = operation.getParameters();
+ if (params == null || params.isEmpty()) {
+ return 0;
+ }
+
+ // Get Request QueryParams
+ String query = (String) message.get(Message.QUERY_STRING);
+ String path = (String) message.get(Message.REQUEST_URI);
+ Map<String, List<String>> qParams = JAXRSUtils.getStructuredParams(query, "&", true, false);
+ Map<String, List<String>> mParams = JAXRSUtils.getMatrixParams(path, true);
+ // Get Request Headers
+ Map<?, ?> qHeader = (java.util.Map<?, ?>) message.get(Message.PROTOCOL_HEADERS);
+
+ int rate = 0;
+ for (Parameter p : params) {
+ switch (p.getType()) {
+ case QUERY:
+ if (qParams.containsKey(p.getName())) {
+ rate += 2;
+ } else if (p.getDefaultValue() == null) {
+ rate -= 1;
+ }
+ break;
+ case MATRIX:
+ if (mParams.containsKey(p.getName())) {
+ rate += 2;
+ } else if (p.getDefaultValue() == null) {
+ rate -= 1;
+ }
+ break;
+ case HEADER:
+ if (qHeader.containsKey(p.getName())) {
+ rate += 2;
+ } else if (p.getDefaultValue() == null) {
+ rate -= 1;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return rate;
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/utils/RestServiceExceptionMapper.java Tue Aug 5 11:20:00 2014
@@ -1,276 +1,276 @@
-/*
- * 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.rest.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.persistence.EntityExistsException;
-import javax.persistence.PersistenceException;
-import javax.persistence.RollbackException;
-import javax.validation.ValidationException;
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
-import org.apache.cxf.jaxrs.utils.JAXRSUtils;
-import org.apache.cxf.jaxrs.validation.ValidationExceptionMapper;
-import org.apache.syncope.common.types.EntityViolationType;
-import org.apache.syncope.common.types.ClientExceptionType;
-import org.apache.syncope.common.types.RESTHeaders;
-import org.apache.syncope.common.SyncopeClientCompositeException;
-import org.apache.syncope.common.SyncopeClientException;
-import org.apache.syncope.common.reqres.ErrorTO;
-import org.apache.syncope.core.persistence.dao.NotFoundException;
-import org.apache.syncope.core.persistence.validation.attrvalue.ParsingValidationException;
-import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
-import org.apache.syncope.core.rest.controller.UnauthorizedRoleException;
-import org.apache.syncope.core.workflow.WorkflowException;
-import org.identityconnectors.framework.common.exceptions.ConfigurationException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DataIntegrityViolationException;
-import org.springframework.orm.jpa.JpaSystemException;
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.transaction.TransactionSystemException;
-
-@Provider
-public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, ResponseExceptionMapper<Exception> {
-
- private static final String BASIC_REALM_UNAUTHORIZED = "Basic realm=\"Apache Syncope authentication\"";
-
- private static final Logger LOG = LoggerFactory.getLogger(RestServiceExceptionMapper.class);
-
- private final ValidationExceptionMapper validationEM = new ValidationExceptionMapper();
-
- @Override
- public Response toResponse(final Exception ex) {
- LOG.error("Exception thrown by REST method: " + ex.getMessage(), ex);
-
- ResponseBuilder builder;
-
- if (ex instanceof SyncopeClientException) {
- SyncopeClientException sce = (SyncopeClientException) ex;
- builder = sce.isComposite()
- ? getSyncopeClientCompositeExceptionResponse(sce.asComposite())
- : getSyncopeClientExceptionResponse(sce);
- } else if (ex instanceof WebApplicationException) {
- Response response = ((WebApplicationException) ex).getResponse();
-
- ErrorTO error = new ErrorTO();
- error.setStatus(response.getStatus());
- error.setType(ClientExceptionType.Unknown);
- error.getElements().add(getExMessage(ex));
-
- builder = JAXRSUtils.fromResponse(response).entity(error);
- } else if (ex instanceof AccessDeniedException) {
- builder = Response.status(Response.Status.UNAUTHORIZED).
- header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_UNAUTHORIZED);
- } else if (ex instanceof UnauthorizedRoleException) {
- builder = builder(Response.Status.UNAUTHORIZED, ClientExceptionType.UnauthorizedRole, getExMessage(ex));
- } else if (ex instanceof EntityExistsException) {
- builder = builder(Response.Status.CONFLICT, ClientExceptionType.EntityExists, getExMessage(ex));
- } else if (ex instanceof DataIntegrityViolationException) {
- builder = builder(Response.Status.CONFLICT, ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
- } else {
- builder = processNotFoundExceptions(ex);
- if (builder == null) {
- builder = processInvalidEntityExceptions(ex);
- if (builder == null) {
- builder = processBadRequestExceptions(ex);
- }
- // process JAX-RS validation errors
- if (builder == null && ex instanceof ValidationException) {
- builder = JAXRSUtils.fromResponse(validationEM.toResponse((ValidationException) ex)).
- header(RESTHeaders.ERROR_CODE, ClientExceptionType.RESTValidation.getHeaderValue()).
- header(RESTHeaders.ERROR_INFO,
- ClientExceptionType.RESTValidation.getInfoHeaderValue(getExMessage(ex)));
-
- ErrorTO error = new ErrorTO();
- error.setStatus(ClientExceptionType.RESTValidation.getResponseStatus().getStatusCode());
- error.setType(ClientExceptionType.RESTValidation);
- error.getElements().add(getExMessage(ex));
- builder.entity(error);
- }
- // ...or just report as InternalServerError
- if (builder == null) {
- builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).
- header(RESTHeaders.ERROR_INFO,
- ClientExceptionType.Unknown.getInfoHeaderValue(getExMessage(ex)));
-
- ErrorTO error = new ErrorTO();
- error.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
- error.setType(ClientExceptionType.Unknown);
- error.getElements().add(getExMessage(ex));
- builder.entity(error);
- }
- }
- }
-
- return builder.build();
- }
-
- @Override
- public Exception fromResponse(final Response r) {
- throw new UnsupportedOperationException(
- "Call of fromResponse() method is not expected in RestServiceExceptionMapper");
- }
-
- private ResponseBuilder getSyncopeClientExceptionResponse(final SyncopeClientException ex) {
- ResponseBuilder builder = Response.status(ex.getType().getResponseStatus());
- builder.header(RESTHeaders.ERROR_CODE, ex.getType().getHeaderValue());
-
- ErrorTO error = new ErrorTO();
- error.setStatus(ex.getType().getResponseStatus().getStatusCode());
- error.setType(ex.getType());
-
- for (String element : ex.getElements()) {
- builder.header(RESTHeaders.ERROR_INFO, ex.getType().getInfoHeaderValue(element));
- error.getElements().add(element);
- }
-
- return builder.entity(error);
- }
-
- private ResponseBuilder getSyncopeClientCompositeExceptionResponse(final SyncopeClientCompositeException ex) {
- if (ex.getExceptions().size() == 1) {
- return getSyncopeClientExceptionResponse(ex.getExceptions().iterator().next());
- }
-
- ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-
- List<ErrorTO> errors = new ArrayList<ErrorTO>();
- for (SyncopeClientException sce : ex.getExceptions()) {
- builder.header(RESTHeaders.ERROR_CODE, sce.getType().getHeaderValue());
-
- ErrorTO error = new ErrorTO();
- error.setStatus(sce.getType().getResponseStatus().getStatusCode());
- error.setType(sce.getType());
-
- for (String element : sce.getElements()) {
- builder.header(RESTHeaders.ERROR_INFO, ex.getType().getInfoHeaderValue(element));
- error.getElements().add(element);
- }
-
- errors.add(error);
- }
-
- return builder.entity(errors);
- }
-
- private ResponseBuilder processNotFoundExceptions(final Exception ex) {
- if (ex instanceof javax.ws.rs.NotFoundException || ex instanceof NotFoundException) {
- return builder(Response.Status.NOT_FOUND, ClientExceptionType.NotFound, getExMessage(ex));
- }
-
- return null;
- }
-
- private ResponseBuilder processInvalidEntityExceptions(final Exception ex) {
- InvalidEntityException iee = null;
-
- if (ex instanceof InvalidEntityException) {
- iee = (InvalidEntityException) ex;
- }
- if (ex instanceof TransactionSystemException && ex.getCause() instanceof RollbackException
- && ex.getCause().getCause() instanceof InvalidEntityException) {
-
- iee = (InvalidEntityException) ex.getCause().getCause();
- }
-
- if (iee != null) {
- ClientExceptionType exType =
- iee.getEntityClassSimpleName().endsWith("Policy")
- ? ClientExceptionType.InvalidPolicy
- : ClientExceptionType.valueOf("Invalid" + iee.getEntityClassSimpleName());
-
- ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
- builder.header(RESTHeaders.ERROR_CODE, exType.getHeaderValue());
-
- ErrorTO error = new ErrorTO();
- error.setStatus(exType.getResponseStatus().getStatusCode());
- error.setType(exType);
-
- for (Map.Entry<Class<?>, Set<EntityViolationType>> violation : iee.getViolations().entrySet()) {
- for (EntityViolationType violationType : violation.getValue()) {
- builder.header(RESTHeaders.ERROR_INFO,
- exType.getInfoHeaderValue(violationType.name() + ": " + violationType.getMessage()));
- error.getElements().add(violationType.name() + ": " + violationType.getMessage());
- }
- }
-
- return builder;
- }
-
- return null;
- }
-
- private ResponseBuilder processBadRequestExceptions(final Exception ex) {
- ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-
- if (ex instanceof BadRequestException) {
- if (((BadRequestException) ex).getResponse() == null) {
- return builder;
- } else {
- return JAXRSUtils.fromResponse(((BadRequestException) ex).getResponse());
- }
- } else if (ex instanceof WorkflowException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.Workflow, getExMessage(ex));
- } else if (ex instanceof PersistenceException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.GenericPersistence, getExMessage(ex));
- } else if (ex instanceof org.apache.ibatis.exceptions.PersistenceException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.Workflow,
- getMessage(ex, "Currently unavailable. Please try later."));
- } else if (ex instanceof JpaSystemException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
- } else if (ex instanceof ConfigurationException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.InvalidConnIdConf, getExMessage(ex));
- } else if (ex instanceof ParsingValidationException) {
- return builder(Response.Status.BAD_REQUEST, ClientExceptionType.InvalidValues, getExMessage(ex));
- }
-
- return null;
- }
-
- private ResponseBuilder builder(final Response.Status status, final ClientExceptionType hType, final String msg) {
- ResponseBuilder builder = Response.status(status).
- header(RESTHeaders.ERROR_CODE, hType.getHeaderValue()).
- header(RESTHeaders.ERROR_INFO, hType.getInfoHeaderValue(msg));
-
- ErrorTO error = new ErrorTO();
- error.setStatus(status.getStatusCode());
- error.setType(hType);
- error.getElements().add(msg);
-
- return builder.entity(error);
- }
-
- private String getMessage(final Throwable ex, final String msg) {
- return (msg == null) ? getExMessage(ex) : msg;
- }
-
- private String getExMessage(final Throwable ex) {
- return (ex.getCause() == null) ? ex.getMessage() : ex.getCause().getMessage();
- }
-}
+/*
+ * 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.rest.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.persistence.EntityExistsException;
+import javax.persistence.PersistenceException;
+import javax.persistence.RollbackException;
+import javax.validation.ValidationException;
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.jaxrs.validation.ValidationExceptionMapper;
+import org.apache.syncope.common.types.EntityViolationType;
+import org.apache.syncope.common.types.ClientExceptionType;
+import org.apache.syncope.common.types.RESTHeaders;
+import org.apache.syncope.common.SyncopeClientCompositeException;
+import org.apache.syncope.common.SyncopeClientException;
+import org.apache.syncope.common.reqres.ErrorTO;
+import org.apache.syncope.core.persistence.dao.NotFoundException;
+import org.apache.syncope.core.persistence.validation.attrvalue.ParsingValidationException;
+import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
+import org.apache.syncope.core.rest.controller.UnauthorizedRoleException;
+import org.apache.syncope.core.workflow.WorkflowException;
+import org.identityconnectors.framework.common.exceptions.ConfigurationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataIntegrityViolationException;
+import org.springframework.orm.jpa.JpaSystemException;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.transaction.TransactionSystemException;
+
+@Provider
+public class RestServiceExceptionMapper implements ExceptionMapper<Exception>, ResponseExceptionMapper<Exception> {
+
+ private static final String BASIC_REALM_UNAUTHORIZED = "Basic realm=\"Apache Syncope authentication\"";
+
+ private static final Logger LOG = LoggerFactory.getLogger(RestServiceExceptionMapper.class);
+
+ private final ValidationExceptionMapper validationEM = new ValidationExceptionMapper();
+
+ @Override
+ public Response toResponse(final Exception ex) {
+ LOG.error("Exception thrown by REST method: " + ex.getMessage(), ex);
+
+ ResponseBuilder builder;
+
+ if (ex instanceof SyncopeClientException) {
+ SyncopeClientException sce = (SyncopeClientException) ex;
+ builder = sce.isComposite()
+ ? getSyncopeClientCompositeExceptionResponse(sce.asComposite())
+ : getSyncopeClientExceptionResponse(sce);
+ } else if (ex instanceof WebApplicationException) {
+ Response response = ((WebApplicationException) ex).getResponse();
+
+ ErrorTO error = new ErrorTO();
+ error.setStatus(response.getStatus());
+ error.setType(ClientExceptionType.Unknown);
+ error.getElements().add(getExMessage(ex));
+
+ builder = JAXRSUtils.fromResponse(response).entity(error);
+ } else if (ex instanceof AccessDeniedException) {
+ builder = Response.status(Response.Status.UNAUTHORIZED).
+ header(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM_UNAUTHORIZED);
+ } else if (ex instanceof UnauthorizedRoleException) {
+ builder = builder(Response.Status.UNAUTHORIZED, ClientExceptionType.UnauthorizedRole, getExMessage(ex));
+ } else if (ex instanceof EntityExistsException) {
+ builder = builder(Response.Status.CONFLICT, ClientExceptionType.EntityExists, getExMessage(ex));
+ } else if (ex instanceof DataIntegrityViolationException) {
+ builder = builder(Response.Status.CONFLICT, ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
+ } else {
+ builder = processNotFoundExceptions(ex);
+ if (builder == null) {
+ builder = processInvalidEntityExceptions(ex);
+ if (builder == null) {
+ builder = processBadRequestExceptions(ex);
+ }
+ // process JAX-RS validation errors
+ if (builder == null && ex instanceof ValidationException) {
+ builder = JAXRSUtils.fromResponse(validationEM.toResponse((ValidationException) ex)).
+ header(RESTHeaders.ERROR_CODE, ClientExceptionType.RESTValidation.getHeaderValue()).
+ header(RESTHeaders.ERROR_INFO,
+ ClientExceptionType.RESTValidation.getInfoHeaderValue(getExMessage(ex)));
+
+ ErrorTO error = new ErrorTO();
+ error.setStatus(ClientExceptionType.RESTValidation.getResponseStatus().getStatusCode());
+ error.setType(ClientExceptionType.RESTValidation);
+ error.getElements().add(getExMessage(ex));
+ builder.entity(error);
+ }
+ // ...or just report as InternalServerError
+ if (builder == null) {
+ builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).
+ header(RESTHeaders.ERROR_INFO,
+ ClientExceptionType.Unknown.getInfoHeaderValue(getExMessage(ex)));
+
+ ErrorTO error = new ErrorTO();
+ error.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
+ error.setType(ClientExceptionType.Unknown);
+ error.getElements().add(getExMessage(ex));
+ builder.entity(error);
+ }
+ }
+ }
+
+ return builder.build();
+ }
+
+ @Override
+ public Exception fromResponse(final Response r) {
+ throw new UnsupportedOperationException(
+ "Call of fromResponse() method is not expected in RestServiceExceptionMapper");
+ }
+
+ private ResponseBuilder getSyncopeClientExceptionResponse(final SyncopeClientException ex) {
+ ResponseBuilder builder = Response.status(ex.getType().getResponseStatus());
+ builder.header(RESTHeaders.ERROR_CODE, ex.getType().getHeaderValue());
+
+ ErrorTO error = new ErrorTO();
+ error.setStatus(ex.getType().getResponseStatus().getStatusCode());
+ error.setType(ex.getType());
+
+ for (String element : ex.getElements()) {
+ builder.header(RESTHeaders.ERROR_INFO, ex.getType().getInfoHeaderValue(element));
+ error.getElements().add(element);
+ }
+
+ return builder.entity(error);
+ }
+
+ private ResponseBuilder getSyncopeClientCompositeExceptionResponse(final SyncopeClientCompositeException ex) {
+ if (ex.getExceptions().size() == 1) {
+ return getSyncopeClientExceptionResponse(ex.getExceptions().iterator().next());
+ }
+
+ ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
+
+ List<ErrorTO> errors = new ArrayList<ErrorTO>();
+ for (SyncopeClientException sce : ex.getExceptions()) {
+ builder.header(RESTHeaders.ERROR_CODE, sce.getType().getHeaderValue());
+
+ ErrorTO error = new ErrorTO();
+ error.setStatus(sce.getType().getResponseStatus().getStatusCode());
+ error.setType(sce.getType());
+
+ for (String element : sce.getElements()) {
+ builder.header(RESTHeaders.ERROR_INFO, ex.getType().getInfoHeaderValue(element));
+ error.getElements().add(element);
+ }
+
+ errors.add(error);
+ }
+
+ return builder.entity(errors);
+ }
+
+ private ResponseBuilder processNotFoundExceptions(final Exception ex) {
+ if (ex instanceof javax.ws.rs.NotFoundException || ex instanceof NotFoundException) {
+ return builder(Response.Status.NOT_FOUND, ClientExceptionType.NotFound, getExMessage(ex));
+ }
+
+ return null;
+ }
+
+ private ResponseBuilder processInvalidEntityExceptions(final Exception ex) {
+ InvalidEntityException iee = null;
+
+ if (ex instanceof InvalidEntityException) {
+ iee = (InvalidEntityException) ex;
+ }
+ if (ex instanceof TransactionSystemException && ex.getCause() instanceof RollbackException
+ && ex.getCause().getCause() instanceof InvalidEntityException) {
+
+ iee = (InvalidEntityException) ex.getCause().getCause();
+ }
+
+ if (iee != null) {
+ ClientExceptionType exType =
+ iee.getEntityClassSimpleName().endsWith("Policy")
+ ? ClientExceptionType.InvalidPolicy
+ : ClientExceptionType.valueOf("Invalid" + iee.getEntityClassSimpleName());
+
+ ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
+ builder.header(RESTHeaders.ERROR_CODE, exType.getHeaderValue());
+
+ ErrorTO error = new ErrorTO();
+ error.setStatus(exType.getResponseStatus().getStatusCode());
+ error.setType(exType);
+
+ for (Map.Entry<Class<?>, Set<EntityViolationType>> violation : iee.getViolations().entrySet()) {
+ for (EntityViolationType violationType : violation.getValue()) {
+ builder.header(RESTHeaders.ERROR_INFO,
+ exType.getInfoHeaderValue(violationType.name() + ": " + violationType.getMessage()));
+ error.getElements().add(violationType.name() + ": " + violationType.getMessage());
+ }
+ }
+
+ return builder;
+ }
+
+ return null;
+ }
+
+ private ResponseBuilder processBadRequestExceptions(final Exception ex) {
+ ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
+
+ if (ex instanceof BadRequestException) {
+ if (((BadRequestException) ex).getResponse() == null) {
+ return builder;
+ } else {
+ return JAXRSUtils.fromResponse(((BadRequestException) ex).getResponse());
+ }
+ } else if (ex instanceof WorkflowException) {
+ return builder(Response.Status.BAD_REQUEST, ClientExceptionType.Workflow, getExMessage(ex));
+ } else if (ex instanceof PersistenceException) {
+ return builder(Response.Status.BAD_REQUEST, ClientExceptionType.GenericPersistence, getExMessage(ex));
+ } else if (ex instanceof org.apache.ibatis.exceptions.PersistenceException) {
+ return builder(Response.Status.BAD_REQUEST, ClientExceptionType.Workflow,
+ getMessage(ex, "Currently unavailable. Please try later."));
+ } else if (ex instanceof JpaSystemException) {
+ return builder(Response.Status.BAD_REQUEST, ClientExceptionType.DataIntegrityViolation, getExMessage(ex));
+ } else if (ex instanceof ConfigurationException) {
+ return builder(Response.Status.BAD_REQUEST, ClientExceptionType.InvalidConnIdConf, getExMessage(ex));
+ } else if (ex instanceof ParsingValidationException) {
+ return builder(Response.Status.BAD_REQUEST, ClientExceptionType.InvalidValues, getExMessage(ex));
+ }
+
+ return null;
+ }
+
+ private ResponseBuilder builder(final Response.Status status, final ClientExceptionType hType, final String msg) {
+ ResponseBuilder builder = Response.status(status).
+ header(RESTHeaders.ERROR_CODE, hType.getHeaderValue()).
+ header(RESTHeaders.ERROR_INFO, hType.getInfoHeaderValue(msg));
+
+ ErrorTO error = new ErrorTO();
+ error.setStatus(status.getStatusCode());
+ error.setType(hType);
+ error.getElements().add(msg);
+
+ return builder.entity(error);
+ }
+
+ private String getMessage(final Throwable ex, final String msg) {
+ return (msg == null) ? getExMessage(ex) : msg;
+ }
+
+ private String getExMessage(final Throwable ex) {
+ return (ex.getCause() == null) ? ex.getMessage() : ex.getCause().getMessage();
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConfigurationServiceImpl.java Tue Aug 5 11:20:00 2014
@@ -1,91 +1,91 @@
-/*
- * 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.services;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.StreamingOutput;
-import org.apache.syncope.common.services.ConfigurationService;
-import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.ConfTO;
-import org.apache.syncope.common.wrap.MailTemplate;
-import org.apache.syncope.common.wrap.Validator;
-import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.core.rest.controller.ConfigurationController;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class ConfigurationServiceImpl extends AbstractServiceImpl implements ConfigurationService {
-
- private static final String CONTENT_XML = "content.xml";
-
- @Autowired
- private ConfigurationController controller;
-
- @Override
- public Response export() {
- StreamingOutput sout = new StreamingOutput() {
-
- @Override
- public void write(final OutputStream os) throws IOException {
- controller.export(os);
- }
- };
- return Response.ok(sout).
- type(MediaType.TEXT_XML).
- header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + CONTENT_XML).
- build();
- }
-
- @Override
- public void delete(final String key) {
- controller.delete(key);
- }
-
- @Override
- public List<MailTemplate> getMailTemplates() {
- return CollectionWrapper.wrap(controller.getMailTemplates(), MailTemplate.class);
- }
-
- @Override
- public List<Validator> getValidators() {
- return CollectionWrapper.wrap(controller.getValidators(), Validator.class);
- }
-
- @Override
- public ConfTO list() {
- return controller.list();
- }
-
- @Override
- public AttributeTO read(final String key) {
- return controller.read(key);
- }
-
- @Override
- public void set(final String key, final AttributeTO value) {
- value.setSchema(key);
- controller.set(value);
- }
-}
+/*
+ * 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.services;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+import org.apache.syncope.common.services.ConfigurationService;
+import org.apache.syncope.common.to.AttributeTO;
+import org.apache.syncope.common.to.ConfTO;
+import org.apache.syncope.common.wrap.MailTemplate;
+import org.apache.syncope.common.wrap.Validator;
+import org.apache.syncope.common.util.CollectionWrapper;
+import org.apache.syncope.core.rest.controller.ConfigurationController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConfigurationServiceImpl extends AbstractServiceImpl implements ConfigurationService {
+
+ private static final String CONTENT_XML = "content.xml";
+
+ @Autowired
+ private ConfigurationController controller;
+
+ @Override
+ public Response export() {
+ StreamingOutput sout = new StreamingOutput() {
+
+ @Override
+ public void write(final OutputStream os) throws IOException {
+ controller.export(os);
+ }
+ };
+ return Response.ok(sout).
+ type(MediaType.TEXT_XML).
+ header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + CONTENT_XML).
+ build();
+ }
+
+ @Override
+ public void delete(final String key) {
+ controller.delete(key);
+ }
+
+ @Override
+ public List<MailTemplate> getMailTemplates() {
+ return CollectionWrapper.wrap(controller.getMailTemplates(), MailTemplate.class);
+ }
+
+ @Override
+ public List<Validator> getValidators() {
+ return CollectionWrapper.wrap(controller.getValidators(), Validator.class);
+ }
+
+ @Override
+ public ConfTO list() {
+ return controller.list();
+ }
+
+ @Override
+ public AttributeTO read(final String key) {
+ return controller.read(key);
+ }
+
+ @Override
+ public void set(final String key, final AttributeTO value) {
+ value.setSchema(key);
+ controller.set(value);
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ConnectorServiceImpl.java Tue Aug 5 11:20:00 2014
@@ -1,133 +1,133 @@
-/*
- * 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.services;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.services.ConnectorService;
-import org.apache.syncope.common.reqres.BulkAction;
-import org.apache.syncope.common.reqres.BulkActionResult;
-import org.apache.syncope.common.to.ConnBundleTO;
-import org.apache.syncope.common.to.ConnIdObjectClassTO;
-import org.apache.syncope.common.to.ConnInstanceTO;
-import org.apache.syncope.common.to.SchemaTO;
-import org.apache.syncope.common.types.ConnConfProperty;
-import org.apache.syncope.common.types.RESTHeaders;
-import org.apache.syncope.core.rest.controller.ConnectorController;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class ConnectorServiceImpl extends AbstractServiceImpl implements ConnectorService {
-
- @Autowired
- private ConnectorController controller;
-
- @Override
- public Response create(final ConnInstanceTO connInstanceTO) {
- ConnInstanceTO connInstance = controller.create(connInstanceTO);
- URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(connInstance.getId())).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_ID, connInstance.getId()).
- build();
- }
-
- @Override
- public void delete(final Long connInstanceId) {
- controller.delete(connInstanceId);
- }
-
- @Override
- public List<ConnBundleTO> getBundles(final String lang) {
- return controller.getBundles(lang);
- }
-
- @Override
- public List<ConnConfProperty> getConfigurationProperties(final Long connInstanceId) {
- return controller.getConfigurationProperties(connInstanceId);
- }
-
- @Override
- public List<SchemaTO> getSchemaNames(final Long connInstanceId, final ConnInstanceTO connInstanceTO,
- final boolean includeSpecial) {
-
- connInstanceTO.setId(connInstanceId);
-
- List<String> schemaNames = controller.getSchemaNames(connInstanceTO, includeSpecial);
- List<SchemaTO> result = new ArrayList<SchemaTO>(schemaNames.size());
- for (String name : schemaNames) {
- SchemaTO schemaTO = new SchemaTO();
- schemaTO.setName(name);
- result.add(schemaTO);
- }
- return result;
- }
-
- @Override
- public List<ConnIdObjectClassTO> getSupportedObjectClasses(final Long connInstanceId,
- final ConnInstanceTO connInstanceTO) {
-
- connInstanceTO.setId(connInstanceId);
-
- List<String> objectClasses = controller.getSupportedObjectClasses(connInstanceTO);
- List<ConnIdObjectClassTO> result = new ArrayList<ConnIdObjectClassTO>(objectClasses.size());
- for (String objectClass : objectClasses) {
- result.add(new ConnIdObjectClassTO(objectClass));
- }
- return result;
- }
-
- @Override
- public List<ConnInstanceTO> list(final String lang) {
- return controller.list(lang);
- }
-
- @Override
- public ConnInstanceTO read(final Long connInstanceId) {
- return controller.read(connInstanceId);
- }
-
- @Override
- public ConnInstanceTO readByResource(final String resourceName) {
- return controller.readByResource(resourceName);
- }
-
- @Override
- public void update(final Long connInstanceId, final ConnInstanceTO connInstanceTO) {
- connInstanceTO.setId(connInstanceId);
- controller.update(connInstanceTO);
- }
-
- @Override
- public boolean check(final ConnInstanceTO connInstanceTO) {
- return controller.check(connInstanceTO);
- }
-
- @Override
- public void reload() {
- controller.reload();
- }
-
- @Override
- public BulkActionResult bulk(final BulkAction bulkAction) {
- return controller.bulk(bulkAction);
- }
-}
+/*
+ * 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.services;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.common.services.ConnectorService;
+import org.apache.syncope.common.reqres.BulkAction;
+import org.apache.syncope.common.reqres.BulkActionResult;
+import org.apache.syncope.common.to.ConnBundleTO;
+import org.apache.syncope.common.to.ConnIdObjectClassTO;
+import org.apache.syncope.common.to.ConnInstanceTO;
+import org.apache.syncope.common.to.SchemaTO;
+import org.apache.syncope.common.types.ConnConfProperty;
+import org.apache.syncope.common.types.RESTHeaders;
+import org.apache.syncope.core.rest.controller.ConnectorController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorServiceImpl extends AbstractServiceImpl implements ConnectorService {
+
+ @Autowired
+ private ConnectorController controller;
+
+ @Override
+ public Response create(final ConnInstanceTO connInstanceTO) {
+ ConnInstanceTO connInstance = controller.create(connInstanceTO);
+ URI location = uriInfo.getAbsolutePathBuilder().path(String.valueOf(connInstance.getId())).build();
+ return Response.created(location).
+ header(RESTHeaders.RESOURCE_ID, connInstance.getId()).
+ build();
+ }
+
+ @Override
+ public void delete(final Long connInstanceId) {
+ controller.delete(connInstanceId);
+ }
+
+ @Override
+ public List<ConnBundleTO> getBundles(final String lang) {
+ return controller.getBundles(lang);
+ }
+
+ @Override
+ public List<ConnConfProperty> getConfigurationProperties(final Long connInstanceId) {
+ return controller.getConfigurationProperties(connInstanceId);
+ }
+
+ @Override
+ public List<SchemaTO> getSchemaNames(final Long connInstanceId, final ConnInstanceTO connInstanceTO,
+ final boolean includeSpecial) {
+
+ connInstanceTO.setId(connInstanceId);
+
+ List<String> schemaNames = controller.getSchemaNames(connInstanceTO, includeSpecial);
+ List<SchemaTO> result = new ArrayList<SchemaTO>(schemaNames.size());
+ for (String name : schemaNames) {
+ SchemaTO schemaTO = new SchemaTO();
+ schemaTO.setName(name);
+ result.add(schemaTO);
+ }
+ return result;
+ }
+
+ @Override
+ public List<ConnIdObjectClassTO> getSupportedObjectClasses(final Long connInstanceId,
+ final ConnInstanceTO connInstanceTO) {
+
+ connInstanceTO.setId(connInstanceId);
+
+ List<String> objectClasses = controller.getSupportedObjectClasses(connInstanceTO);
+ List<ConnIdObjectClassTO> result = new ArrayList<ConnIdObjectClassTO>(objectClasses.size());
+ for (String objectClass : objectClasses) {
+ result.add(new ConnIdObjectClassTO(objectClass));
+ }
+ return result;
+ }
+
+ @Override
+ public List<ConnInstanceTO> list(final String lang) {
+ return controller.list(lang);
+ }
+
+ @Override
+ public ConnInstanceTO read(final Long connInstanceId) {
+ return controller.read(connInstanceId);
+ }
+
+ @Override
+ public ConnInstanceTO readByResource(final String resourceName) {
+ return controller.readByResource(resourceName);
+ }
+
+ @Override
+ public void update(final Long connInstanceId, final ConnInstanceTO connInstanceTO) {
+ connInstanceTO.setId(connInstanceId);
+ controller.update(connInstanceTO);
+ }
+
+ @Override
+ public boolean check(final ConnInstanceTO connInstanceTO) {
+ return controller.check(connInstanceTO);
+ }
+
+ @Override
+ public void reload() {
+ controller.reload();
+ }
+
+ @Override
+ public BulkActionResult bulk(final BulkAction bulkAction) {
+ return controller.bulk(bulkAction);
+ }
+}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java?rev=1615910&r1=1615909&r2=1615910&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/EntitlementServiceImpl.java Tue Aug 5 11:20:00 2014
@@ -1,45 +1,45 @@
-/*
- * 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.services;
-
-import java.util.List;
-
-import org.apache.syncope.common.services.EntitlementService;
-import org.apache.syncope.common.wrap.EntitlementTO;
-import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.core.rest.controller.EntitlementController;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class EntitlementServiceImpl extends AbstractServiceImpl implements EntitlementService {
-
- @Autowired
- private EntitlementController controller;
-
- @Override
- public List<EntitlementTO> getAllEntitlements() {
- return CollectionWrapper.wrap(controller.getAll(), EntitlementTO.class);
- }
-
- @Override
- public List<EntitlementTO> getOwnEntitlements() {
- return CollectionWrapper.wrap(controller.getOwn(), EntitlementTO.class);
- }
-}
+/*
+ * 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.services;
+
+import java.util.List;
+
+import org.apache.syncope.common.services.EntitlementService;
+import org.apache.syncope.common.wrap.EntitlementTO;
+import org.apache.syncope.common.util.CollectionWrapper;
+import org.apache.syncope.core.rest.controller.EntitlementController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class EntitlementServiceImpl extends AbstractServiceImpl implements EntitlementService {
+
+ @Autowired
+ private EntitlementController controller;
+
+ @Override
+ public List<EntitlementTO> getAllEntitlements() {
+ return CollectionWrapper.wrap(controller.getAll(), EntitlementTO.class);
+ }
+
+ @Override
+ public List<EntitlementTO> getOwnEntitlements() {
+ return CollectionWrapper.wrap(controller.getOwn(), EntitlementTO.class);
+ }
+}