Example usage for org.apache.commons.lang StringUtils substringAfterLast

List of usage examples for org.apache.commons.lang StringUtils substringAfterLast

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils substringAfterLast.

Prototype

public static String substringAfterLast(String str, String separator) 

Source Link

Document

Gets the substring after the last occurrence of a separator.

Usage

From source file:gov.nih.nci.caarray.web.action.project.ProjectFilesAction.java

/**
 * Calculates and returns the JSON for the nodes that are the children of
 * the passed in node. in the experiment tree
 *
 * @return null - the JSON is written directly to the response stream
 *///from w ww  . j  a  va 2 s . c  o m
@SkipValidation
public String importTreeNodesJson() {
    try {
        final JSONArray jsArray = new JSONArray();

        if (this.nodeType == ExperimentDesignTreeNodeType.ROOT) {
            addJsonForExperimentRoots(jsArray);
        } else if (this.nodeType.isExperimentRootNode()) {
            addJsonForExperimentDesignNodes(jsArray, this.nodeType.getChildrenNodeType(),
                    this.nodeType.getContainedNodes(getExperiment()), this.nodeId);
        } else if (this.nodeType.isBiomaterialRootNode()) {
            // the node id of an associated biomaterials container node will end in [number]_[type]
            // where [type] is the container type and [number] is the id of the biomaterial parent
            final Long biomaterialParentId = Long.parseLong(
                    StringUtils.substringAfterLast(StringUtils.substringBeforeLast(this.nodeId, "_"), "_"));
            final AbstractBioMaterial bioMaterialParent = ServiceLocatorFactory.getGenericDataService()
                    .getPersistentObject(AbstractBioMaterial.class, biomaterialParentId);
            addJsonForExperimentDesignNodes(jsArray, this.nodeType.getChildrenNodeType(),
                    this.nodeType.getContainedNodes(bioMaterialParent), this.nodeId);
        } else if (this.nodeType.isBiomaterialNode()) {
            // note that we should never get requested for biomaterial or hybrdization nodes
            // since they are returned with their children already or marked as leaves
            throw new IllegalStateException("Unsupported node type" + this.nodeType);
        }

        ServletActionContext.getResponse().getWriter().write(jsArray.toString());
    } catch (final IOException e) {
        LOG.error("unable to write response", e);
    }
    return null;
}

From source file:com.apdplat.platform.struts.APDPlatPackageBasedActionConfigBuilder.java

/**
 * Creates a single ActionConfig object.
 *
 * @param pkgCfg       The package the action configuration instance will belong to.
 * @param actionClass  The action class.
 * @param actionName   The name of the action.
 * @param actionMethod The method that the annotation was on (if the annotation is not null) or
 *                     the default method (execute).
 * @param annotation   The ActionName annotation that might override the action name and possibly
 *//*from w w  w.ja v  a2  s. co m*/
