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:nl.surfnet.coin.janus.JanusRestClient.java

@Override
public List<String> getAllowedSps(String idpentityid, String revision) {

    Assert.hasText(idpentityid, "idpentityid is a required parameter");
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("idpentityid", idpentityid);
    if (!StringUtils.isBlank(revision)) {
        parameters.put("idprevision", revision);
    }/*from ww w.  j  a  va  2  s .c  o m*/

    URI signedUri;
    try {
        signedUri = sign("getAllowedSps", 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:com.tilab.fiware.metaware.dao.impls.mongodb.AlgorithmDao.java

/**
 * Checks if the selected Ids in permissions (can be user, department, or company) exist in
 * users, departments, or companies collection; if so, returns the list of permissions.
 *
 * @param algorithm             the selected algorithm.
 * @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.
 *//*  ww  w . j  av  a 2 s  . co  m*/
private List<Permission> checkPermissions(Algorithm algorithm, DBCollection usersCollection,
        DBCollection departmentsCollection, DBCollection companiesCollection) {

    // Check if the field exists
    if (algorithm.getPermissions() == null) {
        log.error(MSG_ERR_NOT_VALID_PERMISSION);
        return null;
    }

    // Prepare lists
    List rawPermissionsList = new ArrayList(algorithm.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())) {
            log.error(MSG_ERR_NOT_VALID_PERMISSION);
            return null;
        }
        // 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) {
            log.error(MSG_ERR_NOT_VALID_PERMISSION);
            return null;
        }
    }

    return permissionsList;
}

From source file:com.aquest.emailmarketing.web.controllers.CampaignsController.java

/**
 * Do create./*  www .ja v  a2 s . c o  m*/
 *
 * @param campaign the campaign
 * @param result the result
 * @param principal the principal
 * @param model the model
 * @param saveCampaign the save campaign
 * @param defineBroadcast the define broadcast
 * @param fromBroadcastTemplate the from broadcast template
 * @param category_id the category_id
 * @return the string
 */
@RequestMapping(value = "/createCampaign", method = RequestMethod.POST)
public String doCreate(@Valid @ModelAttribute("campaign") Campaigns campaign, BindingResult result,
        Principal principal, Model model,
        @RequestParam(value = "saveCampaign", required = false) String saveCampaign,
        @RequestParam(value = "defineBroadcast", required = false) String defineBroadcast,
        @RequestParam(value = "fromBroadcastTemplate", required = false) String fromBroadcastTemplate,
        @RequestParam(value = "category_id") int category_id) {

    if (result.hasErrors()) {
        List<CampaignCategory> campcat = campaignCategoryService.getCategories();
        model.addAttribute("campcat", campcat);
        return "createcampaign";
    }

    if (campaign.getCampaign_id() == null) {
        // this is for new campaign creation
        Timestamp curTimestamp = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
        campaign.setCreation_user(principal.getName());
        campaign.setCreation_dttm(curTimestamp);
        campaign.setCampaign_status("DEFINED");
        campaign.getCampaignCategory().setCategory_id(category_id);
        campaign.setCampaign_source("EM");
        String campaign_id = campaignsService.getNextCampaignId();
        if (campaign_id.equals("Error")) {
            return "error";
        } else {
            campaign.setCampaign_id(campaign_id);
            campaignsService.SaveOrUpdate(campaign);
        }

        if (saveCampaign != null) {
            return "campaigncreated";
        }
        if (defineBroadcast != null) {
            List<EmailConfig> emailconfig = emailConfigService.getAllProfiles();
            model.addAttribute("campaign", campaign);
            System.out.println(emailconfig.toString());
            model.addAttribute("emailconfig", emailconfig);
            System.out.println(campaign.toString());
            Broadcast broadcast = new Broadcast();
            model.addAttribute("broadcast", broadcast);
            return "definebroadcast";
        }

        if (fromBroadcastTemplate != null) {
            model.addAttribute("campaign", campaign);
            Broadcast broadcast = new Broadcast();
            model.addAttribute("broadcast", broadcast);
            List<BroadcastTemplate> broadcastTemplate = broadcastTemplateService.getAllBroadcasts();
            model.addAttribute("broadcastTemplate", broadcastTemplate);
            return "pickbcasttemplate";
        }

        return "error";
    } else {
        // this is for changing campaign
        Timestamp curTimestamp = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
        campaign.setLast_change_user(principal.getName());
        campaign.setLast_change_dttm(curTimestamp);
        campaign.getCampaignCategory().setCategory_id(category_id);
        campaignsService.SaveOrUpdate(campaign);
        return "campaigncreated"; //ovde treba promeniti u campaignchanged stranu
    }
}

