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 2015/12/21 14:29:05 UTC
syncope git commit: Various small fixes
Repository: syncope
Updated Branches:
refs/heads/master a92f400f6 -> 14e06e0f1
Various small fixes
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/14e06e0f
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/14e06e0f
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/14e06e0f
Branch: refs/heads/master
Commit: 14e06e0f1f7d55eefef486784ffc12207fef02c7
Parents: a92f400
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Dec 21 14:29:00 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Dec 21 14:29:00 2015 +0100
----------------------------------------------------------------------
.../java/data/AbstractAnyDataBinder.java | 1 +
.../java/data/AnyObjectDataBinderImpl.java | 70 ++++++++++---------
.../java/data/UserDataBinderImpl.java | 71 +++++++++++---------
.../resources/mysql/domains/Master.properties | 2 +-
4 files changed, 81 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/14e06e0f/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
index 3db4fc8..686742a 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
@@ -555,6 +555,7 @@ abstract class AbstractAnyDataBinder {
protected RelationshipTO getRelationshipTO(final Relationship<? extends Any<?>, AnyObject> relationship) {
return new RelationshipTO.Builder().
+ type(relationship.getType().getKey()).
left(relationship.getLeftEnd().getType().getKey(), relationship.getLeftEnd().getKey()).
right(relationship.getRightEnd().getType().getKey(), relationship.getRightEnd().getKey()).
build();
http://git-wip-us.apache.org/repos/asf/syncope/blob/14e06e0f/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java
index 639f1b2..19684b2 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java
@@ -157,12 +157,16 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An
LOG.debug("Ignoring invalid anyObject " + relationshipTO.getRightKey());
} else if (assignableAnyObjects.contains(otherEnd)) {
RelationshipType relationshipType = relationshipTypeDAO.find(relationshipTO.getType());
- ARelationship relationship = entityFactory.newEntity(ARelationship.class);
- relationship.setType(relationshipType);
- relationship.setRightEnd(anyObject);
- relationship.setLeftEnd(anyObject);
+ if (relationshipType == null) {
+ LOG.debug("Ignoring invalid relationship type {}", relationshipTO.getType());
+ } else {
+ ARelationship relationship = entityFactory.newEntity(ARelationship.class);
+ relationship.setType(relationshipType);
+ relationship.setRightEnd(anyObject);
+ relationship.setLeftEnd(anyObject);
- anyObject.add(relationship);
+ anyObject.add(relationship);
+ }
} else {
LOG.error("{} cannot be assigned to {}", otherEnd, anyObject);
@@ -234,33 +238,37 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An
for (RelationshipPatch patch : anyObjectPatch.getRelationships()) {
if (patch.getRelationshipTO() != null) {
RelationshipType relationshipType = relationshipTypeDAO.find(patch.getRelationshipTO().getType());
- ARelationship relationship =
- anyObject.getRelationship(relationshipType, patch.getRelationshipTO().getRightKey());
- if (relationship != null) {
- anyObject.remove(relationship);
- toBeDeprovisioned.addAll(relationship.getRightEnd().getResourceNames());
- }
-
- if (patch.getOperation() == PatchOperation.ADD_REPLACE) {
- AnyObject otherEnd = anyObjectDAO.find(patch.getRelationshipTO().getRightKey());
- if (otherEnd == null) {
- LOG.debug("Ignoring invalid any object {}", patch.getRelationshipTO().getRightKey());
- } else if (assignableAnyObjects.contains(otherEnd)) {
- relationship = entityFactory.newEntity(ARelationship.class);
- relationship.setType(relationshipType);
- relationship.setRightEnd(otherEnd);
- relationship.setLeftEnd(anyObject);
-
- anyObject.add(relationship);
-
- toBeProvisioned.addAll(otherEnd.getResourceNames());
- } else {
- LOG.error("{} cannot be assigned to {}", otherEnd, anyObject);
+ if (relationshipType == null) {
+ LOG.debug("Ignoring invalid relationship type {}", patch.getRelationshipTO().getType());
+ } else {
+ ARelationship relationship =
+ anyObject.getRelationship(relationshipType, patch.getRelationshipTO().getRightKey());
+ if (relationship != null) {
+ anyObject.remove(relationship);
+ toBeDeprovisioned.addAll(relationship.getRightEnd().getResourceNames());
+ }
- SyncopeClientException unassignabled =
- SyncopeClientException.build(ClientExceptionType.InvalidRelationship);
- unassignabled.getElements().add("Cannot be assigned: " + otherEnd);
- scce.addException(unassignabled);
+ if (patch.getOperation() == PatchOperation.ADD_REPLACE) {
+ AnyObject otherEnd = anyObjectDAO.find(patch.getRelationshipTO().getRightKey());
+ if (otherEnd == null) {
+ LOG.debug("Ignoring invalid any object {}", patch.getRelationshipTO().getRightKey());
+ } else if (assignableAnyObjects.contains(otherEnd)) {
+ relationship = entityFactory.newEntity(ARelationship.class);
+ relationship.setType(relationshipType);
+ relationship.setRightEnd(otherEnd);
+ relationship.setLeftEnd(anyObject);
+
+ anyObject.add(relationship);
+
+ toBeProvisioned.addAll(otherEnd.getResourceNames());
+ } else {
+ LOG.error("{} cannot be assigned to {}", otherEnd, anyObject);
+
+ SyncopeClientException unassignabled =
+ SyncopeClientException.build(ClientExceptionType.InvalidRelationship);
+ unassignabled.getElements().add("Cannot be assigned: " + otherEnd);
+ scce.addException(unassignabled);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/14e06e0f/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index 9fe5ee2..1668fc4 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -200,12 +200,17 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
LOG.debug("Ignoring invalid anyObject " + relationshipTO.getRightKey());
} else if (assignableAnyObjects.contains(otherEnd)) {
RelationshipType relationshipType = relationshipTypeDAO.find(relationshipTO.getType());
- URelationship relationship = entityFactory.newEntity(URelationship.class);
- relationship.setType(relationshipType);
- relationship.setRightEnd(otherEnd);
- relationship.setLeftEnd(user);
+ if (relationshipType == null) {
+ LOG.debug("Ignoring invalid relationship type {}", relationshipTO.getType());
+ } else {
+
+ URelationship relationship = entityFactory.newEntity(URelationship.class);
+ relationship.setType(relationshipType);
+ relationship.setRightEnd(otherEnd);
+ relationship.setLeftEnd(user);
- user.add(relationship);
+ user.add(relationship);
+ }
} else {
LOG.error("{} cannot be assigned to {}", otherEnd, user);
@@ -377,33 +382,37 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
for (RelationshipPatch patch : userPatch.getRelationships()) {
if (patch.getRelationshipTO() != null) {
RelationshipType relationshipType = relationshipTypeDAO.find(patch.getRelationshipTO().getType());
- URelationship relationship =
- user.getRelationship(relationshipType, patch.getRelationshipTO().getRightKey());
- if (relationship != null) {
- user.remove(relationship);
- toBeDeprovisioned.addAll(relationship.getRightEnd().getResourceNames());
- }
-
- if (patch.getOperation() == PatchOperation.ADD_REPLACE) {
- AnyObject otherEnd = anyObjectDAO.find(patch.getRelationshipTO().getRightKey());
- if (otherEnd == null) {
- LOG.debug("Ignoring invalid any object {}", patch.getRelationshipTO().getRightKey());
- } else if (assignableAnyObjects.contains(otherEnd)) {
- relationship = entityFactory.newEntity(URelationship.class);
- relationship.setType(relationshipType);
- relationship.setRightEnd(otherEnd);
- relationship.setLeftEnd(user);
-
- user.add(relationship);
-
- toBeProvisioned.addAll(otherEnd.getResourceNames());
- } else {
- LOG.error("{} cannot be assigned to {}", otherEnd, user);
+ if (relationshipType == null) {
+ LOG.debug("Ignoring invalid relationship type {}", patch.getRelationshipTO().getType());
+ } else {
+ URelationship relationship =
+ user.getRelationship(relationshipType, patch.getRelationshipTO().getRightKey());
+ if (relationship != null) {
+ user.remove(relationship);
+ toBeDeprovisioned.addAll(relationship.getRightEnd().getResourceNames());
+ }
- SyncopeClientException unassignabled =
- SyncopeClientException.build(ClientExceptionType.InvalidRelationship);
- unassignabled.getElements().add("Cannot be assigned: " + otherEnd);
- scce.addException(unassignabled);
+ if (patch.getOperation() == PatchOperation.ADD_REPLACE) {
+ AnyObject otherEnd = anyObjectDAO.find(patch.getRelationshipTO().getRightKey());
+ if (otherEnd == null) {
+ LOG.debug("Ignoring invalid any object {}", patch.getRelationshipTO().getRightKey());
+ } else if (assignableAnyObjects.contains(otherEnd)) {
+ relationship = entityFactory.newEntity(URelationship.class);
+ relationship.setType(relationshipType);
+ relationship.setRightEnd(otherEnd);
+ relationship.setLeftEnd(user);
+
+ user.add(relationship);
+
+ toBeProvisioned.addAll(otherEnd.getResourceNames());
+ } else {
+ LOG.error("{} cannot be assigned to {}", otherEnd, user);
+
+ SyncopeClientException unassignabled =
+ SyncopeClientException.build(ClientExceptionType.InvalidRelationship);
+ unassignabled.getElements().add("Cannot be assigned: " + otherEnd);
+ scce.addException(unassignabled);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/14e06e0f/fit/core-reference/src/main/resources/mysql/domains/Master.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/mysql/domains/Master.properties b/fit/core-reference/src/main/resources/mysql/domains/Master.properties
index 93eba76..978b5f8 100644
--- a/fit/core-reference/src/main/resources/mysql/domains/Master.properties
+++ b/fit/core-reference/src/main/resources/mysql/domains/Master.properties
@@ -19,7 +19,7 @@ Master.url=jdbc:mysql://localhost:3306/syncope?characterEncoding=UTF-8
Master.schema=
Master.username=syncope
Master.password=syncope
-Master.databasePlatform=org.apache.openjpa.jdbc.sql.MySQLDictionary
+Master.databasePlatform=org.apache.openjpa.jdbc.sql.MySQLDictionary(blobTypeName=LONGBLOB)
Master.orm=META-INF/spring-orm.xml
# note: other connection pool settings can also be configured here, see DataSource definition