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

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

Introduction

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

Prototype

String EMPTY

To view the source code for org.apache.commons.lang StringUtils EMPTY.

Click Source Link

Document

The empty String "".

Usage

From source file:fr.paris.lutece.plugins.extend.modules.follow.business.FollowFilter.java

/**
 * CONSTRUCTOR INIT
 */
public FollowFilter() {
    _nIdFollow = ALL;
    _strIdExtendableResource = StringUtils.EMPTY;
    _strExtendableResourceType = StringUtils.EMPTY;
    _bIsWideSearch = false;
}

From source file:info.magnolia.module.admininterface.trees.GroupsTreeConfiguration.java

/**
 * @see info.magnolia.module.admininterface.AdminTreeConfiguration#prepareTree(info.magnolia.cms.gui.control.Tree,
 * boolean, javax.servlet.http.HttpServletRequest)
 *//*from   www.  j  a  v  a  2  s  .  c  o m*/
public void prepareTree(Tree tree, boolean browseMode, HttpServletRequest request) {
    Messages msgs = MessagesManager.getMessages();

    tree.setDrawShifter(false);

    tree.setIconPage(Tree.ICONDOCROOT + "group.gif"); //$NON-NLS-1$
    tree.setIconOndblclick("mgnlTreeMenuOpenDialog(" //$NON-NLS-1$
            + tree.getJavascriptTree() + ",'.magnolia/dialogs/groupedit.html');"); //$NON-NLS-1$
    tree.addItemType(ItemType.GROUP);

    TreeColumn column0 = new TreeColumn(tree.getJavascriptTree(), request);
    column0.setIsLabel(true);
    column0.setHtmlEdit();
    column0.setWidth(2);
    column0.setTitle(msgs.get("tree.groups.name")); //$NON-NLS-1$

    TreeColumn column1 = new TreeColumn(tree.getJavascriptTree(), request);
    column1.setName("title"); //$NON-NLS-1$
    column1.setHtmlEdit();
    column1.setWidth(2);
    column1.setTitle(msgs.get("tree.groups.fullname")); //$NON-NLS-1$

    TreeColumn columnIcons = new TreeColumn(tree.getJavascriptTree(), request);
    columnIcons.setCssClass(StringUtils.EMPTY);
    columnIcons.setWidth(1);
    columnIcons.setIsIcons(true);
    columnIcons.setIconsActivation(true);

    TreeColumn column2 = new TreeColumn(tree.getJavascriptTree(), request);
    column2.setName(MetaData.CREATION_DATE);
    // column2.setName(MetaData.SEQUENCE_POS);
    column2.setIsMeta(true);
    column2.setDateFormat("yyyy-MM-dd, HH:mm"); //$NON-NLS-1$
    column2.setTitle(msgs.get("tree.groups.date")); //$NON-NLS-1$
    column2.setWidth(2);

    tree.addColumn(column0);
    if (!browseMode) {
        tree.addColumn(column1);
        if (Server.isAdmin() || Subscriber.isSubscribersEnabled()) {
            tree.addColumn(columnIcons);
        }
        tree.addColumn(column2);
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.CubaCurrencyField.java

protected void initTextField() {
    textField.setWidth("100%");

    textField.addStyleName(CURRENCYFIELD_TEXT_STYLENAME);

    textField.setValidationVisible(false);
    textField.setShowBufferedSourceException(false);
    textField.setShowErrorForDisabledState(false);
    textField.setImmediate(true);/*from ww w .j a va2 s  . c  o m*/
    textField.setNullRepresentation(StringUtils.EMPTY);
    textField.setConverter(new StringToDatatypeConverter(datatype));

    textField.addValueChangeListener(event -> markAsDirty());
}

From source file:com.amalto.core.storage.hibernate.FlatTypeMappingCreator.java

@Override
public TypeMapping visit(ReferenceFieldMetadata referenceField) {
    String name = context.getFieldColumn(referenceField);
    String typeName = referenceField.getReferencedType().getName().replace('-', '_');
    ComplexTypeMetadata referencedType = new SoftTypeRef(internalRepository,
            referenceField.getReferencedType().getNamespace(), typeName, true);
    FieldMetadata referencedField = new SoftIdFieldRef(internalRepository, typeName);

    TypeMetadata declaringType = referenceField.getDeclaringType();
    ComplexTypeMetadata database = typeMapping.getDatabase();
    ReferenceFieldMetadata newFlattenField = new ReferenceFieldMetadata(database, referenceField.isKey(),
            referenceField.isMany(), isDatabaseMandatory(referenceField, declaringType), name, referencedType,
            referencedField, Collections.<FieldMetadata>emptyList(), referenceField.getForeignKeyInfoFormat(),
            referenceField.isFKIntegrity(), referenceField.allowFKIntegrityOverride(),
            new SimpleTypeMetadata(XMLConstants.W3C_XML_SCHEMA_NS_URI, Types.STRING),
            referenceField.getWriteUsers(), referenceField.getHideUsers(),
            referenceField.getWorkflowAccessRights(), StringUtils.EMPTY, StringUtils.EMPTY);
    if (!referenceField.getContainingType().equals(declaringType)) {
        String declaringTypeName = declaringType.isInstantiable() ? declaringType.getName()
                : "X_" + declaringType.getName(); //$NON-NLS-1$
        SoftTypeRef internalDeclaringType = new SoftTypeRef(internalRepository, declaringType.getNamespace(),
                declaringTypeName, declaringType.isInstantiable());
        newFlattenField.setDeclaringType(internalDeclaringType);
    }//from   w  ww.ja  va 2  s  .c  om
    database.addField(newFlattenField);
    typeMapping.map(referenceField, newFlattenField);
    return typeMapping;
}

From source file:net.dstc.mkts.data.jpa.JpaSurveyDAO.java

private Query buildQuery(SurveyDO query) {
    String queryString = "FROM survey s";
    String whereClause = StringUtils.EMPTY;
    Map<String, Object> parameters = new Hashtable<>(20);

    if (query != null) {
        String title = query.getTitle();
        SurveyStatus status = query.getStatus();
        Date startDate = query.getStartDate();
        SurveyTargetDO target = query.getTarget();
        if (!StringUtils.isBlank(title)) {
            whereClause = "title=:title";
            parameters.put("title", title);
        }//  w ww.  j av  a2  s .  c  om

        if (status != null) {
            whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
            whereClause += "status=:status";
            parameters.put("status", status);
        }

        if (startDate != null) {
            whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
            whereClause += "startDate=:startDate";
            parameters.put("startDate", startDate);
        }

        if (target != null) {
            int minAge = target.getMinAge();
            int maxAge = target.getMaxAge();
            int minIncome = target.getMinIncome();
            int maxIncome = target.getMaxIncome();
            String gender = target.getGender();
            String country = target.getCountry();

            if (minAge > 0) {
                whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
                whereClause += "target.minAge=:minAge";
                parameters.put("target.minAge", minAge);
            }

            if (maxAge > 0) {
                whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
                whereClause += "target.maxAge=:maxAge";
                parameters.put("target.maxAge", maxAge);
            }

            if (minIncome > 0) {
                whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
                whereClause += "target.minIncome=:minIncome";
                parameters.put("target.minIncome", minIncome);
            }

            if (maxIncome > 0) {
                whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
                whereClause += "target.maxIncome=:maxIncome";
                parameters.put("target.maxIncome", maxIncome);
            }

            if (!StringUtils.isBlank(gender)) {
                whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
                whereClause += "target.gender=:gender";
                parameters.put("gender", gender);
            }

            if (!StringUtils.isBlank(country)) {
                whereClause += !StringUtils.isEmpty(whereClause) ? " AND " : StringUtils.EMPTY;
                whereClause += "target.country=:country";
                parameters.put("target.country", country);
            }
        }

        if (!StringUtils.isEmpty(whereClause)) {
            queryString += " WHERE " + whereClause;
        }
    }

    Query jpaQuery = entityManager.createQuery(queryString);

    parameters.forEach((String parmName, Object parmValue) -> {
        jpaQuery.setParameter(parmName, parmValue);
    });

    return jpaQuery;
}

From source file:com.amalto.core.storage.datasource.DataSourceFactory.java

private static synchronized InputStream readDataSourcesConfiguration() {
    Properties configuration = MDMConfiguration.getConfiguration();
    String dataSourcesLocation = (String) configuration.get(DB_DATASOURCES);
    if (dataSourcesLocation == null) { // DB_DATASOURCES property is mandatory to continue.
        throw new IllegalStateException(DB_DATASOURCES + " is not defined in MDM configuration.");
    }/*from   w  w  w.ja  v  a 2  s. co m*/
    String dataSourcesFileName = SystemPropertyUtils.resolvePlaceholders(dataSourcesLocation);
    InputStream configurationAsStream = null;
    // 1- Try from file (direct lookup)
    File file = new File(dataSourcesFileName);
    if (file.exists()) {
        LOGGER.info("Reading from datasource file at '" + file.getAbsolutePath() + "'."); //$NON-NLS-1$ //$NON-NLS-2$
        try {
            configurationAsStream = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            throw new IllegalStateException("Unexpected state (file exists but can't create a stream from it).",
                    e);
        }
    }
    // 2- From class path
    if (configurationAsStream == null) {
        List<String> filePaths = Arrays.asList(dataSourcesFileName);
        Iterator<String> iterator = filePaths.iterator();

        String currentFilePath = StringUtils.EMPTY;
        while (configurationAsStream == null && iterator.hasNext()) {
            currentFilePath = iterator.next();
            configurationAsStream = Thread.currentThread().getContextClassLoader()
                    .getResourceAsStream(currentFilePath);
        }
        if (configurationAsStream != null) {
            LOGGER.info("Reading from datasource file at '" + currentFilePath + "'."); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }
    // 3- error: configuration was not found
    if (configurationAsStream == null) {
        throw new IllegalStateException(
                "Could not find datasources configuration file '" + dataSourcesFileName + "'.");
    }
    return configurationAsStream;
}

From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskGenerateTicketReference.java

@Override
public String processTicketingTask(int nIdResourceHistory, HttpServletRequest request, Locale locale) {
    String strReference = StringUtils.EMPTY;

    // We get the ticket to modify
    Ticket ticket = getTicket(nIdResourceHistory);

    if (ticket != null) {
        synchronized (_ticketReferenceService) {
            strReference = _ticketReferenceService.generateReference(ticket);
            ticket.setReference(strReference);
            TicketHome.update(ticket);/*from ww  w.  j a  v  a 2 s  . co  m*/
        }

        _idChannel = ticket.getIdChannel();
    }

    return MessageFormat.format(
            I18nService.getLocalizedString(MESSAGE_GENERATE_TICKET_REFERENCE_INFORMATION, Locale.FRENCH),
            strReference);
}

From source file:fr.paris.lutece.plugins.genericattributes.service.entrytype.EntryTypeService.java

/**
 * {@inheritDoc}//from w ww  .ja v a2  s. co m
 */
@Override
public String getResponseValueForExport(Entry entry, HttpServletRequest request, Response response,
        Locale locale) {
    return StringUtils.EMPTY;
}

From source file:net.sourceforge.fenixedu.dataTransferObject.student.RegistrationWithStateForExecutionYearBean.java

public String getPersonalDataAuthorization() {
    StudentDataShareAuthorization dataAccess = getStudent()
            .getPersonalDataAuthorizationAt(getExecutionYear().getEndDateYearMonthDay().toDateTimeAtMidnight());
    return dataAccess != null ? dataAccess.getAuthorizationChoice().getDescription() : StringUtils.EMPTY;
}

From source file:fr.paris.lutece.plugins.extend.modules.favorite.business.FavoriteFilter.java

/**
 * CONSTRUCTOR INIT
 */
public FavoriteFilter() {
    _nIdFavorite = ALL;
    _strIdExtendableResource = StringUtils.EMPTY;
    _strExtendableResourceType = StringUtils.EMPTY;
    _bIsWideSearch = false;
}