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:gov.nih.nci.cabig.caaers.api.impl.StudyProcessorImpl.java

public CaaersServiceResponse createStudy(gov.nih.nci.cabig.caaers.integration.schema.study.Studies xmlStudies) {
    gov.nih.nci.cabig.caaers.integration.schema.study.Study studyDto = xmlStudies.getStudy().get(0);

    CaaersServiceResponse caaersServiceResponse = Helper.createResponse();

    logger.info("Study Short Title: " + studyDto.getShortTitle());
    logger.info("Study Long Title:" + studyDto.getLongTitle());

    String errorMsg = checkAuthorizedOrganizations(studyDto);
    if (!errorMsg.equals("ALL_ORGS_AUTH")) {
        return Helper.populateError(caaersServiceResponse, "WS_AEMS_028", errorMsg);
    }//from   w  w w .  j  a v  a  2 s .  c o m
    DomainObjectImportOutcome<Study> studyImportOutcome = null;
    Study study = new LocalStudy();

    //Convert JAXB StudyType to Domain Study
    try {
        logger.info("Converting StudyDto to Study");
        studyConverter.convertStudyDtoToStudyDomain(studyDto, study);
        logger.info("StudyDto converted to Study");
    } catch (CaaersSystemException caEX) {
        studyImportOutcome = new DomainObjectImportOutcome<Study>();
        logger.error("StudyDto to StudyDomain Conversion Failed ", caEX);
        studyImportOutcome.addErrorMessage("StudyDto to StudyDomain Conversion Failed ",
                DomainObjectImportOutcome.Severity.ERROR);
        Helper.populateError(caaersServiceResponse, "WS_GEN_000", "StudyDto to StudyDomain Conversion Failed");
    }

    if (studyImportOutcome == null) {
        studyImportOutcome = studyImportService.importStudy(study);
        //Check if Study Exists
        Study dbStudy = checkDuplicateStudyBasedOnProcolAuthorityIdentifier(
                studyImportOutcome.getImportedDomainObject());
        if (dbStudy != null) {
            studyImportOutcome.addErrorMessage(
                    study.getClass().getSimpleName() + " identifier already exists. ", Severity.ERROR);
            Helper.populateError(caaersServiceResponse, "WS_STU_001",
                    messageSource.getMessage("WS_STU_001",
                            new Object[] { dbStudy.getPrimaryIdentifierValue(),
                                    studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue() },
                            "Another study is using the identifier provided", Locale.getDefault()));
        } else {

            List<String> errors = domainObjectValidator.validate(studyImportOutcome.getImportedDomainObject());
            if (studyImportOutcome.isSavable() && errors.size() == 0) {
                try {
                    Study theStudy = studyImportOutcome.getImportedDomainObject();
                    studyRepository.synchronizeStudyPersonnel(theStudy);
                    studyRepository.save(theStudy);

                    ProcessingOutcome processingOutcome = Helper.createOutcome(Study.class,
                            theStudy.getFundingSponsorIdentifierValue(), String.valueOf(theStudy.getId()),
                            false, "Study \"" + theStudy.getPrimaryIdentifierValue() + "\" Created in caAERS");
                    Helper.populateProcessingOutcome(caaersServiceResponse, processingOutcome);
                    Helper.populateMessage(caaersServiceResponse, "Study with Short Title  \""
                            + theStudy.getPrimaryIdentifierValue() + "\" Created in caAERS");

                    logger.info("Study Created");
                } catch (Exception e) {
                    Helper.populateError(caaersServiceResponse, "WS_GEN_000",
                            "Study Creation Failed " + e.getMessage());
                    logger.error("Error processing study : " + e.getMessage(), e);
                }

            } else {
                for (String errMsg : errors) {
                    studyImportOutcome.addErrorMessage(errMsg, Severity.ERROR);
                }

                List<String> messages = new ArrayList<String>();
                for (Message message : studyImportOutcome.getMessages()) {
                    messages.add(message.getMessage());
                }
                for (String errMsg : errors) {
                    messages.add(errMsg);
                }

                String msg = "Study \""
                        + studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue()
                        + "\" could not be created in caAERS. " + messages.toString();

                Helper.populateError(caaersServiceResponse, "WS_GEN_000", msg);

                Helper.populateProcessingOutcome(caaersServiceResponse,
                        Helper.createOutcome(Study.class,
                                studyImportOutcome.getImportedDomainObject().getFundingSponsorIdentifierValue(),
                                true, msg));
                logger.debug(">>> ERR:" + msg);
            }
        }

    }

    logger.info("Leaving createStudy() in StudyProcessorImpl");
    return caaersServiceResponse;
}

From source file:delfos.rs.trustbased.WeightedGraph.java

private void validateConnections(Map<Node, Map<Node, Number>> connections) throws IllegalStateException {
    List<Double> wrongValues = connections.values().parallelStream()
            .flatMap(thisNodeConnections -> thisNodeConnections.values().stream())
            .map(numberValue -> numberValue.doubleValue()).filter(value -> (value > 1) || (value < 0))
            .collect(Collectors.toList());

    if (!wrongValues.isEmpty()) {
        throw new IllegalStateException(
                "Value must be given in [0,1] interval and it was: " + wrongValues.toString());
    }//from  ww w. jav a2s  .  c om
}

From source file:com.Sor.User.LoginServlet.java

public void getperson(String userId) throws IOException {
        String urlString = "http://localhost:8080/SorServer/rest/user/viewPerson?userId=" + userId;
        URL url = new URL(urlString);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");

        if (conn.getResponseCode() != 200) {
            throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
        }//from   ww w .j  av  a2  s.  c o m

        BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
        String output;
        System.out.println("Output from Server .... \n");
        while ((output = br.readLine()) != null) {
            ObjectMapper mapper = new ObjectMapper();

            Person pers = mapper.readValue(output, Person.class);
            String userName = pers.getUserName();
            String givenName = pers.getGivenName();
            String familyName = pers.getFamilyName();
            String userMail = pers.getUserMail();
            String userAddress = pers.getUserAddress();
            List<Worked> worked = pers.getWorked();
            List<Skill> knowledge = pers.getKnowledge();
            String knowledgeString = knowledge.toString();
            String skill = knowledgeString.substring(knowledgeString.indexOf("skillName") + 10,
                    knowledgeString.indexOf("jobId"));
            String experience = knowledgeString.substring(knowledgeString.indexOf("experience") + 11,
                    knowledgeString.indexOf("experience") + 13) + "/5";

            List<Person> friends = pers.getFriends();
            String nationality = pers.getNationality();
            String married = pers.getMarried();
            String age = pers.getAge();
            String driverLicense = pers.getDriverLicense();
            String homepage = pers.getHomepage();
            String phone = pers.getPhone();
            String salary = pers.getSalary();
            String title = pers.getTitle();
            List<Hobby> hobbies = pers.getHobbies();
            List<Job> jobsSearched = pers.getJobesSearched();

            List<Studied> studied = pers.getStudied();
            String studiedString = studied.toString();
            String studiedAt = studiedString.substring(studiedString.indexOf("organizationId") + 16,
                    studiedString.indexOf("homepage"));

            session.setAttribute("userName", userName);
            session.setAttribute("givenName", givenName);
            session.setAttribute("familyName", familyName);
            session.setAttribute("userMail", userMail);
            session.setAttribute("userAddress", userAddress);
            session.setAttribute("worked", worked);
            session.setAttribute("knowledge", skill + " " + experience);
            session.setAttribute("friends", friends);
            session.setAttribute("nationality", nationality);
            session.setAttribute("married", married);
            session.setAttribute("age", age);
            session.setAttribute("driverLicense", driverLicense);
            session.setAttribute("homepage", homepage);
            session.setAttribute("phone", phone);
            session.setAttribute("salary", salary);
            session.setAttribute("title", title);
            session.setAttribute("hobbies", hobbies);
            session.setAttribute("jobsSearched", jobsSearched);
            session.setAttribute("studied", studiedAt);

            String Sgiven = (String) session.getAttribute("givenName");
            String Sfamily = (String) session.getAttribute("familyName");
            String SusrName = (String) session.getAttribute("userName");
            String SusrMail = (String) session.getAttribute("userMail");
            String SusrAddress = (String) session.getAttribute("userAddress");
            //List<Worked> Sworked=  (List<Worked>) session.getAttribute("worked");
            //List<Skill> Sknowledge=(List<Skill>) session.getAttribute("knowledge");
            String family = (String) session.getAttribute("familyName");
            //List<Person> Sfriends=(List<Person>) session.getAttribute("friends");
            String Snationality = (String) session.getAttribute("nationality");
            String Smarried = (String) session.getAttribute("married");
            String Sage = (String) session.getAttribute("age");
            String SdriverLicense = (String) session.getAttribute("driverLicense");
            String Shomepage = (String) session.getAttribute("homepage");
            String Sphone = (String) session.getAttribute("phone");
            String Ssalary = (String) session.getAttribute("salary");
            String Stitle = (String) session.getAttribute("title");
            //ArrayList<?> Shobbies=(ArrayList<?>) session.getAttribute("hobbies");
            //ArrayList<?> SjobsSearched=(ArrayList<?>) session.getAttribute("jobsSearched");
            String Sstudied = (String) session.getAttribute("studied");
            System.out.println(Sgiven);
            System.out.println(Sfamily);
            System.out.println(SusrName);
            System.out.println(SusrMail);
            System.out.println(SusrAddress);
            //System.out.println(Sworked);
            //System.out.println(Sknowledge);
            //System.out.println(Sfriends);
            //System.out.println(Sfriends);
            System.out.println(Snationality);
            System.out.println(Smarried);
            System.out.println(Sage);
            System.out.println(SdriverLicense);
            System.out.println(Shomepage);
            System.out.println(Sphone);
            System.out.println(Ssalary);
            System.out.println(Stitle);
            //System.out.println(Shobbies);
            //System.out.println(SjobsSearched);
            System.out.println(Sstudied);

            System.out.println(output);
        }
        conn.disconnect();
    }

From source file:com.jvoid.products.product.service.ProductsMasterService.java

public List<Integer> getAllChildrenCategoryIds(int parentCategoryId) {

    List<Integer> childrenCategoryIdsList = new ArrayList<Integer>();
    List<Categories> categoryList = this.categoriesService.getAllChildCategories(parentCategoryId);
    childrenCategoryIdsList.add(parentCategoryId);
    for (int i = 0; i < categoryList.size(); i++) {
        childrenCategoryIdsList.add(categoryList.get(i).getId());
        List<Integer> childrenList = getAllChildrenCategoryIds(categoryList.get(i).getId());
        System.out.println("CHILDREN:" + childrenList.toString());
        childrenCategoryIdsList.addAll(childrenList);
    }// w  w  w  .j  av  a2 s  .c o  m
    Collections.sort(childrenCategoryIdsList);

    List<Integer> UniqueCategoryIdsList = new ArrayList<Integer>();
    for (int i = 0; i < childrenCategoryIdsList.size(); i++) {

        if (!UniqueCategoryIdsList.contains(childrenCategoryIdsList.get(i).intValue())) {
            UniqueCategoryIdsList.add(childrenCategoryIdsList.get(i).intValue());
        }
    }
    return UniqueCategoryIdsList;
}

From source file:delfos.rs.trustbased.WeightedGraph.java

private void validateEdges(Set<PathBetweenNodes<Node>> edges) throws IllegalArgumentException {
    List<PathBetweenNodes<Node>> edgesWithMoreThanOneJump = edges.parallelStream()
            .filter(edge -> edge.numEdges() != 1).collect(Collectors.toList());

    if (!edgesWithMoreThanOneJump.isEmpty()) {
        System.out.println("There are edges that are paths!");
        edgesWithMoreThanOneJump.forEach(edge -> System.out.println(edge));
        throw new IllegalArgumentException(
                "The edges specified have more than one jump: " + edgesWithMoreThanOneJump.toString());
    }/*w ww.j  a va  2  s  .co  m*/
}

From source file:gov.nih.nci.cabig.caaers.dao.index.AbstractIndexDao.java

/**
 * @param userName - the login name of the user
 * @param indexEntries - entries to insert into the database.
 */// ww w .  jav a2  s  .  c  o m
