Example usage for org.apache.commons.lang Validate notEmpty

List of usage examples for org.apache.commons.lang Validate notEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang Validate notEmpty.

Prototype

public static void notEmpty(String string, String message) 

Source Link

Document

Validate an argument, throwing IllegalArgumentException if the argument String is empty (null or zero length).

 Validate.notEmpty(myString, "The string must not be empty"); 

Usage

From source file:ch.algotrader.dao.PositionDaoImpl.java

@Override
public <V> List<V> findOpenPositionsByStrategy(String strategyName, EntityConverter<Position, V> converter) {

    Validate.notEmpty(strategyName, "Strategy name is empty");

    return find(converter, "Position.findOpenPositionsByStrategy", QueryType.BY_NAME,
            new NamedParam("strategyName", strategyName));
}

From source file:com.evolveum.midpoint.repo.sql.data.common.container.RCertWorkItemReference.java

public static RCertWorkItemReference jaxbRefToRepo(ObjectReferenceType reference, PrismContext prismContext,
        RAccessCertificationWorkItem owner) {
    if (reference == null) {
        return null;
    }// w w w.ja va2s. c  o  m
    Validate.notNull(owner, "Owner of reference must not be null.");
    Validate.notEmpty(reference.getOid(), "Target oid reference must not be null.");

    RCertWorkItemReference repoRef = new RCertWorkItemReference();
    repoRef.setOwner(owner);
    RCertWorkItemReference.copyFromJAXB(reference, repoRef);
    return repoRef;
}

From source file:ch.algotrader.dao.strategy.MeasurementDaoImpl.java

@Override
public List<Measurement> findMeasurementsByMinDate(int limit, String strategyName, String name,
        Date minDateTime) {//w  w w.j ava  2 s .co  m

    Validate.notEmpty(strategyName, "Strategy name is empty");
    Validate.notEmpty(name, "Name is empty");
    Validate.notNull(minDateTime, "minDateTime is null");

    return find("Measurement.findMeasurementsByMinDate", limit, QueryType.BY_NAME,
            new NamedParam("strategyName", strategyName), new NamedParam("name", name),
            new NamedParam("minDateTime", minDateTime));
}

From source file:com.vmware.identity.session.impl.SessionManagerImpl.java

/**
 * createSession() create a new session/*from www.jav  a2  s .c  om*/
 * @param externalIDPSessionId  -  optional external idp session id,
 *  only used for external authentication workflow.
 * @throws SamlServiceException
 */
@Override
public Session createSession(PrincipalId principal, AuthnMethod authMethod, String externalIDPSessionId,
        String idpEntId) throws SamlServiceException {

    Validate.notNull(principal, "user principalId");

    // create a new session here
    Calendar calendar = new GregorianCalendar();
    calendar.add(Calendar.MINUTE, Shared.SESSION_LIFETIME_MINUTES);
    Date sessionEndTime = calendar.getTime();
    try {
        Session currentSession = new Session(principal, sessionEndTime, authMethod);
        if (externalIDPSessionId != null) {
            Validate.notEmpty(idpEntId, "Need idpEntId for creating external authenticated session");

            currentSession.setUsingExtIDP(true);
            currentSession.setExtIDPToUsed(new IDPConfig(idpEntId));
            currentSession.setExtIDPSessionID(externalIDPSessionId);
        }
        add(currentSession);
        return currentSession;
    } catch (NoSuchAlgorithmException e) {
        throw new SamlServiceException(e);
    }
}

From source file:com.vmware.identity.idm.server.clientcert.IdmCertificatePathValidator.java

/**
 * @param trustStore/*from w w w.ja v  a  2  s .c o m*/
 * @param certPolicy
 * @param tenantName
 * @throws CertificateRevocationCheckException
 */
public IdmCertificatePathValidator(KeyStore trustStore, ClientCertPolicy certPolicy, String tenantName,
        String siteID) {
    this.trustStore = trustStore;
    this.siteID = siteID;

    Validate.notNull(certPolicy, "Cert Policy");
    Validate.notNull(trustStore, "Trust Store");
    Validate.notEmpty(tenantName, "tenantName");

    this.tenantName = tenantName;
    this.certPolicy = certPolicy;
}

From source file:fr.Axeldu18.PterodactylAPI.Methods.POSTMethods.java

/**
 * @param name Name of the new server./*from   w  ww.  j ava2 s  .  c  om*/
 * @param user_id ID of a user that exists on the system to assign this server to.
 * @param location_id ID of location in which server should be created.
 * @param node_id ID of the node to assign this server to. Only required if auto_deploy is false OPTIONAL.
 * @param allocation_id ID of allocation to use for the server. Only required if auto_deploy is false OPTIONAL.
 * @param memory Total memory (in MB) to assign to the server.
 * @param swap Total swap (in MB) to assign to the server.
 * @param disk Total disk space (in MB) to assign to the server.
 * @param cpu CPU limit adjustment number.
 * @param io Block IO adjustment number.
 * @param service_id ID of the service this server is using.
 * @param option_id ID of the specific service option this server is using.
 * @param startup The startup parameters this server is using.
 * @param auto_deploy Should the server be auto-deployed to a node.
 * @param pack_id The pack ID to use for this server.
 * @param custom_container Pass a custom docker image to run this server with.
 * @return if success it return the ID of the new server.
 */
public String createMCServer(String name, int user_id, int location_id, int node_id, int allocation_id,
        int memory, int swap, int disk, int cpu, int io, int service_id, int option_id, String startup,
        String jarName, String version, boolean auto_deploy, int pack_id, String custom_container) {
    Validate.notEmpty(name, "The NAME is required");
    Validate.notNull(user_id, "The USER_ID is required");
    Validate.notNull(location_id, "The location_id is required");
    Validate.notNull(memory, "The MEMORY is required");
    Validate.notNull(swap, "The SWAP is required");
    Validate.notNull(disk, "The DISK is required");
    Validate.notNull(cpu, "The CPU is required");
    Validate.notNull(io, "The IO is required");
    Validate.notNull(service_id, "The SERVICE_ID is required");
    Validate.notNull(option_id, "The OPTION_ID is required");
    Validate.notNull(startup, "The STARTUP is required");
    Validate.notNull(jarName, "The JARNAME is required");
    Validate.notNull(version, "The VERSION is required");
    int autoDeploy = (auto_deploy) ? 1 : 0;
    JSONObject jsonServerPost = new JSONObject();
    jsonServerPost.put("name", name);
    jsonServerPost.put("user_id", node_id);
    jsonServerPost.put("location_id", location_id);
    jsonServerPost.put("node_id", node_id);
    jsonServerPost.put("allocation_id", allocation_id);
    jsonServerPost.put("memory", memory);
    jsonServerPost.put("swap", swap);
    jsonServerPost.put("disk", disk);
    jsonServerPost.put("cpu", cpu);
    jsonServerPost.put("io", io);
    jsonServerPost.put("service_id", service_id);
    jsonServerPost.put("option_id", option_id);
    jsonServerPost.put("startup", startup);
    jsonServerPost.put("env_SERVER_JARFILE", jarName);
    jsonServerPost.put("env_DL_VERSION", version);
    jsonServerPost.put("auto_deploy", autoDeploy);
    jsonServerPost.put("pack_id", pack_id);
    jsonServerPost.put("custom_container", custom_container);
    return call(main.getMainURL() + Methods.SERVERS_CREATE_SERVER.getURL(), jsonServerPost.toString());
}

From source file:ch.algotrader.adapter.fix.DefaultFixAdapter.java

/**
 * creates an individual session/*  www.  ja  v a  2  s . co m*/
 */
@Override
public void createSessionForService(String orderServiceType) throws BrokerAdapterException {

    Validate.notEmpty(orderServiceType, "Order service type is empty");

    Collection<String> sessionQualifiers = this.lookupService
            .getActiveSessionsByOrderServiceType(orderServiceType);
    if (sessionQualifiers == null || sessionQualifiers.isEmpty()) {

        if (LOGGER.isWarnEnabled()) {
            LOGGER.warn("There are no active sessions for order service type {}", orderServiceType);
        }
        return;
    }
    for (String sessionQualifier : sessionQualifiers) {
        if (sessionQualifier != null) {
            createSession(sessionQualifier);
        }
    }
}

From source file:ch.algotrader.dao.SubscriptionDaoImpl.java

@Override
public List<Subscription> findNonPositionSubscriptionsByType(String strategyName,
        Class<? extends Security> type) {

    Validate.notEmpty(strategyName, "Strategy name is empty");

    return findCaching("Subscription.findNonPositionSubscriptionsByType", QueryType.BY_NAME,
            new NamedParam("strategyName", strategyName), new NamedParam("type", type.getSimpleName()));
}

From source file:com.common.poi.excel.util.Reflections.java

/**
 * ?, ?DeclaredField, ?./*www.j  a  v  a  2 s .c  o m*/
 * 
 * ?Object?, null.
 */
public static Field getAccessibleField(final Object obj, final String fieldName) {
    Validate.notNull(obj, "object can't be null");
    Validate.notEmpty(fieldName, "fieldName can't be blank");
    for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass
            .getSuperclass()) {
        try {
            Field field = superClass.getDeclaredField(fieldName);
            makeAccessible(field);
            return field;
        } catch (NoSuchFieldException e) {//NOSONAR
            // Field??,?
            continue;// new add
        }
    }
    return null;
}

From source file:net.jadler.AbstractRequestMatching.java

/**
 * {@inheritDoc}//from www .j a  v  a2  s. c o  m
 */
@Override
public T havingParameter(final String name, final Matcher<? super List<String>> predicate) {
    Validate.notEmpty(name, "name cannot be empty");
    Validate.notNull(predicate, "predicate cannot be null");

    return that(requestParameter(name, predicate));
}