Example usage for org.apache.commons.lang3 StringUtils isNoneBlank

List of usage examples for org.apache.commons.lang3 StringUtils isNoneBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isNoneBlank.

Prototype

public static boolean isNoneBlank(final CharSequence... css) 

Source Link

Document

Checks if none of the CharSequences are blank ("") or null and whitespace only..

 StringUtils.isNoneBlank(null)             = false StringUtils.isNoneBlank(null, "foo")      = false StringUtils.isNoneBlank(null, null)       = false StringUtils.isNoneBlank("", "bar")        = false StringUtils.isNoneBlank("bob", "")        = false StringUtils.isNoneBlank("  bob  ", null)  = false StringUtils.isNoneBlank(" ", "bar")       = false StringUtils.isNoneBlank("foo", "bar")     = true 

Usage

From source file:org.kuali.coeus.common.budget.framework.nonpersonnel.BudgetLineItem.java

public String getLineItemGroupDescription() {
    StringBuilder personDetailGroup = new StringBuilder();
    personDetailGroup.append(getCostElementBO().getDescription());
    if (StringUtils.isNoneBlank(getGroupName())) {
        personDetailGroup.append(" (");
        personDetailGroup.append(getGroupName());
        personDetailGroup.append(")");
    }// w w w . j  a  v  a 2  s .co  m
    return personDetailGroup.toString();
}

From source file:org.kuali.test.runner.execution.HttpRequestOperationExecution.java

private boolean isBackdoorLogin(WebRequest request) {
    boolean retval = false;
    if (request != null) {
        URL url = request.getUrl();

        if (url != null) {
            String surl = url.toExternalForm();
            retval = (StringUtils.isNoneBlank(surl) && surl.toLowerCase().endsWith("backdoorlogin.do"));
        }/*  www. j  av  a2 s  .c o m*/
    }

    return retval;
}

From source file:org.kuali.test.ui.components.dialogs.PlatformDlg.java

/**
 *
 * @return/*from  ww w  .j  av  a 2s .c  o m*/
 */
@Override
protected boolean save() {
    boolean retval = false;
    boolean oktosave = true;
    if (StringUtils.isNotBlank(name.getText()) && StringUtils.isNotBlank((String) application.getSelectedItem())
            && StringUtils.isNotBlank(version.getText())) {

        if (!isEditmode()) {
            if (platformNameExists()) {
                oktosave = false;
                displayExistingNameAlert("Platform", name.getText());
            }
        }
    } else {
        displayRequiredFieldsMissingAlert("Platform", "name, application, version");
        oktosave = false;
    }

    if (oktosave) {
        if (!isEditmode()) {
            platform = getConfiguration().getPlatforms().addNewPlatform();
            platform.setName(name.getText());
            platform.addNewPlatformTests();
            platform.addNewTestSuites();
        }
        platform.setApplication(KualiApplication.Enum.forString(application.getSelectedItem().toString()));
        platform.setWebServiceName(webService.getSelectedItem().toString());
        platform.setWebUrl(weburl.getText());
        platform.setVersion(version.getText());

        String s = emailAddresses.getText();

        if (StringUtils.isNotBlank(s)) {
            platform.setEmailAddresses(s);
        }

        s = (String) dbconnection.getSelectedItem();

        if (StringUtils.isNoneBlank(s)) {
            platform.setDatabaseConnectionName(s);
        }

        s = (String) jmxConnection.getSelectedItem();

        if (StringUtils.isNoneBlank(s)) {
            platform.setJmxConnectionName(s);
        }

        getConfiguration().setModified(true);
        setSaved(true);
        dispose();
        retval = true;
    }

    return retval;
}

From source file:org.kuali.test.ui.components.dialogs.TestExecutionParameterDetailsDlg.java

private void initComponents(TestExecutionParameter parameter) {
    String[] labels = { "Parameter Name", "Handler", "Additional Info" };

    String handlerName = "";
    if (StringUtils.isNoneBlank(parameter.getParameterHandler())) {
        try {/*from   ww  w. j  a v  a  2s . c  o m*/
            handlerName = Class.forName(parameter.getParameterHandler()).newInstance().toString();
        }

        catch (Exception ex) {
            handlerName = "unknown handler";
        }
        ;
    }

    String additionalInfo = parameter.getAdditionalInfo();

    if (StringUtils.isBlank(additionalInfo)) {
        additionalInfo = "";
    }

    JComponent[] components = { new DataDisplayLabel(parameter.getName()), new DataDisplayLabel(handlerName),
            new DataDisplayLabel(additionalInfo) };

    getContentPane().add(UIUtils.buildEntryPanel(labels, components), BorderLayout.NORTH);
    getContentPane().add(new TablePanel(buildPropertiesTable(parameter.getValueProperty()), 5),
            BorderLayout.CENTER);

    addStandardButtons();
    getSaveButton().setVisible(false);
    setDefaultBehavior();
}