From source file:org.openmastery.logging.LoggingFilter.java

private void logHeaders(MultivaluedMap<String, String> allHeaders) {
    if (log.isDebugEnabled()) {
        List<Map.Entry<String, List<String>>> headersToLog = new ArrayList<>();

        for (Map.Entry<String, List<String>> headerEntry : allHeaders.entrySet()) {
            if (headersKeysToLog.contains(headerEntry.getKey())) {
                headersToLog.add(headerEntry);
            }//from  w w w  .  j  ava  2 s .  c om
        }

        if (!headersToLog.isEmpty()) {
            log.debug("Headers: " + headersToLog.toString());
        }
    }
}

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

/**
 * Checks if the selected Ids in permissions (can be user, department, or company) exist in
 * users, departments, or companies collection; if so, returns the list of permissions.
 *
 * @param process               the selected process.
 * @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(Process process, DBCollection usersCollection,
        DBCollection departmentsCollection, DBCollection companiesCollection) {
    // Check if the field exists
    if (process.getPermissions() == null) {
        log.error(MSG_ERR_NOT_VALID_PERMISSION);
        return null;
    }

    // Prepare lists
    List rawPermissionsList = new ArrayList(process.getPermissions()); // uspecified 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())) {
            log.error(MSG_ERR_NOT_VALID_PERMISSION);
            return null;
        }
        // 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) {
            log.error(MSG_ERR_NOT_VALID_PERMISSION);
            return null;
        }
    }

    return permissionsList;
}

From source file:gemlite.shell.commands.admin.Monitor.java

/**
 * ?serviceNameCheckPoint//w w  w  .  ja v a 2s. com
 * 
 * @return
 */
@SuppressWarnings("unchecked")
@CliCommand(value = "list checkpoints", help = "list checkpoints")
public String checkpoints(
        @CliOption(key = "moduleName", mandatory = true, help = "Name of the module") String moduleName,
        @CliOption(key = "serviceName", mandatory = true, optionContext = "disable-string-converter param.context.service.name", help = "Name of the service to be described.") String serviceName) {
    String oname = MBeanHelper.createManagerMBeanName("CheckPointService");
    Object obj = jmxSrv.invokeOperation(oname, "listMethods", moduleName, serviceName);
    List<ScannedMethodItem> list = new ArrayList<ScannedMethodItem>();

    if (obj instanceof List) {
        list = (List<ScannedMethodItem>) obj;
    } else {
        LogUtil.getCoreLog().error("list Methods error:{}", obj);
    }

    // ws??
    put(CommandMeta.LIST_CHECKPOINTS, list);
    if (!list.isEmpty())
        return list.toString();
    return "no checkpoint";
}

From source file:info.archinnov.achilles.test.integration.tests.SliceQuerySelectIT.java

