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

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

Introduction

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

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

Checks if a String is not empty ("") and not null.

Usage

From source file:com.haulmont.cuba.gui.xml.layout.loaders.TextAreaLoader.java

@Override
public void loadComponent() {
    super.loadComponent();

    loadMaxLength(resultComponent, element);
    loadTrimming(resultComponent, element);
    loadInputPrompt(resultComponent, element);
    loadCaseConversion(resultComponent, element);
    loadTextChangeEventProperties(resultComponent, element);

    String cols = element.attributeValue("cols");
    if (StringUtils.isNotEmpty(cols)) {
        resultComponent.setColumns(Integer.parseInt(cols));
    }/*from  www  . j  a v  a2  s.c  o  m*/

    String rows = element.attributeValue("rows");
    if (StringUtils.isNotEmpty(rows)) {
        resultComponent.setRows(Integer.parseInt(rows));
    }

    String wordwrap = element.attributeValue("wordwrap");
    if (StringUtils.isNotEmpty(wordwrap)) {
        resultComponent.setWordwrap(Boolean.parseBoolean(wordwrap));
    }

    String datatypeAttribute = element.attributeValue("datatype");
    if (StringUtils.isNotEmpty(datatypeAttribute)) {
        Datatype datatype = Datatypes.get(datatypeAttribute);
        resultComponent.setDatatype(datatype);
    }
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.EmbeddedLoader.java

@Override
public void loadComponent() {
    assignFrame(resultComponent);/*from w w  w . j  a v a 2 s. c  om*/

    String relativeSrc = element.attributeValue("relativeSrc");
    if (StringUtils.isNotEmpty(relativeSrc)) {
        resultComponent.setRelativeSource(relativeSrc);
    }

    String srcAttr = element.attributeValue("src");
    if (srcAttr != null) {
        if (srcAttr.startsWith(URL_PREFIX)) {
            String src = srcAttr.substring(URL_PREFIX.length());

            URL targetUrl;
            try {
                targetUrl = new URL(src);
            } catch (MalformedURLException e) {
                throw new GuiDevelopmentException("Incorrect URL in Embedded src attribute",
                        context.getFullFrameId(), "src", srcAttr);
            }

            resultComponent.setType(Embedded.Type.BROWSER);
            resultComponent.setSource(targetUrl);

        } else if (srcAttr.startsWith(THEME_PREFIX)) {
            resultComponent.setSource(srcAttr);
        } else if (srcAttr.startsWith(FILE_PREFIX)) {
            String src = srcAttr.substring(FILE_PREFIX.length());
            resultComponent.setType(Embedded.Type.OBJECT);
            resultComponent.setSource(src);
        } else {
            throw new GuiDevelopmentException(
                    "Illegal src attribute value. 'url://' or 'file://' or theme:// prefix expected",
                    context.getFullFrameId(), "src", srcAttr);
        }
    }

    String typeAttribute = element.attributeValue("type");
    if (StringUtils.isNotEmpty(typeAttribute)) {
        Embedded.Type type = Embedded.Type.valueOf(typeAttribute);
        resultComponent.setType(type);
    }

    loadVisible(resultComponent, element);
    loadEnable(resultComponent, element);
    loadStyleName(resultComponent, element);

    loadHeight(resultComponent, element);
    loadWidth(resultComponent, element);
    loadAlign(resultComponent, element);

    loadCaption(resultComponent, element);
    loadDescription(resultComponent, element);
    loadIcon(resultComponent, element);
}

From source file:net.duckling.ddl.web.api.APIBaseResourceController.java

protected boolean isCurrentUserMarked(String user, Set<String> markedSet) {
    boolean marked = false;
    if (StringUtils.isNotEmpty(user) && markedSet != null) {
        for (String markedName : markedSet) {
            if (user.equals(markedName)) {
                marked = true;/*ww w  .j a v  a 2 s .  c  o m*/
                break;
            }
        }
    }
    return marked;
}

From source file:net.shopxx.service.impl.SpecificationItemServiceImpl.java

public void filter(List<SpecificationItem> specificationItems) {
    CollectionUtils.filter(specificationItems, new Predicate() {
        public boolean evaluate(Object object) {
            SpecificationItem specificationItem = (SpecificationItem) object;
            if (specificationItem == null || StringUtils.isEmpty(specificationItem.getName())) {
                return false;
            }/*from   w  w  w .  j  av  a 2s. c o  m*/
            CollectionUtils.filter(specificationItem.getEntries(), new Predicate() {
                private Set<Integer> idSet = new HashSet<Integer>();
                private Set<String> valueSet = new HashSet<String>();

                public boolean evaluate(Object object) {
                    SpecificationItem.Entry entry = (SpecificationItem.Entry) object;
                    return entry != null && entry.getId() != null && StringUtils.isNotEmpty(entry.getValue())
                            && entry.getIsSelected() != null && idSet.add(entry.getId())
                            && valueSet.add(entry.getValue());
                }
            });
            return CollectionUtils.isNotEmpty(specificationItem.getEntries()) && specificationItem.isSelected();
        }
    });
}

From source file:eu.apenet.dpt.standalone.gui.commons.TextChanger.java

public static boolean isDateSetReady(List<TextFieldWithDate> textFieldWithDates, boolean addYear,
        boolean addRange) {
    int counterDate = 0;
    if (addYear)/*from  w w w. j a va2s  .  co m*/
        counterDate++;
    int counterDateRange = 0;
    if (addRange)
        counterDateRange++;
    for (TextFieldWithDate textFieldWithDate : textFieldWithDates) {
        if (StringUtils.isNotEmpty(textFieldWithDate.getDate())) {
            counterDate++;
        } else if (StringUtils.isNotEmpty(textFieldWithDate.getFromDate())
                && StringUtils.isNotEmpty(textFieldWithDate.getToDate())) {
            counterDateRange++;
        }
    }
    if (counterDate > 1 || counterDateRange > 1 || (counterDate > 0 && counterDateRange > 0)) {
        return true;
    } else {
        if (counterDate == 1) {
            return false;
        } else if (counterDateRange == 1) {
            return false;
        }
    }
    return false;
}

From source file:com.dp2345.plugin.oss.OssController.java

/**
 * // ww w . j  a v  a 2  s .  co m
 */
@RequestMapping(value = "/install", method = RequestMethod.POST)
public @ResponseBody Message install() {
    String specificationVersion = System.getProperty("java.specification.version");
    if (StringUtils.isNotEmpty(specificationVersion)) {
        BigDecimal version = new BigDecimal(specificationVersion);
        if (version.compareTo(new BigDecimal("1.6")) < 0) {
            return Message.error("admin.plugin.oss.unsupportedJavaVersion");
        }
    }
    if (!ossPlugin.getIsInstalled()) {
        PluginConfig pluginConfig = new PluginConfig();
        pluginConfig.setPluginId(ossPlugin.getId());
        pluginConfig.setIsEnabled(false);
        pluginConfigService.save(pluginConfig);
    }
    return SUCCESS_MESSAGE;
}

From source file:io.github.jeddict.jpa.modeler.properties.extend.ClassSelectionPanel.java

@Override
public ReferenceClass getValue() {
    if (StringUtils.isNotEmpty(class_EditorPane.getText())) {
        referenceClass = new ReferenceClass(class_EditorPane.getText());
    } else {/*from   w w w  .j a va 2  s .  co  m*/
        referenceClass = null;
    }
    return referenceClass;
}

From source file:com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto.java

public String getName() {
    StringBuilder builder = new StringBuilder();
    if (StringUtils.isNotEmpty(refinedDefinition.getDisplayName())) {
        builder.append(refinedDefinition.getDisplayName());
        builder.append(", ");
    }/*  w  w  w  .jav  a 2 s  . c  o m*/

    if (refinedDefinition.getTypeName() != null) {
        builder.append(refinedDefinition.getTypeName().getLocalPart());
    }

    return builder.toString().trim();
}

From source file:com.jive.myco.seyren.core.util.email.SeyrenMailSender.java

@Inject
public SeyrenMailSender(SeyrenConfig seyrenConfig) {

    int port = seyrenConfig.getSmtpPort();
    String host = seyrenConfig.getSmtpHost();
    String username = seyrenConfig.getSmtpUsername();
    String password = seyrenConfig.getSmtpPassword();
    String protocol = seyrenConfig.getSmtpProtocol();

    setPort(port);//w ww . j  a  va2s  .  com
    setHost(host);

    Properties props = new Properties();
    if (StringUtils.isNotEmpty(username) && StringUtils.isNotEmpty(password)) {
        props.setProperty("mail.smtp.auth", "true");
        setUsername(username);
        setPassword(password);
    }

    if (getPort() == 587) {
        props.put("mail.smtp.starttls.enable", "true");
    }

    if (props.size() > 0) {
        setJavaMailProperties(props);
    }

    setProtocol(protocol);

    LOGGER.info("{}:{}@{}", username, password, host);

}

From source file:com.haulmont.cuba.web.gui.components.WebClasspathResource.java

@Override
protected void createResource() {
    String name = StringUtils.isNotEmpty(fileName) ? fileName : FilenameUtils.getName(path);

    resource = new StreamResource(() -> AppBeans.get(Resources.class).getResourceAsStream(path), name);

    StreamResource streamResource = (StreamResource) this.resource;

    streamResource.setMIMEType(mimeType);
    streamResource.setCacheTime(cacheTime);
    streamResource.setBufferSize(bufferSize);
}