protected void createActionConfig(PackageConfig.Builder pkgCfg, Class<?> actionClass, String actionName,
        String actionMethod, Action annotation) {
    if (annotation != null) {
        actionName = annotation.value() != null && annotation.value().equals(Action.DEFAULT_VALUE) ? actionName
                : annotation.value();
        actionName = StringUtils.contains(actionName, "/") ? StringUtils.substringAfterLast(actionName, "/")
                : actionName;
    }

    ActionConfig.Builder actionConfig = new ActionConfig.Builder(pkgCfg.getName(), actionName,
            actionClass.getName());
    actionConfig.methodName(actionMethod);

    if (LOG.isDebugEnabled()) {
        LOG.debug("Creating action config for class [" + actionClass.toString() + "], name [" + actionName
                + "] and package name [" + pkgCfg.getName() + "] in namespace [" + pkgCfg.getNamespace() + "]");
    }

    //build interceptors
    List<InterceptorMapping> interceptors = interceptorMapBuilder.build(actionClass, pkgCfg, actionName,
            annotation);
    actionConfig.addInterceptors(interceptors);

    //build results
    Map<String, ResultConfig> results = resultMapBuilder.build(actionClass, annotation, actionName,
            pkgCfg.build());
    actionConfig.addResultConfigs(results);

    //add params
    if (annotation != null)
        actionConfig.addParams(StringTools.createParameterMap(annotation.params()));

    //add exception mappings from annotation
    if (annotation != null && annotation.exceptionMappings() != null)
        actionConfig.addExceptionMappings(buildExceptionMappings(annotation.exceptionMappings(), actionName));

    //add exception mapping from class
    ExceptionMappings exceptionMappings = actionClass.getAnnotation(ExceptionMappings.class);
    if (exceptionMappings != null)
        actionConfig.addExceptionMappings(buildExceptionMappings(exceptionMappings.value(), actionName));

    //add
    pkgCfg.addActionConfig(actionName, actionConfig.build());

    //check if an action with the same name exists on that package (from XML config probably)
    PackageConfig existingPkg = configuration.getPackageConfig(pkgCfg.getName());
    if (existingPkg != null) {
        // there is a package already with that name, check action
        ActionConfig existingActionConfig = existingPkg.getActionConfigs().get(actionName);
        if (existingActionConfig != null && LOG.isWarnEnabled())
            LOG.warn("Duplicated action definition in package [#0] with name [#1].", pkgCfg.getName(),
                    actionName);
    }

    //watch class file
    if (isReloadEnabled()) {
        URL classFile = actionClass.getResource(actionClass.getSimpleName() + ".class");
        FileManager.loadFile(classFile, false);
        loadedFileUrls.add(classFile.toString());
    }
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * //  ww w . j a v a  2 s  .c o  m
 */
protected void fieldSelected() {
    boolean ignoreChanges = isIgnoreChanges();

    setIgnoreChanges(true);

    if (statusBar != null) {
        statusBar.setText("");
    }

    LocalizableItemIFace fld = getSelectedFieldItem();
    if (fld != null && tableInfo != null) {
        fieldInfo = fld != null ? tableInfo.getFieldByName(fld.getName()) : null;
        relInfo = fieldInfo == null ? tableInfo.getRelationshipByName(fld.getName()) : null;

        fillFormatSwticherCBX(tableInfo.getItemByName(fld.getName()));

        if (pcl != null) {
            pcl.propertyChange(new PropertyChangeEvent(fieldsList, "index", null, fld));
        }

        //fld = localizableIO.realize(fld);
        fieldDescText.setText(getDescStrForCurrLocale(fld));
        fieldNameText.setText(getNameDescStrForCurrLocale(fld));
        fieldHideChk.setSelected(fld.getIsHidden());

        String dspName = disciplineType != null ? disciplineType.getName() : null;
        if (AppContextMgr.getInstance().hasContext()
                && AppContextMgr.getInstance().getClassObject(Discipline.class) != null) {
            dspName = AppContextMgr.getInstance().getClassObject(Discipline.class).getType();
        }

        loadPickLists(dspName, fld);

        if (isDBSchema) {
            mustBeRequired = true;
            fieldReqChk.setSelected(false);

            DBTableInfo ti = DBTableIdMgr.getInstance().getInfoByTableName(currContainer.getName());
            if (ti != null) {
                DBFieldInfo fi = ti.getFieldByName(fld.getName());
                if (fi != null) {
                    String ts = fi.getType();
                    String typeStr = ts.indexOf('.') > -1 ? StringUtils.substringAfterLast(fi.getType(), ".")
                            : ts;
                    if (typeStr.equals("Calendar")) {
                        typeStr = "Date";
                    }
                    fieldTypeTxt.setText(typeStr);

                    String lenStr = fi.getLength() != -1 ? Integer.toString(fi.getLength()) : " ";
                    fieldLengthTxt.setText(lenStr);

                    fieldTypeLbl.setEnabled(true);
                    fieldTypeTxt.setEnabled(true);

                    fieldLengthLbl.setEnabled(StringUtils.isNotEmpty(lenStr));
                    fieldLengthTxt.setEnabled(StringUtils.isNotEmpty(lenStr));

                    mustBeRequired = fi.isRequiredInSchema();
                    fieldReqChk.setSelected(mustBeRequired || fld.getIsRequired());

                } else {
                    DBRelationshipInfo ri = ti.getRelationshipByName(fld.getName());
                    if (ri != null) {
                        String title = ri.getType().toString();
                        if (ri.getType() == DBRelationshipInfo.RelationshipType.OneToMany) {
                            title = DBRelationshipInfo.RelationshipType.OneToMany.toString();

                        } else if (ri.getType() == DBRelationshipInfo.RelationshipType.ManyToOne) {
                            title = DBRelationshipInfo.RelationshipType.ManyToOne.toString();
                        }
                        fieldTypeTxt.setText(title + " " + getResourceString("SL_TO") + " "
                                + getNameDescStrForCurrLocale(currContainer));
                        fieldTypeLbl.setEnabled(true);

                        fieldLengthTxt.setText(" ");
                        fieldLengthLbl.setEnabled(false);
                        fieldLengthTxt.setEnabled(false);

                        //fieldReqChk.setSelected(ri.isRequired());
                        fieldReqChk.setSelected(false);//fld.getIsRequired());
                    } else {
                        //throw new RuntimeException("couldn't find field or relationship.");
                    }
                }
            }
        }

        if (doAutoSpellCheck) {
            checker.spellCheck(fieldDescText);
            checker.spellCheck(fieldNameText);
        }

        enableUIControls(true);

    } else {
        enableUIControls(false);
        fieldDescText.setText("");
        fieldNameText.setText("");
        fieldHideChk.setSelected(false);
        fieldTypeTxt.setText("");
        fieldLengthTxt.setText("");
    }

    fillFormatBox(fieldInfo != null ? fieldInfo.getFormatter() : null);
    fillWebLinkBox();

    String label = SL_NONE;

    if (pickListCBX.getSelectedIndex() > 0) {
        label = SL_PICKLIST;
    }

    if (formatCombo.getSelectedIndex() > 0) {
        label = SL_FORMAT;
    }

    if (webLinkCombo.getSelectedIndex() > 0) {
        label = SL_WEBLINK;
    }

    formatSwitcherCombo.setSelectedItem(label);

    boolean ok = fld != null;
    fieldDescText.setEnabled(ok);
    fieldNameText.setEnabled(ok);
    fieldNameLbl.setEnabled(ok);
    fieldDescLbl.setEnabled(ok);

    setIgnoreChanges(ignoreChanges);

    prevField = fld;

    updateBtns();

    hasChanged = false;
}

From source file:edu.ku.brc.specify.tools.datamodelgenerator.DatamodelGenerator.java

protected void adjustRelsForZeroToOne(final Table tbl) {
    String shortTableName = StringUtils.substringAfterLast(tbl.getName(), ".");
    if (shortTableName.equals("Locality")) {
        setRelToZeroToOne(tbl.getRelationships(), "localityDetails");
        setRelToZeroToOne(tbl.getRelationships(), "geoCoordDetails");
    }//from  w  ww  . ja  va  2 s. c o m
}

From source file:adalid.commons.velocity.Writer.java

private void deletePreviouslyGeneratedFiles(String name, String[] stringArray, boolean recursive) {
    String root = getRoot().getPath();
    String raiz = root.replace('\\', '/');
    String path, pathname, wildcard;
    String recursively = recursive ? "and all its subdirectories" : "";
    String slashedPath, regex, pattern, message;
    String hint = "; check property: {0}={1}";
    boolean delete;
    File directory;/*from w  w w  .j a  va2 s.com*/
    IOFileFilter fileFilter;
    IOFileFilter dirFilter = recursive ? ignoreVersionControlFilter : null;
    Collection<File> matchingFiles;
    Arrays.sort(stringArray);
    for (String string : stringArray) {
        pathname = StringUtils.substringBeforeLast(string, SLASH);
        if (StringUtils.isBlank(string) || !StringUtils.contains(string, SLASH)
                || StringUtils.isBlank(pathname)) {
            pattern = "directory is missing or invalid" + hint;
            message = MessageFormat.format(pattern, name, string);
            log(_alertLevel, message);
            warnings++;
            continue;
        }
        wildcard = StringUtils.substringAfterLast(string, SLASH);
        if (StringUtils.isBlank(wildcard)) {
            pattern = "wildcard is missing or invalid" + hint;
            message = MessageFormat.format(pattern, name, string);
            log(_alertLevel, message);
            warnings++;
            continue;
        }
        directory = new File(pathname);
        if (FilUtils.isNotWritableDirectory(directory)) {
            pattern = "{2} is not a writable directory" + hint;
            message = MessageFormat.format(pattern, name, string,
                    StringUtils.removeStartIgnoreCase(pathname, raiz));
            log(_alertLevel, message);
            warnings++;
            continue;
        }
        log(_detailLevel, "deleting files " + wildcard + " from "
                + StringUtils.removeStartIgnoreCase(pathname, raiz) + " " + recursively);
        fileFilter = new WildcardFileFilter(wildcard);
        matchingFiles = FileUtils.listFiles(directory, fileFilter, dirFilter);
        for (File file : matchingFiles) {
            path = file.getPath();
            slashedPath = path.replace('\\', '/');
            delete = true;
            for (Pattern fxp : filePreservationPatterns) {
                regex = fxp.pattern();
                if (slashedPath.matches(regex)) {
                    delete = false;
                    pattern = "file {0} will not be deleted; it matches preservation expression \"{1}\"";
                    message = MessageFormat.format(pattern,
                            StringUtils.removeStartIgnoreCase(slashedPath, raiz), regex);
                    log(_alertLevel, message);
                    warnings++;
                    break;
                }
            }
            if (delete) {
                logger.trace("deleting " + StringUtils.removeStartIgnoreCase(path, root));
                FileUtils.deleteQuietly(file);
            }
        }
    }
}

From source file:de.iteratec.iteraplan.businesslogic.service.legacyExcel.ExcelImportServiceImpl.java

/**
 * Returns the Parent name by passing a hierarchical name, or null if not found.
 * //  w  w  w .  j a  v a  2s  .c o m
 * @param nameHierarchy
 * @param nameNonHierarchy
 *          If passed (not null), checks that this is the name contained in the other parameter, returning null on mismatch.
 */
String getParentNameFromHierarchicalName(String nameHierarchy, String nameNonHierarchy,
        String cellCoordinates) {
    if (nameHierarchy == null) {
        return null;
    }

    // If there is at least one :, there is a parent
    final String hierarchySeparator = Constants.HIERARCHYSEP.trim();

    if (nameHierarchy.contains(hierarchySeparator)) {
        // Only verify the name if this parameter was passed
        if (nameNonHierarchy != null) {
            String nameNonHierarchyFound = StringUtils.substringAfterLast(nameHierarchy, hierarchySeparator);
            nameNonHierarchyFound = StringUtils.strip(nameNonHierarchyFound);

            // Check if the Name part of the Hierarchy is the one we expected
            if (!nameNonHierarchyFound.equalsIgnoreCase(nameNonHierarchy)) {
                getProcessingLog().warn(
                        "Hierarchical Name \"{0}\" in cell [{1}] does not contain the name of the BuildingBlock it belongs to ({2}). Not setting parent!",
                        nameHierarchy, cellCoordinates, nameNonHierarchy);
                return null;
            }
        }
        String allBeforeName = StringUtils.substringBeforeLast(nameHierarchy, hierarchySeparator);
        allBeforeName = StringUtils.strip(allBeforeName);

        // Strip grandparents+ if necessary
        if (allBeforeName.contains(hierarchySeparator)) {
            return StringUtils.substringAfterLast(allBeforeName, Constants.HIERARCHYSEP).trim();
        }
        return allBeforeName;
    }
    return null;
}

From source file:net.sourceforge.subsonic.security.RESTRequestParameterProcessingFilter.java

/**
 * {@inheritDoc}/* ww  w. java 2 s . co  m*/
 */
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    if (!(request instanceof HttpServletRequest)) {
        throw new ServletException("Can only process HttpServletRequest");
    }
    if (!(response instanceof HttpServletResponse)) {
        throw new ServletException("Can only process HttpServletResponse");
    }

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;

    String username = StringUtils.trimToNull(httpRequest.getParameter("u"));
    String password = decrypt(StringUtils.trimToNull(httpRequest.getParameter("p")));
    String version = StringUtils.trimToNull(httpRequest.getParameter("v"));
    String client = StringUtils.trimToNull(httpRequest.getParameter("c"));

    RESTController.ErrorCode errorCode = null;

    // The username and password parameters are not required if the user
    // was previously authenticated, for example using Basic Auth.
    Authentication previousAuth = SecurityContextHolder.getContext().getAuthentication();
    boolean missingCredentials = previousAuth == null && (username == null || password == null);
    if (missingCredentials || version == null || client == null) {
        errorCode = RESTController.ErrorCode.MISSING_PARAMETER;
    }

    if (errorCode == null) {
        errorCode = checkAPIVersion(version);
    }

    if (errorCode == null) {
        errorCode = authenticate(username, password, previousAuth);
    }

    if (errorCode == null) {
        String restMethod = StringUtils.substringAfterLast(httpRequest.getRequestURI(), "/");
        errorCode = checkLicense(client, restMethod);
    }

    if (errorCode == null) {
        chain.doFilter(request, response);
    } else {
        SecurityContextHolder.getContext().setAuthentication(null);
        sendErrorXml(httpRequest, httpResponse, errorCode);
    }
}

