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 2016/08/08 10:02:21 UTC
[1/2] syncope git commit: White noise: turning off yellow warnings in
Netbeans
Repository: syncope
Updated Branches:
refs/heads/master 7e886de79 -> 62e9636ae
White noise: turning off yellow warnings in Netbeans
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/12ef6f50
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/12ef6f50
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/12ef6f50
Branch: refs/heads/master
Commit: 12ef6f5041e33d505e10c7f5d7b56b8c5ff3b67f
Parents: 7e886de
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Mon Aug 8 11:06:44 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Mon Aug 8 11:06:44 2016 +0200
----------------------------------------------------------------------
.../syncope/common/lib/to/CamelRouteTO.java | 14 +-
.../camel/component/PropagateComponent.java | 34 ++--
.../camel/component/PropagateEndpoint.java | 82 +++++----
.../camel/component/PropagateType.java | 37 +++--
.../camel/producer/AbstractProducer.java | 32 ++--
.../producer/ConfirmPasswordResetProducer.java | 30 ++--
.../camel/producer/CreateProducer.java | 38 +++--
.../camel/producer/DeleteProducer.java | 165 ++++++++++---------
.../camel/producer/DeprovisionProducer.java | 116 +++++++------
.../camel/producer/ProvisionProducer.java | 34 ++--
.../camel/producer/StatusProducer.java | 47 +++---
.../camel/producer/SuspendProducer.java | 32 ++--
.../camel/producer/UpdateProducer.java | 37 +++--
13 files changed, 384 insertions(+), 314 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/common-lib/src/main/java/org/apache/syncope/common/lib/to/CamelRouteTO.java
----------------------------------------------------------------------
diff --git a/ext/camel/common-lib/src/main/java/org/apache/syncope/common/lib/to/CamelRouteTO.java b/ext/camel/common-lib/src/main/java/org/apache/syncope/common/lib/to/CamelRouteTO.java
index cb64fb6..7c82c94 100644
--- a/ext/camel/common-lib/src/main/java/org/apache/syncope/common/lib/to/CamelRouteTO.java
+++ b/ext/camel/common-lib/src/main/java/org/apache/syncope/common/lib/to/CamelRouteTO.java
@@ -1,23 +1,23 @@
-package org.apache.syncope.common.lib.to;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.syncope.common.lib.to;
+
import javax.ws.rs.PathParam;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateComponent.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateComponent.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateComponent.java
index c0728cd..b8a118a 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateComponent.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateComponent.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.component;
@@ -30,13 +32,13 @@ import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
import org.springframework.beans.factory.annotation.Autowired;
public class PropagateComponent extends UriEndpointComponent {
-
+
@Autowired
protected PropagationManager propagationManager;
@Autowired
protected PropagationTaskExecutor taskExecutor;
-
+
@Autowired
protected UserDAO userDAO;
@@ -57,7 +59,7 @@ public class PropagateComponent extends UriEndpointComponent {
}
protected Endpoint createEndpoint(final String uri, final String remaining,
- final Map<String, Object> parameters) throws Exception {
+ final Map<String, Object> parameters) throws Exception {
PropagateType type = PropagateType.valueOf(remaining);
PropagateEndpoint endpoint = new PropagateEndpoint(uri, this);
endpoint.setPropagateType(type);
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateEndpoint.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateEndpoint.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateEndpoint.java
index 1afb23c..5936430 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateEndpoint.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateEndpoint.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.component;
@@ -46,12 +48,13 @@ import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
@UriEndpoint(scheme = "propagate", title = "propagate", syntax = "propagate:propagateType", producerOnly = true)
public class PropagateEndpoint extends DefaultEndpoint {
- @UriPath @Metadata(required = "true")
+ @UriPath
+ @Metadata(required = "true")
private PropagateType propagateType;
@UriParam
private AnyTypeKind anyTypeKind;
-
+
@UriParam
private boolean pull;
@@ -66,8 +69,8 @@ public class PropagateEndpoint extends DefaultEndpoint {
private AnyObjectDAO anyObjectDAO;
private GroupDataBinder groupDataBinder;
-
- private UserWorkflowAdapter uwfAdapter;
+
+ private UserWorkflowAdapter uwfAdapter;
public PropagateEndpoint(final String endpointUri, final Component component) {
super(endpointUri, component);
@@ -76,22 +79,35 @@ public class PropagateEndpoint extends DefaultEndpoint {
@Override
public Producer createProducer() throws Exception {
AbstractProducer producer = null;
- if (PropagateType.create == propagateType) {
- producer = new CreateProducer(this, anyTypeKind);
- } else if (PropagateType.update == propagateType) {
- producer = new UpdateProducer(this, anyTypeKind);
- } else if (PropagateType.delete == propagateType) {
- producer = new DeleteProducer(this, anyTypeKind, userDAO, groupDataBinder);
- } else if (PropagateType.provision == propagateType) {
- producer = new ProvisionProducer(this, anyTypeKind);
- } else if (PropagateType.deprovision == propagateType) {
- producer = new DeprovisionProducer(this, anyTypeKind, userDAO, groupDAO, anyObjectDAO);
- } else if (PropagateType.status == propagateType) {
- producer = new StatusProducer(this, anyTypeKind, userDAO, uwfAdapter);
- } else if (PropagateType.suspend == propagateType) {
- producer = new SuspendProducer(this, anyTypeKind);
- } else if (PropagateType.confirmPasswordReset == propagateType) {
- producer = new ConfirmPasswordResetProducer(this, anyTypeKind);
+ if (null != propagateType) {
+ switch (propagateType) {
+ case create:
+ producer = new CreateProducer(this, anyTypeKind);
+ break;
+ case update:
+ producer = new UpdateProducer(this, anyTypeKind);
+ break;
+ case delete:
+ producer = new DeleteProducer(this, anyTypeKind, userDAO, groupDataBinder);
+ break;
+ case provision:
+ producer = new ProvisionProducer(this, anyTypeKind);
+ break;
+ case deprovision:
+ producer = new DeprovisionProducer(this, anyTypeKind, userDAO, groupDAO, anyObjectDAO);
+ break;
+ case status:
+ producer = new StatusProducer(this, anyTypeKind, userDAO, uwfAdapter);
+ break;
+ case suspend:
+ producer = new SuspendProducer(this, anyTypeKind);
+ break;
+ case confirmPasswordReset:
+ producer = new ConfirmPasswordResetProducer(this, anyTypeKind);
+ break;
+ default:
+ break;
+ }
}
if (producer != null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateType.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateType.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateType.java
index fd36908..5e2e8ef 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateType.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/component/PropagateType.java
@@ -1,23 +1,32 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.component;
public enum PropagateType {
- create, update, delete, provision, deprovision, status, suspend, confirmPasswordReset
+ create,
+ update,
+ delete,
+ provision,
+ deprovision,
+ status,
+ suspend,
+ confirmPasswordReset
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/AbstractProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/AbstractProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/AbstractProducer.java
index c781609..a8b13e4 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/AbstractProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/AbstractProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -24,12 +26,12 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecu
public abstract class AbstractProducer extends DefaultProducer {
+ private final AnyTypeKind anyTypeKind;
+
private PropagationManager propagationManager;
private PropagationTaskExecutor taskExecutor;
- private AnyTypeKind anyTypeKind;
-
private boolean pull;
public AbstractProducer(final Endpoint endpoint, final AnyTypeKind anyTypeKind) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ConfirmPasswordResetProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ConfirmPasswordResetProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ConfirmPasswordResetProducer.java
index 92b44f0..b84d9db 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ConfirmPasswordResetProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ConfirmPasswordResetProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -37,7 +39,7 @@ public class ConfirmPasswordResetProducer extends AbstractProducer {
public void process(final Exchange exchange) throws Exception {
if (getAnyTypeKind() == AnyTypeKind.USER) {
WorkflowResult<Pair<UserPatch, Boolean>> updated =
- (WorkflowResult<Pair<UserPatch, Boolean>>) exchange.getIn().getBody();
+ (WorkflowResult<Pair<UserPatch, Boolean>>) exchange.getIn().getBody();
List<PropagationTask> tasks = getPropagationManager().getUserUpdateTasks(updated);
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
index 9482be1..54ff11b 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -60,8 +62,8 @@ public class CreateProducer extends AbstractProducer {
created.getPropByRes(),
((UserTO) actual).getVirAttrs(),
excludedResources);
- PropagationReporter propagationReporter =
- getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ PropagationReporter propagationReporter =
+ getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
exchange.getOut().setBody(
new ImmutablePair<>(created.getResult().getKey(), propagationReporter.getStatuses()));
@@ -72,7 +74,7 @@ public class CreateProducer extends AbstractProducer {
if (actual instanceof AnyObjectTO) {
anyTypeKind = AnyTypeKind.ANY_OBJECT;
}
-
+
if (actual instanceof GroupTO && isPull()) {
Map<String, String> groupOwnerMap = exchange.getProperty("groupOwnerMap", Map.class);
AttrTO groupOwner = ((GroupTO) actual).getPlainAttrMap().get(StringUtils.EMPTY);
@@ -97,10 +99,10 @@ public class CreateProducer extends AbstractProducer {
((AnyTO) actual).getVirAttrs(),
excludedResources);
PropagationReporter propagationReporter =
- getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(created.getResult(),
- propagationReporter.getStatuses()));
+ propagationReporter.getStatuses()));
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeleteProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeleteProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeleteProducer.java
index ff02e4a..7ced13d 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeleteProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeleteProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -33,11 +35,16 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
public class DeleteProducer extends AbstractProducer {
- private UserDAO userDAO;
- private GroupDataBinder groupDataBinder;
+ private final UserDAO userDAO;
+
+ private final GroupDataBinder groupDataBinder;
+
+ public DeleteProducer(
+ final Endpoint endpoint,
+ final AnyTypeKind anyTypeKind,
+ final UserDAO userDao,
+ final GroupDataBinder groupDataBinder) {
- public DeleteProducer(final Endpoint endpoint, final AnyTypeKind anyTypeKind, final UserDAO userDao,
- final GroupDataBinder groupDataBinder) {
super(endpoint, anyTypeKind);
this.userDAO = userDao;
this.groupDataBinder = groupDataBinder;
@@ -50,67 +57,71 @@ public class DeleteProducer extends AbstractProducer {
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
- if (getAnyTypeKind() == AnyTypeKind.USER) {
- PropagationByResource propByRes = new PropagationByResource();
- propByRes.set(ResourceOperation.DELETE, userDAO.findAllResourceNames(key));
-
- // Note here that we can only notify about "delete", not any other
- // task defined in workflow process definition: this because this
- // information could only be available after uwfAdapter.delete(), which
- // will also effectively remove user from db, thus making virtually
- // impossible by NotificationManager to fetch required user information
- List<PropagationTask> tasks = getPropagationManager().getDeleteTasks(
- AnyTypeKind.USER,
- key,
- propByRes,
- excludedResources);
-
- PropagationReporter propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
-
- exchange.setProperty("statuses", propagationReporter.getStatuses());
- } else if (getAnyTypeKind() == AnyTypeKind.GROUP) {
- List<PropagationTask> tasks = new ArrayList<>();
-
- // Generate propagation tasks for deleting users from group resources, if they are on those resources only
- // because of the reason being deleted (see SYNCOPE-357)
- for (Map.Entry<String, PropagationByResource> entry
- : groupDataBinder.findUsersWithTransitiveResources(key).entrySet()) {
-
- tasks.addAll(getPropagationManager().getDeleteTasks(
- AnyTypeKind.USER,
- entry.getKey(),
- entry.getValue(),
- excludedResources));
+ if (null != getAnyTypeKind()) {
+ List<PropagationTask> tasks;
+ PropagationReporter propagationReporter;
+ switch (getAnyTypeKind()) {
+ case USER:
+ PropagationByResource propByRes = new PropagationByResource();
+ propByRes.set(ResourceOperation.DELETE, userDAO.findAllResourceNames(key));
+ // Note here that we can only notify about "delete", not any other
+ // task defined in workflow process definition: this because this
+ // information could only be available after uwfAdapter.delete(), which
+ // will also effectively remove user from db, thus making virtually
+ // impossible by NotificationManager to fetch required user information
+ tasks = getPropagationManager().getDeleteTasks(
+ AnyTypeKind.USER,
+ key,
+ propByRes,
+ excludedResources);
+ propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ exchange.setProperty("statuses", propagationReporter.getStatuses());
+ break;
+
+ case GROUP:
+ tasks = new ArrayList<>();
+ // Generate propagation tasks for deleting users from group resources, if they are on those
+ // resources only because of the reason being deleted (see SYNCOPE-357)
+ for (Map.Entry<String, PropagationByResource> entry
+ : groupDataBinder.findUsersWithTransitiveResources(key).entrySet()) {
+
+ tasks.addAll(getPropagationManager().getDeleteTasks(
+ AnyTypeKind.USER,
+ entry.getKey(),
+ entry.getValue(),
+ excludedResources));
+ }
+ for (Map.Entry<String, PropagationByResource> entry
+ : groupDataBinder.findAnyObjectsWithTransitiveResources(key).entrySet()) {
+
+ tasks.addAll(getPropagationManager().getDeleteTasks(
+ AnyTypeKind.ANY_OBJECT,
+ entry.getKey(),
+ entry.getValue(),
+ excludedResources));
+ } // Generate propagation tasks for deleting this group from resources
+ tasks.addAll(getPropagationManager().getDeleteTasks(
+ AnyTypeKind.GROUP,
+ key,
+ null,
+ null));
+ propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ exchange.setProperty("statuses", propagationReporter.getStatuses());
+ break;
+
+ case ANY_OBJECT:
+ tasks = getPropagationManager().getDeleteTasks(
+ AnyTypeKind.ANY_OBJECT,
+ key,
+ null,
+ excludedResources);
+ propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ exchange.setProperty("statuses", propagationReporter.getStatuses());
+ break;
+
+ default:
+ break;
}
- for (Map.Entry<String, PropagationByResource> entry
- : groupDataBinder.findAnyObjectsWithTransitiveResources(key).entrySet()) {
-
- tasks.addAll(getPropagationManager().getDeleteTasks(
- AnyTypeKind.ANY_OBJECT,
- entry.getKey(),
- entry.getValue(),
- excludedResources));
- }
-
- // Generate propagation tasks for deleting this group from resources
- tasks.addAll(getPropagationManager().getDeleteTasks(
- AnyTypeKind.GROUP,
- key,
- null,
- null));
-
- PropagationReporter propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
-
- exchange.setProperty("statuses", propagationReporter.getStatuses());
- } else if (getAnyTypeKind() == AnyTypeKind.ANY_OBJECT) {
- List<PropagationTask> tasks = getPropagationManager().getDeleteTasks(
- AnyTypeKind.ANY_OBJECT,
- key,
- null,
- excludedResources);
- PropagationReporter propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
-
- exchange.setProperty("statuses", propagationReporter.getStatuses());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java
index 01c3223..b5d5d04 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -31,13 +33,20 @@ import org.apache.syncope.core.provisioning.api.PropagationByResource;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
public class DeprovisionProducer extends AbstractProducer {
-
- private UserDAO userDAO;
- private GroupDAO groupDAO;
- private AnyObjectDAO anyObjectDAO;
- public DeprovisionProducer(final Endpoint endpoint, final AnyTypeKind anyTypeKind, final UserDAO userDAO,
- final GroupDAO groupDAO, final AnyObjectDAO anyObjectDAO) {
+ private final UserDAO userDAO;
+
+ private final GroupDAO groupDAO;
+
+ private final AnyObjectDAO anyObjectDAO;
+
+ public DeprovisionProducer(
+ final Endpoint endpoint,
+ final AnyTypeKind anyTypeKind,
+ final UserDAO userDAO,
+ final GroupDAO groupDAO,
+ final AnyObjectDAO anyObjectDAO) {
+
super(endpoint, anyTypeKind);
this.userDAO = userDAO;
this.groupDAO = groupDAO;
@@ -50,43 +59,48 @@ public class DeprovisionProducer extends AbstractProducer {
String key = exchange.getIn().getBody(String.class);
List<String> resources = exchange.getProperty("resources", List.class);
Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
-
- if (getAnyTypeKind() == AnyTypeKind.USER) {
- PropagationByResource propByRes = new PropagationByResource();
- propByRes.set(ResourceOperation.DELETE, resources);
-
- List<PropagationTask> tasks = getPropagationManager().getDeleteTasks(
- AnyTypeKind.USER,
- key,
- propByRes,
- CollectionUtils.removeAll(userDAO.findAllResourceNames(key), resources));
- PropagationReporter propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
- exchange.getOut().setBody(propagationReporter.getStatuses());
- } else if (getAnyTypeKind() == AnyTypeKind.GROUP) {
+ if (null != getAnyTypeKind()) {
PropagationByResource propByRes = new PropagationByResource();
- propByRes.addAll(ResourceOperation.DELETE, resources);
+ List<PropagationTask> tasks;
+ PropagationReporter propagationReporter;
+ switch (getAnyTypeKind()) {
+ case USER:
+ propByRes.set(ResourceOperation.DELETE, resources);
+ tasks = getPropagationManager().getDeleteTasks(
+ AnyTypeKind.USER,
+ key,
+ propByRes,
+ CollectionUtils.removeAll(userDAO.findAllResourceNames(key), resources));
+ propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ exchange.getOut().setBody(propagationReporter.getStatuses());
+ break;
- List<PropagationTask> tasks = getPropagationManager().getDeleteTasks(
- AnyTypeKind.GROUP,
- key,
- propByRes,
- CollectionUtils.removeAll(groupDAO.authFind(key).getResourceKeys(), resources));
- PropagationReporter propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
-
- exchange.getOut().setBody(propagationReporter.getStatuses());
- } else if (getAnyTypeKind() == AnyTypeKind.ANY_OBJECT) {
- PropagationByResource propByRes = new PropagationByResource();
- propByRes.addAll(ResourceOperation.DELETE, resources);
+ case GROUP:
+ propByRes.addAll(ResourceOperation.DELETE, resources);
+ tasks = getPropagationManager().getDeleteTasks(
+ AnyTypeKind.GROUP,
+ key,
+ propByRes,
+ CollectionUtils.removeAll(groupDAO.authFind(key).getResourceKeys(), resources));
+ propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ exchange.getOut().setBody(propagationReporter.getStatuses());
+ break;
- List<PropagationTask> tasks = getPropagationManager().getDeleteTasks(
- AnyTypeKind.ANY_OBJECT,
- key,
- propByRes,
- CollectionUtils.removeAll(anyObjectDAO.findAllResourceNames(key), resources));
- PropagationReporter propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ case ANY_OBJECT:
+ propByRes.addAll(ResourceOperation.DELETE, resources);
+ tasks = getPropagationManager().getDeleteTasks(
+ AnyTypeKind.ANY_OBJECT,
+ key,
+ propByRes,
+ CollectionUtils.removeAll(anyObjectDAO.findAllResourceNames(key), resources));
+ propagationReporter = getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ exchange.getOut().setBody(propagationReporter.getStatuses());
+ break;
- exchange.getOut().setBody(propagationReporter.getStatuses());
+ default:
+ break;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java
index 0b9047a..182a459 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -47,15 +49,15 @@ public class ProvisionProducer extends AbstractProducer {
String key = exchange.getIn().getBody(String.class);
List<String> resources = exchange.getProperty("resources", List.class);
Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
-
+
if (getAnyTypeKind() == AnyTypeKind.USER) {
Boolean changePwd = exchange.getProperty("changePwd", Boolean.class);
String password = exchange.getProperty("password", String.class);
UserPatch userPatch = new UserPatch();
userPatch.setKey(key);
- userPatch.getResources().addAll(CollectionUtils.collect(resources,
- new Transformer<String, StringPatchItem>() {
+ userPatch.getResources().addAll(CollectionUtils.collect(resources,
+ new Transformer<String, StringPatchItem>() {
@Override
public StringPatchItem transform(final String resource) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java
index 921a66d..45f62e6 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -38,11 +40,16 @@ import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
public class StatusProducer extends AbstractProducer {
- private UserDAO userDAO;
- private UserWorkflowAdapter uwfAdapter;
-
- public StatusProducer(final Endpoint endpoint, final AnyTypeKind anyTypeKind, final UserDAO userDAO,
- final UserWorkflowAdapter uwfAdapter) {
+ private final UserDAO userDAO;
+
+ private final UserWorkflowAdapter uwfAdapter;
+
+ public StatusProducer(
+ final Endpoint endpoint,
+ final AnyTypeKind anyTypeKind,
+ final UserDAO userDAO,
+ final UserWorkflowAdapter uwfAdapter) {
+
super(endpoint, anyTypeKind);
this.userDAO = userDAO;
this.uwfAdapter = uwfAdapter;
@@ -52,8 +59,8 @@ public class StatusProducer extends AbstractProducer {
@Override
public void process(final Exchange exchange) throws Exception {
if (getAnyTypeKind() == AnyTypeKind.USER && isPull()) {
- WorkflowResult<Map.Entry<UserPatch, Boolean>> updated =
- (WorkflowResult<Entry<UserPatch, Boolean>>) exchange.getIn().getBody();
+ WorkflowResult<Map.Entry<UserPatch, Boolean>> updated =
+ (WorkflowResult<Entry<UserPatch, Boolean>>) exchange.getIn().getBody();
Boolean enabled = exchange.getProperty("enabled", Boolean.class);
String key = exchange.getProperty("key", String.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/SuspendProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/SuspendProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/SuspendProducer.java
index 367ceb6..57c1404 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/SuspendProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/SuspendProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -37,8 +39,8 @@ public class SuspendProducer extends AbstractProducer {
@Override
public void process(final Exchange exchange) throws Exception {
if (getAnyTypeKind() == AnyTypeKind.USER) {
- Pair<WorkflowResult<String>, Boolean> updated =
- (Pair<WorkflowResult<String>, Boolean>) exchange.getIn().getBody();
+ Pair<WorkflowResult<String>, Boolean> updated =
+ (Pair<WorkflowResult<String>, Boolean>) exchange.getIn().getBody();
// propagate suspension if and only if it is required by policy
if (updated != null && updated.getValue()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/12ef6f50/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java
index 6a73712..7c3761e 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java
@@ -1,18 +1,20 @@
-/**
- * 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
+/*
+ * 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
+ * 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.
+ * 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.provisioning.camel.producer;
@@ -49,16 +51,15 @@ public class UpdateProducer extends AbstractProducer {
WorkflowResult<Pair<UserPatch, Boolean>> updated =
(WorkflowResult<Pair<UserPatch, Boolean>>) exchange.getIn().getBody();
- List<PropagationTask> tasks = null;
-
+ List<PropagationTask> tasks;
if (isPull()) {
boolean passwordNotNull = updated.getResult().getKey().getPassword() != null;
tasks = getPropagationManager().getUserUpdateTasks(updated, passwordNotNull, excludedResources);
} else {
tasks = getPropagationManager().getUserUpdateTasks(updated);
}
- PropagationReporter propagationReporter =
- getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ PropagationReporter propagationReporter =
+ getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(
updated.getResult().getKey().getKey(), propagationReporter.getStatuses()));
@@ -79,7 +80,7 @@ public class UpdateProducer extends AbstractProducer {
((AnyPatch) actual).getVirAttrs(),
excludedResources);
PropagationReporter propagationReporter =
- getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
+ getPropagationTaskExecutor().execute(tasks, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propagationReporter.getStatuses()));
}
[2/2] syncope git commit: [SYNCOPE-700] Workflow and approval
Posted by il...@apache.org.
[SYNCOPE-700] Workflow and approval
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/62e9636a
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/62e9636a
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/62e9636a
Branch: refs/heads/master
Commit: 62e9636ae4abfd91df726e7628fb3adf0db3226a
Parents: 12ef6f5
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Mon Aug 8 12:02:10 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Mon Aug 8 12:02:10 2016 +0200
----------------------------------------------------------------------
src/main/asciidoc/images/approval1.png | Bin 0 -> 1705 bytes
src/main/asciidoc/images/approval2.png | Bin 0 -> 13774 bytes
src/main/asciidoc/images/approval3.png | Bin 0 -> 14284 bytes
src/main/asciidoc/images/approval4.png | Bin 0 -> 13969 bytes
src/main/asciidoc/images/approval5.png | Bin 0 -> 21400 bytes
src/main/asciidoc/images/approval6.png | Bin 0 -> 9966 bytes
.../reference-guide/architecture/core.adoc | 1 +
.../reference-guide/concepts/concepts.adoc | 2 +-
.../reference-guide/concepts/workflow.adoc | 156 +++++++++++++++++++
.../adminconsole/adminconsole.adoc | 2 +
.../adminconsole/approval.adoc | 31 ++++
11 files changed, 191 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/images/approval1.png
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/images/approval1.png b/src/main/asciidoc/images/approval1.png
new file mode 100644
index 0000000..d667fc6
Binary files /dev/null and b/src/main/asciidoc/images/approval1.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/images/approval2.png
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/images/approval2.png b/src/main/asciidoc/images/approval2.png
new file mode 100644
index 0000000..64e82aa
Binary files /dev/null and b/src/main/asciidoc/images/approval2.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/images/approval3.png
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/images/approval3.png b/src/main/asciidoc/images/approval3.png
new file mode 100644
index 0000000..f27f50d
Binary files /dev/null and b/src/main/asciidoc/images/approval3.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/images/approval4.png
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/images/approval4.png b/src/main/asciidoc/images/approval4.png
new file mode 100644
index 0000000..6fbce13
Binary files /dev/null and b/src/main/asciidoc/images/approval4.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/images/approval5.png
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/images/approval5.png b/src/main/asciidoc/images/approval5.png
new file mode 100644
index 0000000..d5edd63
Binary files /dev/null and b/src/main/asciidoc/images/approval5.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/images/approval6.png
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/images/approval6.png b/src/main/asciidoc/images/approval6.png
new file mode 100644
index 0000000..69ed6f4
Binary files /dev/null and b/src/main/asciidoc/images/approval6.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/reference-guide/architecture/core.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/architecture/core.adoc b/src/main/asciidoc/reference-guide/architecture/core.adoc
index 2d4ab54..cc2ec2e 100644
--- a/src/main/asciidoc/reference-guide/architecture/core.adoc
+++ b/src/main/asciidoc/reference-guide/architecture/core.adoc
@@ -68,6 +68,7 @@ external data.
In addition, an http://camel.apache.org/[Apache Camel^]-based implementation is also available as
<<apache-camel-provisioning-engine,extension>>, which brings all the power of runtime changes and adaptation.
+[[workflow-layer]]
==== Workflow
The Workflow layer is responsible for managing the internal lifecycle of users, groups and any objects.
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/reference-guide/concepts/concepts.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/concepts/concepts.adoc b/src/main/asciidoc/reference-guide/concepts/concepts.adoc
index 62fa53e..09db683 100644
--- a/src/main/asciidoc/reference-guide/concepts/concepts.adoc
+++ b/src/main/asciidoc/reference-guide/concepts/concepts.adoc
@@ -34,7 +34,7 @@ include::provisioning/provisioning.adoc[]
include::policies.adoc[]
-=== Workflow and Approval
+include::workflow.adoc[]
=== Notifications
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/reference-guide/concepts/workflow.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/concepts/workflow.adoc b/src/main/asciidoc/reference-guide/concepts/workflow.adoc
new file mode 100644
index 0000000..5863816
--- /dev/null
+++ b/src/main/asciidoc/reference-guide/concepts/workflow.adoc
@@ -0,0 +1,156 @@
+//
+// 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.
+//
+=== Workflow
+
+Workflow manages the internal identity lifecycle by defining statuses and transitions that every user, group or any
+object in Apache Syncope will traverse. A workflow instance is started once identities get created, and shut down when
+removed.
+
+Workflow is triggered during the <<provisioning,provisioning>> process as first step to create, update or delete
+identities into the internal storage.
+
+[NOTE]
+.Workflow Adapters
+====
+The workflow features are defined by the workflow adapter interfaces:
+
+ifeval::["{snapshotOrRelease}" == "release"]
+* https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java[UserWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+* https://github.com/apache/syncope/blob/master/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java[UserWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "release"]
+* https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/GroupWorkflowAdapter.java[GroupWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+* https://github.com/apache/syncope/blob/master/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/GroupWorkflowAdapter.java[GroupWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "release"]
+* https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/AnyObjectWorkflowAdapter.java[AnyObjectWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+* https://github.com/apache/syncope/blob/master/core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/AnyObjectWorkflowAdapter.java[AnyObjectWorkflowAdapter^]
+endif::[]
+
+Default implementations are available:
+
+ifeval::["{snapshotOrRelease}" == "release"]
+* https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultUserWorkflowAdapter.java[DefaultUserWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+* https://github.com/apache/syncope/blob/master/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultUserWorkflowAdapter.java[DefaultUserWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "release"]
+* https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultGroupWorkflowAdapter.java[DefaultGroupWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+* https://github.com/apache/syncope/blob/master/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultGroupWorkflowAdapter.java[DefaultGroupWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "release"]
+* https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultAnyObjectWorkflowAdapter.java[DefaultAnyObjectWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+* https://github.com/apache/syncope/blob/master/core/workflow-java/src/main/java/org/apache/syncope/core/workflow/java/DefaultAnyObjectWorkflowAdapter.java[DefaultAnyObjectWorkflowAdapter^]
+endif::[]
+
+Custom adapters can be provided by implementing the related interfaces, also as bridges towards third-party tools as
+https://camunda.org/[Camunda^] or http://jbpm.jboss.org/[jBPM^].
+====
+
+==== Activiti User Workflow Adapter
+
+An advanced adapter is provided for users, based on http://www.activiti.org/[Activiti BPM^], the reference open source
+http://www.bpmn.org/[BPMN 2.0^] implementation.
+
+The
+ifeval::["{snapshotOrRelease}" == "release"]
+https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java[ActivitiUserWorkflowAdapter^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+https://github.com/apache/syncope/blob/master/core/workflow-activiti/src/main/java/org/apache/syncope/core/workflow/activiti/ActivitiUserWorkflowAdapter.java[ActivitiUserWorkflowAdapter^]
+endif::[]
+is bootstrapped from
+ifeval::["{snapshotOrRelease}" == "release"]
+https://github.com/apache/syncope/blob/syncope-{docVersion}/core/workflow-activiti/src/main/resources/userWorkflow.bpmn20.xml[userWorkflow.bpmn20.xml^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+https://github.com/apache/syncope/blob/master/core/workflow-activiti/src/main/resources/userWorkflow.bpmn20.xml[userWorkflow.bpmn20.xml^]
+endif::[]
+and presents several advantages and more features, if compared to the default user adapter:
+
+. Besides mandatory statuses, which are modeled as BPMN `userTask` instances, more can be freely added
+at runtime, provided that adequate transitions and conditions are also inserted; more details about available BPMN
+constructs in the http://www.activiti.org/userguide/index.html#bpmnConstructs[Activiti User Guide^]. +
+Additional statuses and transitions allow the internal processes of Apache Syncope to better adapt to suit organizational flows.
+. Custom logic can be injected into the workflow process by providing BPMN `serviceTask` instances.
+. http://www.activiti.org/userguide/index.html#forms[Activiti forms^] are used for implementing <<approval,approval>>.
+. The http://www.activiti.org/userguide/index.html#activitiModeler[Activiti Modeler^] can be enabled in the
+<<admin-console,admin console>>, thus allowing web-based graphical modeling of the workflow definition.
+
+[.text-center]
+image::userWorkflow.png[title="Default Activiti user workflow",alt="Default Activiti user workflow"]
+
+===== Approval
+
+Every transition in the Activiti user workflow definition can be subjected to approval.
+
+The underlying idea is that some kind of self-modifications (group memberships, external resource assignments, ...)
+might not be allowed to 'plain' users, as there could be conditions which require management approval.
+Managers could also be asked for completing the information provided before the requested operation is completed.
+
+In order to define an approval form, a dedicated BPMN `userTask` needs to be defined, following the rules established
+for http://www.activiti.org/userguide/index.html#forms[Activiti forms^].
+
+[[sample-selfreg-approval]]
+.Approving self-registration
+====
+The snippet below shows how to define an approval form in XML; the same operation can be performed via the
+http://www.activiti.org/userguide/index.html#activitiModeler[Activiti Modeler^].
+
+[source,xml]
+----
+<userTask id="createApproval" name="Create approval"
+ activiti:candidateGroups="managingDirector" activiti:formKey="createApproval"> // <1>
+ <extensionElements>
+ <activiti:formProperty id="username" name="Username" type="string"
+ expression="${user.username}" writable="false"/> // <2>
+ <activiti:formProperty id="approve" name="Approve?" type="boolean"
+ variable="approve" required="true"/> // <3>
+ <activiti:formProperty id="rejectReason" name="Reason for rejecting" type="string"
+ variable="rejectReason"/>
+ </extensionElements>
+</userTask>
+----
+<1> `formKey` and `id` must be unique across the workflow definition, `name` is displayed by the admin console;
+`candidateGroups` and `candidateUsers` might be defined, even both, to indicate which groups or users should be
+managing these approvals
+<2> `expression` will be evaluated against the current requesting `user` (as workflow variable) and related properties;
+read-only form input can be defined by setting `writable="false"`
+<3> exporting approval inputs into workflow variables is possible via the `variable` attribute; required form input can
+be defined by setting `required="true"`
+====
+
+Once the form is defined, any modification subject to that approval will be manageable via admin console, according to
+the following flow (the actual operations on admin console for the sample above are reported <<console-approval,below>>):
+
+. administrator A sees the new approval notifications +
+. administrator A claims the approval and is then allowed to manage it
+. administrator A reviews the updated user, with ongoing modification applied (no actual modification performed yet)
+. administrator A can approve or reject such modification
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/adminconsole.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/adminconsole.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/adminconsole.adoc
index 3be38cc..056ed25 100644
--- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/adminconsole.adoc
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/adminconsole.adoc
@@ -43,4 +43,6 @@ include::reports.adoc[]
include::configuration.adoc[]
+include::approval.adoc[]
+
include::extensions.adoc[]
http://git-wip-us.apache.org/repos/asf/syncope/blob/62e9636a/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/approval.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/approval.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/approval.adoc
new file mode 100644
index 0000000..1d30904
--- /dev/null
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/adminconsole/approval.adoc
@@ -0,0 +1,31 @@
+//
+// 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.
+//
+
+[[console-approval]]
+===== Approval
+
+The images below refers to the self-registration approval <<sample-selfreg-approval,sample>> and to the typical approval
+flow as explained <<approval,above>>.
+
+image::approval1.png[title="Approval notification",alt="Approval notification"]
+image::approval2.png[title="Claiming an approval",alt="Claiming an approval"]
+image::approval3.png[title="Managing an approval",alt="Managing an approval"]
+image::approval4.png[title="Approval form",alt="Approval form"]
+image::approval5.png[title="Reviewing modifications",alt="Reviewing modifications"]
+image::approval6.png[title="Approving modiications",alt="Approving modiications"]