Example usage for java.lang Double equals

List of usage examples for java.lang Double equals

Introduction

In this page you can find the example usage for java.lang Double equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object against the specified object.

Usage

From source file:org.structr.core.entity.AbstractRelationship.java

@Override
public Double getDoubleProperty(final PropertyKey<Double> key) throws FrameworkException {

    Object propertyValue = getProperty(key);
    Double result = null;//from w  w  w  . j a va 2  s  . c  om

    if (propertyValue == null) {

        return null;
    }

    if (propertyValue instanceof Double) {

        Double doubleValue = (Double) propertyValue;

        if (doubleValue.equals(Double.NaN)) {

            // clean NaN values from database
            setProperty(key, null);

            return null;
        }

        result = doubleValue;

    } else if (propertyValue instanceof String) {

        if ("".equals((String) propertyValue)) {

            return null;
        }

        result = Double.parseDouble(((String) propertyValue));

    }

    return result;

}

From source file:com.ecofactor.qa.automation.drapi.DRAPI_Execution_410_Test.java

/**
 * Checks if is end entry validated./*from   w ww  . j a  v  a  2 s  .  co  m*/
 * @param details the details
 * @param groupEventId the group event id
 * @return true, if is end entry validated
 */
public boolean isEndEntryValidated(final List<ThermostatEvent> details, final Double groupEventId) {

    boolean endEntryValidate = false;
    final Double grpEventIdCompleted = groupEventId + 0.2;
    setLogString("Group Event ID Compleated : " + grpEventIdCompleted, true);
    for (ThermostatEvent thermostatEvent : details) {
        if ((thermostatEvent.getAction().equalsIgnoreCase(ENDEVENT))
                && (thermostatEvent.getAlgorithmId().equals(ALGORITHMID_410))
                && (thermostatEvent.getEventPhase().equals(EVENTPHASE_2))
                && (thermostatEvent.getEventStatus().equalsIgnoreCase(EVENTSTATUS))
                && (thermostatEvent.getEventType().equalsIgnoreCase(EVENTYPE_ALGO))
                && (grpEventIdCompleted.equals(thermostatEvent.getGroupEventId()))) {
            endEntryValidate = true;
            break;
        }
    }
    return endEntryValidate;
}

From source file:org.sakaiproject.component.gradebook.GradebookExternalAssessmentServiceImpl.java

public void updateExternalAssessmentScore(final String gradebookUid, final String externalId,
        final String studentUid, final String points)
        throws GradebookNotFoundException, AssessmentNotFoundException {
    final Assignment asn = getExternalAssignment(gradebookUid, externalId);

    if (asn == null) {
        throw new AssessmentNotFoundException(
                "There is no assessment id=" + externalId + " in gradebook uid=" + gradebookUid);
    }//from   w w w .  java  2 s . c o  m

    if (logData.isDebugEnabled())
        logData.debug("BEGIN: Update 1 score for gradebookUid=" + gradebookUid + ", external assessment="
                + externalId + " from " + asn.getExternalAppName());

    HibernateCallback hc = new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            Date now = new Date();

            AssignmentGradeRecord agr = getAssignmentGradeRecord(asn, studentUid, session);

            // Try to reduce data contention by only updating when the
            // score has actually changed or property has been set forcing a db update every time.
            boolean alwaysUpdate = ServerConfigurationService.getBoolean(UPDATE_SAME_SCORE_PROP, false);

            //TODO: for ungraded items, needs to set ungraded-grades later...
            Double oldPointsEarned = (agr == null) ? null : agr.getPointsEarned();
            Double newPointsEarned = (points == null) ? null : convertStringToDouble(points);
            if (alwaysUpdate || (newPointsEarned != null && !newPointsEarned.equals(oldPointsEarned))
                    || (newPointsEarned == null && oldPointsEarned != null)) {
                if (agr == null) {
                    if (newPointsEarned != null)
                        agr = new AssignmentGradeRecord(asn, studentUid, Double.valueOf(newPointsEarned));
                    else
                        agr = new AssignmentGradeRecord(asn, studentUid, null);
                } else {
                    if (newPointsEarned != null)
                        agr.setPointsEarned(Double.valueOf(newPointsEarned));
                    else
                        agr.setPointsEarned(null);
                }

                agr.setDateRecorded(now);
                agr.setGraderId(getUserUid());
                if (log.isDebugEnabled())
                    log.debug("About to save AssignmentGradeRecord id=" + agr.getId() + ", version="
                            + agr.getVersion() + ", studenttId=" + agr.getStudentId() + ", pointsEarned="
                            + agr.getPointsEarned());
                session.saveOrUpdate(agr);

                // Sync database.
                session.flush();
                session.clear();
                postUpdateGradeEvent(gradebookUid, asn.getName(), studentUid, newPointsEarned);
            } else {
                if (log.isDebugEnabled())
                    log.debug(
                            "Ignoring updateExternalAssessmentScore, since the new points value is the same as the old");
            }
            return null;
        }
    };
    getHibernateTemplate().execute(hc);
    if (logData.isDebugEnabled())
        logData.debug("END: Update 1 score for gradebookUid=" + gradebookUid + ", external assessment="
                + externalId + " from " + asn.getExternalAppName());
    if (log.isDebugEnabled())
        log.debug("External assessment score updated in gradebookUid=" + gradebookUid + ", externalId="
                + externalId + " by userUid=" + getUserUid() + ", new score=" + points);
}

