Search in sources :

Example 1 with ExternalMessageVO

use of com.centurylink.mdw.model.value.event.ExternalMessageVO in project mdw-designer by CenturyLinkCloud.

the class ActivityInstanceDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.verticalSpacing = 1;
    composite.setLayout(layout);
    composite.getShell().setText("Activity Instance");
    // activity name
    Label nameLabel = new Label(composite, SWT.NONE);
    nameLabel.setFont(new Font(nameLabel.getDisplay(), new FontData("Tahoma", 8, SWT.BOLD)));
    GridData gd = new GridData(SWT.LEFT);
    gd.horizontalSpan = 3;
    nameLabel.setLayoutData(gd);
    nameLabel.setText(activity.getName());
    // high-level info
    new Label(composite, SWT.NONE).setText("Instance ID: " + activityInstanceVO.getId());
    Label spacer = new Label(composite, SWT.NONE);
    gd = new GridData(SWT.LEFT);
    gd.widthHint = 50;
    spacer.setLayoutData(gd);
    new Label(composite, SWT.NONE).setText("Start: " + activityInstanceVO.getStartDate());
    new Label(composite, SWT.NONE).setText("Status: " + WorkStatuses.getWorkStatuses().get(activityInstanceVO.getStatusCode()));
    spacer = new Label(composite, SWT.NONE);
    spacer.setLayoutData(gd);
    new Label(composite, SWT.NONE).setText("End: " + activityInstanceVO.getEndDate());
    if (!mode.equals(Mode.RETRY)) {
        if (!mode.equals(Mode.SKIP)) {
            if (activity.isAdapter() || activity.isStart() || activity.isEventWait()) {
                ExternalMessageVO messageVO = getDesignerProxy().getExternalMessage(activity, activityInstanceVO);
                if (!activity.isEventWait()) {
                    spacer = new Label(composite, SWT.NONE);
                    gd = new GridData(SWT.LEFT);
                    gd.horizontalSpan = 3;
                    gd.heightHint = 5;
                    spacer.setLayoutData(gd);
                    // request
                    Label label = new Label(composite, SWT.NONE);
                    gd = new GridData(SWT.LEFT);
                    gd.horizontalSpan = 3;
                    label.setLayoutData(gd);
                    label.setText(activity.isAdapter() ? "Adapter Request:" : "External Event Request:");
                    requestMessageText = new Text(composite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
                    gd = new GridData(SWT.LEFT);
                    gd.horizontalSpan = 3;
                    gd.widthHint = 500;
                    gd.heightHint = 180;
                    requestMessageText.setLayoutData(gd);
                    if (messageVO != null && messageVO.getRequest() != null)
                        requestMessageText.setText(messageVO.getRequest());
                }
                spacer = new Label(composite, SWT.NONE);
                gd = new GridData(SWT.LEFT);
                gd.horizontalSpan = 3;
                gd.heightHint = 5;
                spacer.setLayoutData(gd);
                // response
                Label label = new Label(composite, SWT.NONE);
                gd = new GridData(SWT.LEFT);
                gd.horizontalSpan = 3;
                label.setLayoutData(gd);
                label.setText(activity.isAdapter() ? "Adapter Response:" : activity.isEmpty() ? "Event Message:" : "Response Message:");
                responseMessageText = new Text(composite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
                gd = new GridData(SWT.LEFT);
                gd.horizontalSpan = 3;
                gd.widthHint = 500;
                gd.heightHint = 180;
                responseMessageText.setLayoutData(gd);
                if (messageVO != null && messageVO.getResponse() != null)
                    responseMessageText.setText(messageVO.getResponse());
            }
        }
        spacer = new Label(composite, SWT.NONE);
        gd = new GridData(SWT.LEFT);
        gd.horizontalSpan = 3;
        gd.heightHint = 5;
        spacer.setLayoutData(gd);
        // completion code / status message
        Label label = new Label(composite, SWT.NONE);
        gd = new GridData(SWT.LEFT);
        gd.horizontalSpan = 3;
        label.setLayoutData(gd);
        label.setText(mode.equals(Mode.VIEW) ? "Completion Code / Status Message:" : "Completion Code");
        int style = SWT.BORDER;
        if (mode.equals(Mode.VIEW))
            style = style | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL;
        completionCodeText = new Text(composite, style);
        gd = new GridData(SWT.LEFT);
        gd.horizontalSpan = 3;
        gd.widthHint = 500;
        if (mode.equals(Mode.VIEW))
            gd.heightHint = 100;
        completionCodeText.setLayoutData(gd);
        if (mode.equals(Mode.VIEW) && activityInstanceVO.getStatusMessage() != null)
            completionCodeText.setText(activityInstanceVO.getStatusMessage());
        if (mode.equals(Mode.SKIP)) {
            completionCodeText.addModifyListener(new ModifyListener() {

                public void modifyText(ModifyEvent e) {
                    String compCode = completionCodeText.getText().trim();
                    completionCode = compCode.length() == 0 ? null : compCode;
                }
            });
        }
    }
    return composite;
}
Also used : ExternalMessageVO(com.centurylink.mdw.model.value.event.ExternalMessageVO) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) FontData(org.eclipse.swt.graphics.FontData) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) Font(org.eclipse.swt.graphics.Font)

Example 2 with ExternalMessageVO

use of com.centurylink.mdw.model.value.event.ExternalMessageVO in project mdw-designer by CenturyLinkCloud.

the class RuntimeDataAccessRest method getExternalMessage.

// used by designer for displaying adapter raw message content
public ExternalMessageVO getExternalMessage(Long activityId, Long activityInstId, Long eventInstId) throws DataAccessException {
    try {
        String pathWithArgs = "Requests";
        if (eventInstId != null)
            pathWithArgs += "/" + eventInstId;
        else
            pathWithArgs += "?ownerId=" + activityInstId + "&type=outboundRequests";
        if (!getServer().isSchemaVersion61()) {
            pathWithArgs = "ExternalMessageInstance?format=json&activityId=" + activityId + "&activityInstId=" + activityInstId;
            if (eventInstId != null)
                pathWithArgs += "&eventInstId=" + eventInstId;
        }
        String response = invokeResourceService(pathWithArgs);
        return new ExternalMessageVO(response);
    } catch (IOException ex) {
        throw new DataAccessOfflineException(ex.getMessage(), ex);
    } catch (Exception ex) {
        throw new DataAccessException(ex.getMessage(), ex);
    }
}
Also used : DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) ExternalMessageVO(com.centurylink.mdw.model.value.event.ExternalMessageVO) IOException(java.io.IOException) JSONException(org.json.JSONException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Aggregations

ExternalMessageVO (com.centurylink.mdw.model.value.event.ExternalMessageVO)2 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 IOException (java.io.IOException)1 XmlException (org.apache.xmlbeans.XmlException)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 Font (org.eclipse.swt.graphics.Font)1 FontData (org.eclipse.swt.graphics.FontData)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 JSONException (org.json.JSONException)1