From 9f6d3a45ca962a1ed5c64c84a01e398ec3b00874 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Wed, 13 Sep 2017 16:17:05 +0200 Subject: Clean unnecessary files using camunda The camunda examples have been removed as not used by anyone Change-Id: Ib659ea0d68aff613620fce6bf25d4d4a1e1acac4 Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) --- .../org/onap/clamp/clds/service/LogService.java | 38 --- .../onap/clamp/clds/service/LogServiceImpl.java | 295 --------------------- src/main/resources/META-INF/processes.xml | 8 - .../resources/bpmn/SampleTestProcessDelegate.bpmn | 79 ------ src/main/resources/bpmn/TestHumanTask.bpmn | 80 ------ src/main/resources/bpmn/TestHumanTask.png | Bin 3979 -> 0 bytes src/main/resources/bpmn/dish.dmn | 36 --- src/main/resources/bpmn/log-message.bpmn | 50 ---- src/main/resources/bpmn/log-message.png | Bin 3093 -> 0 bytes 9 files changed, 586 deletions(-) delete mode 100644 src/main/java/org/onap/clamp/clds/service/LogService.java delete mode 100644 src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java delete mode 100644 src/main/resources/bpmn/SampleTestProcessDelegate.bpmn delete mode 100644 src/main/resources/bpmn/TestHumanTask.bpmn delete mode 100644 src/main/resources/bpmn/TestHumanTask.png delete mode 100644 src/main/resources/bpmn/dish.dmn delete mode 100644 src/main/resources/bpmn/log-message.bpmn delete mode 100644 src/main/resources/bpmn/log-message.png diff --git a/src/main/java/org/onap/clamp/clds/service/LogService.java b/src/main/java/org/onap/clamp/clds/service/LogService.java deleted file mode 100644 index 1c3d9dc67..000000000 --- a/src/main/java/org/onap/clamp/clds/service/LogService.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * 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============================================ - * =================================================================== - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ - -package org.onap.clamp.clds.service; - -public interface LogService { - - String logMessage(String logMessageText, String javamail, String springmail, String commonsmail); - - String postLogMessage(String histEventList); - - String createLogMessage(String startTime, String endTime, String serviceName); - - String createLogMessageUsingHistory(String procInstId, String histEventList); - - String CreateHistLog(String procInstId); - -} diff --git a/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java b/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java deleted file mode 100644 index 2f02aa6ab..000000000 --- a/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java +++ /dev/null @@ -1,295 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * 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============================================ - * =================================================================== - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ - -package org.onap.clamp.clds.service; - -import com.att.ajsc.camunda.core.AttCamundaHistoryEvent; -import com.att.ajsc.camunda.core.AttCamundaService; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.gson.Gson; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import javax.ws.rs.core.Context; - -import org.apache.commons.mail.Email; -import org.apache.commons.mail.SimpleEmail; -import org.apache.cxf.jaxrs.ext.MessageContext; -import org.camunda.bpm.engine.HistoryService; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.history.HistoricActivityInstance; -import org.camunda.bpm.engine.impl.history.event.HistoricActivityInstanceEventEntity; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.onap.clamp.clds.common.LogMessages; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.mail.MailException; -import org.springframework.mail.SimpleMailMessage; -import org.springframework.mail.javamail.JavaMailSenderImpl; -import org.springframework.stereotype.Service; - -@Service -public class LogServiceImpl implements LogService { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LogServiceImpl.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - - @Autowired - private RuntimeService runtimeService; - - @Autowired - private HistoryService historyService; - - @Context - private MessageContext context; - - public void setRuntimeService(RuntimeService runtimeService) { - this.runtimeService = runtimeService; - } - - public LogServiceImpl() { - // needed for instantiation - } - - @Override - public String logMessage(String logMessageText, String javamail, String springmail, String commonsmail) { - logger.info("Value of contexxt : " + context); - String convId = null; - if (context != null) { - convId = context.getHttpServletRequest().getHeader("X-CSI-ConversationId"); - if (convId == null) { - convId = (String) context.getHttpServletRequest().getAttribute("X-CSI-ConversationId"); - } - context.getHttpServletRequest().setAttribute("CALL_TYPE", "Testing"); - AttCamundaService.setHttpRequest(context.getHttpServletRequest()); - } - // input variables to example camunda process - Map variables = new HashMap<>(); - variables.put("logMessageText", logMessageText); - if (convId != null) { - variables.put("conversationId", convId); - } - - // BEGIN - added for send mail testing - // also added the following to the method signature: , - // @QueryParam("javamail") String javamail, @QueryParam("springmail") - // String springmail, @QueryParam("commonsmail") String commonsmail - // if javamail parameter provided, assume it contains an email address. - // use Java Mail to send an email from that address, to that address - if (javamail != null && javamail.length() > 0) { - variables.put("javamail", javamail); - try { - Properties props = new Properties(); - props.put("mail.smtp.host", "smtp.sbc.com"); // eMail.setHostName - Session session = Session.getInstance(props); - MimeMessage msg = new MimeMessage(session); - - msg.setFrom(new InternetAddress(javamail)); // eMail.setFrom - - InternetAddress[] fromAddresses = { new InternetAddress(javamail) }; - msg.setReplyTo(fromAddresses); // eMail.addReplyTo - msg.setSubject("test message using javax.mail"); // eMail.setSubject - msg.setText(logMessageText); // eMail.setMsg - - msg.addRecipient(Message.RecipientType.TO, new InternetAddress(javamail)); // eMail.addTo - Transport.send(msg); - } catch (MessagingException e) { - logger.error(LogMessages.LOGSERVICE_EMAIL_ERROR, e); - } - } - - // if springmail parameter provided, assume it contains an email - // address. - // use Spring Mail to send an email from that address, to that address - if (springmail != null && springmail.length() > 0) { - variables.put("springmail", springmail); - JavaMailSenderImpl sender = new JavaMailSenderImpl(); - SimpleMailMessage smsg = new SimpleMailMessage(); - - try { - sender.setHost("smtp.sbc.com"); // eMail.setHostName - smsg.setFrom(springmail); // eMail.setFrom - smsg.setReplyTo(springmail); // eMail.addReplyTo - smsg.setSubject("test message using spring mail"); // eMail.setSubject - smsg.setText(logMessageText); // eMail.setMsg - smsg.setTo(springmail); // eMail.addTo - sender.send(smsg); - } catch (MailException e) { - logger.error(LogMessages.LOGSERVICE_EMAIL_ERROR, e); - } - } - - // if commonsmail parameter provided, assume it contains an email - // address. - // use Apache Commons Mail to send an email from that address, to that - // address - if (commonsmail != null && commonsmail.length() > 0) { - variables.put("commonsmail", commonsmail); - Email email = new SimpleEmail(); - try { - email.setHostName("smtp.sbc.com"); - email.setFrom(commonsmail); - email.addReplyTo(commonsmail); - email.setSubject("test message using commons mail"); - email.setMsg(logMessageText); - email.addTo(commonsmail); - java.net.URL classUrl = this.getClass().getResource("com.sun.mail.util.TraceInputStream"); - if (classUrl != null) { - logger.info(LogMessages.LOGSERVICE_EMAIL_CLASS, classUrl.getFile()); - } else { - logger.info(LogMessages.LOGSERVICE_EMAIL_CLASS_NULL); - } - email.send(); - } catch (Exception e) { - logger.error(LogMessages.LOGSERVICE_EMAIL_ERROR, e); - } - } - // END - added for send mail testing - - // execute example camunda process, log-message-wf - ProcessInstance pi = runtimeService.startProcessInstanceByKey("log-message-wf", variables); - AttCamundaService.setHttpRequest(null); - // return text message of what was done - return "Started processDefinitionId=" + pi.getProcessDefinitionId() + ", processInstanceId=" - + pi.getProcessInstanceId() + ", to log message: " + logMessageText; - } - - @Override - public String postLogMessage(String histEventList) { - String message = "no logs Created"; - logger.info("value of history events:" + histEventList); - Gson gson = new Gson(); - AttCamundaHistoryEvent attCamundaHistoryEvent = gson.fromJson(histEventList, AttCamundaHistoryEvent.class); - if (attCamundaHistoryEvent != null && attCamundaHistoryEvent.getProcInstId() != null) { - logger.info(LogMessages.PROCESS_INSTANCE_ID, attCamundaHistoryEvent.getProcInstId()); - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - context.getHttpServletRequest().setAttribute("CALL_TYPE", "Testing"); - List histActInstList = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(attCamundaHistoryEvent.getProcInstId()).list(); - - if (histActInstList != null && histActInstList.size() > 0) { - for (HistoricActivityInstance currHistoricActivityInstance : histActInstList) { - if (currHistoricActivityInstance != null - && currHistoricActivityInstance.getActivityName() != null - && currHistoricActivityInstance.getStartTime() != null - && currHistoricActivityInstance.getEndTime() != null) { - logger.info("value of serviceTrack:" + currHistoricActivityInstance); - message = "Log Entry Created"; - logger.info(message); - } - } - } - if (attCamundaHistoryEvent.getHistoryEventList() != null - && attCamundaHistoryEvent.getHistoryEventList().size() > 0) { - List historyEventList = attCamundaHistoryEvent - .getHistoryEventList(); - for (HistoricActivityInstanceEventEntity actiEvent : historyEventList) { - // resolve null pointer exception if - // actiEvent.getActivityName() - message = "Log Entry Created"; - } - } - } - } - return message; - } - - @Override - public String createLogMessage(String startTime, String endTime, String serviceName) { - String message = "no logs Created"; - - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - context.getHttpServletRequest().setAttribute("X-CSI-ClientApp", "AJSC-CSI~sdsds"); - /* - * PerformanceTrackingBean trackingBean =(PerformanceTrackingBean) - * context.getHttpServletRequest().getAttribute( - * "PERFORMANCE_TRACKER_BEAN"); - * PerformanceTracking.addInvokeServiceTrack(trackingBean, - * serviceName, Long.valueOf(startTime), Long.valueOf(endTime), - * "Completed", 500, 1000) ; - */ - message = "Log Entry Created"; - } - // return text message of what was done - return message; - } - - @Override - public String createLogMessageUsingHistory(String procInstId, String histEventList) { - String message = "no logs Created"; - logger.info("value of history events:" + histEventList); - logger.info("value of events:" + histEventList + ":" + histEventList); - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - context.getHttpServletRequest().setAttribute("CALL_TYPE", "Testing"); - List histActInstList = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(procInstId).list(); - - if (histActInstList != null && histActInstList.size() > 0) { - for (HistoricActivityInstance currHistoricActivityInstance : histActInstList) { - if (currHistoricActivityInstance != null && currHistoricActivityInstance.getActivityName() != null - && currHistoricActivityInstance.getStartTime() != null - && currHistoricActivityInstance.getEndTime() != null) { - logger.info("value of serviceTrack:" + currHistoricActivityInstance); - message = "Log Entry Created"; - logger.info(message); - } - } - } - } - return message; - } - - @Override - public String CreateHistLog(String procInstId) { - String message = "no logs Created"; - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - List histActInstList = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(procInstId).list(); - - if (histActInstList != null && histActInstList.size() > 0) { - for (HistoricActivityInstance currHistoricActivityInstance : histActInstList) { - if (currHistoricActivityInstance != null && currHistoricActivityInstance.getActivityName() != null - && currHistoricActivityInstance.getStartTime() != null - && currHistoricActivityInstance.getEndTime() != null) { - logger.info("value of serviceTrack:" + currHistoricActivityInstance); - context.getHttpServletRequest().setAttribute("X-CSI-ClientApp", "AJSC-CSI~sdsds"); - message = "Log Entry Created"; - } - } - } - } - return message; - } -} diff --git a/src/main/resources/META-INF/processes.xml b/src/main/resources/META-INF/processes.xml index bd3547dfc..921a1029b 100644 --- a/src/main/resources/META-INF/processes.xml +++ b/src/main/resources/META-INF/processes.xml @@ -25,14 +25,6 @@ - - default - bpmn/log-message.bpmn - - true - false - - default bpmn/clds-process-action.bpmn diff --git a/src/main/resources/bpmn/SampleTestProcessDelegate.bpmn b/src/main/resources/bpmn/SampleTestProcessDelegate.bpmn deleted file mode 100644 index 41ffdb6dc..000000000 --- a/src/main/resources/bpmn/SampleTestProcessDelegate.bpmn +++ /dev/null @@ -1,79 +0,0 @@ - - - - - SequenceFlow_2 - - - SequenceFlow_2 - SequenceFlow_1 - - - - - SequenceFlow_1 - SequenceFlow_6 - - - - SequenceFlow_6 - SequenceFlow_5 - - - - SequenceFlow_5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/bpmn/TestHumanTask.bpmn b/src/main/resources/bpmn/TestHumanTask.bpmn deleted file mode 100644 index d456d65f1..000000000 --- a/src/main/resources/bpmn/TestHumanTask.bpmn +++ /dev/null @@ -1,80 +0,0 @@ - - - - - SequenceFlow_2 - - - SequenceFlow_2 - SequenceFlow_3 - - - - SequenceFlow_5 - - - SequenceFlow_6 - SequenceFlow_5 - - - - SequenceFlow_027hi4f - SequenceFlow_6 - - - - - SequenceFlow_3 - SequenceFlow_027hi4f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/bpmn/TestHumanTask.png b/src/main/resources/bpmn/TestHumanTask.png deleted file mode 100644 index 7d8af39d4..000000000 Binary files a/src/main/resources/bpmn/TestHumanTask.png and /dev/null differ diff --git a/src/main/resources/bpmn/dish.dmn b/src/main/resources/bpmn/dish.dmn deleted file mode 100644 index 473a07ae5..000000000 --- a/src/main/resources/bpmn/dish.dmn +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - season - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bpmn/log-message.bpmn b/src/main/resources/bpmn/log-message.bpmn deleted file mode 100644 index f38f254d8..000000000 --- a/src/main/resources/bpmn/log-message.bpmn +++ /dev/null @@ -1,50 +0,0 @@ - - - - - SequenceFlow_0k87nxp - - - SequenceFlow_0zjfjoh - - - - - SequenceFlow_0k87nxp - SequenceFlow_0zjfjoh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bpmn/log-message.png b/src/main/resources/bpmn/log-message.png deleted file mode 100644 index fa7c7565f..000000000 Binary files a/src/main/resources/bpmn/log-message.png and /dev/null differ -- cgit 1.2.3-korg