From 025301d08b061482c1f046d562bf017c8cbcfe8d Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 11:40:03 +0100 Subject: Initial OpenECOMP MSO commit Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC --- .../camunda/bpm/plugin/urnmap/URNMapPlugin.java | 54 ++++++ .../urnmap/db/MyBatisExtendedSessionFactory.java | 89 +++++++++ .../urnmap/db/MyBatisQueryCommandExecutor.java | 44 +++++ .../att/camunda/bpm/plugin/urnmap/db/URNData.java | 47 +++++ .../camunda/bpm/plugin/urnmap/db/URNService.java | 48 +++++ .../urnmap/resources/ProcessInstanceResource.java | 98 ++++++++++ .../urnmap/resources/URNMapPluginRootResource.java | 43 +++++ .../bpm/plugin/urnmap/resources/URNResource.java | 205 +++++++++++++++++++++ 8 files changed, 628 insertions(+) create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/URNMapPlugin.java create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisExtendedSessionFactory.java create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisQueryCommandExecutor.java create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNData.java create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNService.java create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResource.java create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResource.java create mode 100644 bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResource.java (limited to 'bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm') diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/URNMapPlugin.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/URNMapPlugin.java new file mode 100644 index 0000000000..9a02aa0c38 --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/URNMapPlugin.java @@ -0,0 +1,54 @@ +/*- + * ============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 com.att.camunda.bpm.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 com.att.camunda.bpm.plugin.urnmap.resources.URNMapPluginRootResource; + + + +public class URNMapPlugin extends AbstractCockpitPlugin{ + public static final String ID = "urnMap-plugin"; + + public String getId() { + return ID; + } + + @Override + public Set> getResourceClasses() { + Set> classes = new HashSet>(); + + classes.add(URNMapPluginRootResource.class); + + return classes; + } + + @Override + public List getMappingFiles() { + return Arrays.asList("com/att/camunda/bpm/plugin/urnmap/queries/urnMap.xml"); + } +} diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisExtendedSessionFactory.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisExtendedSessionFactory.java new file mode 100644 index 0000000000..8a9d136dd6 --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisExtendedSessionFactory.java @@ -0,0 +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 com.att.camunda.bpm.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 getDefaultCommandInterceptorsTxRequired() { + List defaultCommandInterceptorsTxRequired = new ArrayList(); + 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/com/att/camunda/bpm/plugin/urnmap/db/MyBatisQueryCommandExecutor.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisQueryCommandExecutor.java new file mode 100644 index 0000000000..0bd7d739c5 --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisQueryCommandExecutor.java @@ -0,0 +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 com.att.camunda.bpm.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 executeQueryCommand(Command command) { + return myBatisExtendedSessionFactory.getCommandExecutorTxRequired().execute(command); + } + + +} diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNData.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNData.java new file mode 100644 index 0000000000..f8396bb223 --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNData.java @@ -0,0 +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 com.att.camunda.bpm.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/com/att/camunda/bpm/plugin/urnmap/db/URNService.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNService.java new file mode 100644 index 0000000000..7fd41c131d --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNService.java @@ -0,0 +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 com.att.camunda.bpm.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 getProperties() { + ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine(); + ProcessEngineConfigurationImpl processEngineConfiguration = processEngine.getProcessEngineConfiguration(); + + MyBatisQueryCommandExecutor commandExecutor = new MyBatisQueryCommandExecutor(processEngineConfiguration, "mappings.xml"); + return commandExecutor.executeQueryCommand(new Command>() { + + @SuppressWarnings("unchecked") + public List execute(CommandContext commandContext) { + return (List) commandContext.getDbSqlSession().selectList("retrieveUrnKeyValuePair", null); + } + }); + } + +} diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResource.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResource.java new file mode 100644 index 0000000000..44fe47b053 --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResource.java @@ -0,0 +1,98 @@ +/*- + * ============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 com.att.camunda.bpm.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 com.att.camunda.bpm.plugin.urnmap.db.*; +import org.camunda.bpm.cockpit.db.CommandExecutor; + +import com.att.camunda.bpm.plugin.urnmap.db.URNData; + +public class ProcessInstanceResource extends AbstractPluginResource { + + public ProcessInstanceResource(String engineName) { + super(engineName); + } + + @GET + public List getUrnDataMap() { + List list = getQueryService() + .executeQuery( + "cockpit.urnMap.retrieveUrnKeyValuePair", + new QueryParameters()); + + 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 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/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResource.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResource.java new file mode 100644 index 0000000000..c30eb8d8d7 --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResource.java @@ -0,0 +1,43 @@ +/*- + * ============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 com.att.camunda.bpm.plugin.urnmap.resources; + +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; + +import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginRootResource; + +import com.att.camunda.bpm.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/com/att/camunda/bpm/plugin/urnmap/resources/URNResource.java b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResource.java new file mode 100644 index 0000000000..08724db415 --- /dev/null +++ b/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResource.java @@ -0,0 +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 com.att.camunda.bpm.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 com.att.camunda.bpm.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 getUrnDataMap() + { + List list = new ArrayList(); + + try { + + conn = getDBConnection(); + PreparedStatement psData = conn + .prepareStatement("select * from ATT_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 getUrnDataMapOLD() + { + + List list = getQueryService() + .executeQuery("cockpit.urnMap.retrieveUrnKeyValuePair", new QueryParameters()); + + 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 ATT_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 ATT_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'"); + + psData.executeUpdate(); + + psData.close(); + conn.close(); + } catch (Exception e) + { + + e.printStackTrace(); + } + + } +} -- cgit 1.2.3-korg