web.sequences.design_sequence.jsp Maven / Gradle / Ivy
The newest version!
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%--
~ Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) 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.
--%>
<%@ page import="org.apache.axiom.om.OMAttribute" %>
<%@ page import="org.apache.axiom.om.OMElement" %>
<%@ page import="org.apache.axiom.om.OMFactory" %>
<%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
<%@ page import="org.wso2.carbon.mediator.service.MediatorStore" %>
<%@ page import="org.wso2.carbon.mediator.service.builtin.SequenceMediator" %>
<%@ page import="org.wso2.carbon.mediator.service.ui.Mediator" %>
<%@ page import="org.wso2.carbon.sequences.ui.client.SequenceAdminClient" %>
<%@ page import="org.wso2.carbon.sequences.ui.SequenceEditorConstants" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.SequenceEditorHelper" %>
<%@ page import="javax.xml.namespace.QName" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page import="org.wso2.carbon.sequences.ui.client.EditorUIClient" %>
<%@ page import="org.wso2.carbon.mediation.service.templates.TemplateMediator" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%
ResourceBundle bundle = ResourceBundle.getBundle("org.wso2.carbon.sequences.ui.i18n.Resources", request.getLocale());
String name = request.getParameter("sequenceName");
String sequenceXML = request.getParameter("sequenceXML");
String action = request.getParameter("sequenceAction");
SequenceMediator sequence;
if (action != null) {
if (name != null) {
org.wso2.carbon.sequences.ui.client.EditorUIClient sequenceClient
= SequenceEditorHelper.getClientForEditor(getServletConfig(), session);//new SequenceAdminClient(getServletConfig(), session);
sequence = sequenceClient.getSequenceMediator(name);
} else {
//remove attribute if it is already set in edit dynamic sequence page
session.removeAttribute("registrySequenceName");
sequence = SequenceEditorHelper.getSequenceForEditor(session);//new SequenceMediator();
}
session.setAttribute("editingSequenceAction", action);
} else if (sequenceXML != null && !"".equals(sequenceXML)) {
if (SequenceEditorConstants.ACTION_PARAM_VALUE_ANONIFY.equals(
SequenceEditorHelper.getEditingSequenceAction(session))) {
OMElement elem = SequenceEditorHelper.parseStringToElement(sequenceXML);
// changes the inSequence or outSequence or faultSequence to just sequence
if ("sequence".equals(SequenceEditorHelper.getEditorMode(session))) {
elem.setLocalName("sequence");
}
OMAttribute nameAttr = elem.getAttribute(new QName("name"));
if (nameAttr != null) {
nameAttr.setAttributeValue("__anonSequence__");
} else {
OMFactory fac = elem.getOMFactory();
elem.addAttribute("name", "__anonSequence__", fac.createOMNamespace("", ""));
}
sequenceXML = elem.toString().trim();
}
try {
sequence = SequenceEditorHelper.parseStringToSequence(sequenceXML);
} catch (Exception e) {
session.setAttribute("sequence.error.message", bundle.getString("sequence.source.invalid") + e.getMessage());
%>
<%
return;
}
} else {
sequence = SequenceEditorHelper.getEditingSequence(session);
}
if (sequence == null) {
session.setAttribute("sequence.error.message", bundle.getString("sequence.design.view.error"));
%>
<%
} else {
session.setAttribute("editingSequence", sequence);
// gets the sequence, i.e. in/out/fault
String seq = (String) session.getAttribute("sequence");
HashMap> mediatorMap
= MediatorStore.getInstance().getMediatorMenuItems();
%>
<%if (sequence instanceof TemplateMediator){%>
<%}%>
<%
if (request.getParameter("serviceName") != null) {
%><%=request.getParameter("serviceName")%>: <%
}
if("edit".equals(SequenceEditorHelper.getEditingSequenceAction(session))){
if("in".equals(seq)) {
%> <%
} else if ("out".equals(seq)) {
%> <%
} else if ("fault".equals(seq)) {
%> <%
} else {
%> <%
}
}else{
if("in".equals(seq)) {
%> <%
} else if ("out".equals(seq)) {
%> <%
} else if ("fault".equals(seq)) {
%> <%
} else {
%> <%
}
}
%>
*
onkeypress="return validateText(event);"/>
-
<%
int count = sequence.getList().size();
if (count != 0) {
%>
<%
int position = 0;
for (Mediator mediator : sequence.getList()) {
count--;
Mediator beforeMed = position > 0 ? sequence.getList().get(position - 1) : null;
Mediator afterMed = position + 1 < sequence.getList().size() ? sequence.getList().get(position + 1) : null;
Mediator secondAfterMed = position + 2 < sequence.getList().size() ? sequence.getList().get(position + 2) : null;
%>
<%=SequenceEditorHelper.getMediatorHTML(mediator, count==0, String.valueOf(position), config, beforeMed, afterMed, request.getLocale(), secondAfterMed)%>
<%
position++;
}
%>
<%
}
%>
Sequence Description
<%
if (sequence instanceof TemplateMediator) {
TemplateMediator template = (TemplateMediator) sequence;
String propertyTableStyle = template.getParameters().size() == 0 ? "display:none;" : "";
%>
<%
}
%>
'/>" id="saveButton" onclick="javascript: saveSequence(); return false;"/>
<%
if (SequenceEditorHelper.getEditingSequenceAction(session) != "anonify") {
%>
'/>" id="saveAsButton" onclick="javascript: showSaveAsForm(true); return false;">
<%
}
%>
" id="applyButton" onclick="javascript: applySequence(); return false;"/>
" onclick="javascript: cancelSequence(); return false;"/>
<%
if (session.getAttribute("sequence.error.message") != null) {
%>
<%
session.removeAttribute("sequence.error.message");
}
if (session.getAttribute("sequence.error2.message") != null) {
%>
<%
session.removeAttribute("sequence.error2.message");
}
if (session.getAttribute("sequence.warn.message") != null) {
%>
<%
session.removeAttribute("sequence.warn.message");
}
%>
<%
}
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy