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:org.crce.interns.dao.impl.SendEmailDAOImpl.java

/**
 * //from   w w w.  ja v a 2 s.  c  o  m
 * @return String
 */

@Override
public String fetchElexSTPC() {
    Session session = sessionFactory.openSession();

    String senderList = "";

    //String SQL_QUERY="Select emailId from PersonalProfile where userName like (select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Computer Engineering')";
    String SQL_QUERY = "select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Electronics Engineering' and p.year like '"
            + Integer.toString(Calendar.getInstance().get(Calendar.YEAR) + 1) + "'";

    Query query = session.createQuery(SQL_QUERY);

    List list = query.list();

    if (!list.isEmpty()) {
        System.out.println(list);
    }

    for (Object list1 : list) {
        System.out.println("senderList at start of loop " + senderList);
        System.out.println(list1);
        String recipient = list1.toString();
        SQL_QUERY = "select emailId from PersonalProfile where userName like '" + recipient + "'";
        query = session.createQuery(SQL_QUERY);
        list = query.list();
        recipient = list.toString();
        senderList = senderList.concat(recipient + " ");

    }
    System.out.println("final senderList " + senderList);

    session.close();
    return senderList;
}

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

/**
 * /*from w w w  .ja  v  a 2  s .c  o  m*/
 * @return String
 */

@Override
public String fetchITSTPC() {
    Session session = sessionFactory.openSession();

    String senderList = "";

    //String SQL_QUERY="Select emailId from PersonalProfile where userName like (select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Computer Engineering')";
    String SQL_QUERY = "select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Information Technology' and p.year like '"
            + Integer.toString(Calendar.getInstance().get(Calendar.YEAR) + 1) + "'";

    Query query = session.createQuery(SQL_QUERY);

    List list = query.list();

    if (!list.isEmpty()) {
        System.out.println(list);
    }

    for (Object list1 : list) {
        System.out.println("senderList at start of loop " + senderList);
        System.out.println(list1);
        String recipient = list1.toString();
        SQL_QUERY = "select emailId from PersonalProfile where userName like '" + recipient + "'";
        query = session.createQuery(SQL_QUERY);
        list = query.list();
        recipient = list.toString();
        senderList = senderList.concat(recipient + " ");

    }
    System.out.println("final senderList " + senderList);

    session.close();
    return senderList;
}

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

/**
 * // ww  w. ja v a 2 s.com
 * @return String
 */

@Override
public String fetchProdSTPC() {
    Session session = sessionFactory.openSession();

    String senderList = "";

    //String SQL_QUERY="Select emailId from PersonalProfile where userName like (select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Computer Engineering')";
    String SQL_QUERY = "select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Production Engineering' and p.year like '"
            + Integer.toString(Calendar.getInstance().get(Calendar.YEAR) + 1) + "'";

    Query query = session.createQuery(SQL_QUERY);

    List list = query.list();

    if (!list.isEmpty()) {
        System.out.println(list);
    }

    for (Object list1 : list) {
        System.out.println("senderList at start of loop " + senderList);
        System.out.println(list1);
        String recipient = list1.toString();
        SQL_QUERY = "select emailId from PersonalProfile where userName like '" + recipient + "'";
        query = session.createQuery(SQL_QUERY);
        list = query.list();
        recipient = list.toString();
        senderList = senderList.concat(recipient + " ");

    }
    System.out.println("final senderList " + senderList);

    session.close();
    return senderList;
}

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

/**
 * /*from w  w w.j ava  2  s  .co m*/
 * @return String
 */

@Override
public String fetchCompsFTPC() {
    Session session = sessionFactory.openSession();

    String senderList = "";

    //String SQL_QUERY="Select emailId from PersonalProfile where userName like (select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Computer Engineering')";
    String SQL_QUERY = "select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '4' and p.branch like 'Computer Engineering' and p.year like '"
            + Integer.toString(Calendar.getInstance().get(Calendar.YEAR) + 1) + "'";

    Query query = session.createQuery(SQL_QUERY);

    List list = query.list();

    if (!list.isEmpty()) {
        System.out.println(list);
    }

    for (Object list1 : list) {
        System.out.println("senderList at start of loop " + senderList);
        System.out.println(list1);
        String recipient = list1.toString();
        SQL_QUERY = "select emailId from PersonalProfile where userName like '" + recipient + "'";
        query = session.createQuery(SQL_QUERY);
        list = query.list();
        recipient = list.toString();
        senderList = senderList.concat(recipient + " ");

    }
    System.out.println("final senderList " + senderList);

    session.close();
    return senderList;
}

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

/**
 * //  w  w  w  .ja  v a  2 s. c o m
 * @return String
 */