@Transactional(readOnly = false)
public void updateIndex(final String userName, List<IndexEntry> indexEntries) {
    String dataBase = "";
    if (this.getProperties().getProperty(DB_NAME) != null) {
        dataBase = getProperties().getProperty(DB_NAME);
    }
    boolean oracleDB = dataBase.equals(ORACLE_DB);

    Map<String, List<IndexEntry>> diffMap = diff(userName, indexEntries);

    final List<IndexEntry> toInsert = diffMap.get("insert");
    if (!CollectionUtils.isEmpty(toInsert)) {

        BatchPreparedStatementSetter setter = new BatchPreparedStatementSetter() {

            public void setValues(PreparedStatement ps, int index) throws SQLException {
                IndexEntry entry = toInsert.get(index);
                ps.setString(1, userName);
                ps.setInt(2, entry.getEntityId());
                ps.setInt(3, entry.getPrivilege());
            }

            public int getBatchSize() {
                return toInsert.size();
            }
        };

        if (log.isInfoEnabled()) {
            log.info("Inserting : " + toInsert.size() + " records");
            log.info(toInsert.toString());
        }

        getJdbcTemplate().batchUpdate(generateSQLInsertTemplate(oracleDB).toString(), setter);
    }

    final List<IndexEntry> toUpdate = diffMap.get("update");
    if (!CollectionUtils.isEmpty(toUpdate)) {
        BatchPreparedStatementSetter setter = new BatchPreparedStatementSetter() {

            public void setValues(PreparedStatement ps, int index) throws SQLException {
                IndexEntry entry = toUpdate.get(index);
                ps.setInt(1, entry.getPrivilege());
                ps.setString(2, userName);
                ps.setInt(3, entry.getEntityId());
            }

            public int getBatchSize() {
                return toUpdate.size();
            }
        };

        if (log.isInfoEnabled()) {
            log.info("Updating : " + toUpdate.size() + " records");
            log.info(toUpdate.toString());
        }

        getJdbcTemplate().batchUpdate(generateSQLUpdateTemplate(oracleDB).toString(), setter);
    }

    List<String> deleteQueries = new ArrayList<String>();
    List<IndexEntry> toDelete = diffMap.get("delete");
    if (!CollectionUtils.isEmpty(toDelete)) {
        if (CollectionUtils.isEmpty(indexEntries)) {
            deleteQueries.add(generateSQL("delete-all", userName, null, oracleDB));
        } else {
            for (IndexEntry entry : toDelete) {
                deleteQueries.add(generateSQL("delete", userName, entry, oracleDB));
            }
        }

        getJdbcTemplate().batchUpdate(deleteQueries.toArray(new String[] {}));
        if (log.isInfoEnabled()) {
            log.info("Deleting : " + deleteQueries.size() + " records");
            log.info(deleteQueries.toString());
        }
    }

}

From source file:com.Sor.User.LoginServlet.java