From source file:org.sakaiproject.component.gradebook.GradebookExternalAssessmentServiceImpl.java

public void updateExternalAssessmentScores(final String gradebookUid, final String externalId,
        final Map<String, Double> studentUidsToScores)
        throws GradebookNotFoundException, AssessmentNotFoundException {

    final Assignment assignment = getExternalAssignment(gradebookUid, externalId);
    if (assignment == null) {
        throw new AssessmentNotFoundException(
                "There is no assessment id=" + externalId + " in gradebook uid=" + gradebookUid);
    }//from   w  ww  . j  a va2s .  c  o m
    final Set studentIds = studentUidsToScores.keySet();
    if (studentIds.isEmpty()) {
        return;
    }
    final Date now = new Date();
    final String graderId = getUserUid();

    getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            List existingScores;
            if (studentIds.size() <= MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST) {
                Query q = session.createQuery(
                        "from AssignmentGradeRecord as gr where gr.gradableObject=:go and gr.studentId in (:studentIds)");
                q.setParameter("go", assignment);
                q.setParameterList("studentIds", studentIds);
                existingScores = q.list();
            } else {
                Query q = session.createQuery("from AssignmentGradeRecord as gr where gr.gradableObject=:go");
                q.setParameter("go", assignment);
                existingScores = filterGradeRecordsByStudents(q.list(), studentIds);
            }

            Set previouslyUnscoredStudents = new HashSet(studentIds);
            Set changedStudents = new HashSet();
            for (Iterator iter = existingScores.iterator(); iter.hasNext();) {
                AssignmentGradeRecord agr = (AssignmentGradeRecord) iter.next();
                String studentUid = agr.getStudentId();
                previouslyUnscoredStudents.remove(studentUid);

                // Try to reduce data contention by only updating when a score
                // has changed or property has been set forcing a db update every time.
                boolean alwaysUpdate = ServerConfigurationService.getBoolean(UPDATE_SAME_SCORE_PROP, false);

                Double oldPointsEarned = agr.getPointsEarned();
                Double newPointsEarned = (Double) studentUidsToScores.get(studentUid);
                if (alwaysUpdate || (newPointsEarned != null && !newPointsEarned.equals(oldPointsEarned))
                        || (newPointsEarned == null && oldPointsEarned != null)) {
                    agr.setDateRecorded(now);
                    agr.setGraderId(graderId);
                    agr.setPointsEarned(newPointsEarned);
                    session.update(agr);
                    changedStudents.add(studentUid);
                    postUpdateGradeEvent(gradebookUid, assignment.getName(), studentUid, newPointsEarned);
                }
            }
            for (Iterator iter = previouslyUnscoredStudents.iterator(); iter.hasNext();) {
                String studentUid = (String) iter.next();

                // Don't save unnecessary null scores.
                Double newPointsEarned = (Double) studentUidsToScores.get(studentUid);
                if (newPointsEarned != null) {
                    AssignmentGradeRecord agr = new AssignmentGradeRecord(assignment, studentUid,
                            newPointsEarned);
                    agr.setDateRecorded(now);
                    agr.setGraderId(graderId);
                    session.save(agr);
                    changedStudents.add(studentUid);
                    postUpdateGradeEvent(gradebookUid, assignment.getName(), studentUid, newPointsEarned);
                }
            }

            if (log.isDebugEnabled())
                log.debug("updateExternalAssessmentScores sent " + studentIds.size()
                        + " records, actually changed " + changedStudents.size());

            // Sync database.
            session.flush();
            session.clear();
            return null;
        }
    });
}

