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.tweetlanes.android.model.AccountDescriptor.java

public String toString() {
    JSONObject object = new JSONObject();
    try {/*from   w w w  .  j  a v a 2s  .  c  om*/
        object.put(KEY_ID, mId);
        object.put(KEY_SCREEN_NAME, mScreenName);
        object.put(KEY_OAUTH_TOKEN, mOAuthToken);
        object.put(KEY_OAUTH_SECRET, mOAuthSecret);
        object.put(KEY_INITIAL_LANE_INDEX, mInitialLaneIndex);
        object.put(KEY_SOCIAL_NET_TYPE, mSocialNetType);

        if (mLists.size() > 0) {
            JSONArray listArray = new JSONArray();
            for (List list : mLists) {
                listArray.put(list.toString());
            }
            object.put(KEY_LISTS, listArray);
        }

        if (mLaneDefinitions != null && mLaneDefinitions.size() > 0) {
            JSONArray laneDisplayArray = new JSONArray();
            for (LaneDescriptor lane : mLaneDefinitions) {
                if (lane.getDisplay()) {
                    laneDisplayArray.put(lane.getLaneTitle());
                }
            }
            object.put(KEY_DISPLAYED_LANES, laneDisplayArray);
        }

    } catch (JSONException e) {
        e.printStackTrace();
    }
    return object.toString();
}

From source file:de.betterform.agent.web.flux.FluxFacade.java

private List handleUIEvent(UIEvent uiEvent, String sessionKey) throws FluxException {
    FluxProcessor processor = FluxUtil.getProcessor(sessionKey, request, response, session);
    if (processor != null) {
        try {//from   w  w w . j  a v  a2 s  . com
            processor.handleUIEvent(uiEvent);
        } catch (XFormsException e) {
            LOGGER.error(e.getMessage());
        }
    } else {
        //session expired or cookie got lost
        throw new FluxException("Sorry your session expired. Press Reload to start over.");
    }
    EventQueue eventQueue = processor.getEventQueue();
    List eventlog = eventQueue.getEventList();
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Object ID: " + this);
        LOGGER.debug("EventLog: " + eventlog.toString());
        LOGGER.debug("FluxProcessor: " + processor);
    }
    return eventlog;
}

From source file:org.crce.interns.dao.impl.SendEmailDAOImpl.java

/**
 * /*from w ww .  j  av  a  2s .c  o m*/
 * @param receivers
 * @return 
 */
@Override
public String fetchStudentEmailId(String receivers) {
    Session session = sessionFactory.openSession();

    String SQL_QUERY = "Select emailId from PersonalProfile where userName like '" + receivers + "'";
    Query query = session.createQuery(SQL_QUERY);
    List list = query.list();
    if (!list.isEmpty()) {
        System.out.println(list);
    }
    session.close();
    return list.toString();
}

From source file:de.fu_berlin.inf.dpp.invitation.FileList.java

@Override
public String toString() {
    List<String> paths = new ArrayList<String>(getPaths());
    Collections.sort(paths);/*from  w  w  w . j a v a2 s.c o m*/

    return paths.toString();
}

From source file:de.zib.gndms.gndmc.utils.HTTPGetter.java

public int get(final HttpMethod method, String url, final HttpHeaders headers)
        throws NoSuchAlgorithmException, KeyManagementException {
    logger.debug(method.toString() + " URL " + url);

    EnhancedResponseExtractor responseExtractor = get(method, url, new RequestCallback() {
        @Override/* w ww .ja  v a2 s .  co m*/
        public void doWithRequest(ClientHttpRequest request) throws IOException {
            // add headers
            if (headers != null)
                request.getHeaders().putAll(headers);
        }
    });
    int statusCode = responseExtractor.getStatusCode();

    int redirectionCounter = 0;

    // redirect as long as needed
    while (300 <= statusCode && statusCode < 400) {
        final List<String> cookies = DefaultResponseExtractor.getCookies(responseExtractor.getHeaders());
        final String location = DefaultResponseExtractor.getLocation(responseExtractor.getHeaders());

        logger.debug("Redirection " + ++redirectionCounter);
        logger.trace("Redirecting to " + location + " with cookies " + cookies.toString());

        responseExtractor = get(method, location, new RequestCallback() {
            @Override
            public void doWithRequest(ClientHttpRequest request) throws IOException {
                for (String c : cookies)
                    request.getHeaders().add("Cookie", c.split(";", 2)[0]);

                // add headers
                if (headers != null)
                    request.getHeaders().putAll(headers);
            }
        });

        statusCode = responseExtractor.getStatusCode();
    }

    logger.debug("HTTP " + method.toString() + " Status Code " + statusCode + " after " + redirectionCounter
            + " redirections");

    return statusCode;
}

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

/**
 * Checks if the selected users (can be user, department, or company) exist in users,
 * departments, or companies collection; if so, return the list of ObjectIds.
 *
 * @param dataset               the selected dataset
 * @param usersCollection       the collection of registered users.
 * @param departmentsCollection the collection of registered departments.
 * @param companiesCollection   the collection of registered companies.
 * @return idList the list of Ids./*  w  ww  .j  ava2s.  c o  m*/
 */