public void getperson(String userId) throws IOException { //http://sorserver.eu-gb.mybluemix.net/rest/user/viewPerson?userId=
        String urlString = Constants.url + "user/viewPerson?userId=" + userId;
        URL url = new URL(urlString);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");

        if (conn.getResponseCode() != 200) {
            throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
        }/*from w  w w  . j  a  va2 s  . c  o m*/

        BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
        String output;
        System.out.println("Output from Server .... \n");

        while ((output = br.readLine()) != null) {
            ObjectMapper mapper = new ObjectMapper();

            Person pers = mapper.readValue(output, Person.class);
            String userName = pers.getUserName();
            String givenName = pers.getGivenName();
            String familyName = pers.getFamilyName();
            String userMail = pers.getUserMail();
            String userAddress = pers.getUserAddress();

            List<Worked> worked = pers.getWorked();
            String workedOrg = worked.get(0).getOrganizationId().toString();
            String careerLevel = worked.get(0).getJob().getJobCareerLevel().toString();
            //String workedOrg=worked.get(0).getOrganizationId().toString();
            //System.out.println(workedOrg);
            //String careerLevel=worked.get(0).getJob().getJobCareerLevel().toString();

            List<Skill> knowledge = pers.getKnowledge();
            String knowledgeString = "";
            int countk = 0;
            for (Skill s : knowledge) {
                if (countk == 0) {
                    knowledgeString = knowledgeString + s.getSkillName();
                } else {
                    knowledgeString = knowledgeString + "," + s.getSkillName();
                }
                countk++;
            }
            System.out.println(knowledgeString);

            List<Person> friends = pers.getFriends();
            String friendsList = "";
            int countf = 0;
            for (Person p : friends) {
                if (countf == 0) {
                    friendsList = friendsList + p.getName();
                } else {
                    friendsList = friendsList + "," + p.getName();
                }
                countf++;
            }

            String nationality = pers.getNationality();
            String married = pers.getMarried();
            String age = pers.getAge();
            String driverLicense = pers.getDriverLicense();
            String homepage = pers.getHomepage();
            String phone = pers.getPhone();
            String salary = pers.getSalary();
            String title = pers.getTitle();
            List<Hobby> hobbies = pers.getHobbies();
            List<Job> jobsSearched = pers.getJobesSearched();
            List<Studied> studied = pers.getStudied();
            String studiedString = studied.toString();
            String studiedAt = studied.get(0).getOrganizationId();
            System.out.println(studiedAt);
            session.setAttribute("userName", userName);
            session.setAttribute("givenName", givenName);
            session.setAttribute("familyName", familyName);
            session.setAttribute("userMail", userMail);
            session.setAttribute("userAddress", userAddress);
            session.setAttribute("workedOrg", workedOrg);
            session.setAttribute("careerLevel", careerLevel);
            session.setAttribute("knowledge", knowledgeString);
            session.setAttribute("friends", friendsList);
            session.setAttribute("nationality", nationality);
            session.setAttribute("married", married);
            session.setAttribute("age", age);
            session.setAttribute("driverLicense", driverLicense);
            session.setAttribute("homepage", homepage);
            session.setAttribute("phone", phone);
            session.setAttribute("salary", salary);
            session.setAttribute("title", title);
            session.setAttribute("hobbies", hobbies);
            session.setAttribute("jobsSearched", jobsSearched);
            session.setAttribute("studied", studiedAt);

            /*
            String Sgiven=(String) session.getAttribute("givenName");
            String Sfamily=(String) session.getAttribute("familyName");
            String SusrName=(String) session.getAttribute("userName");
            String SusrMail=(String) session.getAttribute("userMail");
            String SusrAddress=(String) session.getAttribute("userAddress");
            //List<Worked> Sworked=  (List<Worked>) session.getAttribute("worked");
            //List<Skill> Sknowledge=(List<Skill>) session.getAttribute("knowledge");
            String family=(String) session.getAttribute("familyName");
            //List<Person> Sfriends=(List<Person>) session.getAttribute("friends");
            String Snationality=(String) session.getAttribute("nationality");
            String Smarried=(String) session.getAttribute("married");
            String Sage=(String) session.getAttribute("age");
            String SdriverLicense=(String) session.getAttribute("driverLicense");
            String Shomepage=(String) session.getAttribute("homepage");
            String Sphone=(String) session.getAttribute("phone");
            String Ssalary=(String) session.getAttribute("salary");
            String Stitle=(String) session.getAttribute("title");
            //ArrayList<?> Shobbies=(ArrayList<?>) session.getAttribute("hobbies");
            //ArrayList<?> SjobsSearched=(ArrayList<?>) session.getAttribute("jobsSearched");
            String Sstudied=(String) session.getAttribute("studied");
            System.out.println(Sgiven);
            System.out.println(Sfamily);
            System.out.println(SusrName);
            System.out.println(SusrMail);
            System.out.println(SusrAddress);
            //System.out.println(Sworked);
            //System.out.println(Sknowledge);
            //System.out.println(Sfriends);
            //System.out.println(Sfriends);
            System.out.println(Snationality);
            System.out.println(Smarried);
            System.out.println(Sage);
            System.out.println(SdriverLicense);
            System.out.println(Shomepage);
            System.out.println(Sphone);
            System.out.println(Ssalary);
            System.out.println(Stitle);
            //System.out.println(Shobbies);
            //System.out.println(SjobsSearched);
            System.out.println(Sstudied);
                
                
            System.out.println(output);*/
        }
        conn.disconnect();
    }