@Override
public String fetchElexFTPC() {
    Session session = sessionFactory.openSession();

    String senderList = "";

    //String SQL_QUERY="Select emailId from PersonalProfile where userName like (select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Computer Engineering')";
    String SQL_QUERY = "select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '4' and p.branch like 'Electronics Engineering' and p.year like '"
            + Integer.toString(Calendar.getInstance().get(Calendar.YEAR) + 1) + "'";

    Query query = session.createQuery(SQL_QUERY);

    List list = query.list();

    if (!list.isEmpty()) {
        System.out.println(list);
    }

    for (Object list1 : list) {
        System.out.println("senderList at start of loop " + senderList);
        System.out.println(list1);
        String recipient = list1.toString();
        SQL_QUERY = "select emailId from PersonalProfile where userName like '" + recipient + "'";
        query = session.createQuery(SQL_QUERY);
        list = query.list();
        recipient = list.toString();
        senderList = senderList.concat(recipient + " ");

    }
    System.out.println("final senderList " + senderList);

    session.close();
    return senderList;
}

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

/**
 * //  ww  w .  ja  v a  2 s.com
 * @return String
 */

@Override
public String fetchITFTPC() {
    Session session = sessionFactory.openSession();

    String senderList = "";

    //String SQL_QUERY="Select emailId from PersonalProfile where userName like (select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Computer Engineering')";
    String SQL_QUERY = "select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '4' and p.branch like 'Information Technology Engineering' and p.year like '"
            + Integer.toString(Calendar.getInstance().get(Calendar.YEAR) + 1) + "'";

    Query query = session.createQuery(SQL_QUERY);

    List list = query.list();

    if (!list.isEmpty()) {
        System.out.println(list);
    }

    for (Object list1 : list) {
        System.out.println("senderList at start of loop " + senderList);
        System.out.println(list1);
        String recipient = list1.toString();
        SQL_QUERY = "select emailId from PersonalProfile where userName like '" + recipient + "'";
        query = session.createQuery(SQL_QUERY);
        list = query.list();
        recipient = list.toString();
        senderList = senderList.concat(recipient + " ");

    }
    System.out.println("final senderList " + senderList);

    session.close();
    return senderList;
}

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

/**
 * /*w w w.j a va  2s  .c o m*/
 * @return String
 */

@Override
public String fetchProdFTPC() {
    Session session = sessionFactory.openSession();

    String senderList = "";

    //String SQL_QUERY="Select emailId from PersonalProfile where userName like (select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '3' and p.branch like 'Computer Engineering')";
    String SQL_QUERY = "select u.userName from UserDetails as u,ProfessionalProfile as p where u.userName=p.userName and u.roleId like '4' and p.branch like 'Production Engineering' and p.year like '"
            + Integer.toString(Calendar.getInstance().get(Calendar.YEAR) + 1) + "'";

    Query query = session.createQuery(SQL_QUERY);

    List list = query.list();

    if (!list.isEmpty()) {
        System.out.println(list);
    }

    for (Object list1 : list) {
        System.out.println("senderList at start of loop " + senderList);
        System.out.println(list1);
        String recipient = list1.toString();
        SQL_QUERY = "select emailId from PersonalProfile where userName like '" + recipient + "'";
        query = session.createQuery(SQL_QUERY);
        list = query.list();
        recipient = list.toString();
        senderList = senderList.concat(recipient + " ");

    }
    System.out.println("final senderList " + senderList);

    session.close();
    return senderList;
}

From source file:com.thinkbiganalytics.datalake.authorization.RangerAuthorizationService.java

@Override
public void createReadOnlyHdfsPolicy(String categoryName, String feedName, List<String> securityGroupNames,
        List<String> hdfsPaths) {

    RangerCreateOrUpdatePolicy rangerCreateOrUpdatePolicy = new RangerCreateOrUpdatePolicy();

    /**/*w  w  w  .  ja va2s  .c  o m*/
     * Create HDFS Policy
     */
    List<String> hdfsPermissions = new ArrayList<>();
    hdfsPermissions.add(HDFS_READ_ONLY_PERMISSION);
    String rangerHdfsPolicyName = getHdfsPolicyName(categoryName, feedName);
    String description = "Ranger policy created for group list " + securityGroupNames.toString()
            + " for resource " + hdfsPaths.toString();
    String hdfsResource = convertListToString(hdfsPaths, ",");

    rangerCreateOrUpdatePolicy.setPolicyName(rangerHdfsPolicyName);
    rangerCreateOrUpdatePolicy.setResourceName(hdfsResource);
    rangerCreateOrUpdatePolicy.setDescription(description);
    rangerCreateOrUpdatePolicy.setRepositoryName(rangerConnection.getHdfsRepositoryName());
    rangerCreateOrUpdatePolicy.setRepositoryType(HDFS_REPOSITORY_TYPE);
    rangerCreateOrUpdatePolicy.setIsEnabled(IsEnable);
    rangerCreateOrUpdatePolicy.setIsRecursive(IsRecursive);
    rangerCreateOrUpdatePolicy.setIsAuditEnabled(IsAuditable);
    rangerCreateOrUpdatePolicy.setPermMapList(securityGroupNames, hdfsPermissions);

    try {
        rangerRestClient.createPolicy(rangerCreateOrUpdatePolicy);
    } catch (Exception e) {
        log.error("Error creating HDFS Ranger policy", e);
        throw new RuntimeException("Error creating HDFS Ranger policy", e);
    }
}