From source file:nl.nn.adapterframework.extensions.svn.ScanTibcoSolutionPipe.java

private void addFileContent(XMLStreamWriter xmlStreamWriter, String urlString, String type)
        throws XMLStreamException {
    xmlStreamWriter.writeStartElement("content");
    xmlStreamWriter.writeAttribute("type", type);
    String content;//  w w w. j  av a  2 s . c o m
    try {
        content = getHtml(urlString);
    } catch (Exception e) {
        error(xmlStreamWriter, "error occured during getting file content", e, true);
        content = null;
    }
    if (content != null) {
        Vector<String> warnMessage = new Vector<String>();
        try {
            if (type.equals("jmsDest") || type.equals("jmsDestConf")) {
                // AMX - receive (for jmsInboundDest)
                Collection<String> c1 = XmlUtils.evaluateXPathNodeSet(content, "namedResource/@name");
                if (c1 != null && c1.size() > 0) {
                    if (c1.size() > 1) {
                        warnMessage.add("more then one resourceName found");
                    }
                    String resourceName = (String) c1.iterator().next();
                    xmlStreamWriter.writeStartElement("resourceName");
                    xmlStreamWriter.writeCharacters(resourceName);
                    xmlStreamWriter.writeEndElement();
                } else {
                    warnMessage.add("no resourceName found");
                }
                Collection<String> c2 = XmlUtils.evaluateXPathNodeSet(content,
                        "namedResource/configuration/@jndiName");
                if (c2 != null && c2.size() > 0) {
                    if (c2.size() > 1) {
                        warnMessage.add("more then one resourceJndiName found");
                    }
                    String resourceJndiName = (String) c2.iterator().next();
                    xmlStreamWriter.writeStartElement("resourceJndiName");
                    xmlStreamWriter.writeCharacters(resourceJndiName);
                    xmlStreamWriter.writeEndElement();
                } else {
                    warnMessage.add("no resourceJndiName found");
                }
            } else if (type.equals("composite")) {
                // AMX - receive
                Collection<String> c1 = XmlUtils.evaluateXPathNodeSet(content,
                        "composite/service/bindingAdjunct/property[@name='JmsInboundDestinationConfig']/@simpleValue");
                if (c1 != null && c1.size() > 0) {
                    for (Iterator<String> c1it = c1.iterator(); c1it.hasNext();) {
                        xmlStreamWriter.writeStartElement("jmsInboundDest");
                        xmlStreamWriter.writeCharacters(c1it.next());
                        xmlStreamWriter.writeEndElement();
                    }
                } else {
                    warnMessage.add("no jmsInboundDest found");
                }
                // AMX - send
                Collection<String> c2 = XmlUtils.evaluateXPathNodeSet(content,
                        "composite/reference/interface.wsdl/@wsdlLocation");
                if (c2 != null && c2.size() > 0) {
                    for (Iterator<String> c2it = c2.iterator(); c2it.hasNext();) {
                        String itn = c2it.next();
                        String wsdl = null;
                        try {
                            URL url = new URL(urlString);
                            URL wsdlUrl = new URL(url, itn);
                            wsdl = getHtml(wsdlUrl.toString());
                        } catch (Exception e) {
                            error(xmlStreamWriter, "error occured during getting wsdl file content", e, true);
                            wsdl = null;
                        }
                        if (wsdl != null) {
                            Collection<String> c3 = XmlUtils.evaluateXPathNodeSet(wsdl,
                                    // "definitions/service/port/targetAddress",
                                    // "concat(.,';',../../@name)");
                                    "definitions/service/port/targetAddress");
                            if (c3 != null && c3.size() > 0) {
                                for (Iterator<String> c3it = c3.iterator(); c3it.hasNext();) {
                                    xmlStreamWriter.writeStartElement("targetAddr");
                                    xmlStreamWriter.writeCharacters(c3it.next());
                                    xmlStreamWriter.writeEndElement();
                                }
                            } else {
                                warnMessage.add("no targetAddr found");
                            }
                        } else {
                            warnMessage.add("wsdl [" + itn + "] not found");
                        }
                    }
                } else {
                    warnMessage.add("no wsdlLocation found");
                }
            } else if (type.equals("process")) {
                // BW - receive
                Double d1 = XmlUtils.evaluateXPathNumber(content,
                        "count(ProcessDefinition/starter[type='com.tibco.plugin.soap.SOAPEventSource']/config)");
                if (d1 > 0) {
                    Collection<String> c1 = XmlUtils.evaluateXPathNodeSet(content,
                            "ProcessDefinition/starter[type='com.tibco.plugin.soap.SOAPEventSource']/config/sharedChannels/jmsChannel/JMSTo");
                    if (c1 != null && c1.size() > 0) {
                        for (Iterator<String> c1it = c1.iterator(); c1it.hasNext();) {
                            xmlStreamWriter.writeStartElement("jmsTo");
                            xmlStreamWriter.writeAttribute("type", "soapEventSource");
                            xmlStreamWriter.writeCharacters(c1it.next());
                            xmlStreamWriter.writeEndElement();
                        }
                    } else {
                        warnMessage.add("no jmsTo found for soapEventSource");
                    }
                } else {
                    warnMessage.add("no soapEventSource found");
                }
                // BW - send
                Double d2 = XmlUtils.evaluateXPathNumber(content,
                        "count(ProcessDefinition/activity[type='com.tibco.plugin.soap.SOAPSendReceiveActivity']/config)");
                if (d2 > 0) {
                    Collection<String> c2 = XmlUtils.evaluateXPathNodeSet(content,
                            "ProcessDefinition/activity[type='com.tibco.plugin.soap.SOAPSendReceiveActivity']/config/sharedChannels/jmsChannel/JMSTo");
                    if (c2 != null && c2.size() > 0) {
                        for (Iterator<String> c2it = c2.iterator(); c2it.hasNext();) {
                            xmlStreamWriter.writeStartElement("jmsTo");
                            xmlStreamWriter.writeAttribute("type", "soapSendReceiveActivity");
                            xmlStreamWriter.writeCharacters(c2it.next());
                            xmlStreamWriter.writeEndElement();
                        }
                    } else {
                        warnMessage.add("no jmsTo found for soapSendReceiveActivity");
                    }
                } else {
                    warnMessage.add("no soapSendReceiveActivity found");
                }
            } else if (type.equals("substVar")) {
                String path = StringUtils
                        .substringBeforeLast(StringUtils.substringAfterLast(urlString, "/defaultVars/"), "/");
                Map<String, String> m1 = XmlUtils.evaluateXPathNodeSet(content,
                        "repository/globalVariables/globalVariable", "name", "value");
                if (m1 != null && m1.size() > 0) {
                    for (Iterator<String> m1it = m1.keySet().iterator(); m1it.hasNext();) {
                        Object key = m1it.next();
                        Object value = m1.get(key);
                        xmlStreamWriter.writeStartElement("globalVariable");
                        xmlStreamWriter.writeAttribute("name", (String) key);
                        xmlStreamWriter.writeAttribute("ref", "%%" + path + "/" + key + "%%");
                        xmlStreamWriter.writeCharacters((String) value);
                        xmlStreamWriter.writeEndElement();
                    }
                } else {
                    warnMessage.add("no globalVariable found");
                }
                /*
                 * } else { content = XmlUtils.removeNamespaces(content);
                 * xmlStreamWriter.writeCharacters(content);
                 */
            }
        } catch (Exception e) {
            error(xmlStreamWriter, "error occured during processing " + type + " file", e, true);
        }
        if (warnMessage.size() > 0) {
            xmlStreamWriter.writeStartElement("warnMessages");
            for (int i = 0; i < warnMessage.size(); i++) {
                xmlStreamWriter.writeStartElement("warnMessage");
                xmlStreamWriter.writeCharacters(warnMessage.elementAt(i));
                xmlStreamWriter.writeEndElement();
            }
            xmlStreamWriter.writeEndElement();
        }
    }
    xmlStreamWriter.writeEndElement();
}