From source file:com.hortonworks.streamline.streams.service.TopologyComponentBundleResource.java

/**
 * List custom processors matching specific query parameter filters.
 *//*from  ww  w.j  a v a  2 s .co  m*/
@GET
@Path("/componentbundles/{processor}/custom")
@Timed
public Response listCustomProcessorsWithFilters(
        @PathParam("processor") TopologyComponentBundle.TopologyComponentType componentType,
        @Context UriInfo uriInfo, @Context SecurityContext securityContext) throws IOException {
    SecurityUtil.checkRole(authorizer, securityContext, Roles.ROLE_TOPOLOGY_COMPONENT_BUNDLE_USER);
    if (!TopologyComponentBundle.TopologyComponentType.PROCESSOR.equals(componentType)) {
        throw new CustomProcessorOnlyException();
    }
    List<QueryParam> queryParams;
    MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
    queryParams = WSUtils.buildQueryParameters(params);
    Collection<CustomProcessorInfo> customProcessorInfos = catalogService
            .listCustomProcessorsFromBundleWithFilter(queryParams);
    if (customProcessorInfos != null) {
        return WSUtils.respondEntities(customProcessorInfos, OK);
    }

    throw EntityNotFoundException.byFilter(queryParams.toString());
}

From source file:gov.nih.nci.cabig.caaers.api.impl.StudyProcessorImpl.java

@Transactional(readOnly = false)
public CaaersServiceResponse updateStudy(gov.nih.nci.cabig.caaers.integration.schema.study.Studies xmlStudies) {
    gov.nih.nci.cabig.caaers.integration.schema.study.Study studyDto = xmlStudies.getStudy().get(0);
    CaaersServiceResponse caaersServiceResponse = Helper.createResponse();

    logger.info("Study Short Title --- " + studyDto.getShortTitle());
    logger.info("Study Long Title --- " + studyDto.getLongTitle());

    String errorMsg = checkAuthorizedOrganizations(studyDto);
    if (!errorMsg.equals("ALL_ORGS_AUTH")) {
        Helper.populateError(caaersServiceResponse, "WS_AEMS_028", errorMsg);
        return caaersServiceResponse;
    }/*  ww  w .  jav a  2  s.  c  om*/

    DomainObjectImportOutcome<Study> studyImportOutcome = null;
    Study study = new LocalStudy();

    //Convert JAXB StudyType to Domain Study
    try {
        studyConverter.convertStudyDtoToStudyDomain(studyDto, study);
        logger.info("StudyDto converted to Study");
    } catch (CaaersSystemException caEX) {
        studyImportOutcome = new DomainObjectImportOutcome<Study>();
        logger.error("StudyDto to StudyDomain Conversion Failed ", caEX);
        studyImportOutcome.addErrorMessage("StudyDto to StudyDomain Conversion Failed ",
                DomainObjectImportOutcome.Severity.ERROR);
        Helper.populateError(caaersServiceResponse, "WS_GEN_000", "StudyDto to StudyDomain Conversion Failed");
        return caaersServiceResponse;
    }

    if (studyImportOutcome == null) {
        studyImportOutcome = studyImportService.importStudy(study);
        List<String> errors = domainObjectValidator.validate(studyImportOutcome.getImportedDomainObject());
        if (studyImportOutcome.isSavable() && errors.size() == 0) {
            Study dbStudy = fetchStudy(studyImportOutcome.getImportedDomainObject());

            if (dbStudy == null) {
                Helper.populateError(caaersServiceResponse, "WS_GEN_000",
                        "Study \"" + studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue()
                                + "\" does not exist in caAERS");
                studyImportOutcome.addErrorMessage(
                        "Study \"" + studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue()
                                + "\" does not exist in caAERS",
                        DomainObjectImportOutcome.Severity.ERROR);
                return caaersServiceResponse;
            }

            studySynchronizer.migrate(dbStudy, studyImportOutcome.getImportedDomainObject(),
                    studyImportOutcome);
            studyImportOutcome.setImportedDomainObject(dbStudy);

            //check if another study exist?
            Study anotherStudy = checkDuplicateStudyBasedOnProcolAuthorityIdentifier(
                    studyImportOutcome.getImportedDomainObject());
            if (anotherStudy != null) {
                String errorDescription = messageSource.getMessage("WS_STU_001",
                        new Object[] { anotherStudy.getPrimaryIdentifierValue(),
                                studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue() },
                        "Another study is using the identifier provided", Locale.getDefault());
                Helper.populateError(caaersServiceResponse, "WS_GEN_000", errorDescription);
                studyImportOutcome.addErrorMessage(errorDescription, DomainObjectImportOutcome.Severity.ERROR);
                return caaersServiceResponse;
            }
            try {
                Study theStudy = studyImportOutcome.getImportedDomainObject();
                studyRepository.synchronizeStudyPersonnel(theStudy);
                studyRepository.save(theStudy);
                ProcessingOutcome processingOutcome = Helper.createOutcome(Study.class,
                        theStudy.getFundingSponsorIdentifierValue(), String.valueOf(theStudy.getId()), false,
                        "Study \"" + studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue()
                                + "\" updated in caAERS");
                Helper.populateProcessingOutcome(caaersServiceResponse, processingOutcome);
                Helper.populateMessage(caaersServiceResponse,
                        "Study \"" + studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue()
                                + "\" updated in caAERS");
                caaersServiceResponse.getServiceResponse().getResponsecode();
                logger.info("Study Updated");
            } catch (Exception e) {
                logger.error("Error while saving the study :" + e.getMessage(), e);
                String msg = "Cannot process study : " + e.getMessage();
                Helper.populateError(caaersServiceResponse, "WS_GEN_000", msg);
                Helper.populateProcessingOutcome(caaersServiceResponse,
                        Helper.createOutcome(Study.class,
                                studyImportOutcome.getImportedDomainObject().getFundingSponsorIdentifierValue(),
                                true, msg));
            }

        } else {

            List<String> messages = new ArrayList<String>();
            for (Message message : studyImportOutcome.getMessages()) {
                messages.add(message.getMessage());
            }
            for (String errMsg : errors) {
                messages.add(errMsg);
            }
            Helper.populateError(caaersServiceResponse, "WS_GEN_000",
                    "Study \"" + studyImportOutcome.getImportedDomainObject().getPrimaryIdentifierValue()
                            + "\" could not be updated in caAERS. " + messages.toString());

        }
    }

    logger.info("Leaving updateStudy() in StudyProcessor");
    return caaersServiceResponse;
}