From source file:com.microsoft.office365.meetingfeedback.model.service.MyMeetingsService.java

@Override
protected void onHandleIntent(Intent intent) {
    Log.d(TAG, "Polling for new Meeting Ratings...");
    mRatingServiceManager.loadMyMeetings(mDataStore.getUsername(), new Callback<MyMeetingsResponse>() {
        @Override// www . ja v a2  s .c o m
        public void success(MyMeetingsResponse meetingResponse, Response response) {
            Log.d(TAG, "success!");
            //todo: compare the shared preferences version with the new version
            Map<String, Double> newMeetingResponse = meetingResponse.toMap();
            for (final String id : newMeetingResponse.keySet()) {
                Double savedCountForMeeting = mSavedMeetingResults.get(id);
                Double newCountForMeeting = newMeetingResponse.get(id);
                //if old meeting response didn't have the key
                Callback<Void> loadRatingsCallback = new Callback<Void>() {
                    @Override
                    public void success(Void aVoid, Response response) {
                        sendNotificationForEvent(id);
                    }

                    @Override
                    public void failure(RetrofitError error) {
                        Log.e(TAG, error.getMessage());
                    }
                };
                if (!mSavedMeetingResults.containsKey(id) && newCountForMeeting > 0) {
                    Log.d(TAG, "RATING COUNT CHANGED! Send a notification for " + id + "!");
                    mRatingServiceManager.loadRatingFromWebservice(id, "", loadRatingsCallback);
                }
                if (savedCountForMeeting != null && newCountForMeeting != null
                        && !savedCountForMeeting.equals(newCountForMeeting)) {
                    Log.d(TAG, "RATING COUNT CHANGED! Send a notification for " + id + " !");
                    mRatingServiceManager.loadRatingFromWebservice(id, "", loadRatingsCallback);
                }
            }
            mDataStore.setMyMeetings(newMeetingResponse);
        }

        @Override
        public void failure(RetrofitError error) {
            Log.e(TAG, "An error occurred", error);
        }
    });
}

From source file:org.globus.workspace.async.AsyncRequestManagerImpl.java

/**
 * Invokes the associated PricingModel in order
 * to calculate the next price (given current
 * OPEN and ACTIVE requests), and changes the
 * price in case the new price is different
 *//*from  w ww  .j  a  va 2  s  .  co m*/
private void changePrice() {
    Double newPrice = pricingModel.getNextPrice(this.getMaxVMs(), getAliveSpotRequests(), currentPrice);
    if (!newPrice.equals(this.currentPrice)) {
        logger.info(Lager.ev(-1) + "Spot price has changed. " + "Previous price = " + this.currentPrice + ". "
                + "Current price = " + newPrice);
        setPrice(newPrice);
    }
}