From source file:nl.nn.adapterframework.webcontrol.pipes.Webservices.java

private String doGet(IPipeLineSession session) throws PipeRunException {
    IbisManager ibisManager = RestListenerUtils.retrieveIbisManager(session);

    String uri = (String) session.get("uri");
    String indent = (String) session.get("indent");
    String useIncludes = (String) session.get("useIncludes");

    if (StringUtils.isNotEmpty(uri) && (uri.endsWith(getWsdlExtention()) || uri.endsWith(".zip"))) {
        String adapterName = StringUtils.substringBeforeLast(StringUtils.substringAfterLast(uri, "/"), ".");
        IAdapter adapter = ibisManager.getRegisteredAdapter(adapterName);
        if (adapter == null) {
            throw new PipeRunException(this,
                    getLogPrefix(session) + "adapter [" + adapterName + "] doesn't exist");
        }/*from w  w  w  .j a  v  a2s.  co  m*/
        try {
            if (uri.endsWith(getWsdlExtention())) {
                RestListenerUtils.setResponseContentType(session, "application/xml");
                wsdl((Adapter) adapter, session, indent, useIncludes);
            } else {
                RestListenerUtils.setResponseContentType(session, "application/octet-stream");
                zip((Adapter) adapter, session);
            }

        } catch (Exception e) {
            throw new PipeRunException(this, getLogPrefix(session) + "exception on retrieving wsdl", e);
        }
        return "";
    } else {
        return list(ibisManager);
    }
}

From source file:org.akaza.openclinica.control.core.SecureController.java

License:asdf

public String getRequestSchema(HttpServletRequest request) {
    switch (StringUtils.substringAfterLast(request.getRequestURI(), "/")) {
    case "ChangeStudy":
    case "DeleteStudyUserRole":
    case "DeleteUser":
    case "ListStudyUser":
    case "ViewUserAccount":
    case "ListUserAccounts":
    case "CreateUserAccount":
    case "SetUserRole":
    case "ListStudy":
    case "AuditUserActivity":
    case "EditStudyUserRole":
    case "SignStudySubject":
        return "public";
    default://from  ww  w . ja v a 2 s  . co m
        return currentPublicStudy.getSchemaName();
    }
}