added svcapi ui and camunda code
[it/otf.git] / otf-camunda / src / main / java / org / oran / otf / camunda / plugin / OtfIncidentHandlerPlugin.java
1 /*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
2 #                                                                              #\r
3 #   Licensed under the Apache License, Version 2.0 (the "License");            #\r
4 #   you may not use this file except in compliance with the License.           #\r
5 #   You may obtain a copy of the License at                                    #\r
6 #                                                                              #\r
7 #       http://www.apache.org/licenses/LICENSE-2.0                             #\r
8 #                                                                              #\r
9 #   Unless required by applicable law or agreed to in writing, software        #\r
10 #   distributed under the License is distributed on an "AS IS" BASIS,          #\r
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
12 #   See the License for the specific language governing permissions and        #\r
13 #   limitations under the License.                                             #\r
14 ##############################################################################*/\r
15 \r
16 \r
17 package org.oran.otf.camunda.plugin;\r
18 \r
19 import org.oran.otf.camunda.workflow.handler.ExternalTaskIncidentHandler;\r
20 import org.oran.otf.camunda.workflow.handler.FailedJobIncidentHandler;\r
21 import java.util.Arrays;\r
22 import org.camunda.bpm.engine.ProcessEngine;\r
23 import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;\r
24 import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin;\r
25 import org.slf4j.Logger;\r
26 import org.slf4j.LoggerFactory;\r
27 import org.springframework.beans.factory.annotation.Autowired;\r
28 import org.springframework.stereotype.Component;\r
29 \r
30 @Component\r
31 public class OtfIncidentHandlerPlugin implements ProcessEnginePlugin {\r
32 \r
33   private static final Logger logger = LoggerFactory.getLogger(OtfIncidentHandlerPlugin.class);\r
34 \r
35   @Autowired\r
36   private FailedJobIncidentHandler failedJobIncidentHandler;\r
37   @Autowired\r
38   private ExternalTaskIncidentHandler externalTaskIncidentHandler;\r
39 \r
40   @Override\r
41   public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {\r
42     logger.info("Adding Open Test Framework custom incident handlers.");\r
43     processEngineConfiguration.setCustomIncidentHandlers(\r
44         Arrays.asList(failedJobIncidentHandler, externalTaskIncidentHandler));\r
45   }\r
46 \r
47   @Override\r
48   public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {\r
49   }\r
50 \r
51   @Override\r
52   public void postProcessEngineBuild(ProcessEngine processEngine) {\r
53   }\r
54 }\r