Example usage for java.lang Boolean compareTo

List of usage examples for java.lang Boolean compareTo

Introduction

In this page you can find the example usage for java.lang Boolean compareTo.

Prototype

public int compareTo(Boolean b) 

Source Link

Document

Compares this Boolean instance with another.

Usage

From source file:Main.java

public static void main(String[] args) {
    Boolean boolean1 = new Boolean("true");
    System.out.println(boolean1);

    Boolean boolean2 = new Boolean(true);
    System.out.println(boolean2.compareTo(boolean1));
}

From source file:eionet.cr.util.sesame.ResultCompareUtil.java

/**
 *
 * @param bs1/*from  w  w w  .  j  a v a2 s. c  o m*/
 * @param bs2
 * @param bNodeMapping
 * @return
 */
private static boolean bindingSetsMatch(BindingSet bs1, BindingSet bs2, Map<BNode, BNode> bNodeMapping) {

    if (bs1.size() != bs2.size()) {
        return false;
    }

    for (Binding binding1 : bs1) {
        Value value1 = binding1.getValue();
        Value value2 = bs2.getValue(binding1.getName());

        if (value1 instanceof BNode && value2 instanceof BNode) {
            BNode mappedBNode = bNodeMapping.get(value1);

            if (mappedBNode != null) {
                // bNode 'value1' was already mapped to some other bNode
                if (!value2.equals(mappedBNode)) {
                    // 'value1' and 'value2' do not match
                    return false;
                }
            } else {
                // 'value1' was not yet mapped, we need to check if 'value2' is a
                // possible mapping candidate
                if (bNodeMapping.containsValue(value2)) {
                    // 'value2' is already mapped to some other value.
                    return false;
                }
            }
        } else {

            if (!StringUtils.equals(value1.stringValue(), value2.stringValue())) {
                return false;
            }
            // values are not (both) bNodes
            if (value1 instanceof Literal && value2 instanceof Literal) {
                // do literal value-based comparison for supported datatypes
                Literal leftLit = (Literal) value1;
                Literal rightLit = (Literal) value2;

                URI dt1 = leftLit.getDatatype();
                URI dt2 = rightLit.getDatatype();

                if (dt1 != null && dt2 != null && dt1.equals(dt2)
                        && XMLDatatypeUtil.isValidValue(leftLit.getLabel(), dt1)
                        && XMLDatatypeUtil.isValidValue(rightLit.getLabel(), dt2)) {
                    Integer compareResult = null;
                    if (dt1.equals(XMLSchema.DOUBLE)) {
                        compareResult = Double.compare(leftLit.doubleValue(), rightLit.doubleValue());
                    } else if (dt1.equals(XMLSchema.FLOAT)) {
                        compareResult = Float.compare(leftLit.floatValue(), rightLit.floatValue());
                    } else if (dt1.equals(XMLSchema.DECIMAL)) {
                        compareResult = leftLit.decimalValue().compareTo(rightLit.decimalValue());
                    } else if (XMLDatatypeUtil.isIntegerDatatype(dt1)) {
                        compareResult = leftLit.integerValue().compareTo(rightLit.integerValue());
                    } else if (dt1.equals(XMLSchema.BOOLEAN)) {
                        Boolean leftBool = Boolean.valueOf(leftLit.booleanValue());
                        Boolean rightBool = Boolean.valueOf(rightLit.booleanValue());
                        compareResult = leftBool.compareTo(rightBool);
                    } else if (XMLDatatypeUtil.isCalendarDatatype(dt1)) {
                        XMLGregorianCalendar left = leftLit.calendarValue();
                        XMLGregorianCalendar right = rightLit.calendarValue();

                        compareResult = left.compare(right);
                    }

                    if (compareResult != null) {
                        if (compareResult.intValue() != 0) {
                            return false;
                        }
                    } else if (!value1.equals(value2)) {
                        return false;
                    }
                } else if (!value1.equals(value2)) {
                    return false;
                }
            } else if (!value1.equals(value2)) {
                return false;
            }
        }
    }

    return true;
}