From source file:org.sakaiproject.tool.gradebook.ui.AssignmentBean.java

public String updateAssignment() {
    try {/*from w ww  .  j  a v  a2  s.c  o m*/
        Category category = retrieveSelectedCategory();
        assignment.setCategory(category);

        if (!GB_ADJUSTMENT_ENTRY.equals(assignment.getSelectedGradeEntryValue()) && category != null
                && category.isDropScores() && !isAssignmentTheOnlyOne(assignment, category)) {
            assignment.setPointsPossible(category.getItemValue()); // if category drops scores, point value will come from the category level
        }

        Assignment originalAssignment = getGradebookManager().getAssignment(assignmentId);
        Double origPointsPossible = originalAssignment.getPointsPossible();
        Double newPointsPossible = assignment.getPointsPossible();
        boolean scoresEnteredForAssignment = getGradebookManager().isEnteredAssignmentScores(assignmentId);

        /* If grade entry by percentage or letter and the points possible has changed for this assignment,
         * we need to convert all of the stored point values to retain the same value
         */
        if ((getGradeEntryByPercent() || getGradeEntryByLetter()) && scoresEnteredForAssignment) {
            if (!newPointsPossible.equals(origPointsPossible)) {
                List enrollments = getSectionAwareness().getSiteMembersInRole(getGradebookUid(), Role.STUDENT);
                List studentUids = new ArrayList();
                for (Iterator iter = enrollments.iterator(); iter.hasNext();) {
                    studentUids.add(((EnrollmentRecord) iter.next()).getUser().getUserUid());
                }
                getGradebookManager().convertGradePointsForUpdatedTotalPoints(getGradebook(),
                        originalAssignment, assignment.getPointsPossible(), studentUids);
            }
        }

        getGradebookManager().updateAssignment(assignment);
        long dueDateMillis = -1;
        Date dueDate = assignment.getDueDate();
        if (dueDate != null)
            dueDateMillis = dueDate.getTime();
        getGradebookBean().getEventTrackingService().postEvent("gradebook.updateAssignment",
                "/gradebook/" + getGradebookUid() + "/" + assignment.getName() + "/"
                        + assignment.getPointsPossible() + "/" + dueDateMillis + "/" + assignment.isReleased()
                        + "/" + assignment.isCounted() + "/" + getAuthzLevel());

        if ((!origPointsPossible.equals(newPointsPossible)) && scoresEnteredForAssignment) {
            if (getGradeEntryByPercent())
                FacesUtil.addRedirectSafeMessage(getLocalizedString("edit_assignment_save_percentage",
                        new String[] { assignment.getName() }));
            else if (getGradeEntryByLetter())
                FacesUtil.addRedirectSafeMessage(getLocalizedString("edit_assignment_save_converted",
                        new String[] { assignment.getName() }));
            else
                FacesUtil.addRedirectSafeMessage(getLocalizedString("edit_assignment_save_scored",
                        new String[] { assignment.getName() }));

        } else {
            FacesUtil.addRedirectSafeMessage(
                    getLocalizedString("edit_assignment_save", new String[] { assignment.getName() }));
        }

    } catch (ConflictingAssignmentNameException e) {
        logger.error(e);
        FacesUtil.addErrorMessage(getLocalizedString("edit_assignment_name_conflict_failure"));
        return "failure";
    } catch (StaleObjectModificationException e) {
        logger.error(e);
        FacesUtil.addErrorMessage(getLocalizedString("edit_assignment_locking_failure"));
        return "failure";
    }

    return navigateBack();
}

From source file:org.sakaiproject.component.gradebook.GradebookExternalAssessmentServiceImpl.java

