http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/server/persistence/jpa/relationship/ResourceTest.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/server/persistence/jpa/relationship/ResourceTest.java b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/server/persistence/jpa/relationship/ResourceTest.java index c5fbf29..dc9124b 100644 --- a/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/server/persistence/jpa/relationship/ResourceTest.java +++ b/syncope620/server/persistence-jpa/src/test/java/org/apache/syncope/server/persistence/jpa/relationship/ResourceTest.java @@ -118,7 +118,7 @@ public class ResourceTest extends AbstractTest { UMappingItem item = entityFactory.newEntity(UMappingItem.class); item.setExtAttrName("test" + i); item.setIntAttrName("nonexistent" + i); - item.setIntMappingType(IntMappingType.UserSchema); + item.setIntMappingType(IntMappingType.UserPlainSchema); item.setMandatoryCondition("false"); item.setPurpose(MappingPurpose.SYNCHRONIZATION); mapping.addItem(item); @@ -257,13 +257,16 @@ public class ResourceTest extends AbstractTest { List<? extends RMappingItem> items = ldap.getRmapping().getItems(); assertNotNull(items); assertFalse(items.isEmpty()); - List<Long> itemIds = new ArrayList<Long>(items.size()); + List<Long> itemIds = new ArrayList<>(items.size()); for (RMappingItem item : items) { itemIds.add(item.getKey()); } ldap.setRmapping(null); + // need to avoid any class not defined in this Maven module + ldap.getPropagationActionsClassNames().clear(); + resourceDAO.save(ldap); resourceDAO.flush();
http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/persistence-jpa/src/test/resources/content.xml ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-jpa/src/test/resources/content.xml b/syncope620/server/persistence-jpa/src/test/resources/content.xml index 0fb3b79..ecbf06d 100644 --- a/syncope620/server/persistence-jpa/src/test/resources/content.xml +++ b/syncope620/server/persistence-jpa/src/test/resources/content.xml @@ -407,10 +407,10 @@ under the License. <RDerAttrTemplate id="1003" owner_id="1" schema_name="rderToBePropagated"/> <RDerAttr id="1003" owner_id="1" template_id="1003"/> - <RVirAttrTemplate id="100" owner_id="4" schema_name="rvirtualdata"/> - <RVirAttr id="100" owner_id="4" template_id="100"/> + <RVirAttrTemplate id="98" owner_id="4" schema_name="rvirtualdata"/> + <RVirAttr id="98" owner_id="4" template_id="98"/> - <RVirAttrTemplate id="101" owner_id="3" schema_name="rvirtualdata"/> + <RVirAttrTemplate id="99" owner_id="3" schema_name="rvirtualdata"/> <MPlainAttrTemplate id="98" owner_id="1" schema_name="mderived_sx"/> @@ -438,7 +438,7 @@ under the License. <MDerAttrTemplate id="100" owner_id="1" schema_name="mderToBePropagated"/> - <MVirAttrTemplate id="100" owner_id="2" schema_name="mvirtualdata"/> + <MVirAttrTemplate id="99" owner_id="2" schema_name="mvirtualdata"/> <ConnInstance id="100" displayName="ConnInstance100" location="${connid.location}" @@ -605,7 +605,7 @@ under the License. creator="admin" lastModifier="admin" creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/> <ExternalResource_PropActions externalResource_name="resource-ldap" - action="org.apache.syncope.server.provisioning.api.propagation.PropagationActions"/> + action="org.apache.syncope.server.provisioning.java.propagation.LDAPMembershipPropagationActions"/> <ExternalResource name="ws-target-resource-nopropagation" connector_id="103" randomPwdIfNotProvided="0" enforceMandatoryCondition="1" propagationMode="TWO_PHASES" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL" @@ -664,49 +664,49 @@ under the License. intMappingType="UserId" mandatoryCondition="true" accountid="1" password="0" purpose="PROPAGATION"/> <UMappingItem id="100" extAttrName="email" mapping_id="15" - intAttrName="email" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="email" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="PROPAGATION"/> <UMappingItem id="101" extAttrName="surname" mapping_id="15" - intAttrName="surname" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="surname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="PROPAGATION"/> <UMappingItem id="102" mapping_id="15" extAttrName="__PASSWORD__" intMappingType="Password" mandatoryCondition="true" accountid="0" password="1" purpose="PROPAGATION"/> <UMappingItem id="335" mapping_id="15" - extAttrName="fullname" intAttrName="surname" intMappingType="UserSchema" mandatoryCondition="true" + extAttrName="fullname" intAttrName="surname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="PROPAGATION"/> <UMappingItem id="336" mapping_id="15" - extAttrName="type" intAttrName="type" intMappingType="UserSchema" mandatoryCondition="true" + extAttrName="type" intAttrName="type" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="PROPAGATION"/> <UMappingItem id="337" mapping_id="15" - extAttrName="name" intAttrName="firstname" intMappingType="UserSchema" mandatoryCondition="false" + extAttrName="name" intAttrName="firstname" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="0" password="0" purpose="NONE"/> <UMapping id="12" resource_name="ws-target-resource-list-mappings-1"/> <UMappingItem id="103" mapping_id="12" - extAttrName="email" intAttrName="email" intMappingType="UserSchema" mandatoryCondition="true" + extAttrName="email" intAttrName="email" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="1" password="0" purpose="PROPAGATION"/> <UMappingItem id="104" extAttrName="surname" mapping_id="12" - intAttrName="surname" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="surname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="PROPAGATION"/> <UMapping id="13" resource_name="ws-target-resource-list-mappings-2"/> <UMappingItem id="105" mapping_id="13" - extAttrName="userId" intAttrName="userId" intMappingType="UserSchema" mandatoryCondition="true" + extAttrName="userId" intAttrName="userId" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="1" password="0" purpose="PROPAGATION"/> <UMapping id="1" resource_name="ws-target-resource-2"/> <UMappingItem id="106" mapping_id="1" extAttrName="fullname" - intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="1" password="0" purpose="BOTH"/> <UMappingItem id="107" mapping_id="1" extAttrName="__PASSWORD__" intMappingType="Password" mandatoryCondition="true" accountid="0" password="1" purpose="BOTH"/> <UMappingItem id="108" extAttrName="type" mapping_id="1" - intAttrName="type" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="type" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="BOTH"/> <UMappingItem id="109" extAttrName="surname" mapping_id="1" - intAttrName="surname" intMappingType="UserSchema" mandatoryCondition="type == 'F'" + intAttrName="surname" intMappingType="UserPlainSchema" mandatoryCondition="type == 'F'" accountid="0" password="0" purpose="BOTH"/> <UMappingItem id="110" extAttrName="name" mapping_id="1" intAttrName="virtualdata" intMappingType="UserVirtualSchema" mandatoryCondition="type == 'F'" @@ -717,33 +717,33 @@ under the License. <UMapping id="2" resource_name="ws-target-resource-update"/> <UMappingItem id="112" extAttrName="email" mapping_id="2" - intAttrName="email" intMappingType="UserSchema" mandatoryCondition="false" + intAttrName="email" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="0" password="0" purpose="PROPAGATION"/> <UMappingItem id="113" extAttrName="userId" mapping_id="2" - intAttrName="userId" intMappingType="UserSchema" mandatoryCondition="false" + intAttrName="userId" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="1" password="0" purpose="PROPAGATION"/> <UMappingItem id="114" extAttrName="test3" mapping_id="2" - intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="false" + intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="0" password="0" purpose="PROPAGATION"/> <UMapping id="3" resource_name="ws-target-resource-nopropagation"/> <UMappingItem id="115" mapping_id="3" extAttrName="fullname" - intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="1" password="0" purpose="PROPAGATION"/> <UMapping id="4" resource_name="ws-target-resource-nopropagation2"/> <UMappingItem id="116" mapping_id="4" extAttrName="fullname" - intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="1" password="0" purpose="PROPAGATION"/> <UMapping id="5" resource_name="ws-target-resource-nopropagation3"/> <UMappingItem id="117" mapping_id="5" extAttrName="fullname" - intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="1" password="0" purpose="PROPAGATION"/> <UMapping id="6" resource_name="ws-target-resource-nopropagation4"/> <UMappingItem id="118" mapping_id="6" - extAttrName="fullname" intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="true" + extAttrName="fullname" intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="1" password="0" purpose="PROPAGATION"/> <UMapping id="7" resource_name="resource-testdb"/> @@ -767,22 +767,22 @@ under the License. intMappingType="Username" mandatoryCondition="true" accountid="0" password="0" purpose="BOTH"/> <UMappingItem id="201" extAttrName="id" mapping_id="9" - intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="BOTH"/> <UMappingItem id="202" mapping_id="9" extAttrName="__PASSWORD__" intMappingType="Password" mandatoryCondition="true" accountid="0" password="1" purpose="BOTH"/> <UMappingItem id="203" extAttrName="name" mapping_id="9" - intAttrName="firstname" intMappingType="UserSchema" mandatoryCondition="false" + intAttrName="firstname" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="0" password="0" purpose="BOTH"/> <UMappingItem id="204" extAttrName="surname" mapping_id="9" - intAttrName="surname" intMappingType="UserSchema" mandatoryCondition="false" + intAttrName="surname" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="0" password="0" purpose="BOTH"/> <UMappingItem id="205" extAttrName="email" mapping_id="9" - intAttrName="userId" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="userId" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="SYNCHRONIZATION"/> <UMappingItem id="206" extAttrName="email" mapping_id="9" - intAttrName="email" intMappingType="UserSchema" mandatoryCondition="true" + intAttrName="email" intMappingType="UserPlainSchema" mandatoryCondition="true" accountid="0" password="0" purpose="SYNCHRONIZATION"/> <UMappingItem id="207" extAttrName="__NAME__" mapping_id="9" intAttrName="csvuserid" intMappingType="UserDerivedSchema" mandatoryCondition="true" @@ -796,10 +796,10 @@ under the License. <UMapping id="10" resource_name="ws-target-resource-update-resetsynctoken"/> <UMappingItem id="300" mapping_id="10" - extAttrName="userId" intAttrName="userId" intMappingType="UserSchema" mandatoryCondition="false" + extAttrName="userId" intAttrName="userId" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="1" password="0" purpose="BOTH"/> <UMappingItem id="301" mapping_id="10" - extAttrName="__PASSWORD__" intAttrName="fullname" intMappingType="UserSchema" mandatoryCondition="false" + extAttrName="__PASSWORD__" intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="false" accountid="0" password="1" purpose="BOTH"/> <UMapping id="11" resource_name="resource-ldap" @@ -811,31 +811,31 @@ under the License. extAttrName="__PASSWORD__" intAttrName="Password" intMappingType="Password" mandatoryCondition="true" purpose="BOTH"/> <UMappingItem id="313" accountid="0" password="0" mapping_id="11" - extAttrName="sn" intAttrName="surname" intMappingType="UserSchema" + extAttrName="sn" intAttrName="surname" intMappingType="UserPlainSchema" mandatoryCondition="true" purpose="BOTH"/> <UMappingItem id="314" accountid="0" password="0" mapping_id="11" - extAttrName="cn" intAttrName="fullname" intMappingType="UserSchema" + extAttrName="cn" intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" purpose="BOTH"/> <UMappingItem id="315" accountid="0" password="0" mapping_id="11" - extAttrName="mail" intAttrName="email" intMappingType="UserSchema" + extAttrName="mail" intAttrName="email" intMappingType="UserPlainSchema" mandatoryCondition="false" purpose="BOTH"/> <UMappingItem id="316" accountid="0" password="0" mapping_id="11" - extAttrName="title" intAttrName="title" intMappingType="RoleSchema" + extAttrName="title" intAttrName="title" intMappingType="RolePlainSchema" mandatoryCondition="false" purpose="BOTH"/> <UMappingItem id="317" accountid="0" password="0" mapping_id="11" - extAttrName="postalAddress" intAttrName="postalAddress" intMappingType="MembershipSchema" + extAttrName="postalAddress" intAttrName="postalAddress" intMappingType="MembershipPlainSchema" mandatoryCondition="false" purpose="BOTH"/> <UMappingItem id="318" accountid="0" password="0" mapping_id="11" - extAttrName="mail" intAttrName="userId" intMappingType="UserSchema" + extAttrName="mail" intAttrName="userId" intMappingType="UserPlainSchema" mandatoryCondition="false" purpose="BOTH"/> <UMappingItem id="319" accountid="0" password="0" mapping_id="11" extAttrName="givenname" intAttrName="virtualReadOnly" intMappingType="UserVirtualSchema" mandatoryCondition="false" purpose="BOTH"/> <UMappingItem id="320" accountid="0" password="0" mapping_id="11" - extAttrName="registeredAddress" intAttrName="obscure" intMappingType="UserSchema" + extAttrName="registeredAddress" intAttrName="obscure" intMappingType="UserPlainSchema" mandatoryCondition="false" purpose="BOTH"/> <UMappingItem id="321" accountid="0" password="0" mapping_id="11" - extAttrName="jpegPhoto" intAttrName="photo" intMappingType="UserSchema" + extAttrName="jpegPhoto" intAttrName="photo" intMappingType="UserPlainSchema" mandatoryCondition="false" purpose="BOTH"/> <RMapping id="1" resource_name="resource-ldap" @@ -847,7 +847,7 @@ under the License. extAttrName="owner" intAttrName="roleOwnerSchema" intMappingType="RoleOwnerSchema" mandatoryCondition="false" purpose="BOTH"/> <RMappingItem id="3" accountid="0" password="0" mapping_id="1" - extAttrName="description" intAttrName="title" intMappingType="RoleSchema" + extAttrName="description" intAttrName="title" intMappingType="RolePlainSchema" mandatoryCondition="false" purpose="BOTH"/> <RMappingItem id="4" extAttrName="businessCategory" mapping_id="1" intAttrName="rvirtualdata" intMappingType="RoleVirtualSchema" mandatoryCondition="false" @@ -855,22 +855,22 @@ under the License. <UMapping id="16" resource_name="resource-db-sync"/> <UMappingItem id="322" accountid="0" mapping_id="16" - extAttrName="EMAIL" intAttrName="email" intMappingType="UserSchema" + extAttrName="EMAIL" intAttrName="email" intMappingType="UserPlainSchema" mandatoryCondition="false" password="0" purpose="BOTH"/> <UMappingItem id="323" accountid="0" mapping_id="16" - extAttrName="SURNAME" intAttrName="fullname" intMappingType="UserSchema" + extAttrName="SURNAME" intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="false" password="0" purpose="BOTH"/> <UMappingItem id="324" accountid="1" mapping_id="16" - extAttrName="ID" intAttrName="aLong" intMappingType="UserSchema" + extAttrName="ID" intAttrName="aLong" intMappingType="UserPlainSchema" mandatoryCondition="false" password="0" purpose="BOTH"/> <UMappingItem id="325" accountid="0" mapping_id="16" - extAttrName="SURNAME" intAttrName="surname" intMappingType="UserSchema" + extAttrName="SURNAME" intAttrName="surname" intMappingType="UserPlainSchema" mandatoryCondition="false" password="0" purpose="BOTH"/> <UMappingItem id="326" accountid="0" mapping_id="16" extAttrName="USERNAME" intAttrName="Username" intMappingType="Username" mandatoryCondition="false" password="0" purpose="BOTH"/> <UMappingItem id="327" accountid="0" mapping_id="16" - extAttrName="EMAIL" intAttrName="userId" intMappingType="UserSchema" + extAttrName="EMAIL" intAttrName="userId" intMappingType="UserPlainSchema" mandatoryCondition="false" password="0" purpose="BOTH"/> <UMapping id="17" resource_name="resource-db-virattr"/> @@ -883,7 +883,7 @@ under the License. <UMapping id="18" resource_name="ws-target-resource-timeout"/> <UMappingItem id="333" mapping_id="18" accountid="1" password="0" - extAttrName="fullname" intAttrName="fullname" intMappingType="UserSchema" + extAttrName="fullname" intAttrName="fullname" intMappingType="UserPlainSchema" mandatoryCondition="true" purpose="PROPAGATION"/> <UMapping id="19" resource_name="ws-target-resource-delete"/> @@ -904,7 +904,7 @@ under the License. <Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="4" name="CSV (update matching; assign unmatching)" resource_name="resource-csv" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0" jobClassName="org.apache.syncope.server.provisioning.api.job.SyncJob" unmatchingRule="ASSIGN" matchingRule="UPDATE" - userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"type","readonly":false,"values":["email == '[email protected]'? 'TYPE_8': 'TYPE_OTHER'"]}],"derivedAttributes":[{"schema":"cn","readonly":false,"values":[null]}],"virtualAttributes":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"id":0,"roleId":8,"roleName":null,"attributes":[{"schema":"subscriptionDate","readonly":false,"values":["'2009-08-18T16:33:12.203+0200'"]}],"derivedAttributes":[],"virtualAttributes":[]}]}' + userTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"password":null,"status":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"attributes":[{"schema":"type","readonly":false,"values":["email == '[email protected]'? 'TYPE_8': 'TYPE_OTHER'"]}],"derivedAttributes":[{"schema":"cn","readonly":false,"values":[null]}],"virtualAttributes":[],"resources":["resource-testdb"],"propagationStatuses":[],"memberships":[{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"roleId":8,"roleName":null,"attributes":[{"schema":"subscriptionDate","readonly":false,"values":["'2009-08-18T16:33:12.203+0200'"]}],"derivedAttributes":[],"virtualAttributes":[]}]}' roleTemplate='{"creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"name":null,"parent":0,"userOwner":null,"roleOwner":null,"inheritOwner":false,"inheritTemplates":false,"inheritPlainAttrs":false,"inheritDerAttrs":false,"inheritVirAttrs":false,"inheritPasswordPolicy":false,"inheritAccountPolicy":false,"passwordPolicy":null,"accountPolicy":null,"attributes":[],"derivedAttributes":[],"virtualAttributes":[],"resources":[],"propagationStatuses":[],"entitlements":[],"rAttrTemplates":[],"rDerAttrTemplates":[],"rVirAttrTemplates":[],"mAttrTemplates":[],"mDerAttrTemplates":[],"mVirAttrTemplates":[]}'/> <Task DTYPE="SchedTask" type="SCHEDULED" id="5" name="SampleJob Task" jobClassName="org.apache.syncope.server.provisioning.java.job.SampleJob" cronExpression="0 0 0 1 * ?"/> <Task DTYPE="PropagationTask" type="PROPAGATION" id="6" propagationMode="TWO_PHASES" propagationOperation="UPDATE" @@ -989,12 +989,12 @@ under the License. performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0" jobClassName="org.apache.syncope.server.provisioning.api.job.SyncJob" unmatchingRule="ASSIGN" matchingRule="IGNORE"/> - <Notification id="1" active="1" recipientAttrName="email" recipientAttrType="UserSchema" selfAsRecipient="1" + <Notification id="1" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1" sender="[email protected]" subject="Password Reset request" template="requestPasswordReset" traceLevel="FAILURES" userAbout="token!=$null"/> <Notification_events Notification_id="1" events="[CUSTOM]:[]:[]:[requestPasswordReset]:[SUCCESS]"/> - <Notification id="2" active="1" recipientAttrName="email" recipientAttrType="UserSchema" selfAsRecipient="1" + <Notification id="2" active="1" recipientAttrName="email" recipientAttrType="UserPlainSchema" selfAsRecipient="1" sender="[email protected]" subject="Password Reset successful" template="confirmPasswordReset" traceLevel="FAILURES" userAbout="token!=$null"/> <Notification_events Notification_id="2" events="[CUSTOM]:[]:[]:[confirmPasswordReset]:[SUCCESS]"/> @@ -1003,7 +1003,7 @@ under the License. traceLevel="FAILURES" userAbout="fullname==*o*;fullname==*i*" recipients="$roles==7" - recipientAttrType="UserSchema" recipientAttrName="email" active="1"/> + recipientAttrType="UserPlainSchema" recipientAttrName="email" active="1"/> <Notification_events Notification_id="10" events="[CUSTOM]:[]:[]:[unexisting1]:[FAILURE]"/> <Notification_events Notification_id="10" events="[CUSTOM]:[]:[]:[unexisting2]:[SUCCESS]"/> @@ -1011,7 +1011,7 @@ under the License. <Report id="1" name="test"/> <ReportletConfInstance id="1" Report_id="1" - serializedInstance='{"@class":"org.apache.syncope.common.lib.report.UserReportletConf","name":"testUserReportlet","matchingCond":null,"attributes":["fullname","gender"],"derivedAttributes":["cn"],"virtualAttributes":["virtualdata"],"features":["key","username","workflowId","status","creationDate","lastLoginDate","changePwdDate","passwordHistorySize","failedLoginCount","memberships","resources"]}'/> + serializedInstance='{"@class":"org.apache.syncope.common.lib.report.UserReportletConf","name":"testUserReportlet","matchingCond":null,"plainAttributes":["fullname","gender"],"derivedAttributes":["cn"],"virtualAttributes":["virtualdata"],"features":["key","username","workflowId","status","creationDate","lastLoginDate","changePwdDate","passwordHistorySize","failedLoginCount","memberships","resources"]}'/> <ReportExec Report_id="1" id="1" status="SUCCESS" startDate="2012-02-26 15:40:04" endDate="2012-02-26 15:41:04"/> <SyncopeLogger logName="syncope.audit.[REST]:[EntitlementController]:[]:[getOwn]:[SUCCESS]" logLevel="DEBUG" logType="AUDIT"/> http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/UserSuspender.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/UserSuspender.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/UserSuspender.java new file mode 100644 index 0000000..218f826 --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/UserSuspender.java @@ -0,0 +1,26 @@ +/* + * 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.server.provisioning.api; + +import org.apache.syncope.server.persistence.api.entity.user.User; + +public interface UserSuspender { + + void suspend(User user, boolean propagateSuspension); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/job/JobInstanceLoader.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/job/JobInstanceLoader.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/job/JobInstanceLoader.java new file mode 100644 index 0000000..e77aaca --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/job/JobInstanceLoader.java @@ -0,0 +1,41 @@ +/* + * 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.server.provisioning.api.job; + +import java.text.ParseException; +import org.apache.syncope.server.persistence.api.entity.Report; +import org.apache.syncope.server.persistence.api.entity.task.Task; +import org.quartz.SchedulerException; + +public interface JobInstanceLoader { + + void registerJob(Task task, String jobClassName, String cronExpression) + throws ClassNotFoundException, SchedulerException, ParseException; + + void registerJob(Report report) throws SchedulerException, ParseException; + + void registerReportJob(Long reportKey) throws SchedulerException, ParseException; + + void registerTaskJob(Long taskKey) throws ClassNotFoundException, SchedulerException, ParseException; + + void unregisterJob(Task task); + + void unregisterJob(Report report); + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/ProvisioningActions.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/ProvisioningActions.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/ProvisioningActions.java index f7b1663..7277708 100644 --- a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/ProvisioningActions.java +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/ProvisioningActions.java @@ -18,7 +18,6 @@ */ package org.apache.syncope.server.provisioning.api.sync; -import java.util.List; import org.quartz.JobExecutionException; public interface ProvisioningActions { @@ -35,9 +34,7 @@ public interface ProvisioningActions { * Action to be executed after the synchronization task completion. * * @param profile sync profile - * @param results synchronization result * @throws JobExecutionException in case of generic failure */ - void afterAll(final ProvisioningProfile<?, ?> profile, final List<ProvisioningResult> results) - throws JobExecutionException; + void afterAll(final ProvisioningProfile<?, ?> profile) throws JobExecutionException; } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RolePushResultHandler.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RolePushResultHandler.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RolePushResultHandler.java new file mode 100644 index 0000000..0c765b5 --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RolePushResultHandler.java @@ -0,0 +1,23 @@ +/* + * 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.server.provisioning.api.sync; + +public interface RolePushResultHandler extends SyncopePushResultHandler { + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RoleSyncResultHandler.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RoleSyncResultHandler.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RoleSyncResultHandler.java new file mode 100644 index 0000000..1f77591 --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/RoleSyncResultHandler.java @@ -0,0 +1,26 @@ +/* + * 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.server.provisioning.api.sync; + +import java.util.Map; + +public interface RoleSyncResultHandler extends SyncopeSyncResultHandler { + + Map<Long, String> getRoleOwnerMap(); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopePushResultHandler.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopePushResultHandler.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopePushResultHandler.java new file mode 100644 index 0000000..bf6f680 --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopePushResultHandler.java @@ -0,0 +1,26 @@ +/* + * 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.server.provisioning.api.sync; + +import org.apache.syncope.server.persistence.api.entity.task.PushTask; + +public interface SyncopePushResultHandler extends SyncopeResultHandler<PushTask, PushActions> { + + boolean handle(long subjectId); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopeSyncResultHandler.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopeSyncResultHandler.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopeSyncResultHandler.java new file mode 100644 index 0000000..111af19 --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/SyncopeSyncResultHandler.java @@ -0,0 +1,29 @@ +/* + * 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.server.provisioning.api.sync; + +import org.apache.syncope.server.persistence.api.entity.task.SyncTask; +import org.identityconnectors.framework.common.objects.SyncDelta; +import org.identityconnectors.framework.common.objects.SyncResultsHandler; + +public interface SyncopeSyncResultHandler extends SyncopeResultHandler<SyncTask, SyncActions>, SyncResultsHandler { + + @Override + boolean handle(SyncDelta delta); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserPushResultHandler.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserPushResultHandler.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserPushResultHandler.java new file mode 100644 index 0000000..6d93a87 --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserPushResultHandler.java @@ -0,0 +1,23 @@ +/* + * 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.server.provisioning.api.sync; + +public interface UserPushResultHandler extends SyncopePushResultHandler { + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserSyncResultHandler.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserSyncResultHandler.java b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserSyncResultHandler.java new file mode 100644 index 0000000..00b972c --- /dev/null +++ b/syncope620/server/provisioning-api/src/main/java/org/apache/syncope/server/provisioning/api/sync/UserSyncResultHandler.java @@ -0,0 +1,23 @@ +/* + * 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.server.provisioning.api.sync; + +public interface UserSyncResultHandler extends SyncopeSyncResultHandler { + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/AsyncConnectorFacade.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/AsyncConnectorFacade.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/AsyncConnectorFacade.java index a22145a..b7e2197 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/AsyncConnectorFacade.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/AsyncConnectorFacade.java @@ -58,7 +58,7 @@ public class AsyncConnectorFacade { final GuardedString password, final OperationOptions options) { - return new AsyncResult<Uid>(connector.authenticate(ObjectClass.ACCOUNT, username, password, options)); + return new AsyncResult<>(connector.authenticate(ObjectClass.ACCOUNT, username, password, options)); } @Async @@ -68,7 +68,7 @@ public class AsyncConnectorFacade { final Set<Attribute> attrs, final OperationOptions options) { - return new AsyncResult<Uid>(connector.create(objectClass, attrs, options)); + return new AsyncResult<>(connector.create(objectClass, attrs, options)); } @Async @@ -79,7 +79,7 @@ public class AsyncConnectorFacade { final Set<Attribute> attrs, final OperationOptions options) { - return new AsyncResult<Uid>(connector.update(objectClass, uid, attrs, options)); + return new AsyncResult<>(connector.update(objectClass, uid, attrs, options)); } @Async @@ -90,14 +90,14 @@ public class AsyncConnectorFacade { final OperationOptions options) { connector.delete(objectClass, uid, options); - return new AsyncResult<Uid>(uid); + return new AsyncResult<>(uid); } @Async public Future<SyncToken> getLatestSyncToken( final ConnectorFacade connector, final ObjectClass objectClass) { - return new AsyncResult<SyncToken>(connector.getLatestSyncToken(objectClass)); + return new AsyncResult<>(connector.getLatestSyncToken(objectClass)); } @Async @@ -107,7 +107,7 @@ public class AsyncConnectorFacade { final Uid uid, final OperationOptions options) { - return new AsyncResult<ConnectorObject>(connector.getObject(objectClass, uid, options)); + return new AsyncResult<>(connector.getObject(objectClass, uid, options)); } @Async @@ -127,7 +127,7 @@ public class AsyncConnectorFacade { attribute = object.getAttributeByName(attributeName); } - return new AsyncResult<Attribute>(attribute); + return new AsyncResult<>(attribute); } @Async @@ -137,7 +137,7 @@ public class AsyncConnectorFacade { final Uid uid, final OperationOptions options) { - final Set<Attribute> attributes = new HashSet<Attribute>(); + final Set<Attribute> attributes = new HashSet<>(); final ConnectorObject object = connector.getObject(objectClass, uid, options); @@ -149,7 +149,7 @@ public class AsyncConnectorFacade { } } - return new AsyncResult<Set<Attribute>>(attributes); + return new AsyncResult<>(attributes); } @Async @@ -170,7 +170,7 @@ public class AsyncConnectorFacade { LOG.debug("While reading schema on connector {}", connector, e); } - return new AsyncResult<Set<String>>(schemaNames); + return new AsyncResult<>(schemaNames); } @Async @@ -187,18 +187,18 @@ public class AsyncConnectorFacade { LOG.debug("While reading schema on connector {}", connector, e); } - return new AsyncResult<Set<ObjectClass>>(objectClasses); + return new AsyncResult<>(objectClasses); } @Async public Future<String> validate(final ConnectorFacade connector) { connector.validate(); - return new AsyncResult<String>("OK"); + return new AsyncResult<>("OK"); } @Async public Future<String> test(final ConnectorFacade connector) { connector.test(); - return new AsyncResult<String>("OK"); + return new AsyncResult<>("OK"); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/ConnectorFacadeProxy.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/ConnectorFacadeProxy.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/ConnectorFacadeProxy.java index 3e5f03a..6557979 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/ConnectorFacadeProxy.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/ConnectorFacadeProxy.java @@ -388,13 +388,12 @@ public class ConnectorFacadeProxy implements Connector { @Override public boolean handle(final ConnectorObject obj) { - final SyncDeltaBuilder bld = new SyncDeltaBuilder(); - bld.setObject(obj); - bld.setUid(obj.getUid()); - bld.setDeltaType(SyncDeltaType.CREATE_OR_UPDATE); - bld.setToken(new SyncToken("")); - - return handler.handle(bld.build()); + return handler.handle(new SyncDeltaBuilder(). + setObject(obj). + setUid(obj.getUid()). + setDeltaType(SyncDeltaType.CREATE_OR_UPDATE). + setToken(new SyncToken("")). + build()); } }, options); } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultRoleProvisioningManager.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultRoleProvisioningManager.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultRoleProvisioningManager.java index 666d535..06f205b 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultRoleProvisioningManager.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultRoleProvisioningManager.java @@ -99,7 +99,7 @@ public class DefaultRoleProvisioningManager implements RoleProvisioningManager { final RoleTO roleTO, final Map<Long, String> roleOwnerMap, final Set<String> excludedResources) { WorkflowResult<Long> created = rwfAdapter.create((RoleTO) roleTO); - AttrTO roleOwner = roleTO.getAttrMap().get(StringUtils.EMPTY); + AttrTO roleOwner = roleTO.getPlainAttrMap().get(StringUtils.EMPTY); if (roleOwner != null) { roleOwnerMap.put(created.getResult(), roleOwner.getValues().iterator().next()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultUserProvisioningManager.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultUserProvisioningManager.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultUserProvisioningManager.java index 2c00a02..3c4225e 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultUserProvisioningManager.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/DefaultUserProvisioningManager.java @@ -73,6 +73,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { return create(userTO, true, false, null, Collections.<String>emptySet()); } + @Override public Map.Entry<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword) { return create(userTO, storePassword, false, null, Collections.<String>emptySet()); } @@ -99,7 +100,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { propagationReporter.onPrimaryResourceFailure(tasks); } - Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<Long, List<PropagationStatus>>( + Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<>( created.getResult().getKey(), propagationReporter.getStatuses()); return result; } @@ -149,7 +150,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { } } - Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<Long, List<PropagationStatus>>( + Map.Entry<Long, List<PropagationStatus>> result = new AbstractMap.SimpleEntry<>( updated.getResult().getKey().getKey(), propagationReporter.getStatuses()); return result; } @@ -198,11 +199,11 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { if (statusMod.isOnSyncope()) { updated = uwfAdapter.activate(user.getKey(), statusMod.getToken()); } else { - updated = new WorkflowResult<Long>(user.getKey(), null, statusMod.getType().name().toLowerCase()); + updated = new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase()); } List<PropagationStatus> statuses = propagateStatus(user, statusMod); - return new AbstractMap.SimpleEntry<Long, List<PropagationStatus>>(updated.getResult(), statuses); + return new AbstractMap.SimpleEntry<>(updated.getResult(), statuses); } @Override @@ -211,11 +212,11 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { if (statusMod.isOnSyncope()) { updated = uwfAdapter.reactivate(user.getKey()); } else { - updated = new WorkflowResult<Long>(user.getKey(), null, statusMod.getType().name().toLowerCase()); + updated = new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase()); } List<PropagationStatus> statuses = propagateStatus(user, statusMod); - return new AbstractMap.SimpleEntry<Long, List<PropagationStatus>>(updated.getResult(), statuses); + return new AbstractMap.SimpleEntry<>(updated.getResult(), statuses); } @Override @@ -224,15 +225,15 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { if (statusMod.isOnSyncope()) { updated = uwfAdapter.suspend(user.getKey()); } else { - updated = new WorkflowResult<Long>(user.getKey(), null, statusMod.getType().name().toLowerCase()); + updated = new WorkflowResult<>(user.getKey(), null, statusMod.getType().name().toLowerCase()); } List<PropagationStatus> statuses = propagateStatus(user, statusMod); - return new AbstractMap.SimpleEntry<Long, List<PropagationStatus>>(updated.getResult(), statuses); + return new AbstractMap.SimpleEntry<>(updated.getResult(), statuses); } protected List<PropagationStatus> propagateStatus(final User user, final StatusMod statusMod) { - Set<String> resourcesToBeExcluded = new HashSet<String>(user.getResourceNames()); + Set<String> resourcesToBeExcluded = new HashSet<>(user.getResourceNames()); resourcesToBeExcluded.removeAll(statusMod.getResourceNames()); List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds( @@ -261,7 +262,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { final List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds( new WorkflowResult<Map.Entry<UserMod, Boolean>>( - new AbstractMap.SimpleEntry<UserMod, Boolean>(userMod, Boolean.FALSE), + new AbstractMap.SimpleEntry<>(userMod, Boolean.FALSE), updated.getPropByRes(), updated.getPerformedTasks())); taskExecutor.execute(tasks); @@ -276,7 +277,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { noPropResourceName.removeAll(resources); final List<PropagationTask> tasks = - propagationManager.getUserDeleteTaskIds(userKey, new HashSet<String>(resources), noPropResourceName); + propagationManager.getUserDeleteTaskIds(userKey, new HashSet<>(resources), noPropResourceName); final PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class); try { @@ -303,7 +304,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { result.setMessage("Update failed, trying to sync status anyway (if configured)\n" + e.getMessage()); updated = new WorkflowResult<Map.Entry<UserMod, Boolean>>( - new AbstractMap.SimpleEntry<UserMod, Boolean>(userMod, false), new PropagationByResource(), + new AbstractMap.SimpleEntry<>(userMod, false), new PropagationByResource(), new HashSet<String>()); } @@ -341,7 +342,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager { propagationReporter.onPrimaryResourceFailure(tasks); } - return new AbstractMap.SimpleEntry<Long, List<PropagationStatus>>(updated.getResult().getKey().getKey(), + return new AbstractMap.SimpleEntry<>(updated.getResult().getKey().getKey(), propagationReporter.getStatuses()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/UserSuspenderImpl.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/UserSuspenderImpl.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/UserSuspenderImpl.java new file mode 100644 index 0000000..357c15f --- /dev/null +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/UserSuspenderImpl.java @@ -0,0 +1,51 @@ +/* + * 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.server.provisioning.java; + +import org.apache.syncope.server.provisioning.api.UserSuspender; +import org.apache.syncope.server.persistence.api.entity.user.User; +import org.apache.syncope.server.provisioning.api.UserProvisioningManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class UserSuspenderImpl implements UserSuspender { + + private static final Logger LOG = LoggerFactory.getLogger(UserSuspenderImpl.class); + + @Autowired + private UserProvisioningManager provisioningManager; + + @Override + public void suspend(final User user, final boolean suspend) { + try { + LOG.debug("User {}:{} is over to max failed logins", user.getKey(), user.getUsername()); + + // reduce failed logins number to avoid multiple request + user.setFailedLogins(user.getFailedLogins() - 1); + + // disable user and propagate suspension if and only if it is required by policy + provisioningManager.innerSuspend(user, suspend); + } catch (Exception e) { + LOG.error("Error during user suspension", e); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/AbstractAttributableDataBinder.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/AbstractAttributableDataBinder.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/AbstractAttributableDataBinder.java index c38edfc..f7e75c0 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/AbstractAttributableDataBinder.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/AbstractAttributableDataBinder.java @@ -215,7 +215,7 @@ abstract class AbstractAttributableDataBinder { } private boolean evaluateMandatoryCondition(final AttributableUtil attrUtil, final ExternalResource resource, - final Attributable attributable, final String intAttrName, final IntMappingType intMappingType) { + final Attributable<?,?,?> attributable, final String intAttrName, final IntMappingType intMappingType) { boolean result = false; @@ -409,7 +409,7 @@ abstract class AbstractAttributableDataBinder { } // 3. attributes to be removed - for (String attributeToBeRemoved : attributableMod.getAttrsToRemove()) { + for (String attributeToBeRemoved : attributableMod.getPlainAttrsToRemove()) { PlainSchema schema = getPlainSchema(attributeToBeRemoved, attrUtil.plainSchemaClass()); if (schema != null) { PlainAttr attr = attributable.getPlainAttr(schema.getKey()); @@ -417,7 +417,7 @@ abstract class AbstractAttributableDataBinder { LOG.debug("No attribute found for schema {}", schema); } else { String newValue = null; - for (AttrMod mod : attributableMod.getAttrsToUpdate()) { + for (AttrMod mod : attributableMod.getPlainAttrsToUpdate()) { if (schema.getKey().equals(mod.getSchema())) { newValue = mod.getValuesToBeAdded().get(0); } @@ -456,7 +456,7 @@ abstract class AbstractAttributableDataBinder { LOG.debug("Attributes to be removed:\n{}", propByRes); // 4. attributes to be updated - for (AttrMod attributeMod : attributableMod.getAttrsToUpdate()) { + for (AttrMod attributeMod : attributableMod.getPlainAttrsToUpdate()) { PlainSchema schema = getPlainSchema(attributeMod.getSchema(), attrUtil.plainSchemaClass()); PlainAttr attr = null; if (schema != null) { http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/ReportDataBinderImpl.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/ReportDataBinderImpl.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/ReportDataBinderImpl.java index 12c0254..6ffe2fc 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/ReportDataBinderImpl.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/ReportDataBinderImpl.java @@ -18,6 +18,8 @@ */ package org.apache.syncope.server.provisioning.java.data; +import java.util.HashSet; +import java.util.Set; import org.apache.syncope.server.provisioning.api.data.ReportDataBinder; import org.apache.syncope.common.lib.report.AbstractReportletConf; import org.apache.syncope.common.lib.report.ReportletConf; @@ -59,7 +61,17 @@ public class ReportDataBinderImpl implements ReportDataBinder { @Override public void getReport(final Report report, final ReportTO reportTO) { BeanUtils.copyProperties(reportTO, report, IGNORE_REPORT_PROPERTIES); - report.getReportletConfs().clear(); + + // 1. remove all reportlet confs + Set<ReportletConf> toRemove = new HashSet<>(); + for (ReportletConf conf : report.getReportletConfs()) { + toRemove.add(conf); + } + for (ReportletConf conf : toRemove) { + report.removeReportletConf(conf); + } + + // 2. take all reportlet confs from reportTO for (ReportletConf conf : reportTO.getReportletConfs()) { report.addReportletConf(conf); } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/RoleDataBinderImpl.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/RoleDataBinderImpl.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/RoleDataBinderImpl.java index be16ee7..851799c 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/RoleDataBinderImpl.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/RoleDataBinderImpl.java @@ -29,7 +29,6 @@ import org.apache.syncope.common.lib.types.AttributableType; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.ResourceOperation; import org.apache.syncope.server.persistence.api.dao.EntitlementDAO; -import org.apache.syncope.server.persistence.api.dao.RoleDAO; import org.apache.syncope.server.persistence.api.entity.AccountPolicy; import org.apache.syncope.server.persistence.api.entity.AttrTemplate; import org.apache.syncope.server.persistence.api.entity.Entitlement; @@ -64,9 +63,6 @@ import org.springframework.transaction.annotation.Transactional; public class RoleDataBinderImpl extends AbstractAttributableDataBinder implements RoleDataBinder { @Autowired - private RoleDAO roleDAO; - - @Autowired private ConnObjectUtil connObjectUtil; @Autowired @@ -76,7 +72,7 @@ public class RoleDataBinderImpl extends AbstractAttributableDataBinder implement final Role role, final List<String> schemaNames, final Class<T> templateClass, final Class<S> schemaClass) { - List<T> toRemove = new ArrayList<T>(); + List<T> toRemove = new ArrayList<>(); for (T template : role.getAttrTemplates(templateClass)) { if (!schemaNames.contains(template.getSchema().getKey())) { toRemove.add(template); @@ -89,7 +85,7 @@ public class RoleDataBinderImpl extends AbstractAttributableDataBinder implement S schema = getSchema(schemaName, schemaClass); if (schema != null) { try { - T template = templateClass.newInstance(); + T template = entityFactory.newEntity(templateClass); template.setSchema(schema); template.setOwner(role); role.getAttrTemplates(templateClass).add(template); @@ -105,7 +101,7 @@ public class RoleDataBinderImpl extends AbstractAttributableDataBinder implement public Role create(final Role role, final RoleTO roleTO) { role.setInheritOwner(roleTO.isInheritOwner()); - role.setInheritPlainAttrs(roleTO.isInheritAttrs()); + role.setInheritPlainAttrs(roleTO.isInheritPlainAttrs()); role.setInheritDerAttrs(roleTO.isInheritDerAttrs()); role.setInheritVirAttrs(roleTO.isInheritVirAttrs()); @@ -335,7 +331,7 @@ public class RoleDataBinderImpl extends AbstractAttributableDataBinder implement roleTO.setInheritTemplates(role.isInheritTemplates()); - roleTO.setInheritAttrs(role.isInheritPlainAttrs()); + roleTO.setInheritPlainAttrs(role.isInheritPlainAttrs()); roleTO.setInheritDerAttrs(role.isInheritDerAttrs()); roleTO.setInheritVirAttrs(role.isInheritVirAttrs()); http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/SchemaDataBinderImpl.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/SchemaDataBinderImpl.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/SchemaDataBinderImpl.java index 94b0ccf..31141c0 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/SchemaDataBinderImpl.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/SchemaDataBinderImpl.java @@ -69,15 +69,13 @@ public class SchemaDataBinderImpl implements SchemaDataBinder { List<PlainAttr> attrs = schemaDAO.findAttrs(schema, attributableUtil.plainAttrClass()); if (!attrs.isEmpty()) { if (schema.getType() != schemaTO.getType()) { - SyncopeClientException e = SyncopeClientException.build( - ClientExceptionType.valueOf("Invalid" + schema.getClass().getSimpleName())); + SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.InvalidPlainSchema); e.getElements().add("Cannot change type since " + schema.getKey() + " has attributes"); scce.addException(e); } if (schema.isUniqueConstraint() != schemaTO.isUniqueConstraint()) { - SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.valueOf("Invalid" - + schema.getClass().getSimpleName())); + SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.InvalidPlainSchema); e.getElements().add("Cannot alter unique contraint since " + schema.getKey() + " has attributes"); scce.addException(e); @@ -112,11 +110,10 @@ public class SchemaDataBinderImpl implements SchemaDataBinder { scce.addException(requiredValuesMissing); } else if (!JexlUtil.isExpressionValid(derSchemaTO.getExpression())) { - SyncopeClientException invalidMandatoryCondition = SyncopeClientException.build( - ClientExceptionType.InvalidValues); - invalidMandatoryCondition.getElements().add(derSchemaTO.getExpression()); + SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.InvalidValues); + e.getElements().add(derSchemaTO.getExpression()); - scce.addException(invalidMandatoryCondition); + scce.addException(e); } if (scce.hasExceptions()) { http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/TaskDataBinderImpl.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/TaskDataBinderImpl.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/TaskDataBinderImpl.java index 9ebfbce..920d294 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/TaskDataBinderImpl.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/data/TaskDataBinderImpl.java @@ -180,7 +180,7 @@ public class TaskDataBinderImpl implements TaskDataBinder { final Class<? extends AbstractTaskTO> taskTOClass = taskUtil.taskTOClass(); if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) { - throw new ClassCastException( + throw new IllegalArgumentException( String.format("taskUtil is type %s but task is not: %s", taskTOClass, taskTO.getClass())); } @@ -211,13 +211,13 @@ public class TaskDataBinderImpl implements TaskDataBinder { Class<? extends Task> taskClass = taskUtil.taskClass(); Class<? extends AbstractTaskTO> taskTOClass = taskUtil.taskTOClass(); - if (taskClass == null || !taskClass.equals(task.getClass())) { - throw new ClassCastException( + if (taskClass == null || !taskClass.isAssignableFrom(task.getClass())) { + throw new IllegalArgumentException( String.format("taskUtil is type %s but task is not: %s", taskClass, task.getClass())); } if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) { - throw new ClassCastException( + throw new IllegalArgumentException( String.format("taskUtil is type %s but task is not: %s", taskTOClass, taskTO.getClass())); } @@ -283,7 +283,7 @@ public class TaskDataBinderImpl implements TaskDataBinder { switch (taskUtil.getType()) { case PROPAGATION: if (!(task instanceof PropagationTask)) { - throw new ClassCastException("taskUtil is type Propagation but task is not PropagationTask: " + throw new IllegalArgumentException("taskUtil is type Propagation but task is not PropagationTask: " + task.getClass().getName()); } ((PropagationTaskTO) taskTO).setResource(((PropagationTask) task).getResource().getKey()); @@ -291,7 +291,7 @@ public class TaskDataBinderImpl implements TaskDataBinder { case SCHEDULED: if (!(task instanceof SchedTask)) { - throw new ClassCastException("taskUtil is type Sched but task is not SchedTask: " + throw new IllegalArgumentException("taskUtil is type Sched but task is not SchedTask: " + task.getClass().getName()); } setExecTime((SchedTaskTO) taskTO, task); @@ -301,7 +301,7 @@ public class TaskDataBinderImpl implements TaskDataBinder { case SYNCHRONIZATION: if (!(task instanceof SyncTask)) { - throw new ClassCastException("taskUtil is type Sync but task is not SyncTask: " + throw new IllegalArgumentException("taskUtil is type Sync but task is not SyncTask: " + task.getClass().getName()); } setExecTime((SchedTaskTO) taskTO, task); @@ -316,7 +316,7 @@ public class TaskDataBinderImpl implements TaskDataBinder { case PUSH: if (!(task instanceof PushTask)) { - throw new ClassCastException("taskUtil is type Push but task is not PushTask: " + throw new IllegalArgumentException("taskUtil is type Push but task is not PushTask: " + task.getClass().getName()); } setExecTime((SchedTaskTO) taskTO, task); http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/job/SpringBeanJobFactory.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/job/SpringBeanJobFactory.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/job/SpringBeanJobFactory.java new file mode 100644 index 0000000..b56e920 --- /dev/null +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/job/SpringBeanJobFactory.java @@ -0,0 +1,97 @@ +/* + * 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.server.provisioning.java.job; + +import org.apache.syncope.server.provisioning.api.job.JobNamer; +import org.apache.syncope.server.provisioning.api.job.JobInstanceLoader; +import org.quartz.SchedulerContext; +import org.quartz.spi.TriggerFiredBundle; +import org.springframework.beans.BeanWrapper; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.beans.PropertyAccessorFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; + +public class SpringBeanJobFactory extends org.springframework.scheduling.quartz.SpringBeanJobFactory { + + private String[] ignoredUnknownProperties; + + private SchedulerContext schedulerContext; + + @Override + public void setIgnoredUnknownProperties(final String[] ignoredUnknownProperties) { + String[] defensiveCopy = ignoredUnknownProperties.clone(); + super.setIgnoredUnknownProperties(defensiveCopy); + this.ignoredUnknownProperties = defensiveCopy; + } + + @Override + public void setSchedulerContext(final SchedulerContext schedulerContext) { + super.setSchedulerContext(schedulerContext); + this.schedulerContext = schedulerContext; + } + + /** + * An implementation of SpringBeanJobFactory that retrieves the bean from the Spring context so that autowiring and + * transactions work. + * + * {@inheritDoc} + */ + @Override + protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception { + final ApplicationContext ctx = ((ConfigurableApplicationContext) schedulerContext.get("applicationContext")); + + // Try to re-create job bean from underlying task (useful for managing failover scenarios) + if (!ctx.containsBean(bundle.getJobDetail().getKey().getName())) { + Long taskId = JobNamer.getTaskIdFromJobName(bundle.getJobDetail().getKey().getName()); + if (taskId != null) { + JobInstanceLoader jobInstanceLoader = ctx.getBean(JobInstanceLoader.class); + jobInstanceLoader.registerTaskJob(taskId); + } + + Long reportId = JobNamer.getReportIdFromJobName(bundle.getJobDetail().getKey().getName()); + if (reportId != null) { + JobInstanceLoader jobInstanceLoader = ctx.getBean(JobInstanceLoader.class); + jobInstanceLoader.registerReportJob(reportId); + } + } + + final Object job = ctx.getBean(bundle.getJobDetail().getKey().getName()); + final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(job); + if (isEligibleForPropertyPopulation(wrapper.getWrappedInstance())) { + final MutablePropertyValues pvs = new MutablePropertyValues(); + if (this.schedulerContext != null) { + pvs.addPropertyValues(this.schedulerContext); + } + pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap()); + pvs.addPropertyValues(bundle.getTrigger().getJobDataMap()); + if (this.ignoredUnknownProperties == null) { + wrapper.setPropertyValues(pvs, true); + } else { + for (String propName : this.ignoredUnknownProperties) { + if (pvs.contains(propName) && !wrapper.isWritableProperty(propName)) { + pvs.removePropertyValue(propName); + } + } + wrapper.setPropertyValues(pvs); + } + } + return job; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/notification/NotificationManager.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/notification/NotificationManager.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/notification/NotificationManager.java index 59379b9..436f32c 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/notification/NotificationManager.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/notification/NotificationManager.java @@ -350,7 +350,7 @@ public class NotificationManager { email = user.getUsername(); break; - case UserSchema: + case UserPlainSchema: UPlainAttr attr = user.getPlainAttr(recipientAttrName); if (attr != null && !attr.getValuesAsStrings().isEmpty()) { email = attr.getValuesAsStrings().get(0); http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/propagation/PriorityPropagationTaskExecutor.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/propagation/PriorityPropagationTaskExecutor.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/propagation/PriorityPropagationTaskExecutor.java index 7016a0b..6d7bf38 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/propagation/PriorityPropagationTaskExecutor.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/propagation/PriorityPropagationTaskExecutor.java @@ -76,7 +76,7 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec null, null, result, - reporter.getStatuses(), + reporter == null ? null : reporter.getStatuses(), tasks); auditManager.audit( @@ -85,7 +85,7 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec null, null, result, - reporter.getStatuses(), + reporter == null ? null : reporter.getStatuses(), tasks); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/80589a1b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/sync/AbstractProvisioningJob.java ---------------------------------------------------------------------- diff --git a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/sync/AbstractProvisioningJob.java b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/sync/AbstractProvisioningJob.java index f99e179..311c607 100644 --- a/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/sync/AbstractProvisioningJob.java +++ b/syncope620/server/provisioning-java/src/main/java/org/apache/syncope/server/provisioning/java/sync/AbstractProvisioningJob.java @@ -20,6 +20,7 @@ package org.apache.syncope.server.provisioning.java.sync; import java.lang.reflect.ParameterizedType; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import org.apache.syncope.common.lib.types.TraceLevel; import org.apache.syncope.server.persistence.api.dao.EntitlementDAO; @@ -97,7 +98,7 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte * @param dryRun dry run? * @return report as string */ - protected String createReport(final List<ProvisioningResult> provResults, final TraceLevel syncTraceLevel, + protected String createReport(final Collection<ProvisioningResult> provResults, final TraceLevel syncTraceLevel, final boolean dryRun) { if (syncTraceLevel == TraceLevel.NONE) { @@ -341,7 +342,9 @@ public abstract class AbstractProvisioningJob<T extends ProvisioningTask, A exte uMapping, rMapping, dryRun); - + } catch (Throwable t) { + LOG.error("While executing provisioning job {}", getClass().getName(), t); + throw t; } finally { // POST: clean up the SecurityContextHolder SecurityContextHolder.clearContext();