From source file:adalid.commons.util.ObjUtils.java

public static Integer compare(Object x, Object y) {
    if (x == null || y == null) {
        return null;
    }//from  ww w .  j a v  a2s . co  m
    if (x instanceof Boolean && y instanceof Boolean) {
        Boolean bx = (Boolean) x;
        Boolean by = (Boolean) y;
        return bx.compareTo(by);
    }
    if (x instanceof String && y instanceof String) {
        String sx = (String) x;
        String sy = (String) y;
        return sx.compareTo(sy);
    }
    if (x instanceof Number && y instanceof Number) {
        BigDecimal nx = NumUtils.numberToBigDecimal(x);
        BigDecimal ny = NumUtils.numberToBigDecimal(y);
        return nx.compareTo(ny);
    }
    if (x instanceof java.util.Date && y instanceof java.util.Date) {
        java.util.Date dx = (java.util.Date) x;
        java.util.Date dy = (java.util.Date) y;
        return dx.compareTo(dy);
    }
    if (x instanceof String || y instanceof String) {
        String sx = toString(x);
        String sy = toString(y);
        if (sx != null && sy != null) {
            return sx.compareTo(sy);
        }
    }
    return null;
}

From source file:io.fabric8.jenkins.openshiftsync.JenkinsUtils.java

public static void handleBuildList(WorkflowJob job, List<Build> builds,
        BuildConfigProjectProperty buildConfigProjectProperty) {
    if (builds.isEmpty()) {
        return;/*from w  w w .  jav  a 2 s  .  c o  m*/
    }
    boolean isSerialLatestOnly = SERIAL_LATEST_ONLY.equals(buildConfigProjectProperty.getBuildRunPolicy());
    if (isSerialLatestOnly) {
        // Try to cancel any builds that haven't actually started, waiting for executor perhaps.
        cancelNotYetStartedBuilds(job, buildConfigProjectProperty.getUid());
    }
    sort(builds, new Comparator<Build>() {
        @Override
        public int compare(Build b1, Build b2) {
            // Order so cancellations are first in list so we can stop processing build list when build run policy is
            // SerialLatestOnly and job is currently building.
            Boolean b1Cancelled = b1.getStatus() != null && b1.getStatus().getCancelled() != null
                    ? b1.getStatus().getCancelled()
                    : false;
            Boolean b2Cancelled = b2.getStatus() != null && b2.getStatus().getCancelled() != null
                    ? b2.getStatus().getCancelled()
                    : false;
            // Inverse comparison as boolean comparison would put false before true. Could have inverted both cancellation
            // states but this removes that step.
            int cancellationCompare = b2Cancelled.compareTo(b1Cancelled);
            if (cancellationCompare != 0) {
                return cancellationCompare;
            }

            return Long.compare(
                    Long.parseLong(b1.getMetadata().getAnnotations().get(OPENSHIFT_ANNOTATIONS_BUILD_NUMBER)),
                    Long.parseLong(b2.getMetadata().getAnnotations().get(OPENSHIFT_ANNOTATIONS_BUILD_NUMBER)));
        }
    });
    boolean isSerial = SERIAL.equals(buildConfigProjectProperty.getBuildRunPolicy());
    boolean jobIsBuilding = job.isBuilding();
    for (int i = 0; i < builds.size(); i++) {
        Build b = builds.get(i);
        // For SerialLatestOnly we should try to cancel all builds before the latest one requested.
        if (isSerialLatestOnly) {
            // If the job is currently building, then let's return on the first non-cancellation request so we do not try to
            // queue a new build.
            if (jobIsBuilding && !isCancelled(b.getStatus())) {
                return;
            }

            if (i < builds.size() - 1) {
                cancelQueuedBuild(job, b);
                updateOpenShiftBuildPhase(b, CANCELLED);
                continue;
            }
        }
        boolean buildAdded = false;
        try {
            buildAdded = buildAdded(b);
        } catch (IOException e) {
            ObjectMeta meta = b.getMetadata();
            LOGGER.log(WARNING, "Failed to add new build " + meta.getNamespace() + "/" + meta.getName(), e);
        }
        // If it's a serial build then we only need to schedule the first build request.
        if (isSerial && buildAdded) {
            return;
        }
    }
}