public void updateExternalAssessmentScoresString(final String gradebookUid, final String externalId,
        final Map<String, String> studentUidsToScores)
        throws GradebookNotFoundException, AssessmentNotFoundException {

    final Assignment assignment = getExternalAssignment(gradebookUid, externalId);
    if (assignment == null) {
        throw new AssessmentNotFoundException(
                "There is no assessment id=" + externalId + " in gradebook uid=" + gradebookUid);
    }//from w w w .jav a  2s. co  m
    final Set studentIds = studentUidsToScores.keySet();
    if (studentIds.isEmpty()) {
        return;
    }
    final Date now = new Date();
    final String graderId = getUserUid();

    getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            List existingScores;
            if (studentIds.size() <= MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST) {
                Query q = session.createQuery(
                        "from AssignmentGradeRecord as gr where gr.gradableObject=:go and gr.studentId in (:studentIds)");
                q.setParameter("go", assignment);
                q.setParameterList("studentIds", studentIds);
                existingScores = q.list();
            } else {
                Query q = session.createQuery("from AssignmentGradeRecord as gr where gr.gradableObject=:go");
                q.setParameter("go", assignment);
                existingScores = filterGradeRecordsByStudents(q.list(), studentIds);
            }

            Set previouslyUnscoredStudents = new HashSet(studentIds);
            Set changedStudents = new HashSet();
            for (Iterator iter = existingScores.iterator(); iter.hasNext();) {
                AssignmentGradeRecord agr = (AssignmentGradeRecord) iter.next();
                String studentUid = agr.getStudentId();
                previouslyUnscoredStudents.remove(studentUid);

                // Try to reduce data contention by only updating when a score
                // has changed or property has been set forcing a db update every time.
                boolean alwaysUpdate = ServerConfigurationService.getBoolean(UPDATE_SAME_SCORE_PROP, false);

                //TODO: for ungraded items, needs to set ungraded-grades later...
                Double oldPointsEarned = agr.getPointsEarned();
                //Double newPointsEarned = (Double)studentUidsToScores.get(studentUid);
                String newPointsEarnedString = (String) studentUidsToScores.get(studentUid);
                Double newPointsEarned = (newPointsEarnedString == null) ? null
                        : convertStringToDouble(newPointsEarnedString);
                if (alwaysUpdate || (newPointsEarned != null && !newPointsEarned.equals(oldPointsEarned))
                        || (newPointsEarned == null && oldPointsEarned != null)) {
                    agr.setDateRecorded(now);
                    agr.setGraderId(graderId);
                    if (newPointsEarned != null)
                        agr.setPointsEarned(Double.valueOf(newPointsEarned));
                    else
                        agr.setPointsEarned(null);
                    session.update(agr);
                    changedStudents.add(studentUid);
                    postUpdateGradeEvent(gradebookUid, assignment.getName(), studentUid, newPointsEarned);
                }
            }
            for (Iterator iter = previouslyUnscoredStudents.iterator(); iter.hasNext();) {
                String studentUid = (String) iter.next();

                // Don't save unnecessary null scores.
                String newPointsEarned = (String) studentUidsToScores.get(studentUid);
                if (newPointsEarned != null) {
                    AssignmentGradeRecord agr = new AssignmentGradeRecord(assignment, studentUid,
                            convertStringToDouble(newPointsEarned));
                    agr.setDateRecorded(now);
                    agr.setGraderId(graderId);
                    session.save(agr);
                    changedStudents.add(studentUid);
                    postUpdateGradeEvent(gradebookUid, assignment.getName(), studentUid,
                            convertStringToDouble(newPointsEarned));
                }
            }

            if (log.isDebugEnabled())
                log.debug("updateExternalAssessmentScores sent " + studentIds.size()
                        + " records, actually changed " + changedStudents.size());

            // Sync database.
            session.flush();
            session.clear();
            return null;
        }
    });
}

From source file:com.gallatinsystems.surveyal.app.web.SurveyalRestServlet.java