@Test
public void should_get_with_partition_keys_IN() throws Exception {
    long pk1 = RandomUtils.nextLong(0, Long.MAX_VALUE);
    long pk2 = pk1 + 1;
    long pk3 = pk1 + 2;
    long pk4 = pk1 + 3;

    insertClusteredValues(pk1, 1, "name", 1);
    insertClusteredValues(pk2, 1, "name", 1);
    insertClusteredValues(pk3, 1, "name", 2);
    insertClusteredValues(pk4, 1, "name", 1);

    final List<ClusteredEntity> entities = manager.sliceQuery(ClusteredEntity.class).forSelect()
            .withPartitionComponentsIN(pk1, pk3).get(5);

    Collections.sort(entities, new ClusteredEntity.ClusteredEntityComparator());
    entities.toString();

    assertThat(entities).hasSize(3);/* w  w  w  .  j  av a 2s.com*/

    assertThat(entities.get(0).getId().getId()).isEqualTo(pk1);
    assertThat(entities.get(0).getValue()).isEqualTo("value11");

    assertThat(entities.get(1).getId().getId()).isEqualTo(pk3);
    assertThat(entities.get(1).getValue()).isEqualTo("value11");

    assertThat(entities.get(2).getId().getId()).isEqualTo(pk3);
    assertThat(entities.get(2).getValue()).isEqualTo("value12");
}

From source file:io.github.jeddict.jpa.modeler.widget.EntityWidget.java

public void scanPrimaryKeyError() {
    InheritanceStateType inheritanceState = this.getInheritanceState();
    if (SINGLETON == inheritanceState || ROOT == inheritanceState) {
        // Issue Fix #6041 Start
        boolean relationKey = this.getOneToOneRelationAttributeWidgets().stream()
                .anyMatch(w -> w.getBaseElementSpec().isPrimaryKey()) ? true
                        : this.getManyToOneRelationAttributeWidgets().stream()
                                .anyMatch(w -> w.getBaseElementSpec().isPrimaryKey());
        List<Id> ids = this.getBaseElementSpec().getAttributes().getSuperId();
        if (ids.isEmpty() && this.isCompositePKPropertyAllow() == CompositePKProperty.NONE && !relationKey) {
            getSignalManager().fire(ERROR, NO_PRIMARYKEY_EXIST);
        } else {//  w  w  w . j av a  2  s  . c  o  m
            getSignalManager().clear(ERROR, NO_PRIMARYKEY_EXIST);
        }
        List<String> idGenList = ids.stream().filter(idAttr -> idAttr.getGeneratedValue() != null)
                .filter(idAttr -> idAttr.getGeneratedValue().getStrategy() != null).map(Id::getName)
                .collect(toList());
        if (idGenList.size() > 1) {
            getSignalManager().fire(ERROR, MANY_PRIMARYKEY_GEN_EXIST, idGenList.toString());
        } else {
            getSignalManager().clear(ERROR, MANY_PRIMARYKEY_GEN_EXIST);
        }
    } else {
        getSignalManager().clear(ERROR, ClassValidator.NO_PRIMARYKEY_EXIST);
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddAssociatedConceptGenerator.java

private void sortConcepts(List<AssociatedConceptInfo> concepts) {
    Collections.sort(concepts, new AssociatedConceptInfoComparator());
    log.debug("Concepts should be sorted now" + concepts.toString());
}

From source file:com.jayway.maven.plugins.android.phase09package.Apklib2Mojo.java

private void crunchResources(File srcDir, File outDir) throws MojoExecutionException {

    CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
    executor.setLogger(this.getLog());

    List<String> commands = new ArrayList<String>();
    commands.add("crunch");
    commands.add("-S");
    commands.add(srcDir.getAbsolutePath());
    commands.add("-C");
    commands.add(outDir.getAbsolutePath());
    getLog().info(getAndroidSdk().getPathForTool("aapt") + " " + commands.toString());
    try {// w  ww  . j  av  a2s . c o m
        executor.executeCommand(getAndroidSdk().getPathForTool("aapt"), commands, project.getBasedir(), false);
    } catch (ExecutionException e) {
        throw new MojoExecutionException("", e);
    }

}