From source file:com.epam.ta.reportportal.ws.model.externalsystem.PostFormField.java

@Override
public int compareTo(PostFormField field) {
    Boolean current = this.isRequired;
    Boolean byField = field.isRequired;
    return byField.compareTo(current);
}

From source file:com.diversityarrays.kdxplore.curate.StatsData.java

public void sortTraitInstances() {
    Comparator<TraitInstance> comparator = new Comparator<TraitInstance>() {
        @Override/*from  w w w  .j a va 2s . c om*/
        public int compare(TraitInstance t1, TraitInstance t2) {
            SimpleStatistics<?> s1 = statsByTraitInstance.get(t1);
            SimpleStatistics<?> s2 = statsByTraitInstance.get(t2);

            Boolean has1 = s1 != null && (s1.getValidCount() > 0);
            Boolean has2 = s2 != null && (s2.getValidCount() > 0);

            // Those WITH come before those WITHOUT
            int diff = has2.compareTo(has1);

            if (diff == 0) {
                String n1 = statsNameByTi.get(t1);
                String n2 = statsNameByTi.get(t2);
                diff = n1.compareTo(n2);
            }
            return diff;
        }
    };
    Collections.sort(traitInstances, comparator);
}

From source file:com.eurelis.opencms.admin.xmltransformation.ui.CmsXmlMockProcessDialog.java

protected CmsXmlMockProcessDialog(CmsJspActionElement jsp, String listId, CmsMessageContainer listName,
        String sortedColId, CmsListOrderEnum sortOrder, String searchableColId) {
    super(jsp, listId, listName, sortedColId, sortOrder, searchableColId);

    //this.setParamAction("/system/modules/com.eurelis.opencms.admin/elements/mock_process.jsp");

    this.cmsXmlTransformation = (CmsXmlTransformation) jsp.getRequest().getSession()
            .getAttribute(CmsXmlTransformation.SESSION_KEY);
    this.cmsXmlTransformation.setMockProcess(false);
    sortedJournalList = cmsXmlTransformation.getJournalList();

    //this.getList().setSortedColumn(sortedColId);

    if (sortedColId.equals(LIST_COLUMN_PATH)) {
        if (sortOrder == CmsListOrderEnum.ORDER_ASCENDING) {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg0, Journal arg1) {
                    return arg0.getDocumentId().compareTo(arg1.getDocumentId());
                }/*  w  w w.  j a v  a  2  s  .  co  m*/

            });

        } else {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg1, Journal arg0) {
                    return arg0.getDocumentId().compareTo(arg1.getDocumentId());
                }

            });
        }

    } else if (sortedColId.equals(LIST_COLUMN_VALID_BEFORE_PROCESSING)) {
        if (sortOrder == CmsListOrderEnum.ORDER_ASCENDING) {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg0, Journal arg1) {
                    Boolean b0 = arg0.hasInitialValidationFailed();
                    Boolean b1 = arg1.hasInitialValidationFailed();

                    return b0.compareTo(b1);
                }

            });
        } else {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg1, Journal arg0) {
                    Boolean b0 = arg0.hasInitialValidationFailed();
                    Boolean b1 = arg1.hasInitialValidationFailed();

                    return b0.compareTo(b1);
                }

            });
        }
    } else if (sortedColId.equals(LIST_COLUMN_VALID_AFTER_PROCESSING)) {
        if (sortOrder == CmsListOrderEnum.ORDER_ASCENDING) {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg0, Journal arg1) {
                    Boolean b0 = arg0.hasTransformationSucceed();
                    Boolean b1 = arg1.hasTransformationSucceed();

                    return b0.compareTo(b1);
                }

            });
        } else {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg1, Journal arg0) {
                    Boolean b0 = arg0.hasTransformationSucceed();
                    Boolean b1 = arg1.hasTransformationSucceed();

                    return b0.compareTo(b1);
                }

            });
        }
    } else if (sortedColId.equals(LIST_COLUMN_CHECKBOX)) {
        if (sortOrder == CmsListOrderEnum.ORDER_ASCENDING) {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg0, Journal arg1) {
                    Boolean b0 = cmsXmlTransformation.ignoreValidation(arg0.getDocumentId());
                    Boolean b1 = cmsXmlTransformation.ignoreValidation(arg1.getDocumentId());

                    return b0.compareTo(b1);
                }

            });
        } else {
            Collections.sort(sortedJournalList, new Comparator<Journal>() {

                public int compare(Journal arg1, Journal arg0) {
                    Boolean b0 = cmsXmlTransformation.ignoreValidation(arg0.getDocumentId());
                    Boolean b1 = cmsXmlTransformation.ignoreValidation(arg1.getDocumentId());

                    return b0.compareTo(b1);
                }

            });
        }
    }

    // TODO Auto-generated constructor stub
}

