All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web.publishEvent-mediator.edit-mediator.jsp Maven / Gradle / Ivy

There is a newer version: 4.7.219
Show newest version
<%--
~  Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~  Licensed to the Apache Software Foundation (ASF) under one or more
~  contributor license agreements.  See the NOTICE file distributed with
~  this work for additional information regarding copyright ownership.
~
~  The ASF licenses this file to You 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.
--%>
<%@ page import="org.apache.synapse.SynapseException" %>
<%@ page import="org.apache.synapse.config.xml.SynapsePath" %>
<%@ page import="org.apache.synapse.util.xpath.SynapseXPath" %>
<%@ page import="org.wso2.carbon.context.PrivilegedCarbonContext" %>
<%@ page import="org.wso2.carbon.event.sink.EventSink" %>
<%@ page import="org.wso2.carbon.event.sink.EventSinkService" %>
<%@ page import="org.wso2.carbon.mediator.publishevent.ui.Property" %>
<%@ page import="org.wso2.carbon.mediator.publishevent.ui.PublishEventMediator" %>
<%@ page import="org.wso2.carbon.mediator.service.ui.Mediator" %>
<%@ page import="org.wso2.carbon.mediator.service.util.MediatorProperty" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.SequenceEditorHelper" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.ns.NameSpacesRegistrar" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>


<%
    Mediator mediator = SequenceEditorHelper.getEditingMediator(request, session);
    if (!(mediator instanceof org.wso2.carbon.mediator.publishevent.ui.PublishEventMediator)) {
        // todo : proper error handling
        throw new RuntimeException("Unable to edit the mediator");
    }
    PublishEventMediator publishEventMediator = (PublishEventMediator) mediator;

    List mediatorMetaPropertyList = publishEventMediator.getMetaProperties();
    List mediatorCorrelationPropertyList = publishEventMediator.getCorrelationProperties();
    List mediatorPayloadPropertyList = publishEventMediator.getPayloadProperties();
    List mediatorArbitraryPropertyList = publishEventMediator.getArbitraryProperties();
    NameSpacesRegistrar nameSpacesRegistrar = NameSpacesRegistrar.getInstance();

    nameSpacesRegistrar.registerNameSpaces(convertPropertyList(mediatorMetaPropertyList), "metaPropertyValue", session);
    nameSpacesRegistrar
            .registerNameSpaces(convertPropertyList(mediatorCorrelationPropertyList), "correlationPropertyValue",
                                session);
    nameSpacesRegistrar
            .registerNameSpaces(convertPropertyList(mediatorPayloadPropertyList), "payloadPropertyValue", session);
    nameSpacesRegistrar
            .registerNameSpaces(convertPropertyList(mediatorArbitraryPropertyList), "arbitraryPropertyValue", session);
    String metaPropertyTableStyle = mediatorMetaPropertyList.isEmpty() ? "display:none;" : "";
    String correlationPropertyTableStyle = mediatorCorrelationPropertyList.isEmpty() ? "display:none;" : "";
    String payloadPropertyTableStyle = mediatorPayloadPropertyList.isEmpty() ? "display:none;" : "";
    String arbitraryPropertyTableStyle = mediatorArbitraryPropertyList.isEmpty() ? "display:none;" : "";

%>



*
*
*

<% int i = 0; for (Property mp : mediatorMetaPropertyList) { if (mp != null) { String value = mp.getValue(); String type = mp.getType(); String pathValue; SynapseXPath path = mp.getExpression(); if (path == null) { pathValue = ""; } else { pathValue = path.toString(); } boolean isLiteral = value != null && !"".equals(value); %> <%}%> <% } i++; } %>
<% if (value != null && !"".equals(value)) {%> <%} else if (path != null) {%> <%} else { %> <% }%> "> <% if (!isLiteral && path != null) {%>

<% i = 0; for (Property mp : mediatorCorrelationPropertyList) { if (mp != null) { String value = mp.getValue(); String type = mp.getType(); String pathValue; SynapseXPath path = mp.getExpression(); if (path == null) { pathValue = ""; } else { pathValue = path.toString(); } boolean isLiteral = value != null && !"".equals(value); %> <%}%> <% } i++; } %>
<% if (value != null && !"".equals(value)) {%> <%} else if (path != null) {%> <%} else { %> <% }%> "> <% if (!isLiteral && path != null) {%>

<% i = 0; for (Property mp : mediatorPayloadPropertyList) { if (mp != null) { String value = mp.getValue(); String type = mp.getType(); String pathValue; SynapseXPath path = mp.getExpression(); if (path == null) { pathValue = ""; } else { pathValue = path.toString(); } boolean isLiteral = value != null && !"".equals(value); %> <%}%> <% } i++; } %>
<% if (value != null && !"".equals(value)) {%> <%} else if (path != null) {%> <%} else { %> <% }%> "> <% if (!isLiteral && path != null) {%>

<% i = 0; for (Property mp : mediatorArbitraryPropertyList) { if (mp != null) { String value = mp.getValue(); String type = mp.getType(); String pathValue; SynapseXPath path = mp.getExpression(); if (path == null) { pathValue = ""; } else { pathValue = path.toString(); } boolean isLiteral = value != null && !"".equals(value); %> <%}%> <% } i++; } %>
<% if (value != null && !"".equals(value)) {%> <%} else if (path != null) {%> <%} else { %> <% }%> "> <% if (!isLiteral && path != null) {%>
<%! List convertPropertyList(List list) { List newList = new ArrayList(); for (Property p : list) { newList.add(p); } return newList; } %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy