Example usage for java.util List toString

List of usage examples for java.util List toString

Introduction

In this page you can find the example usage for java.util List toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.serena.rlc.provider.schedule.ScheduleExecutionProvider.java

@Action(name = WAIT_FOR, displayName = "Wait for (minutes)", description = "Wait for a number of minutes.")
@Params(params = {/* w  ww  .ja v a  2s.c  o m*/
        @Param(fieldName = DELAY_TIME, displayName = "Delay Time (mins)", description = "Delay time in minutes", required = true, environmentProperty = true, deployUnit = false, dataType = DataType.NUMERIC) })
public ExecutionInfo waitFor(List<Field> properties, Boolean validateOnly) throws ProviderException {
    ExecutionInfo execInfo = new ExecutionInfo();
    try {
        Boolean bValid = validateWaitFor(properties);
        if (validateOnly) {
            logger.debug("Validating waitFor with: " + properties.toString());
            execInfo.setSuccess(bValid);
            execInfo.setMessage("Valid schedule action: " + WAIT_FOR);
            return execInfo;
        } else {
            UUID executionId = UUID.randomUUID();
            long sleepTime = TimeUnit.MINUTES.toMillis(Long.parseLong(delayTime));
            try {
                ScheduleWaiter scheduleWaiter = new ScheduleWaiter(callbackUrl, callbackUsername,
                        callbackPassword, executionId, sleepTime);
                Thread waiterThread = new Thread(scheduleWaiter, "ScheduleWaiter-" + executionId.toString());
                waiterThread.start();
            } catch (Exception ex) {
                throw new ProviderException(ex.getLocalizedMessage());
            }

            execInfo.setStatus(ExecutionStatus.IN_PROGRESS);
            execInfo.setExecutionId(executionId.toString());
            return execInfo;
        }
    } catch (ProviderException ex) {
        if (validateOnly) {
            execInfo.setSuccess(false);
            execInfo.setMessage(ex.getLocalizedMessage());
            return execInfo;
        }

        throw ex;
    }
}

From source file:gtu._work.ui.SqlCreaterUI.java

private String fetchInsertSQL(String tableName, Map<String, String> wkDataObjectMapCopy) {
    List<String> insertFieldList = new ArrayList<String>();
    List<String> insertValueList = new ArrayList<String>();
    for (String key : wkDataObjectMapCopy.keySet()) {
        insertFieldList.add(key);/*www. ja  va2s. c  o m*/
        insertValueList.add(wkDataObjectMapCopy.get(key));
    }
    String inf = insertFieldList.toString();
    inf = inf.replaceAll(" ", "");
    inf = inf.substring(1, inf.length() - 1);
    String inv = insertValueList.toString();
    inv = inv.replaceAll(" ", "");
    inv = inv.replaceAll(",", "','");
    inv = inv.substring(1, inv.length() - 1);
    inv = "'" + inv + "'";
    return "insert into " + tableName + " (" + inf + ") values (" + inv + ");";
}

From source file:com.tilab.fiware.metaware.dao.impls.mongodb.DataSourceDao.java

/**
 * Checks if the selected Ids in permissions (can be user, department, or company) exist in
 * users, departments, or companies collections; if so, returns the list of permissions.
 *
 * @param datasource            the selected data source.
 * @param usersCollection       the collection of registered users.
 * @param departmentsCollection the collection of registered departments.
 * @param companiesCollection   the collection of registered companies.
 * @return permissionsList the list of permissions.
 *//*from  w  w  w.j a  v a 2s .com*/
private List<Permission> checkPermissions(DataSource datasource, DBCollection usersCollection,
        DBCollection departmentsCollection, DBCollection companiesCollection) {
    // Check if the field exists
    if (datasource.getPermissions() == null) {
        return null; // no permissions provided
    }

    // Prepare lists
    List rawPermissionsList = new ArrayList(datasource.getPermissions()); // unspecified type generates maven warning
    List<Permission> permissionsList = new ArrayList<>();

    log.debug("Inserted permissions (raw): " + rawPermissionsList.toString());

    // Convert from raw to Permission objects
    for (Object rawCurrPerm : rawPermissionsList) {
        Permission currPerm = new Permission((Map) rawCurrPerm);
        if (!ObjectId.isValid(currPerm.getReference())) {
            return null; // the associated id isn't valid
        }
        // TODO: insert check for "perm" string too
        currPerm.setReferenceId(new ObjectId(currPerm.getReference())); // transform the id from string to objectid
        permissionsList.add(currPerm);
    }

    log.debug("Inserted permissions: " + permissionsList.toString());

    // Make the query
    BasicDBObject query = new BasicDBObject();
    for (Permission currPerm : permissionsList) {
        query.put("_id", currPerm.getReferenceId()); // query by id
        int resNumUser = usersCollection.find(query).count(); // count users
        int resNumDepartment = departmentsCollection.find(query).count(); // count departments
        int resNumCompany = companiesCollection.find(query).count(); // count companies
        if ((resNumUser + resNumDepartment + resNumCompany) == 0) {
            return null; // found nothing
        }
    }

    return permissionsList;
}

From source file:Tela.java

private void exibeDetalhesMelhorResultado() {

    Individuo individuo = algoritmo.selecionaMelhorResultado();
    List<Artigo> artigos = algoritmo.getArtigos();

    List<String> artigosMochila = new ArrayList<>();
    for (int i = 0; i < individuo.getCromossomo().size(); i++) {
        if (individuo.getCromossomo().get(i) == 1) {
            artigosMochila.add(artigos.get(i).getNome());
        }//from   ww w  . j a va2s.  co m
    }
    txtArtigos.setText(artigosMochila.toString());

    lblPeso.setText(individuo.getPeso().toString());
    lblVolume.setText(individuo.getVolume().toString());
    lblValor.setText(individuo.getValor().toString());
}

From source file:org.socialsignin.spring.data.dynamodb.mapping.event.ValidatingDynamoDBEventListener.java

@Override
public void onBeforeSave(Object source) {

    LOG.debug("Validating object: {}", source);

    List<String> messages = new ArrayList<String>();
    Set<ConstraintViolation<Object>> violations = validator.validate(source);
    Set<ConstraintViolation<?>> genericViolationSet = new HashSet<ConstraintViolation<?>>();
    if (!violations.isEmpty()) {
        for (ConstraintViolation<?> v : violations) {
            genericViolationSet.add(v);// w ww  .  j av a2  s.  c  om
            messages.add(v.toString());
        }
        LOG.info("During object: {} validation violations found: {}", source, violations);
        throw new ConstraintViolationException(messages.toString(), genericViolationSet);
    }
}

From source file:at.ac.tuwien.dsg.esperstreamprocessing.service.TaskDelivery.java

public void deliver(Task task, String enrichmentInfo, String eventVals, String uri) {

    String content = task.getContent() + "\n" + "Detected: " + eventVals + "\n" + "More information: "
            + enrichmentInfo;//ww w  . ja v a  2 s.  c o  m

    if (task != null) {

        List<NameValuePair> paramList = new ArrayList<NameValuePair>();
        paramList.add(new BasicNameValuePair("name", task.getName()));
        paramList.add(new BasicNameValuePair("content", content));
        paramList.add(new BasicNameValuePair("tag", task.getTag()));
        paramList.add(new BasicNameValuePair("severity", task.getSeverity().name()));

        RestHttpClient ws = new RestHttpClient(uri);
        ws.callPostMethod(paramList);
        //System.out.println("Forward Task !");
        String log = "Forward Task !" + paramList.toString();
        Logger.getLogger(EventHandler.class.getName()).log(Level.INFO, log);
    }
}

From source file:com.hybris.datahub.service.impl.DefaultMarketplaceIntegrationService.java

@Override
public void processRawItem(String rawItemType, List<Map<String, String>> csv) {
    if (null == csv) {
        return;/*from w  w w  . j a  v  a 2  s.co m*/
    }

    final List<Map<String, String>> rawFragments = new LinkedList<Map<String, String>>();
    rawFragments.addAll(csv);

    final boolean result = rawFragmentInputChannel.send(new GenericMessage<List<Map<String, String>>>(
            rawFragments, constructMessageHeader(rawItemType, getFeedName(rawItemType))));
    if (LOG.isInfoEnabled()) {
        LOG.info("Process result : " + result + ", item type :" + rawItemType + " fragment: " + csv.toString());
    }
}

From source file:com.serena.rlc.provider.schedule.ScheduleExecutionProvider.java

@Action(name = WAIT_UNTIL, displayName = "Wait until (time)", description = "Wait until a specific time.")
@Params(params = {// w  ww . j a  va2 s.c  o  m
        @Param(fieldName = SCHEDULED_TIME, displayName = "Scheduled Time", description = "Scheduled time", required = true, environmentProperty = true, deployUnit = false, dataType = DataType.TEXT) })
public ExecutionInfo waitUntil(List<Field> properties, Boolean validateOnly) throws ProviderException {
    ExecutionInfo execInfo = new ExecutionInfo();
    try {
        Boolean bValid = validateWaitUntil(properties);
        if (validateOnly) {
            logger.debug("Validating waitUntil with: " + properties.toString());
            execInfo.setSuccess(bValid);
            execInfo.setMessage("Valid schedule action: " + WAIT_UNTIL);
            return execInfo;
        } else {
            UUID executionId = UUID.randomUUID();
            Date scheduledDate;
            try {
                scheduledDate = new SimpleDateFormat(dateFormat).parse(scheduledTime);
                logger.debug("Scheduled date is: " + scheduledDate.toString());
            } catch (ParseException ex) {
                throw new ProviderException("Invalid scheduled time, format is " + dateFormat);
            }
            long sleepTime = scheduledDate.getTime() - (new Date()).getTime();
            try {
                ScheduleWaiter scheduleWaiter = new ScheduleWaiter(callbackUrl, callbackUsername,
                        callbackPassword, executionId, sleepTime);
                Thread waiterThread = new Thread(scheduleWaiter, "ScheduleWaiter-" + executionId.toString());
                waiterThread.start();
            } catch (Exception ex) {
                throw new ProviderException(ex.getLocalizedMessage());
            }

            execInfo.setStatus(ExecutionStatus.IN_PROGRESS);
            execInfo.setExecutionId(executionId.toString());
            return execInfo;
        }
    } catch (ProviderException ex) {
        if (validateOnly) {
            execInfo.setSuccess(false);
            execInfo.setMessage(ex.getLocalizedMessage());
            return execInfo;
        }

        throw ex;
    }
}

From source file:nl.surfnet.coin.janus.JanusRestClient.java

@Override
public List<String> getEntityIdsByMetaData(Metadata key, String value) {
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("key", key.val());
    parameters.put("value", value);

    URI signedUri;/*from w  w  w  .j a  v a 2 s .  c  om*/
    try {
        signedUri = sign("findIdentifiersByMetadata", parameters);

        if (LOG.isTraceEnabled()) {
            LOG.trace("Signed Janus-request is: {}", signedUri);
        }

        @SuppressWarnings("unchecked")
        final List<String> restResponse = restTemplate.getForObject(signedUri, List.class);

        if (LOG.isTraceEnabled()) {
            LOG.trace("Janus-request returned: {}", restResponse.toString());
        }

        return restResponse;

    } catch (IOException e) {
        LOG.error("While doing Janus-request", e);
    }
    return null;

}

From source file:org.grails.datastore.mapping.redis.query.RedisQuery.java

private String formulateDisjunctionKey(List<String> indicesList) {
    Collections.sort(indicesList);
    return "~!" + indicesList.toString().replaceAll("\\s", "");
}