From source file:com.esd.cs.settings.UserController.java

/**
 * /*from w w w  .  j  a  v a 2 s. c  o  m*/
 * 
 * @param request
 * @return
 */
@RequestMapping(value = "/list")
@ResponseBody
public Map<String, Object> list(@RequestParam(value = "page") Integer page,
        @RequestParam(value = "rows") Integer rows, HttpServletRequest request) {
    Map<String, Object> entity = new HashMap<>();
    try {
        User user = new User();
        String userName = request.getParameter("userName");
        String userRealName = request.getParameter("userRealName");
        String userMobile = request.getParameter("userMobile");
        user.setUserName(userName);
        user.setUserRealName(userRealName);
        user.setUserMobile(userMobile);
        PaginationRecordsAndNumber<User, Number> query = null;
        query = userService.getPaginationRecords(user, page, rows);
        Integer total = query.getNumber().intValue();// ??
        List<Map<String, Object>> list = new ArrayList<>();
        for (Iterator<User> iterator = query.getRecords().iterator(); iterator.hasNext();) {
            User it = iterator.next();
            Map<String, Object> map = new HashMap<>();
            map.put("id", it.getId());// id
            map.put("userName", it.getUserName());// ??
            map.put("userRealName", it.getUserRealName());// ??
            map.put("userMobile", it.getUserMobile());// ?
            map.put("userGroup", it.getUserGroup().getUserGroupName());// 
            map.put("userStatus", it.getUserStatus());// ?
            list.add(map);
        }
        entity.put("total", total);
        entity.put("rows", list);
        logger.debug("total:{},rows:{}", total, list.toString());

    } catch (Exception e) {
        logger.error(e.getMessage());
    }
    return entity;
}