From source file:com.jayway.maven.plugins.android.phase04processclasses.DexMojo.java

private void runDex(CommandExecutor executor, File outputFile, File inputFile) throws MojoExecutionException {
    // Unpack all dependent and main classes
    File classesOutputDirectory = unpackClasses(inputFile);

    List<String> commands = new ArrayList<String>();
    if (jvmArguments != null) {
        for (String jvmArgument : jvmArguments) {
            if (jvmArgument != null) {
                if (jvmArgument.startsWith("-")) {
                    jvmArgument = jvmArgument.substring(1);
                }//from  ww  w  .  j  av  a  2s. co m
                commands.add("-J" + jvmArgument);
            }
        }
    }
    commands.add("--dex");
    commands.add("--output=" + outputFile.getAbsolutePath());
    if (coreLibrary) {
        commands.add("--core-library");
    }
    commands.add(classesOutputDirectory.getAbsolutePath());
    getLog().info(getAndroidSdk().getPathForTool("dx") + " " + commands.toString());
    try {
        executor.executeCommand(getAndroidSdk().getPathForTool("dx"), commands, project.getBasedir(), false);
    } catch (ExecutionException e) {
        throw new MojoExecutionException("", e);
    }
}

From source file:de.dailab.plistacontest.client.ContestHandlerOfflineCheating.java

/**
 * Method to handle incoming messages from the server.
 * //  w  w  w . j a  va 2 s  .co m
 * @param messageType
 *            the messageType of the incoming contest server message
 * @param _jsonMessageBody
 *            the incoming contest server message
 * @return the response to the contest server
 */
@SuppressWarnings("unused")
private String handleTraditionalMessage(final String messageType, final String _jsonMessageBody) {

    // write all data from the server to a file
    logger.info(messageType + "\t" + _jsonMessageBody);

    // create an jSON object from the String
    final JSONObject jObj = (JSONObject) JSONValue.parse(_jsonMessageBody);

    // define a response object
    String response = null;

    // TODO handle "item_create"

    // in a complex if/switch statement we handle the differentTypes of
    // messages
    if ("item_update".equalsIgnoreCase(messageType)) {

        // we extract itemID, domainID, text and the timeTime, create/update
        final RecommenderItem recommenderItem = RecommenderItem.parseItemUpdate(_jsonMessageBody);

        response = ";item_update successfull";
    }

    else if ("recommendation_request".equalsIgnoreCase(messageType)) {
        // THIS ISN'T WORKING BECAUSE REQUEST HAS A DIFFRENT JSON FORMAT THEN ITEM UPDATE
        //final RecommenderItem recommenderItem = RecommenderItem.parseItemUpdate(_jsonMessageBody);

        // we handle a recommendation request
        try {
            // parse the new recommender request
            RecommenderItem currentRequest = RecommenderItem.parseRecommendationRequest(_jsonMessageBody);

            // gather the items to be recommended
            List<Long> resultList = recommenderItemTable.getFutureItems(currentRequest.getTimeStamp(),
                    currentRequest.getDomainID(), currentRequest.getUserID());
            if (resultList == null) {
                response = "[]";
                System.out.println("invalid resultList");
            } else {
                response = resultList.toString();
            }
            response = getRecommendationResultJSON(response);

            // TODO? might handle the the request as impressions
        } catch (Throwable t) {
            t.printStackTrace();
        }
    } else if ("event_notification".equalsIgnoreCase(messageType)) {

        // parse the type of the event
        final RecommenderItem item = RecommenderItem.parseEventNotification(_jsonMessageBody);
        final String eventNotificationType = item.getNotificationType();

        // impression refers to articles read by the user
        if ("impression".equalsIgnoreCase(eventNotificationType)
                || "impression_empty".equalsIgnoreCase(eventNotificationType)) {

            // we mark this information in the article table
            if (item.getItemID() != null) {
                response = "handle impression eventNotification successful";
            }
            // click refers to recommendations clicked by the user
        } else if ("click".equalsIgnoreCase(eventNotificationType)) {

            response = "handle click eventNotification successful";

        } else {
            System.out.println("unknown event-type: " + eventNotificationType + " (message ignored)");
        }

    } else if ("error_notification".equalsIgnoreCase(messageType)) {

        System.out.println("error-notification: " + _jsonMessageBody);

    } else {
        System.out.println("unknown MessageType: " + messageType);
        // Error handling
        logger.info(jObj.toString());
        // this.contestRecommender.error(jObj.toString());
    }
    return response;
}