diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-05-02 03:53:18 -0700 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-05-02 06:59:21 -0700 |
commit | 94ee92559b051f2f82ed681f841f4f13016842ed (patch) | |
tree | 9760a0ad7da03572ed4c9dc596c4b0f537e64112 /bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda | |
parent | 43bbca64032716730d2e7795b6569d5fdbda9d12 (diff) |
[MSO-8] Second step of the rebase for MSO
Second rebase containing additional features for MSO + total reworking
of the BPMN structure + Notification flow can now be added at the end of
some BPMN flows
Change-Id: I7e937c7a0ba1593ca85e164a093f79c7e38b6ce0
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda')
8 files changed, 624 insertions, 624 deletions
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java index fc08d2d54e..09fdc1c85e 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java @@ -1,53 +1,53 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.camunda.bpm.cockpit.plugin.spi.impl.AbstractCockpitPlugin; -import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource; - - - -public class URNMapPlugin extends AbstractCockpitPlugin{ - public static final String ID = "urnMap-plugin"; - - public String getId() { - return ID; - } - - @Override - public Set<Class<?>> getResourceClasses() { - Set<Class<?>> classes = new HashSet<Class<?>>(); - - classes.add(URNMapPluginRootResource.class); - - return classes; - } - - @Override - public List<String> getMappingFiles() { - return Arrays.asList("org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml"); - } -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.camunda.bpm.cockpit.plugin.spi.impl.AbstractCockpitPlugin;
+import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource;
+
+
+
+public class URNMapPlugin extends AbstractCockpitPlugin{
+ public static final String ID = "urnMap-plugin";
+
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public Set<Class<?>> getResourceClasses() {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+
+ classes.add(URNMapPluginRootResource.class);
+
+ return classes;
+ }
+
+ @Override
+ public List<String> getMappingFiles() {
+ return Arrays.asList("org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml");
+ }
+}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java index 728042008d..f7cc311e77 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java @@ -1,89 +1,89 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap.db; - -import org.camunda.bpm.engine.ProcessEngineConfiguration; -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration; -import org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor; -import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor; -import org.camunda.bpm.engine.impl.interceptor.LogInterceptor; -import org.camunda.bpm.engine.impl.util.ReflectUtil; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class MyBatisExtendedSessionFactory extends StandaloneProcessEngineConfiguration { - - private String resourceName; - - protected void init() { - throw new IllegalArgumentException( - "Normal 'init' on process engine only used for extended MyBatis mappings is not allowed, please use 'initFromProcessEngineConfiguration'. You cannot construct a process engine with this configuration."); - } - - /** - * initialize the {@link ProcessEngineConfiguration} from an existing one, - * just using the database settings and initialize the database / MyBatis - * stuff. - */ - public void initFromProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration, String resourceName) { - this.resourceName = resourceName; - - setDatabaseType(processEngineConfiguration.getDatabaseType()); - setDataSource(processEngineConfiguration.getDataSource()); - setDatabaseTablePrefix(processEngineConfiguration.getDatabaseTablePrefix()); - - initDataSource(); - //initVariableTypes(); - initCommandContextFactory(); - initTransactionFactory(); - initTransactionContextFactory(); - initCommandExecutors(); - initSqlSessionFactory(); - initIncidentHandlers(); - initIdentityProviderSessionFactory(); - initSessionFactories(); - } - - /** - * In order to always open a new command context set the property - * "alwaysOpenNew" to true inside the CommandContextInterceptor. - * - * If you execute the custom queries inside the process engine - * (for example in a service task), you have to do this. - */ - @Override - protected Collection<? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequired() { - List<CommandInterceptor> defaultCommandInterceptorsTxRequired = new ArrayList<CommandInterceptor>(); - defaultCommandInterceptorsTxRequired.add(new LogInterceptor()); - defaultCommandInterceptorsTxRequired.add(new CommandContextInterceptor(commandContextFactory, this, true)); - return defaultCommandInterceptorsTxRequired; - } - - @Override - protected InputStream getMyBatisXmlConfigurationSteam() { - return ReflectUtil.getResourceAsStream(resourceName); - } - -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap.db;
+
+import org.camunda.bpm.engine.ProcessEngineConfiguration;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration;
+import org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor;
+import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
+import org.camunda.bpm.engine.impl.interceptor.LogInterceptor;
+import org.camunda.bpm.engine.impl.util.ReflectUtil;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class MyBatisExtendedSessionFactory extends StandaloneProcessEngineConfiguration {
+
+ private String resourceName;
+
+ protected void init() {
+ throw new IllegalArgumentException(
+ "Normal 'init' on process engine only used for extended MyBatis mappings is not allowed, please use 'initFromProcessEngineConfiguration'. You cannot construct a process engine with this configuration.");
+ }
+
+ /**
+ * initialize the {@link ProcessEngineConfiguration} from an existing one,
+ * just using the database settings and initialize the database / MyBatis
+ * stuff.
+ */
+ public void initFromProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration, String resourceName) {
+ this.resourceName = resourceName;
+
+ setDatabaseType(processEngineConfiguration.getDatabaseType());
+ setDataSource(processEngineConfiguration.getDataSource());
+ setDatabaseTablePrefix(processEngineConfiguration.getDatabaseTablePrefix());
+
+ initDataSource();
+ //initVariableTypes();
+ initCommandContextFactory();
+ initTransactionFactory();
+ initTransactionContextFactory();
+ initCommandExecutors();
+ initSqlSessionFactory();
+ initIncidentHandlers();
+ initIdentityProviderSessionFactory();
+ initSessionFactories();
+ }
+
+ /**
+ * In order to always open a new command context set the property
+ * "alwaysOpenNew" to true inside the CommandContextInterceptor.
+ *
+ * If you execute the custom queries inside the process engine
+ * (for example in a service task), you have to do this.
+ */
+ @Override
+ protected Collection<? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequired() {
+ List<CommandInterceptor> defaultCommandInterceptorsTxRequired = new ArrayList<CommandInterceptor>();
+ defaultCommandInterceptorsTxRequired.add(new LogInterceptor());
+ defaultCommandInterceptorsTxRequired.add(new CommandContextInterceptor(commandContextFactory, this, true));
+ return defaultCommandInterceptorsTxRequired;
+ }
+
+ @Override
+ protected InputStream getMyBatisXmlConfigurationSteam() {
+ return ReflectUtil.getResourceAsStream(resourceName);
+ }
+
+}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java index e7140cd318..02b128f4ee 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java @@ -1,44 +1,44 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap.db; - -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.interceptor.Command; - -/** - * Helper to initialize a minimized process engine which does all the transaction and MyBatis mapping stuff for us - * and can be used to execute queries. - */ -public class MyBatisQueryCommandExecutor { - - private MyBatisExtendedSessionFactory myBatisExtendedSessionFactory; - - public MyBatisQueryCommandExecutor(ProcessEngineConfigurationImpl processEngineConfiguration, String mappingResourceName) { - myBatisExtendedSessionFactory = new MyBatisExtendedSessionFactory(); - myBatisExtendedSessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration, mappingResourceName); - } - - public <T> T executeQueryCommand(Command<T> command) { - return myBatisExtendedSessionFactory.getCommandExecutorTxRequired().execute(command); - } - - -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap.db;
+
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.interceptor.Command;
+
+/**
+ * Helper to initialize a minimized process engine which does all the transaction and MyBatis mapping stuff for us
+ * and can be used to execute queries.
+ */
+public class MyBatisQueryCommandExecutor {
+
+ private MyBatisExtendedSessionFactory myBatisExtendedSessionFactory;
+
+ public MyBatisQueryCommandExecutor(ProcessEngineConfigurationImpl processEngineConfiguration, String mappingResourceName) {
+ myBatisExtendedSessionFactory = new MyBatisExtendedSessionFactory();
+ myBatisExtendedSessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration, mappingResourceName);
+ }
+
+ public <T> T executeQueryCommand(Command<T> command) {
+ return myBatisExtendedSessionFactory.getCommandExecutorTxRequired().execute(command);
+ }
+
+
+}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java index ac8b2e15ee..59c41b1e42 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java @@ -1,47 +1,47 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap.db; - -public class URNData { - - private String URNName; - private String URNValue; - private String Ver_; - public String getURNName() { - return URNName; - } - public void setURNName(String uRNName) { - URNName = uRNName; - } - public String getURNValue() { - return URNValue; - } - public void setURNValue(String uRNValue) { - URNValue = uRNValue; - } - public String getVer_() { - return Ver_; - } - public void setVer_(String ver_) { - Ver_ = ver_; - } - -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap.db;
+
+public class URNData {
+
+ private String URNName;
+ private String URNValue;
+ private String Ver_;
+ public String getURNName() {
+ return URNName;
+ }
+ public void setURNName(String uRNName) {
+ URNName = uRNName;
+ }
+ public String getURNValue() {
+ return URNValue;
+ }
+ public void setURNValue(String uRNValue) {
+ URNValue = uRNValue;
+ }
+ public String getVer_() {
+ return Ver_;
+ }
+ public void setVer_(String ver_) {
+ Ver_ = ver_;
+ }
+
+}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java index 3838343aba..c512c35c68 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java @@ -1,48 +1,48 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap.db; - -import java.util.List; - -import org.camunda.bpm.engine.ProcessEngines; -import org.camunda.bpm.engine.impl.ProcessEngineImpl; -import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.interceptor.Command; -import org.camunda.bpm.engine.impl.interceptor.CommandContext; - -public class URNService { - - - public List<URNData> getProperties() { - ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine(); - ProcessEngineConfigurationImpl processEngineConfiguration = processEngine.getProcessEngineConfiguration(); - - MyBatisQueryCommandExecutor commandExecutor = new MyBatisQueryCommandExecutor(processEngineConfiguration, "mappings.xml"); - return commandExecutor.executeQueryCommand(new Command<List<URNData>>() { - - @SuppressWarnings("unchecked") - public List<URNData> execute(CommandContext commandContext) { - return (List<URNData>) commandContext.getDbSqlSession().selectList("retrieveUrnKeyValuePair", null); - } - }); - } - -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap.db;
+
+import java.util.List;
+
+import org.camunda.bpm.engine.ProcessEngines;
+import org.camunda.bpm.engine.impl.ProcessEngineImpl;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.interceptor.Command;
+import org.camunda.bpm.engine.impl.interceptor.CommandContext;
+
+public class URNService {
+
+
+ public List<URNData> getProperties() {
+ ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
+ ProcessEngineConfigurationImpl processEngineConfiguration = processEngine.getProcessEngineConfiguration();
+
+ MyBatisQueryCommandExecutor commandExecutor = new MyBatisQueryCommandExecutor(processEngineConfiguration, "mappings.xml");
+ return commandExecutor.executeQueryCommand(new Command<List<URNData>>() {
+
+ @SuppressWarnings("unchecked")
+ public List<URNData> execute(CommandContext commandContext) {
+ return (List<URNData>) commandContext.getDbSqlSession().selectList("retrieveUrnKeyValuePair", null);
+ }
+ });
+ }
+
+}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java index 4a155809e5..51ceb0d1ab 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java @@ -1,96 +1,96 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap.resources; - -import java.util.List; -import java.util.StringTokenizer; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; - -import org.camunda.bpm.cockpit.db.QueryParameters; -import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource; -import org.camunda.bpm.cockpit.db.CommandExecutor; -import org.openecomp.camunda.bpmn.plugin.urnmap.db.*; - -public class ProcessInstanceResource extends AbstractPluginResource { - - public ProcessInstanceResource(String engineName) { - super(engineName); - } - - @GET - public List<URNData> getUrnDataMap() { - List<URNData> list = getQueryService() - .executeQuery( - "cockpit.urnMap.retrieveUrnKeyValuePair", - new QueryParameters<URNData>()); - - System.out.println("urnmap-plugin project - Results Retrieved: "); - System.out.println("URNName: " + " " + "URNValue: " ); - for(URNData d: list) - { - System.out.println( d.getURNName() + " " + d.getURNValue()); - } - - return list; - } - - @PUT - //public void insertNewRow(String key_, String value_) - public void insertNewRow(String temp) - { - System.out.println("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp); - StringTokenizer st = new StringTokenizer(temp, "|"); - String key_ = ""; - String value_ = ""; - - while(st.hasMoreTokens()) { - key_ = st.nextToken(); - value_ = st.nextToken(); - System.out.println(key_ + "\t" + value_); - } - - System.out.println("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_); - URNData nRow = new URNData(); - nRow.setVer_("1"); - nRow.setURNName(key_); - nRow.setURNValue(value_); - - getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class); - - System.out.println("AddNewRow: XXXXXX END XXXXXXXXXXX"); - } - - @POST - // public void getPersistData(List<URNData > myList) { - public void getPersistData(URNData d) { - - System.out.println("getPersistData: UrnName: " + d.getURNName() + " , URNValue: " + d.getURNValue() ); - - getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class); - //getQueryService().executeQuery("cockpit.sample.persistURNData", d, ProcessInstanceCountDto.class); - - - System.out.println("XXXXXXXXXX - END - XXXXXXXXXXXXXXX"); - } -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap.resources;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+
+import org.camunda.bpm.cockpit.db.QueryParameters;
+import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource;
+import org.camunda.bpm.cockpit.db.CommandExecutor;
+import org.openecomp.camunda.bpmn.plugin.urnmap.db.*;
+
+public class ProcessInstanceResource extends AbstractPluginResource {
+
+ public ProcessInstanceResource(String engineName) {
+ super(engineName);
+ }
+
+ @GET
+ public List<URNData> getUrnDataMap() {
+ List<URNData> list = getQueryService()
+ .executeQuery(
+ "cockpit.urnMap.retrieveUrnKeyValuePair",
+ new QueryParameters<URNData>());
+
+ System.out.println("urnmap-plugin project - Results Retrieved: ");
+ System.out.println("URNName: " + " " + "URNValue: " );
+ for(URNData d: list)
+ {
+ System.out.println( d.getURNName() + " " + d.getURNValue());
+ }
+
+ return list;
+ }
+
+ @PUT
+ //public void insertNewRow(String key_, String value_)
+ public void insertNewRow(String temp)
+ {
+ System.out.println("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp);
+ StringTokenizer st = new StringTokenizer(temp, "|");
+ String key_ = "";
+ String value_ = "";
+
+ while(st.hasMoreTokens()) {
+ key_ = st.nextToken();
+ value_ = st.nextToken();
+ System.out.println(key_ + "\t" + value_);
+ }
+
+ System.out.println("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_);
+ URNData nRow = new URNData();
+ nRow.setVer_("1");
+ nRow.setURNName(key_);
+ nRow.setURNValue(value_);
+
+ getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class);
+
+ System.out.println("AddNewRow: XXXXXX END XXXXXXXXXXX");
+ }
+
+ @POST
+ // public void getPersistData(List<URNData > myList) {
+ public void getPersistData(URNData d) {
+
+ System.out.println("getPersistData: UrnName: " + d.getURNName() + " , URNValue: " + d.getURNValue() );
+
+ getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class);
+ //getQueryService().executeQuery("cockpit.sample.persistURNData", d, ProcessInstanceCountDto.class);
+
+
+ System.out.println("XXXXXXXXXX - END - XXXXXXXXXXXXXXX");
+ }
+}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java index d31fec66b9..0e1ccd96d8 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java @@ -1,42 +1,42 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap.resources; - -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginRootResource; -import org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin; - -@SuppressWarnings("deprecation") -@Path("plugin/" + URNMapPlugin.ID) -public class URNMapPluginRootResource extends AbstractPluginRootResource -{ - public URNMapPluginRootResource() { - super(URNMapPlugin.ID); - //super(""); - } - - @Path("{engineName}/process-instance") - public URNResource getProcessInstanceResource(@PathParam("engineName") String engineName) { - return subResource(new URNResource(engineName), engineName); - } -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap.resources;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginRootResource;
+import org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin;
+
+@SuppressWarnings("deprecation")
+@Path("plugin/" + URNMapPlugin.ID)
+public class URNMapPluginRootResource extends AbstractPluginRootResource
+{
+ public URNMapPluginRootResource() {
+ super(URNMapPlugin.ID);
+ //super("");
+ }
+
+ @Path("{engineName}/process-instance")
+ public URNResource getProcessInstanceResource(@PathParam("engineName") String engineName) {
+ return subResource(new URNResource(engineName), engineName);
+ }
+}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java index 5838130a92..3dc6c249f5 100644 --- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java @@ -1,205 +1,205 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.camunda.bpmn.plugin.urnmap.resources; -/*** -import java.beans.Statement; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -*/ -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.sql.DataSource; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; - -import org.camunda.bpm.cockpit.db.QueryParameters; -import org.camunda.bpm.cockpit.plugin.resource.AbstractCockpitPluginResource; - - -//import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource; -import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData; -import org.openecomp.mso.logger.MsoLogger; - - -//public class ProcessInstanceResource extends AbstractPluginResource { -public class URNResource extends AbstractCockpitPluginResource{ - public URNResource(String engineName) { - super(engineName); - } - - private Connection conn; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - @GET - public List<URNData> getUrnDataMap() - { - List<URNData> list = new ArrayList(); - - try { - - conn = getDBConnection(); - PreparedStatement psData = conn - .prepareStatement("select * from MSO_URN_MAPPING order by NAME_"); - - ResultSet r = psData.executeQuery(); - - while(r.next()) - { - URNData d = new URNData(); - d.setURNName(r.getString("NAME_")); - d.setURNValue(r.getString("VALUE_")); - d.setVer_( r.getString("REV_")); - - list.add(d); - } - - psData.close(); - conn.close(); - - } catch (Exception e) - { - - e.printStackTrace(); - } - - for(URNData d: list) - { - msoLogger.debug( d.getURNName() + " " + d.getURNValue()); - //msoLogger.debug("Started Executing " + getTaskName()); - msoLogger.debug("Started Executing " + d.getURNName() + " " + d.getURNValue()); - } - - return list; - } - - public List<URNData> getUrnDataMapOLD() - { - - List<URNData> list = getQueryService() - .executeQuery("cockpit.urnMap.retrieveUrnKeyValuePair", new QueryParameters<URNData>()); - - msoLogger.debug("urnmap-plugin project - Results Retrieved: "); - msoLogger.debug("URNName: " + " " + "URNValue: " ); - - for(URNData d: list) - { - //msoLogger.debug( d.getURNName() + " " + d.getURNValue()); - msoLogger.debug( d.getURNName() + " " + d.getURNValue()); - } - - return list; - } - - public Connection getDBConnection() - { - try { - - if(conn == null) - { - Context ctx = new InitialContext(); - DataSource ds = (DataSource)ctx.lookup("java:jboss/datasources/ProcessEngine");//jboss - conn = ds.getConnection(); - - } - - } catch (Exception e) - { - - e.printStackTrace(); - } - - return conn; - } - - @PUT - public void insertNewRow(String temp) - { - msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp); - msoLogger.debug("AddNewRow: EngineName ---> " + engineName); - - StringTokenizer st = new StringTokenizer(temp, "|"); - String key_ = ""; - String value_ = ""; - - while(st.hasMoreTokens()) { - key_ = st.nextToken(); - value_ = st.nextToken(); - msoLogger.debug(key_ + "\t" + value_); - } - - msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_); - final URNData nRow = new URNData(); - nRow.setVer_("1"); - final String myKey = key_; - final String myValue = value_; - - msoLogger.debug("----------- START ----------------------"); - try { - - conn = getDBConnection(); - PreparedStatement psData = conn - .prepareStatement("Insert into MSO_URN_MAPPING values ('" + key_ + "', '" + value_ + "', '1')"); - - psData.executeUpdate(); - - psData.close(); - conn.close(); - //} - - } catch (Exception e) - { - - e.printStackTrace(); - } - // getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class); - } - - @POST - public void getPersistData(URNData d) { - - //getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class); - - try { - - conn = getDBConnection(); - PreparedStatement psData = conn - .prepareStatement("UPDATE MSO_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'"); - - psData.executeUpdate(); - - psData.close(); - conn.close(); - } catch (Exception e) - { - - e.printStackTrace(); - } - - } -} +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.camunda.bpmn.plugin.urnmap.resources;
+/***
+import java.beans.Statement;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+*/
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+
+import org.camunda.bpm.cockpit.db.QueryParameters;
+import org.camunda.bpm.cockpit.plugin.resource.AbstractCockpitPluginResource;
+
+
+//import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource;
+import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData;
+import org.openecomp.mso.logger.MsoLogger;
+
+
+//public class ProcessInstanceResource extends AbstractPluginResource {
+public class URNResource extends AbstractCockpitPluginResource{
+ public URNResource(String engineName) {
+ super(engineName);
+ }
+
+ private Connection conn;
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ @GET
+ public List<URNData> getUrnDataMap()
+ {
+ List<URNData> list = new ArrayList();
+
+ try {
+
+ conn = getDBConnection();
+ PreparedStatement psData = conn
+ .prepareStatement("select * from MSO_URN_MAPPING order by NAME_");
+
+ ResultSet r = psData.executeQuery();
+
+ while(r.next())
+ {
+ URNData d = new URNData();
+ d.setURNName(r.getString("NAME_"));
+ d.setURNValue(r.getString("VALUE_"));
+ d.setVer_( r.getString("REV_"));
+
+ list.add(d);
+ }
+
+ psData.close();
+ conn.close();
+
+ } catch (Exception e)
+ {
+
+ e.printStackTrace();
+ }
+
+ for(URNData d: list)
+ {
+ msoLogger.debug( d.getURNName() + " " + d.getURNValue());
+ //msoLogger.debug("Started Executing " + getTaskName());
+ msoLogger.debug("Started Executing " + d.getURNName() + " " + d.getURNValue());
+ }
+
+ return list;
+ }
+
+ public List<URNData> getUrnDataMapOLD()
+ {
+
+ List<URNData> list = getQueryService()
+ .executeQuery("cockpit.urnMap.retrieveUrnKeyValuePair", new QueryParameters<URNData>());
+
+ msoLogger.debug("urnmap-plugin project - Results Retrieved: ");
+ msoLogger.debug("URNName: " + " " + "URNValue: " );
+
+ for(URNData d: list)
+ {
+ //msoLogger.debug( d.getURNName() + " " + d.getURNValue());
+ msoLogger.debug( d.getURNName() + " " + d.getURNValue());
+ }
+
+ return list;
+ }
+
+ public Connection getDBConnection()
+ {
+ try {
+
+ if(conn == null)
+ {
+ Context ctx = new InitialContext();
+ DataSource ds = (DataSource)ctx.lookup("java:jboss/datasources/ProcessEngine");//jboss
+ conn = ds.getConnection();
+
+ }
+
+ } catch (Exception e)
+ {
+
+ e.printStackTrace();
+ }
+
+ return conn;
+ }
+
+ @PUT
+ public void insertNewRow(String temp)
+ {
+ msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> " + temp);
+ msoLogger.debug("AddNewRow: EngineName ---> " + engineName);
+
+ StringTokenizer st = new StringTokenizer(temp, "|");
+ String key_ = "";
+ String value_ = "";
+
+ while(st.hasMoreTokens()) {
+ key_ = st.nextToken();
+ value_ = st.nextToken();
+ msoLogger.debug(key_ + "\t" + value_);
+ }
+
+ msoLogger.debug("AddNewRow: XXXXXXXXXXXXXXXXX ---> key: " + key_ + " , Value: " + value_);
+ final URNData nRow = new URNData();
+ nRow.setVer_("1");
+ final String myKey = key_;
+ final String myValue = value_;
+
+ msoLogger.debug("----------- START ----------------------");
+ try {
+
+ conn = getDBConnection();
+ PreparedStatement psData = conn
+ .prepareStatement("Insert into MSO_URN_MAPPING values ('" + key_ + "', '" + value_ + "', '1')");
+
+ psData.executeUpdate();
+
+ psData.close();
+ conn.close();
+ //}
+
+ } catch (Exception e)
+ {
+
+ e.printStackTrace();
+ }
+ // getQueryService().executeQuery("cockpit.urnMap.insertNewRow", nRow, URNData.class);
+ }
+
+ @POST
+ public void getPersistData(URNData d) {
+
+ //getQueryService().executeQuery("cockpit.urnMap.persistURNData", d, URNData.class);
+
+ try {
+
+ conn = getDBConnection();
+ PreparedStatement psData = conn
+ .prepareStatement("UPDATE MSO_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'");
+
+ psData.executeUpdate();
+
+ psData.close();
+ conn.close();
+ } catch (Exception e)
+ {
+
+ e.printStackTrace();
+ }
+
+ }
+}
|