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

web.sequences.ns_save-ajaxprocessor.jsp Maven / Gradle / Ivy

The newest version!

<%@ page import="org.wso2.carbon.sequences.ui.util.ns.NameSpacesInformationRepository" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.ns.NameSpacesInformation" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.SequenceEditorHelper" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>

<%
    String currentID = request.getParameter("currentID");
    if (currentID == null || "".equals(currentID)) {
        //TODO
        throw new RuntimeException("'currentID' parameter cannot be found");
    }

    NameSpacesInformationRepository repository = (NameSpacesInformationRepository) session.getAttribute(
            NameSpacesInformationRepository.NAMESPACES_INFORMATION_REPOSITORY);
    NameSpacesInformation information = null;
    if (repository == null) {
        repository = new NameSpacesInformationRepository();
        session.setAttribute(NameSpacesInformationRepository.NAMESPACES_INFORMATION_REPOSITORY, repository);
    } else {
        information = repository.getNameSpacesInformation(SequenceEditorHelper.getEditingMediatorPosition(session), currentID);
    }
    if (information == null) {
        information = new NameSpacesInformation();
        repository.addNameSpacesInformation(SequenceEditorHelper.getEditingMediatorPosition(session), currentID, information);
    }
    information.removeAllNameSpaces();
    String CountParameter = request.getParameter("nsCount");
    if (CountParameter != null && !"".equals(CountParameter)) {
        try {
            int count = Integer.parseInt(CountParameter.trim());
            for (int i = 0; i < count; i++) {
                String prefix = request.getParameter("prefix" + i);
                String uri = request.getParameter("uri" + i);
                if (prefix != null && uri != null && !"".equals(uri)) {
                    information.addNameSpace(prefix.trim(), uri.trim());
                }
            }
        } catch (NumberFormatException ignored) {
        }
    }
%>





© 2015 - 2025 Weber Informatics LLC | Privacy Policy