From source file:data.services.ParseBaseService.java

private void updateCarOptionValues() throws SQLException, ClassNotFoundException {
    List<Car> carList = carDao.getAllAsc();
    HashMap<Long, Car> ourOldIdCarMap = new HashMap();
    HashMap<Long, CarOptionValue> fullOldIdCovMap = new HashMap();
    for (Car car : carList) {
        ourOldIdCarMap.put(car.getCmqId(), car);
        for (CarOptionValue cov : car.getCarOptionValues()) {
            fullOldIdCovMap.put(cov.getOldId(), cov);
        }/*www .  j  av a 2  s.  co  m*/
    }

    List<CarCompletionOption> fullCCOList = CCODao.getAllAsc();
    HashMap<Long, CarCompletionOption> ourOldIdCCOMap = new HashMap();
    for (CarCompletionOption cco : fullCCOList) {
        ourOldIdCCOMap.put(cco.getOldId(), cco);
    }

    HashSet<Long> fullOldCovIdInfoSet = new HashSet();

    List<CarOptionValue> covListForSave = new ArrayList();
    List<CarOptionValue> covListForUpdate = new ArrayList();
    List<CarOptionValue> covListForDelete = new ArrayList();

    ResultSet resSet = getFromQutoBase(
            "SELECT cmco.* FROM car_modification_completion_option cmco LEFT JOIN car_modification cm ON cmco.car_modification_id=cm.id WHERE cm.usage='ad_archive_catalog'");

    while (resSet.next()) {
        Long carOldId = resSet.getLong("car_modification_id");
        Long covOldId = resSet.getLong("id");
        fullOldCovIdInfoSet.add(covOldId);

        Double price = resSet.getDouble("price");
        String title = StringAdapter.getString(resSet.getString("title")).trim();
        String desc = StringAdapter.getString(resSet.getString("description")).trim();
        Long sort = resSet.getLong("sort");
        Boolean isPack = resSet.getBoolean("is_package");
        Long ccoOldId = resSet.getLong("car_completion_option_id");
        Long imageId = resSet.getLong("car_modification_completion_option_image_id");

        CarOptionValue cov = fullOldIdCovMap.get(covOldId);
        CarCompletionOption cco = ourOldIdCCOMap.get(ccoOldId);
        if (cco == null) {
            addError("?   ?   Quto:" + ccoOldId + "; ");
        } else {
            if (cov == null) {

                cov = new CarOptionValue();
                cov.setAudial(0);
                cov.setVisual(0);
                cov.setKinestet(0);
                cov.setCCO(cco);
                cov.setCcoOldId(ccoOldId);
                cov.setDescription(desc);
                cov.setIsPack(isPack);
                cov.setOldId(covOldId);
                cov.setTitle(title);
                cov.setSort(sort);
                cov.setCar(ourOldIdCarMap.get(carOldId));
                cov.setPrice(price);
                cov.setCovImageId(imageId);
                if (validate(cov,
                        "  ?   ?: auto_quto_id="
                                + carOldId + ", cov_quto_id=" + covOldId + ", cco_quto_id=" + ccoOldId
                                + "; ")) {
                    covListForSave.add(cov);
                }

            } else {
                if (!Objects.equals(cov.getCCO().getOldId(), ccoOldId) || !desc.equals(cov.getDescription())
                        || isPack.compareTo(cov.isIsPack()) != 0 || !title.equals(cov.getTitle())
                        || !Objects.equals(cov.getSort(), sort) || price.compareTo(cov.getPrice()) != 0
                        || !Objects.equals(cov.getCovImageId(), imageId)
                        || !Objects.equals(cov.getCar().getCmqId(), carOldId)) {
                    cov.setCCO(cco);
                    cov.setCcoOldId(ccoOldId);
                    cov.setDescription(desc);
                    cov.setIsPack(isPack);
                    cov.setOldId(covOldId);
                    cov.setTitle(title);
                    cov.setSort(sort);
                    cov.setCar(ourOldIdCarMap.get(carOldId));
                    cov.setPrice(price);
                    cov.setCovImageId(imageId);
                    if (validate(cov,
                            "  ?   : auto_quto_id="
                                    + carOldId + ", cov_quto_id=" + covOldId + ", cco_quto_id=" + ccoOldId
                                    + "; ")) {
                        covListForUpdate.add(cov);
                    }
                }
            }

        }

    }

    for (Long oldCovId : fullOldIdCovMap.keySet()) {
        if (!fullOldCovIdInfoSet.contains(oldCovId)) {
            covListForDelete.add(fullOldIdCovMap.get(oldCovId));
        }
    }

    int s = 0;
    int u = 0;
    int d = 0;
    for (CarOptionValue cov : covListForSave) {
        carOptionValueDao.save(cov);
        s++;
    }
    for (CarOptionValue cov : covListForUpdate) {
        carOptionValueDao.update(cov);
        u++;
    }
    for (CarOptionValue cov : covListForDelete) {
        carOptionValueDao.delete(cov);
        d++;
    }

    addError(" : " + s + " ?, " + u + " , " + d
            + " .");
}

From source file:edu.northwestern.jcr.adapter.xtf.query.SearchIndex.java

/**
 * Sorts the query results based on the value of the properties.
 * The ORDER BY clause is actually handled here.
 *
 * @param lines array of comma-separated full paths to the query results
 * @param valueMap maps pid to comma-separated values
 * @param orderSpecs true for ascending, false for descending
 * @return array of sorted results//from w w  w.j  a va  2  s .c o m
 */
private String[] sort(String[] lines, final Map<String, String> valueMap, final boolean[] orderSpecs) {

    Comparator<String> result_order = new Comparator<String>() {
        public int compare(String line1, String line2) {
            String pid1, pid2;
            String valueList1, valueList2;
            String[] parts;
            String[] valueString1, valueString2;
            String value1, value2;
            Double double1, double2;
            Long long1, long2;
            Calendar calendar1, calendar2;
            Boolean boolean1, boolean2;
            int i;
            int compare = 0;

            // get pid of the last object in the list
            parts = line1.split(",");
            pid1 = parts[parts.length - 1];
            parts = line2.split(",");
            pid2 = parts[parts.length - 1];

            // get comma-separated the value list
            valueList1 = valueMap.get(pid1);
            valueList2 = valueMap.get(pid2);

            valueString1 = valueList1.split(",");
            valueString2 = valueList2.split(",");

            for (i = 0; i < valueString1.length; ++i) {
                // loop over the values
                value1 = valueString1[i];
                parts = value1.split("%57");
                value1 = parts[parts.length - 1];

                value2 = valueString2[i];
                parts = value2.split("%57");
                value2 = parts[parts.length - 1];

                switch (Integer.parseInt(parts[0])) {
                case PropertyType.STRING:
                    if (orderSpecs[i]) {
                        compare = value1.compareTo(value2);
                    } else {
                        compare = value2.compareTo(value1);
                    }
                    break;
                case PropertyType.DOUBLE:
                    double1 = Double.parseDouble(value1);
                    double2 = Double.parseDouble(value2);
                    if (orderSpecs[i]) {
                        compare = double1.compareTo(double2);
                    } else {
                        compare = double2.compareTo(double1);
                    }
                    break;
                case PropertyType.LONG:
                    long1 = Long.parseLong(value1);
                    long2 = Long.parseLong(value2);
                    if (orderSpecs[i]) {
                        compare = long1.compareTo(long2);
                    } else {
                        compare = long2.compareTo(long1);
                    }
                    break;
                case PropertyType.DATE:
                    calendar1 = ISO8601.parse(value1);
                    calendar2 = ISO8601.parse(value2);
                    if (orderSpecs[i]) {
                        compare = calendar1.compareTo(calendar2);
                    } else {
                        compare = calendar2.compareTo(calendar1);
                    }
                    break;
                case PropertyType.BOOLEAN:
                    boolean1 = Boolean.valueOf(value1);
                    boolean2 = Boolean.valueOf(value2);
                    if (orderSpecs[i]) {
                        compare = boolean1.compareTo(boolean2);
                    } else {
                        compare = boolean2.compareTo(boolean1);
                    }
                    break;
                // not supported
                case PropertyType.BINARY:
                case PropertyType.REFERENCE:
                case PropertyType.NAME:
                case PropertyType.PATH:
                    compare = 0;
                }

                if (compare != 0) {
                    return compare;
                }

                // more comparison
            }

            return compare;
        }
    };

    List<String> resultList = Arrays.asList(lines);
    Collections.sort(resultList, result_order);
    return resultList.toArray(new String[0]);
}

From source file:org.cgiar.ccafs.ap.action.projects.ProjectEvaluationAction.java

@Override
public void prepare() throws Exception {

    super.prepare();

    try {//w  w  w  . j a va  2  s .  c  om
        projectID = Integer
                .parseInt(StringUtils.trim(this.getRequest().getParameter(APConstants.PROJECT_REQUEST_ID)));
    } catch (NumberFormatException e) {
        LOG.error("-- prepare() > There was an error parsing the project identifier '{}'.", projectID, e);
        projectID = -1;
        return; // Stop here and go to execute method.
    }
    // Getting project
    project = projectManager.getProject(projectID);

    // Getting all the project partners.
    int year = 0;
    if (this.isReportingCycle()) {
        year = config.getReportingCurrentYear();
    } else {
        year = config.getPlanningCurrentYear();
    }
    project.setProjectPartners(projectPartnerManager.getProjectPartners(project, year));

    // Getting the information of the Regions Program associated with the project
    project.setRegions(ipProgramManager.getProjectFocuses(projectID, APConstants.REGION_PROGRAM_TYPE));
    // Getting the information of the Flagships Program associated with the project
    project.setFlagships(ipProgramManager.getProjectFocuses(projectID, APConstants.FLAGSHIP_PROGRAM_TYPE));

    // get the Project Leader information
    projectLeader = project.getLeader();

    // get the Project Leader contact information
    partnerPerson = project.getLeaderPerson();

    // calculate the cumulative total budget
    totalCCAFSBudget = budgetManager.calculateTotalProjectBudgetByType(projectID, BudgetType.W1_W2.getValue());
    totalBilateralBudget = budgetManager.calculateTotalProjectBudgetByType(projectID,
            BudgetType.W3_BILATERAL.getValue());

    List<UserRole> roles = userRoleManager.getUserRolesByUserID(String.valueOf(this.getCurrentUser().getId()));
    List<ProjectEvaluation> lstEvaluations = new ArrayList<ProjectEvaluation>();

    // evaluationUser.setId(new Long(-1));
    int liaisonInstitutionID = 0;
    try {
        liaisonInstitutionID = this.getCurrentUser().getLiaisonInstitution().get(0).getId();
    } catch (Exception e) {
        liaisonInstitutionID = 2;
    }
    currentLiaisonInstitution = liaisonInstitutionManager.getLiaisonInstitution(liaisonInstitutionID);
    if (currentLiaisonInstitution.getIpProgram() == null) {
        currentLiaisonInstitution.setIpProgram("1");
    }

    lstEvaluations.addAll(projectEvaluationManager.getEvaluationsProject(projectID));
    for (UserRole userRole : roles) {
        ProjectEvaluation evaluationUser = null;

        switch (userRole.getId()) {

        case APConstants.ROLE_FLAGSHIP_PROGRAM_LEADER:
        case APConstants.ROLE_REGIONAL_PROGRAM_LEADER:
            evaluationUser = new ProjectEvaluation();
            evaluationUser.setProjectId(new Long(projectID));
            evaluationUser.setYear(this.getCurrentReportingYear());
            evaluationUser.setActive(true);
            evaluationUser.setActiveSince(new Date());
            evaluationUser.setProgramId(new Long(currentLiaisonInstitution.getIpProgram()));
            evaluationUser.setModifiedBy(new Long(this.getCurrentUser().getId()));
            evaluationUser.setTypeEvaluation(userRole.getAcronym());

            if (!this.existEvaluation(lstEvaluations, evaluationUser)) {
                lstEvaluations.add(evaluationUser);
            }

            break;

        case APConstants.ROLE_PROJECT_LEADER:

            Project p = projectManager.getProjectBasicInfo(projectID);
            if (p.getLeaderUserId() == this.getCurrentUser().getId()) {

                evaluationUser = new ProjectEvaluation();
                evaluationUser.setProjectId(new Long(projectID));
                evaluationUser.setYear(this.getCurrentReportingYear());
                evaluationUser.setActive(true);
                evaluationUser.setActiveSince(new Date());
                evaluationUser.setModifiedBy(new Long(this.getCurrentUser().getId()));

                evaluationUser.setTypeEvaluation(userRole.getAcronym());

                if (!this.existEvaluation(lstEvaluations, evaluationUser)) {
                    lstEvaluations.add(evaluationUser);
                }

            }

            break;

        case APConstants.ROLE_EXTERNAL_EVALUATOR:
        case APConstants.ROLE_PROGRAM_DIRECTOR_EVALUATOR:
        case APConstants.ROLE_COORDINATING_UNIT:

            evaluationUser = new ProjectEvaluation();
            evaluationUser.setProjectId(new Long(projectID));
            evaluationUser.setYear(this.getCurrentReportingYear());
            evaluationUser.setActive(true);
            evaluationUser.setActiveSince(new Date());
            evaluationUser.setModifiedBy(new Long(this.getCurrentUser().getId()));
            evaluationUser.setTypeEvaluation(userRole.getAcronym());

            if (!this.existEvaluation(lstEvaluations, evaluationUser)) {
                lstEvaluations.add(evaluationUser);
            }

            break;

        }

    }

    for (ProjectEvaluation projectEvaluation : lstEvaluations) {
        projectEvaluation.setRankingOutcomes(projectEvaluation.getRankingOutcomes() * STAR_DIV);
        projectEvaluation.setRankingOutputs(projectEvaluation.getRankingOutputs() * STAR_DIV);
        projectEvaluation.setRankingParternshipComunnication(
                projectEvaluation.getRankingParternshipComunnication() * STAR_DIV);
        projectEvaluation.setRankingQuality(projectEvaluation.getRankingQuality() * STAR_DIV);
        projectEvaluation.setRankingResponseTeam(projectEvaluation.getRankingResponseTeam() * STAR_DIV);
    }

    Collections.sort(lstEvaluations, new Comparator<ProjectEvaluation>() {

        @Override
        public int compare(ProjectEvaluation s1, ProjectEvaluation s2) {
            Boolean p1 = s1.isSubmited();
            Boolean p2 = s2.isSubmited();
            return p1.compareTo(p2) * -1;
        }
    });

    project.setEvaluations(lstEvaluations);

}