From source file:org.kuali.test.ui.components.panels.HtmlCheckpointPanel.java

private void updatePropertyValueIfRequired(CheckpointProperty cp) {
    if (StringUtils.isBlank(cp.getPropertyValue())) {
        Parameter nameParam = Utils.getCheckpointPropertyTagParameter(cp, Constants.HTML_TAG_ATTRIBUTE_ID);
        Parameter iframeIdParam = Utils.getCheckpointPropertyTagParameter(cp, Constants.IFRAME_IDS);
        String iframeIds = null;/*from w  w  w . j a  va 2 s  .  c  o  m*/
        if (iframeIdParam != null) {
            iframeIds = iframeIdParam.getValue();
        }

        String currentValue = null;

        if (nameParam != null) {
            currentValue = getCurrentDomValueById(cp, iframeIds, nameParam.getValue());
        } else {
            nameParam = Utils.getCheckpointPropertyTagParameter(cp, Constants.HTML_TAG_ATTRIBUTE_NAME);

            if (nameParam != null) {
                currentValue = getCurrentDomValueByName(cp, iframeIds, nameParam.getValue());
            }
        }

        if (StringUtils.isNoneBlank(currentValue)) {
            cp.setPropertyValue(currentValue);
        }
    }
}

From source file:org.kuali.test.utils.Utils.java

/**
 *
 * @param prefix//w  w  w. jav  a 2s. c  om
 * @param propertyName
 * @return
 */
public static String buildMethodNameFromPropertyName(String prefix, String propertyName) {
    String retval = null;
    if (StringUtils.isNoneBlank(prefix) && StringUtils.isNotBlank(propertyName)) {
        StringBuilder buf = new StringBuilder(32);
        buf.append(prefix);
        buf.append(Character.toUpperCase(propertyName.charAt(0)));
        buf.append(propertyName.substring(1));
        retval = buf.toString();
    }

    return retval;
}

From source file:org.mifosplatform.infrastructure.core.service.TenantDatabaseUpgradeService.java

/**
 * check if the flyway.enabled property in the "/var/lib/tomcat7/conf/flyway.properties" file is set to true
 * N/B - This is a temporary fix for the duplicate job scheduling issue resulting from running on a clustered
 * environment//from   w w  w.j av  a  2  s  .c om
 *
 * @return boolean true if value is true, else false
 **/
private boolean isFlywayEnabled() {
    // scheduler is enabled by default
    boolean isEnabled = true;
    Properties flywayProperties = new Properties();
    InputStream flywayPropertiesInputStream = null;
    File catalinaBaseConfDirectory = null;
    File flywayPropertiesFile = null;
    String flywayEnabledValue = null;

    try {
        // create a new File instance for the catalina base conf directory
        catalinaBaseConfDirectory = new File(System.getProperty("catalina.base"), "conf");

        // create a new File instance for the flyway properties file
        flywayPropertiesFile = new File(catalinaBaseConfDirectory, "flyway.properties");

        // create file inputstream to the flyway properties file
        flywayPropertiesInputStream = new FileInputStream(flywayPropertiesFile);

        // read property list from input stream 
        flywayProperties.load(flywayPropertiesInputStream);

        flywayEnabledValue = flywayProperties.getProperty("flyway.enabled");

        // make sure it isn't blank, before trying to parse the string as boolean
        if (StringUtils.isNoneBlank(flywayEnabledValue)) {
            isEnabled = Boolean.parseBoolean(flywayEnabledValue);
        }
    }

    catch (FileNotFoundException ex) {
        isEnabled = true;
    }

    catch (IOException ex) {
        logger.error(ex.getMessage(), ex);
    }

    finally {
        if (flywayPropertiesInputStream != null) {
            try {
                flywayPropertiesInputStream.close();
            }

            catch (IOException e) {
                logger.error(e.getMessage(), e);
            }
        }
    }

    return isEnabled;
}

