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

web.sequences.list_sequences.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.wso2.carbon.sequences.common.to.SequenceInfo" %>
<%@ page import="org.wso2.carbon.sequences.ui.client.SequenceAdminClient" %>
<%@ page import="org.wso2.carbon.sequences.ui.SequenceEditorConstants" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
















<%
    //remove session variables if user exited form design sequence of proxy admin
    session.removeAttribute("sequence");

    //remove any sessions related to templates since template mode settings should not interfere
    //with sequence editor mode settings

    //remove attribute to restate sequence-editor mode
    session.removeAttribute("editorClientFactory");
    session.removeAttribute("sequenceAnonOriginator");
    //remove any endpoint template related session attribs to avoid any confilcts
    session.removeAttribute("endpointTemplate");
    session.removeAttribute("templateEdittingMode");
    session.removeAttribute("templateRegKey");

    SequenceAdminClient sequenceAdminClient
            = new SequenceAdminClient(this.getServletConfig(), session);
    SequenceInfo[] sequences = null;
    SequenceInfo[] dynamicSequences = null;
    String pageNumberStr = request.getParameter("pageNumber");
    String dynamicPageNumberStr = request.getParameter("dynamicPageNumber");
    String sequenceSearchString = request.getParameter("sequenceSearchString");
    boolean isSuccessfulSearch = true;
    if (sequenceSearchString == null) {
        sequenceSearchString = "";
    }
    int pageNumber = 0;
    int dynamicPageNumber = 0;
    if (pageNumberStr != null) {
        pageNumber = Integer.parseInt(pageNumberStr);
    }
    if (dynamicPageNumberStr != null) {
        dynamicPageNumber = Integer.parseInt(dynamicPageNumberStr);
    }
    int numberOfPages = 0;
    int numberOfDynamicPages = 0;
    try {
        int seqCount = 0;
        int dynamicSequenceCount = 0;
        if (sequenceSearchString.equals("")) {

            sequences = sequenceAdminClient.getSequences(pageNumber, SequenceEditorConstants.SEQUENCE_PER_PAGE);
            dynamicSequences = sequenceAdminClient.getDynamicSequences(dynamicPageNumber,
                    SequenceEditorConstants.SEQUENCE_PER_PAGE);
            seqCount = sequenceAdminClient.getSequencesCount();
            dynamicSequenceCount = sequenceAdminClient.getDynamicSequenceCount();
        }


        else{

            sequences = sequenceAdminClient.getSequencesSearch(pageNumber, SequenceEditorConstants.SEQUENCE_PER_PAGE, sequenceSearchString);
            if (sequences == null) {
                seqCount = sequenceAdminClient.getSequencesCount();
            } else {
                seqCount = sequences.length;
            }
            dynamicSequences = sequenceAdminClient.getDynamicSequencesSearch(dynamicPageNumber, SequenceEditorConstants.SEQUENCE_PER_PAGE, sequenceSearchString);
            if (dynamicSequences == null) {
                dynamicSequenceCount = sequenceAdminClient.getDynamicSequenceCount();

            } else {
                dynamicSequenceCount = dynamicSequences.length;
            }

            if (sequences == null && dynamicSequences == null) {
                isSuccessfulSearch = false;
            }
        }

        if (!isSuccessfulSearch) {
            sequences = sequenceAdminClient.getSequences(pageNumber, SequenceEditorConstants.SEQUENCE_PER_PAGE);
            dynamicSequences = sequenceAdminClient.getDynamicSequences(dynamicPageNumber,
                    SequenceEditorConstants.SEQUENCE_PER_PAGE);
            seqCount = sequenceAdminClient.getSequencesCount();
            dynamicSequenceCount = sequenceAdminClient.getDynamicSequenceCount();
        }


        if (seqCount % SequenceEditorConstants.SEQUENCE_PER_PAGE == 0) {
            numberOfPages = seqCount / SequenceEditorConstants.SEQUENCE_PER_PAGE;
        } else {
            numberOfPages = seqCount / SequenceEditorConstants.SEQUENCE_PER_PAGE + 1;
        }

        if (dynamicSequenceCount % SequenceEditorConstants.SEQUENCE_PER_PAGE == 0) {
            numberOfDynamicPages = dynamicSequenceCount / SequenceEditorConstants.SEQUENCE_PER_PAGE;
        } else {
            numberOfDynamicPages = dynamicSequenceCount / SequenceEditorConstants.SEQUENCE_PER_PAGE + 1;
        }
    } catch (Exception e) {
        CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request, e);
%>

<%
        return;
    }

    ResourceBundle bundle = ResourceBundle.getBundle("org.wso2.carbon.sequences.ui.i18n.Resources",
            request.getLocale());
    if ("fail".equals(session.getAttribute("dynamic_edit"))) {
%>

<%
        session.removeAttribute("dynamic_edit");
    }
    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
    session.removeAttribute("mediator.position");

    String dependencyMgtError = (String) session.getAttribute("seq.d.mgt.error.msg");
    if (dependencyMgtError != null) {
        String seqToDelete = (String) session.getAttribute("seq.d.mgt.error.name");
%>

<%
        session.removeAttribute("seq.d.mgt.error.msg");
        session.removeAttribute("seq.d.mgt.error.name");
    }

%>










<% if ( sequenceAdminClient!=null) { %> <%=" :- " + sequenceAdminClient.getSequencesCount()%> <% } %>


<% if (!isSuccessfulSearch) { %> <% } %>
  ">

"/>

<% if(sequences != null) { for (SequenceInfo sequence : sequences) { %> <% if (sequence.isEnableStatistics()) { %> <% } else { %> <% } %> <% if (sequence.isEnableTracing()) { %> <% } else { %> <% } %> <% if (sequence.getArtifactContainerName() != null) { %> <% } else { %> <% } %> <% } }%>
  onmouseover="showTooltip(this,'<%=sequence.getDescription()%>')" <% } %>> <% if (sequence.getArtifactContainerName() != null) { %> <%=Encode.forHtmlContent(sequence.getName())%> <% if(sequence.getIsEdited()) { %> ( Edited ) <% } %> <% } else { %> <%=Encode.forHtmlContent(sequence.getName())%> <% } %>

 



"/>
<% if ((dynamicSequences != null) && (dynamicSequences.length > 0)) { %>


"/>
<% for (SequenceInfo sequence : dynamicSequences) { %> <% } %>
<%= Encode.forHtmlContent(sequence.getName()) %>

"/> <% } else { %>

<% } %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy