Package org.wso2.carbon.bam.common.dataobjects.activity

Examples of org.wso2.carbon.bam.common.dataobjects.activity.MessageDataDO


                && !data.getActivityId().equals("")) {

                ServiceDO service;
                OperationDO operation;
                ActivityDO activity;
                MessageDataDO messageDataDO;

                if (data.getTimeStamp() != null) {
                    if (data.getTimeStamp().equals("")) {
                        messageDataDO = new MessageDataDO(BAMCalendar.getInstance(Calendar.getInstance())
                                .getBAMTimestamp(), data.getRemoteIPAddress(), data.getMessageDirection(),
                                                          data.getMessageBody(), data.getRequestMessageStatus(),
                                                          data.getResponseMessageStatus());
                    } else {
                        messageDataDO = new MessageDataDO(data.getTimeStamp(), data.getRemoteIPAddress(),
                                                          data.getMessageDirection(), data.getMessageBody(),
                                                          data.getRequestMessageStatus(), data.getResponseMessageStatus());
                    }
                } else {
                    messageDataDO = new MessageDataDO(
                            BAMCalendar.getInstance(Calendar.getInstance()).getBAMTimestamp(),
                            data.getRemoteIPAddress(), data.getMessageDirection(), data.getMessageBody(),
                            data.getRequestMessageStatus(), data.getResponseMessageStatus());
                }

                // When first time message comes to a system, service, operation
                // need to be
                // added.
                try {
                    ServerDO serverDO = dsAdmin.getServer(data.getServerName());
                    if (serverDO != null) {
                        messageDataDO.setServerId(serverDO.getId());
                    } else {
                        log.error("Server is not in the Database" + data.getServerName());
                    }
                } catch (BAMException e) {
                    log.error("Could not retrieve server from DB ", e);
                }
                try {
                    if (dsAdmin.getService(messageDataDO.getServerId(), data.getServiceName()) == null) {
                        service = new ServiceDO();
                        ServerDO serverDO = dsAdmin.getServer(data.getServerName());
                        if (serverDO != null) {
                            service.setServerID(serverDO.getId());
                            service.setName(data.getServiceName());
                            dsAdmin.addService(service);
                            messageDataDO.setServiceId(dsAdmin.getService(messageDataDO.getServerId(),
                                                                          data.getServiceName()).getId());
                        }

                    } else {
                        messageDataDO.setServiceId(dsAdmin.getService(messageDataDO.getServerId(),
                                                                      data.getServiceName()).getId());
                    }
                } catch (BAMException e) {
                    log.error("Could not retrieve service from DB ", e);
                }
                try {
                    if (dsAdmin.getOperation(messageDataDO.getServiceId(), data.getOperationName()) == null) {
                        operation = new OperationDO();
                        ServiceDO serviceDO = dsAdmin.getService(messageDataDO.getServerId(), data.getServiceName());
                        if (serviceDO != null) {
                            operation.setServiceID(serviceDO.getId());
                            operation.setName(data.getOperationName());
                            dsAdmin.addOperation(operation);
                            messageDataDO.setOperationId(dsAdmin.getOperation(messageDataDO.getServiceId(),
                                                                              data.getOperationName()).getOperationID());
                        } else {
                            serviceDO = new ServiceDO();
                            serviceDO.setServerID(messageDataDO.getServerId());
                            serviceDO.setName(data.getServiceName());
                            dsAdmin.addService(serviceDO);

                            messageDataDO.setServiceId(dsAdmin.getService(messageDataDO.getServerId(),
                                                                          data.getServiceName()).getId());

                            operation.setServiceID(messageDataDO.getServiceId());
                            operation.setName(data.getOperationName());
                            dsAdmin.addOperation(operation);

                            messageDataDO.setOperationId(dsAdmin.getOperation(messageDataDO.getServiceId(),
                                                                              data.getOperationName()).getOperationID());
                        }
                    } else {
                        messageDataDO.setOperationId(dsAdmin.getOperation(messageDataDO.getServiceId(),
                                                                          data.getOperationName()).getOperationID());
                    }
                } catch (BAMException e) {
                    log.error("Could not retrieve operation from DB ", e);
                }
                checkForActivityExistense(data, dsAdmin, messageDataDO);
                // this is for mediation observer event(it publishes
                // req+response @ single
                // event)
                try {
                    MessageDO inMsg = dsAdmin.getMessage(data.getMessageId(), messageDataDO.getOperationId(),
                                                         messageDataDO.getActivityKeyId());
                    if (inMsg != null) {
                        messageDataDO.setMessageKeyId(inMsg.getMessageKeyId());
                    } else {
                        MessageDO mesg_in = new MessageDO();
                        mesg_in.setMessageId(data.getMessageId());
                        mesg_in.setActivityKeyId(messageDataDO.getActivityKeyId());
                        mesg_in.setOperationId(messageDataDO.getOperationId());
                        mesg_in.setTimestamp(data.getTimeStamp());
                        mesg_in.setIPAddress(data.getRemoteIPAddress());
                        mesg_in.setUserAgent(data.getUserAgent());

                        //TODO: Data Services supports returning the ID
                        dsAdmin.addMessage(mesg_in);
                        messageDataDO.setMessageKeyId(dsAdmin.getMessage(data.getMessageId(),
                                                                         messageDataDO.getOperationId(),
                                                                         messageDataDO.getActivityKeyId())
                                .getMessageKeyId());
                    }
                } catch (BAMException e) {
                    log.error("Error updating Message statistics data for server " + data.getServerName() + " service "
                              + data.getServiceName() + " operation " + data.getOperationName()
                              + " from eventing message receiver " + e.getLocalizedMessage());
                }
                // store to the BAM MessageData table
                try {
                    MessageDataDO msgDat_in = dsAdmin.getMessageDataForActivityKeyIDandMessageKeyID(
                            messageDataDO.getMessageKeyId(), messageDataDO.getActivityKeyId());
                    if (msgDat_in != null) {
                        messageDataDO.setMessageDataKeyId(msgDat_in.getMessageDataKeyId());
                        dsAdmin.updateMessageStatus(data.getRequestMessageStatus(), msgDat_in.getMessageDataKeyId());
                    } else {
                        String direction = "Request";
                        dsAdmin.addMessageDataDump(messageDataDO, direction);
                    }
                } catch (BAMException e) {
                    log.error("Could not dump the full message to DB", e);
                }
                try {
                    String out_msg_id = data.getOutMessageID();
                    if (out_msg_id != null && !"".equals(out_msg_id)) {
                        MessageDO outMsg = dsAdmin.getMessage(data.getOutMessageID(), messageDataDO.getOperationId(),
                                                              messageDataDO.getActivityKeyId());
                        if (outMsg != null) {
                            messageDataDO.setMessageKeyId(outMsg.getMessageKeyId());
                        } else {
                            MessageDO mesg_out = new MessageDO();
                            mesg_out.setMessageId(data.getOutMessageID());
                            mesg_out.setActivityKeyId(messageDataDO.getActivityKeyId());
                            mesg_out.setOperationId(messageDataDO.getOperationId());
                            mesg_out.setTimestamp(data.getTimeStamp());
                            mesg_out.setIPAddress(data.getRemoteIPAddress());
                            mesg_out.setUserAgent(data.getUserAgent());

                            //TODO: Data Services supports returning the ID
                            dsAdmin.addMessage(mesg_out);
                            messageDataDO.setMessageKeyId(dsAdmin.getMessage(data.getOutMessageID(),
                                                                             messageDataDO.getOperationId(),
                                                                             messageDataDO.getActivityKeyId())
                                    .getMessageKeyId());
                        }
                    }

                } catch (BAMException e) {
                    log.error("Error updating Message statistics data for server " + data.getServerName() + " service "
                              + data.getServiceName() + " operation " + data.getOperationName()
                              + " from eventing message receiver " + e.getLocalizedMessage());
                }
                // store to the BAM MessageData table
                try {
                    MessageDataDO msgDat_out = dsAdmin.getMessageDataForActivityKeyIDandMessageKeyID(
                            messageDataDO.getMessageKeyId(), messageDataDO.getActivityKeyId());
                    if (msgDat_out != null) {
                        messageDataDO.setMessageDataKeyId(msgDat_out.getMessageDataKeyId());
                        dsAdmin.updateMessageStatus(data.getResponseMessageStatus(), msgDat_out.getMessageDataKeyId());
                    } else {
                        String direction = "Response";
                        dsAdmin.addMessageDataDump(messageDataDO, direction);
                    }
                } catch (BAMException e) {
View Full Code Here


     * @return The end line number, or -1 if could not be determined
     */
    public int getEndLineNumber() {
      int ret=-1;
     
      ActivityInterface parent=getParent();
     
      if (parent != null) {
        int index=parent.getSubActivities().indexOf(this);
       
        if (index != -1) {
          if (index < (parent.getSubActivities().size()-1)) {
            ActivityInterface other=parent.getSubActivities().get(index+1);
           
            ret = other.getStartLineNumber()-1;
          } else {
            ret = parent.getEndLineNumber();
          }
        }
      }
View Full Code Here

     *
     * @param lineNumber The line number
     * @return The activity, or null if not found
     */
    public ActivityInterface getActivityAtLineNumber(int lineNumber) {
      ActivityInterface ret=null;
     
      int endline=getEndLineNumber();
     
      if (getStartLineNumber() <= lineNumber && (endline == -1 || endline >= lineNumber)) {
       
View Full Code Here

            int width = 0;
            int height = 0;
            dimensions = new SVGDimension(width, height);

            SVGDimension subActivityDim = null;
            ActivityInterface activity = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (subActivityDim.getWidth() > width) {
                    width += subActivityDim.getWidth();
                }
                height += subActivityDim.getHeight();
            }
View Full Code Here

    protected Element getArrows(SVGDocument doc) {
        Element subGroup = null;
        subGroup = doc.createElementNS("http://www.w3.org/2000/svg", "g");

        if (subActivities != null) {
            ActivityInterface prevActivity = null;
            ActivityInterface activity = null;
            String id = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates exitCoords = null;
            SVGCoordinates entryCoords = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = subActivities.iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                if (prevActivity != null) {
                    exitCoords = prevActivity.getExitArrowCoords();
                    entryCoords = activity.getEntryArrowCoords();
                    id = prevActivity.getId() + "-" + activity.getId();
                    subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(),
                        exitCoords.getYTop(), entryCoords.getXLeft(),
                        entryCoords.getYTop(), id, prevActivity, activity));
                }
                prevActivity = activity;
View Full Code Here

    @Override
    public org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates getExitArrowCoords() {
        SVGCoordinates coords = getStartIconExitArrowCoords();

        if (subActivities != null && subActivities.size() > 0) {
            ActivityInterface activity = subActivities.get(subActivities.size() - 1);
            coords = activity.getExitArrowCoords();
        }
        return coords;
    }
View Full Code Here

    protected Element getArrows(SVGDocument doc) {
        Element subGroup = null;
        subGroup = doc.createElementNS("http://www.w3.org/2000/svg", "g");
        if (subActivities != null) {
            ActivityInterface prevActivity = null;
            ActivityInterface activity = null;
            String id = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates exitCoords = null;
            SVGCoordinates entryCoords = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = subActivities.iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                if (prevActivity != null) {
                    exitCoords = prevActivity.getExitArrowCoords();
                    entryCoords = activity.getEntryArrowCoords();
                    id = prevActivity.getId() + "-" + activity.getId();
                    subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(),
                        exitCoords.getYTop(), entryCoords.getXLeft(),
                        entryCoords.getYTop(), id, prevActivity, activity));
                } else {
                    entryCoords = activity.getEntryArrowCoords();
                    subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(),
                        myStartCoords.getYTop(), entryCoords.getXLeft(),
                        entryCoords.getYTop(), id, prevActivity, activity));
                }
                prevActivity = activity;
View Full Code Here

            int width = 0;
            int height = 0;
            dimensions = new org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension(width, height);

            org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension subActivityDim = null;
            ActivityInterface activity = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (subActivityDim.getHeight() > height) {
                    height += subActivityDim.getHeight();
                }
                width += subActivityDim.getWidth();
            }
View Full Code Here

        int xLeft = centreOfMyLayout - (getStartIconWidth() / 2);
        int yTop = startYTop + (getYSpacing() / 2);
        int endXLeft = centreOfMyLayout - (getEndIconWidth() / 2);
        int endYTop = startYTop + dimensions.getHeight() - getEndIconHeight() - (getYSpacing() / 2);

        ActivityInterface activity = null;
        Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
        int childYTop = yTop + getStartIconHeight() + (getYSpacing() / 2);
        int childXLeft = startXLeft + (getXSpacing() / 2);
        while (itr.hasNext()) {
            activity = itr.next();
//            childYTop += centreOfMyLayout - (activity.getDimensions().getHeight() / 2);
            activity.layout(childXLeft, childYTop);
            childXLeft += activity.getDimensions().getWidth();
        }

        // Set the values
        setStartIconXLeft(xLeft);
        setStartIconYTop(yTop);
View Full Code Here

            dimensions = new org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension(coreWidth, coreHeight);
            coreDimensions = new org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension(coreWidth, coreHeight);
            conditionalDimensions = new org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension(conWidth, conHeight);

            org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension subActivityDim = null;
            ActivityInterface activity = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (activity instanceof ElseIfImpl || activity instanceof ElseImpl) {
                    if (subActivityDim.getHeight() > conHeight) {
                        conHeight += subActivityDim.getHeight();
                    }
                    conWidth += subActivityDim.getWidth();
View Full Code Here

TOP

Related Classes of org.wso2.carbon.bam.common.dataobjects.activity.MessageDataDO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.