From source file:org.nuxeo.ecm.web.resources.wro.processor.SassCssFlavorProcessor.java

@Override
public void process(final Resource resource, final Reader reader, final Writer writer, String flavorName)
        throws IOException {
    if (isEnabled(resource)) {
        Reader finalReader = null;
        try {//from   ww  w  . ja  va  2 s  .  c o  m
            String varContents = "";
            if (flavorName != null) {
                ThemeStylingService s = Framework.getService(ThemeStylingService.class);
                FlavorDescriptor fd = s.getFlavor(flavorName);
                if (fd != null) {
                    List<SassImport> sassVars = fd.getSassImports();
                    if (sassVars != null) {
                        for (SassImport var : sassVars) {
                            varContents += var.getContent();
                        }
                    }
                }
            }

            InputSource source = null;
            if (StringUtils.isNoneBlank(varContents)) {
                byte[] varBytes = varContents.getBytes();
                byte[] initalBytes = IOUtils.toByteArray(reader);
                reader.close();
                byte[] finalBytes = ArrayUtils.addAll(varBytes, initalBytes);
                finalReader = new InputStreamReader(new ByteArrayInputStream(finalBytes));
            } else {
                finalReader = reader;
            }
            source = new InputSource(finalReader);
            source.setEncoding(getEncoding());
            SCSSDocumentHandlerImpl scssDocumentHandlerImpl = new SCSSDocumentHandlerImpl();
            ScssStylesheet stylesheet = scssDocumentHandlerImpl.getStyleSheet();

            Parser parser = new Parser();
            parser.setErrorHandler(new SCSSErrorHandler());
            parser.setDocumentHandler(scssDocumentHandlerImpl);

            try {
                parser.parseStyleSheet(source);
            } catch (ParseException e) {
                log.error("Error while parsing resource " + resource.getUri(), e);
                throw WroRuntimeException.wrap(new SCSSParseException(e, resource.getUri()));
            }

            stylesheet.setCharset(getEncoding());
            stylesheet.addSourceUris(Arrays.asList(resource.getUri()));

            stylesheet.compile();

            StringBuilder string = new StringBuilder("");
            String delimeter = "\n\n";
            List<Node> children = stylesheet.getChildren();
            if (children.size() > 0) {
                string.append(ScssStylesheet.PRINT_STRATEGY.build(children.get(0)));
            }
            if (children.size() > 1) {
                for (int i = 1; i < children.size(); i++) {
                    String childString = ScssStylesheet.PRINT_STRATEGY.build(children.get(i));
                    if (childString != null) {
                        string.append(delimeter).append(childString);
                    }
                }
            }

            String content = string.toString();

            writer.write(content);
            writer.flush();
            if (finalReader != null) {
                finalReader.close();
            }
        } catch (final Exception e) {
            log.error("Error while serving resource " + resource.getUri(), e);
            throw WroRuntimeException.wrap(e);
        } finally {
            IOUtils.closeQuietly(finalReader);
        }

    } else {
        IOUtils.copy(reader, writer);
    }
}

From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java

private void appendPersonBirthLocation(Person person, Element personElement) {
    if (StringUtils.isNoneBlank(person.getPlaceOfBirth())) {
        Element personBirthLocation = XmlUtils.appendElement(personElement, NS_NC_30, "PersonBirthLocation");
        Element locationCategoryText = XmlUtils.appendElement(personBirthLocation, NS_NC_30,
                "LocationCategoryText");
        locationCategoryText.setTextContent(person.getPlaceOfBirth());
    }/*from  w  w w.  ja  va 2  s  .  com*/
}

From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java

private void appendCourtOrderRequestEntity(Warrant warrant, Element warrantElement) {
    if (StringUtils.isNoneBlank(warrant.getOperator())) {
        Element courtOrderRequestEntity = XmlUtils.appendElement(warrantElement, NS_JXDM_51,
                "CourtOrderRequestEntity");
        Element entityPerson = XmlUtils.appendElement(courtOrderRequestEntity, NS_NC_30, "EntityPerson");
        Element personEmployeeIdentification = XmlUtils.appendElement(entityPerson, NS_WARRANT_MOD_REQ_EXT,
                "PersonEmployeeIdentification");
        appendIdentificationIdElement(personEmployeeIdentification, warrant.getOperator());
    }/*w w w  . j  a  v a 2 s . c o  m*/
}