/**
 * Create or update a surveyedLocale based on the Geo data that is retrieved from a
 * surveyInstance. This method is unlikely to run in under 1 minute (based on datastore latency)
 * so it is best invoked via a task queue
 *
 * @param surveyInstanceId/*from  ww w  .  jav  a2s . c  o  m*/
 */
private void ingestSurveyInstance(SurveyInstance surveyInstance) {
    SurveyedLocale locale = null;
    Boolean adaptClusterData = Boolean.FALSE;

    // if the surveyed locale id was available in the ingested data,
    // this has been set in the save method in surveyInstanceDao.
    if (surveyInstance.getSurveyedLocaleId() != null) {
        locale = surveyedLocaleDao.getByKey(surveyInstance.getSurveyedLocaleId());
    }

    // create a new locale with basic information
    if (locale == null) {
        // we don't have a locale
        locale = new SurveyedLocale();

        if (StringUtils.isNotBlank(surveyInstance.getSurveyedLocaleIdentifier())) {
            locale.setIdentifier(surveyInstance.getSurveyedLocaleIdentifier());
        } else {
            // if we don't have an identifier, create a random UUID.
            locale.setIdentifier(SurveyedLocale.generateBase32Uuid());
        }

        locale.setOrganization(PropertyUtil.getProperty(DEFAULT_ORG_PROP));

        Survey survey = SurveyUtils.retrieveSurvey(surveyInstance.getSurveyId());
        if (survey != null) {
            SurveyGroup surveyGroup = SurveyUtils.retrieveSurveyGroup(survey.getSurveyGroupId());
            locale.setLocaleType(surveyGroup.getPrivacyLevel().toString());
            locale.setSurveyGroupId(survey.getSurveyGroupId());
            locale.setCreationSurveyId(survey.getKey().getId());
        }
    }

    // try to construct geoPlace. Geo information can come from two sources:
    // 1) the META_GEO information in the surveyInstance, and
    // 2) a geo question.
    // If we can't find geo information in 1), we try 2)

    GeoPlace geoPlace = null;
    Double latitude = UNSET_VAL;
    Double longitude = UNSET_VAL;
    Map<String, Object> geoLocationMap = null;

    try {
        geoLocationMap = SurveyInstance.retrieveGeoLocation(surveyInstance);
    } catch (NumberFormatException nfe) {
        log.log(Level.SEVERE, "Could not parse lat/lon for SurveyInstance " + surveyInstance.getKey().getId());
    }

    if (geoLocationMap != null && !geoLocationMap.isEmpty()) {
        latitude = (Double) geoLocationMap.get(MapUtils.LATITUDE);
        longitude = (Double) geoLocationMap.get(MapUtils.LONGITUDE);

        if (!latitude.equals(locale.getLatitude()) || !longitude.equals(locale.getLongitude())) {
            locale.setLatitude(latitude);
            locale.setLongitude(longitude);
            try {
                locale.setGeocells(GeocellManager.generateGeoCell(new Point(latitude, longitude)));
            } catch (Exception ex) {
                log.log(Level.INFO,
                        "Could not generate Geocell for locale: " + locale.getKey().getId() + " error: " + ex);
            }
            adaptClusterData = Boolean.TRUE;
        }

        geoPlace = getGeoPlace(latitude, longitude);
    }

    if (geoPlace != null) {

        // if we have geoinformation, we will use it on the locale provided that:
        // 1) it is a new Locale, or 2) it was brought in as meta information, meaning it should
        // overwrite previous locale geo information
        setGeoData(geoPlace, locale);

        // TODO: move this to survey instance processing logic
        // if we have a geoPlace, set it on the instance
        surveyInstance.setCountryCode(geoPlace.getCountryCode());
        surveyInstance.setSublevel1(geoPlace.getSub1());
        surveyInstance.setSublevel2(geoPlace.getSub2());
        surveyInstance.setSublevel3(geoPlace.getSub3());
        surveyInstance.setSublevel4(geoPlace.getSub4());
        surveyInstance.setSublevel5(geoPlace.getSub5());
        surveyInstance.setSublevel6(geoPlace.getSub6());
    }

    if (StringUtils.isNotBlank(surveyInstance.getSurveyedLocaleDisplayName())) {
        locale.setDisplayName(surveyInstance.getSurveyedLocaleDisplayName());
    }

    // add surveyInstanceId to list of contributed surveyInstances
    locale.addContributingSurveyInstance(surveyInstance.getKey().getId());

    // last update of the locale information
    locale.setLastSurveyedDate(surveyInstance.getCollectionDate());
    locale.setLastSurveyalInstanceId(surveyInstance.getKey().getId());

    log.log(Level.FINE, "SurveyLocale at this point " + locale.toString());
    final SurveyedLocale savedLocale = surveyedLocaleDao.save(locale);

    // save the surveyalValues
    if (savedLocale.getKey() != null) {
        surveyInstance.setSurveyedLocaleId(savedLocale.getKey().getId());
        List<SurveyalValue> values = constructValues(savedLocale);
        if (values != null) {
            surveyedLocaleDao.save(values);
        }
        surveyedLocaleDao.save(savedLocale);
        surveyInstanceDao.save(surveyInstance);
    }

    // finally fire off adapt cluster data task
    // TODO: consider firing this task after ALL survey instances are processed
    // instead of a single survey instance
    // TODO: when surveyedLocales are deleted, it needs to be substracted from the clusters
    if (adaptClusterData) {
        Queue defaultQueue = QueueFactory.getDefaultQueue();
        TaskOptions adaptClusterTaskOptions = TaskOptions.Builder.withUrl("/app_worker/surveyalservlet")
                .param(SurveyalRestRequest.ACTION_PARAM, SurveyalRestRequest.ADAPT_CLUSTER_DATA_ACTION)
                .param(SurveyalRestRequest.SURVEYED_LOCALE_PARAM, Long.toString(locale.getKey().getId()));
        defaultQueue.add(adaptClusterTaskOptions);
    }
}

