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

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

There is a newer version: 4.7.219
Show newest version

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@ page import="org.wso2.carbon.mediator.service.ui.Mediator" %>
<%@ page import="org.wso2.carbon.mediator.switchm.SwitchDefaultMediator" %>
<%@ page import="org.wso2.carbon.mediator.switchm.SwitchMediator" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.SequenceEditorHelper" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.ns.NameSpacesRegistrar" %>
<%@ 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" %>


    

    <%
        Mediator mediator = SequenceEditorHelper.getEditingMediator(request, session);
        if (!(mediator instanceof SwitchMediator)) {
            // todo : proper error handling
            throw new RuntimeException("Unable to edit the mediator");
        }
        SwitchMediator switchMediator = (SwitchMediator) mediator;

        boolean defaultPresent = false;
        List mediatorList = switchMediator.getList();
        for (Mediator aMediator : mediatorList) {
            if (aMediator instanceof SwitchDefaultMediator) {
                defaultPresent = true;
                break;
            }
        }

        int noOfCases = mediatorList.size();
        if (defaultPresent) {
            noOfCases = noOfCases - 1;
        }
    %>

    

<% if (!defaultPresent) { %> <% } %>
* <% NameSpacesRegistrar nameSpacesRegistrar = NameSpacesRegistrar.getInstance(); nameSpacesRegistrar.registerNameSpaces( switchMediator.getSource(), "sourceXPath", session); if (switchMediator.getSource() != null) { %> <%} else {%> <%}%>
<%= noOfCases %> <%= noOfCases != 1 ? "s" : "" %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy