View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.core.workflow.java;
20  
21  import org.apache.syncope.common.keymaster.client.api.ConfParamOps;
22  import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
23  import org.apache.syncope.core.persistence.api.dao.GroupDAO;
24  import org.apache.syncope.core.persistence.api.dao.RealmDAO;
25  import org.apache.syncope.core.persistence.api.dao.UserDAO;
26  import org.apache.syncope.core.persistence.api.entity.EntityFactory;
27  import org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder;
28  import org.apache.syncope.core.provisioning.api.data.GroupDataBinder;
29  import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
30  import org.apache.syncope.core.provisioning.api.rules.RuleEnforcer;
31  import org.apache.syncope.core.spring.security.SecurityProperties;
32  import org.apache.syncope.core.workflow.api.AnyObjectWorkflowAdapter;
33  import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
34  import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
35  import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
36  import org.springframework.context.ApplicationEventPublisher;
37  import org.springframework.context.annotation.Bean;
38  import org.springframework.context.annotation.Configuration;
39  
40  @Configuration(proxyBeanMethods = false)
41  public class WorkflowContext {
42  
43      @ConditionalOnMissingBean
44      @Bean
45      public UserWorkflowAdapter uwfAdapter(
46              final UserDataBinder userDataBinder,
47              final UserDAO userDAO,
48              final RealmDAO realmDAO,
49              final GroupDAO groupDAO,
50              final EntityFactory entityFactory,
51              final SecurityProperties securityProperties,
52              final RuleEnforcer ruleEnforcer,
53              final ConfParamOps confParamOps,
54              final ApplicationEventPublisher publisher) {
55  
56          return new DefaultUserWorkflowAdapter(
57                  userDataBinder,
58                  userDAO,
59                  realmDAO,
60                  groupDAO,
61                  entityFactory,
62                  securityProperties,
63                  ruleEnforcer,
64                  confParamOps,
65                  publisher);
66      }
67  
68      @ConditionalOnMissingBean
69      @Bean
70      public GroupWorkflowAdapter gwfAdapter(
71              final GroupDataBinder groupDataBinder,
72              final GroupDAO groupDAO,
73              final EntityFactory entityFactory,
74              final ApplicationEventPublisher publisher) {
75  
76          return new DefaultGroupWorkflowAdapter(groupDataBinder, groupDAO, entityFactory, publisher);
77      }
78  
79      @ConditionalOnMissingBean
80      @Bean
81      public AnyObjectWorkflowAdapter awfAdapter(
82              final AnyObjectDataBinder anyObjectDataBinder,
83              final AnyObjectDAO anyObjectDAO,
84              final GroupDAO groupDAO,
85              final EntityFactory entityFactory,
86              final ApplicationEventPublisher publisher) {
87  
88          return new DefaultAnyObjectWorkflowAdapter(
89                  anyObjectDataBinder,
90                  anyObjectDAO,
91                  groupDAO,
92                  entityFactory,
93                  publisher);
94      }
95  }