From source file:org.sakaiproject.tool.gradebook.ui.GradebookSetupBean.java

public boolean isConflictWithCourseGrade() {
    Gradebook gb = getGradebookManager()
            .getGradebookWithGradeMappings(getGradebookManager().getGradebook(localGradebook.getUid()).getId());
    if (gradeEntryMethod.equals(ENTRY_OPT_LETTER)) {
        if ((gb.getSelectedGradeMapping().getGradingScale() != null
                && gb.getSelectedGradeMapping().getGradingScale().getUid().equals("LetterGradeMapping"))
                || (gb.getSelectedGradeMapping().getGradingScale() == null
                        && gb.getSelectedGradeMapping().getName().equals("Letter Grades"))) {
            return false;
        }//from   w w  w  .  j a  va 2s.  c om
        Set mappings = gb.getGradeMappings();
        for (Iterator iter = mappings.iterator(); iter.hasNext();) {
            GradeMapping gm = (GradeMapping) iter.next();

            if (gm != null) {
                if ((gm.getGradingScale() != null && (gm.getGradingScale().getUid().equals("LetterGradeMapping")
                        || gm.getGradingScale().getUid().equals("LetterGradePlusMinusMapping")))
                        || (gm.getGradingScale() == null && (gb.getSelectedGradeMapping().getName()
                                .equals("Letter Grades")
                                || gb.getSelectedGradeMapping().getName().equals("Letter Grades with +/-")))) {
                    Map defaultMapping = gm.getDefaultBottomPercents();
                    for (Iterator gradeIter = gm.getGrades().iterator(); gradeIter.hasNext();) {
                        String grade = (String) gradeIter.next();
                        Double percentage = (Double) gm.getValue(grade);
                        Double defautPercentage = (Double) defaultMapping.get(grade);
                        if (percentage != null && !percentage.equals(defautPercentage)) {
                            return false;
                        }
                    }
                }
            }
        }
    }

    return true;
}