private List<Permission> checkPermissions(Dataset dataset, DBCollection usersCollection,
        DBCollection departmentsCollection, DBCollection companiesCollection) {

    // Check if the field exists
    if (dataset.getPermissions() == null) {
        return null;
    }

    // Prepare lists
    List rawPermissionsList = new ArrayList(dataset.getPermissions());
    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;
        }
        // TODO: insert check for "perm" string too
        currPerm.setReferenceId(new ObjectId(currPerm.getReference()));
        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;
        }
    }

    return permissionsList;
}

From source file:gov.nih.nci.caarray.application.translation.geosoft.GeoSoftExporterBeanTest.java

/**
 * Test of validateForExport method, of class GeoSoftExporterBean.
 *///from   w  w  w . j av a2  s  . c  om
@Test
public void testValidateForExport() throws Exception {
    final Experiment experiment = makeGoodExperiment();
    final List<String> result = this.bean.validateForExport(experiment);
    assertTrue(result.toString(), result.isEmpty());
}

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

private String formulateConjunctionKey(List<String> indices) {
    return "~" + indices.toString().replaceAll("\\s", "");
}

From source file:com.vmware.bdd.service.job.heal.NodeRecoverDiskFailureStep.java

@Override
public RepeatStatus executeStep(ChunkContext chunkContext, JobExecutionStatusHolder jobExecutionStatusHolder)
        throws Exception {
    String clusterName = getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
    String groupName = getJobParameters(chunkContext).getString(JobConstants.GROUP_NAME_JOB_PARAM);
    String targetNode = getJobParameters(chunkContext).getString(JobConstants.SUB_JOB_NODE_NAME);

    VcVirtualMachine vm = null;//w w w. j  av  a2s .c  o  m
    try {
        vm = healService.getFixingVm(clusterName, groupName, targetNode);
    } catch (Exception e) {
        putIntoJobExecutionContext(chunkContext, JobConstants.CURRENT_ERROR_MESSAGE, e.getMessage());
        throw e;
    }

    // find bad disks
    List<DiskSpec> badDisks = healService.getBadDisks(targetNode);
    AuAssert.check(CollectionUtils.isNotEmpty(badDisks));

    // find replacements for bad disks
    logger.debug("get replacements for bad disks");
    List<DiskSpec> replacements;
    try {
        replacements = healService.getReplacementDisks(clusterName, groupName, targetNode, badDisks);
        AuAssert.check(badDisks.size() == replacements.size());
    } catch (Exception e) {
        putIntoJobExecutionContext(chunkContext, JobConstants.CURRENT_ERROR_MESSAGE, e.getMessage());
        throw e;
    }

    logger.debug("get replacement disk set for recovery " + replacements.toString());
    jobExecutionStatusHolder.setCurrentStepProgress(getJobExecutionId(chunkContext), 0.3);

    // need to create replace vm to recover disk fix
    if (vm == null) {

        // clone and recover
        logger.debug("start recovering bad vm " + targetNode);
        try {
            VcVirtualMachine newVm = healService.createReplacementVm(clusterName, groupName, targetNode,
                    replacements);

            // assert, if creation failed, exception should be thrown from previous method
            if (newVm != null) {
                logger.info("created replacement vm " + newVm.getId() + " for node " + targetNode);

                putIntoJobExecutionContext(chunkContext, JobConstants.REPLACE_VM_ID, newVm.getId());
            } else {
                logger.error("failed creating replacement vm for node " + targetNode);
                throw ClusterHealServiceException.FAILED_CREATE_REPLACEMENT_VM(targetNode);
            }
        } catch (Exception e) {
            putIntoJobExecutionContext(chunkContext, JobConstants.CURRENT_ERROR_MESSAGE, e.getMessage());

            throw e;
        }
    } else {
        if (healService.hasBadDisksExceptSystem(targetNode)) {
            vm = healService.replaceBadDisksExceptSystem(clusterName, groupName, targetNode, replacements);
        }
        putIntoJobExecutionContext(chunkContext, JobConstants.REPLACE_VM_ID, vm.getId());
    }

    jobExecutionStatusHolder.setCurrentStepProgress(getJobExecutionId(chunkContext), 1.0);
    return RepeatStatus.FINISHED;
}

From source file:com.tweetlanes.android.core.model.AccountDescriptor.java

public String toString() {
    JSONObject object = new JSONObject();
    try {//from w ww .jav a 2  s .  c  om
        object.put(KEY_ID, mId);
        object.put(KEY_SCREEN_NAME, mScreenName);
        object.put(KEY_NAME, mName);
        object.put(KEY_OAUTH_TOKEN, mOAuthToken);
        object.put(KEY_OAUTH_SECRET, mOAuthSecret);
        object.put(KEY_INITIAL_LANE_INDEX, mInitialLaneIndex);
        object.put(KEY_SOCIAL_NET_TYPE, mSocialNetType);
        object.put(KEY_PROFILE_IMAGE_URL, mProfileImageUrl);

        if (mLists.size() > 0) {
            JSONArray listArray = new JSONArray();
            for (List list : mLists) {
                listArray.put(list.toString());
            }
            object.put(KEY_LISTS, listArray);
        }

        if (mLaneDefinitions != null && mLaneDefinitions.size() > 0) {
            JSONArray laneDisplayArray = new JSONArray();
            for (LaneDescriptor lane : mLaneDefinitions) {
                if (lane.getDisplay()) {
                    laneDisplayArray.put(lane.getLaneTitle());
                }
            }
            object.put(KEY_DISPLAYED_LANES, laneDisplayArray);
        }

    } catch (JSONException e) {
        e.printStackTrace();
    }
    return object.toString();
}