Example usage for org.hibernate.internal.util StringHelper isEmpty

List of usage examples for org.hibernate.internal.util StringHelper isEmpty

Introduction

In this page you can find the example usage for org.hibernate.internal.util StringHelper isEmpty.

Prototype

public static boolean isEmpty(String string) 

Source Link

Usage

From source file:com.hazelcast.hibernate.CacheEnvironment.java

License:Open Source License

public static String getConfigFilePath(Properties props) {
    String configResourcePath = ConfigurationHelper.getString(CacheEnvironment.CONFIG_FILE_PATH_LEGACY, props,
            null);/*from w  w  w.  j a  v a 2 s.c  o m*/
    if (StringHelper.isEmpty(configResourcePath)) {
        configResourcePath = ConfigurationHelper.getString(CacheEnvironment.CONFIG_FILE_PATH, props, null);
    }
    return configResourcePath;
}

From source file:de.innovationgate.webgate.api.mysql.GaleraClusterTableGenerator.java

License:Open Source License

/**
 * Determine the segment value corresponding to this generator instance.
 * <p/>//from   w  w w.j a v a2  s  .co  m
 * Called during {@link #configure configuration}.
 *
 * @see #getSegmentValue()
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @return The name of the value column
 */
protected String determineSegmentValue(Properties params) {
    String segmentValue = params.getProperty(SEGMENT_VALUE_PARAM);
    if (StringHelper.isEmpty(segmentValue)) {
        segmentValue = determineDefaultSegmentValue(params);
    }
    return segmentValue;
}

From source file:org.lightmare.jpa.hibernate.internal.PersistenceXmlParserImpl.java

License:Open Source License

private void bindPersistenceUnit(ParsedPersistenceXmlDescriptor persistenceUnit,
        Element persistenceUnitElement) {
    final String name = persistenceUnitElement.getAttribute("name");
    if (StringHelper.isNotEmpty(name)) {
        LOG.tracef("Persistence unit name from persistence.xml : %s", name);
        persistenceUnit.setName(name);//from   www . j  a  v a 2s .  co  m
    }

    final PersistenceUnitTransactionType transactionType = parseTransactionType(
            persistenceUnitElement.getAttribute("transaction-type"));
    if (transactionType != null) {
        persistenceUnit.setTransactionType(transactionType);
    }

    NodeList children = persistenceUnitElement.getChildNodes();
    boolean resolvedClasses = Boolean.FALSE;
    for (int i = 0; i < children.getLength(); i++) {
        if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
            Element element = (Element) children.item(i);
            String tag = element.getTagName();
            if (tag.equals("non-jta-data-source")) {
                persistenceUnit.setNonJtaDataSource(extractContent(element));
            } else if (tag.equals("jta-data-source")) {
                persistenceUnit.setJtaDataSource(extractContent(element));
            } else if (tag.equals("provider")) {
                persistenceUnit.setProviderClassName(extractContent(element));
            } else if (tag.equals("class")) {
                if (CollectionUtils.invalid(MetaConfig.getClasses(metaConfig))) {
                    persistenceUnit.addClasses(extractContent(element));
                } else if (Boolean.FALSE.equals(resolvedClasses)) {
                    PersistenceDescriptorUtils.resolveEntities(persistenceUnit, metaConfig);
                    resolvedClasses = Boolean.TRUE;
                }
            } else if (tag.equals("mapping-file")) {
                persistenceUnit.addMappingFiles(extractContent(element));
            } else if (tag.equals("jar-file")) {
                persistenceUnit.addJarFileUrl(ArchiveHelper.getURLFromPath(extractContent(element)));
            } else if (tag.equals("exclude-unlisted-classes")) {
                persistenceUnit.setExcludeUnlistedClasses(extractBooleanContent(element, true));
            } else if (tag.equals("delimited-identifiers")) {
                persistenceUnit.setUseQuotedIdentifiers(true);
            } else if (tag.equals("validation-mode")) {
                persistenceUnit.setValidationMode(extractContent(element));
            } else if (tag.equals("shared-cache-mode")) {
                persistenceUnit.setSharedCacheMode(extractContent(element));
            } else if (tag.equals("properties")) {
                NodeList props = element.getChildNodes();
                for (int j = 0; j < props.getLength(); j++) {
                    if (props.item(j).getNodeType() == Node.ELEMENT_NODE) {
                        Element propElement = (Element) props.item(j);
                        if (!"property".equals(propElement.getTagName())) {
                            continue;
                        }
                        String propName = propElement.getAttribute("name").trim();
                        String propValue = propElement.getAttribute("value").trim();
                        if (StringHelper.isEmpty(propValue)) {
                            // fall back to the natural (Hibernate) way of
                            // description
                            propValue = extractContent(propElement, "");
                        }
                        persistenceUnit.getProperties().put(propName, propValue);
                    }
                }
            }
        }
    }

    if (Boolean.FALSE.equals(resolvedClasses)) {
        PersistenceDescriptorUtils.resolveEntities(persistenceUnit, metaConfig);
    }
}

From source file:org.lightmare.jpa.hibernate.internal.PersistenceXmlParserImpl.java

License:Open Source License

private static PersistenceUnitTransactionType parseTransactionType(String value) {
    if (StringHelper.isEmpty(value)) {
        return null;
    } else if (value.equalsIgnoreCase("JTA")) {
        return PersistenceUnitTransactionType.JTA;
    } else if (value.equalsIgnoreCase("RESOURCE_LOCAL")) {
        return PersistenceUnitTransactionType.RESOURCE_LOCAL;
    } else {//from ww w.j  a  va  2s . c  o m
        throw new PersistenceException("Unknown persistence unit transaction type : " + value);
    }
}