Example usage for org.joda.time LocalDateTime equals

List of usage examples for org.joda.time LocalDateTime equals

Introduction

In this page you can find the example usage for org.joda.time LocalDateTime equals.

Prototype

public boolean equals(Object partial) 

Source Link

Document

Compares this ReadablePartial with another returning true if the chronology, field types and values are equal.

Usage

From source file:ca.ualberta.physics.cssdp.dao.type.PersistentLocalDateTime.java

License:Apache License

@Override
public boolean equals(Object x, Object y) throws HibernateException {

    if (x == y) {
        return true;
    }//from   w  w w.  j  a va2  s .  c o m

    if (x == null || y == null) {
        return false;
    }

    LocalDateTime ldt1 = (LocalDateTime) x;
    LocalDateTime ldt2 = (LocalDateTime) y;

    return ldt1.equals(ldt2);
}

From source file:com.gst.infrastructure.core.api.JsonCommand.java

License:Apache License

private boolean differenceExistsTime(final LocalDateTime baseValue, final LocalDateTime workingCopyValue) {
    boolean differenceExists = false;

    if (baseValue != null) {
        differenceExists = !baseValue.equals(workingCopyValue);
    } else {/*from w  ww  . j  av  a 2s .co  m*/
        differenceExists = workingCopyValue != null;
    }

    return differenceExists;
}

From source file:com.gst.infrastructure.reportmailingjob.domain.ReportMailingJob.java

License:Apache License

/** 
 * Update the ReportMailingJob entity //from   w  ww .j  a va2s . co  m
 * 
 * @param jsonCommand JsonCommand object
 * @return map of string to object
 **/
public Map<String, Object> update(final JsonCommand jsonCommand) {
    final Map<String, Object> actualChanges = new LinkedHashMap<>();

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.NAME_PARAM_NAME, this.name)) {
        final String name = jsonCommand.stringValueOfParameterNamed(ReportMailingJobConstants.NAME_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.NAME_PARAM_NAME, name);

        this.name = name;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.DESCRIPTION_PARAM_NAME,
            this.description)) {
        final String description = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.DESCRIPTION_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.DESCRIPTION_PARAM_NAME, description);

        this.description = description;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.RECURRENCE_PARAM_NAME,
            this.recurrence)) {
        final String recurrence = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.RECURRENCE_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.RECURRENCE_PARAM_NAME, recurrence);

        this.recurrence = recurrence;
    }

    if (jsonCommand.isChangeInBooleanParameterNamed(ReportMailingJobConstants.IS_ACTIVE_PARAM_NAME,
            this.isActive)) {
        final boolean isActive = jsonCommand
                .booleanPrimitiveValueOfParameterNamed(ReportMailingJobConstants.IS_ACTIVE_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.IS_ACTIVE_PARAM_NAME, isActive);

        this.isActive = isActive;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.EMAIL_RECIPIENTS_PARAM_NAME,
            this.emailRecipients)) {
        final String emailRecipients = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_RECIPIENTS_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_RECIPIENTS_PARAM_NAME, emailRecipients);

        this.emailRecipients = emailRecipients;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.EMAIL_SUBJECT_PARAM_NAME,
            this.emailSubject)) {
        final String emailSubject = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_SUBJECT_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_SUBJECT_PARAM_NAME, emailSubject);

        this.emailSubject = emailSubject;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.EMAIL_MESSAGE_PARAM_NAME,
            this.emailMessage)) {
        final String emailMessage = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_MESSAGE_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_MESSAGE_PARAM_NAME, emailMessage);

        this.emailMessage = emailMessage;
    }

    if (jsonCommand.isChangeInStringParameterNamed(
            ReportMailingJobConstants.STRETCHY_REPORT_PARAM_MAP_PARAM_NAME, this.stretchyReportParamMap)) {
        final String stretchyReportParamMap = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.STRETCHY_REPORT_PARAM_MAP_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.STRETCHY_REPORT_PARAM_MAP_PARAM_NAME,
                stretchyReportParamMap);

        this.stretchyReportParamMap = stretchyReportParamMap;
    }

    final ReportMailingJobEmailAttachmentFileFormat emailAttachmentFileFormat = ReportMailingJobEmailAttachmentFileFormat
            .newInstance(this.emailAttachmentFileFormat);

    if (jsonCommand.isChangeInIntegerParameterNamed(
            ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME,
            emailAttachmentFileFormat.getId())) {
        final Integer emailAttachmentFileFormatId = jsonCommand.integerValueOfParameterNamed(
                ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME,
                emailAttachmentFileFormatId);

        final ReportMailingJobEmailAttachmentFileFormat newEmailAttachmentFileFormat = ReportMailingJobEmailAttachmentFileFormat
                .newInstance(emailAttachmentFileFormatId);
        this.emailAttachmentFileFormat = newEmailAttachmentFileFormat.getValue();
    }

    final String newStartDateTimeString = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME);

    if (!StringUtils.isEmpty(newStartDateTimeString)) {
        final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat())
                .withLocale(jsonCommand.extractLocale());
        final LocalDateTime newStartDateTime = LocalDateTime.parse(newStartDateTimeString, dateTimeFormatter);
        final LocalDateTime oldStartDateTime = (this.startDateTime != null)
                ? new LocalDateTime(this.startDateTime)
                : null;

        if ((oldStartDateTime != null) && !newStartDateTime.equals(oldStartDateTime)) {
            actualChanges.put(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME, newStartDateTimeString);

            this.startDateTime = newStartDateTime.toDate();
        }
    }

    Long currentStretchyReportId = null;

    if (this.stretchyReport != null) {
        currentStretchyReportId = this.stretchyReport.getId();
    }

    if (jsonCommand.isChangeInLongParameterNamed(ReportMailingJobConstants.STRETCHY_REPORT_ID_PARAM_NAME,
            currentStretchyReportId)) {
        final Long updatedStretchyReportId = jsonCommand
                .longValueOfParameterNamed(ReportMailingJobConstants.STRETCHY_REPORT_ID_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.STRETCHY_REPORT_ID_PARAM_NAME, updatedStretchyReportId);
    }

    return actualChanges;
}

From source file:com.restservice.serviceLogic.ResultLogic.java

License:Open Source License

/**
 * Request handler for getting the count per hour statistic
 * Additional logic beyond the transactor database connection to insert additional zeros
 * for dates where no count (row) has been returned
 * /* ww w  .j  a v  a  2 s  .c  om*/
 * @param id
 *            search term index
 * @return envelope containing a status message and a search result count
 *         per date DTO
 * @throws SQLException
 * @throws ExecutionException
 * @throws InterruptedException
 */
public Envelope getCountAndNewsPerHour(Long id, String lang)
        throws SQLException, InterruptedException, ExecutionException {

    SearchTermsPerQueryPerDate countsPerDay;
    Envelope env = new Envelope();

    countsPerDay = transactor.getCountPerHour(id, lang);

    // Fill with zeros
    ArrayList<Integer> newCounts = new ArrayList<Integer>();
    ArrayList<LocalDateTime> newDates = new ArrayList<LocalDateTime>();
    if (!countsPerDay.getDates().isEmpty()) {
        ArrayList<LocalDateTime> oldDates = new ArrayList<>();
        for (LocalDateTime curDate : countsPerDay.getDates()) {
            oldDates.add(new LocalDateTime(curDate.getYear(), curDate.getMonthOfYear(), curDate.getDayOfMonth(),
                    curDate.getHourOfDay(), 0));
        }

        newDates.add(oldDates.get(0));
        newCounts.add(countsPerDay.getCounts().get(0));
        for (int i = 1; i < oldDates.size(); i++) {
            if (!oldDates.get(i - 1).plusHours(1).equals(oldDates.get(i))) {
                LocalDateTime startDate = oldDates.get(i - 1);
                LocalDateTime endDate = oldDates.get(i);
                while (!startDate.equals(endDate)) {
                    startDate = startDate.plusHours(1);
                    if (startDate.equals(endDate)) {
                        newDates.add(oldDates.get(i));
                        newCounts.add(countsPerDay.getCounts().get(i));
                    } else {
                        newCounts.add(0);
                        newDates.add(startDate);
                    }

                }
            } else {
                newDates.add(oldDates.get(i));
                newCounts.add(countsPerDay.getCounts().get(i));
            }
        }
    }

    countsPerDay.setCounts(newCounts);
    countsPerDay.setDates(newDates);
    countsPerDay.updateDateStrings();

    // convert to nice output format
    CountAndNewsPerHour countAndNews = new CountAndNewsPerHour();
    for (Integer index = 0; index < countsPerDay.getCounts().size(); index++) {
        CountPeaksNewsAndDate element = new CountPeaksNewsAndDate();
        element.setRawDate(countsPerDay.getDates().get(index));
        element.setCount(countsPerDay.getCounts().get(index));
        element.setPeak(false);
        countAndNews.getGraph().add(element);
    }
    countAndNews.setQuery(countsPerDay.getQuery());

    // find and marks peaks
    ArrayList<Integer> peakIndices = PeaksUtil.findPeaks24(countAndNews);
    for (Integer peakIndex : peakIndices) {
        countAndNews.getGraph().get(peakIndex).setPeak(true);
    }

    if (peakIndices.size() > 0) {
        // create news fetchers
        HashMap<Integer, Future<ArrayList<NewsItem>>> newsFetchers = new HashMap<Integer, Future<ArrayList<NewsItem>>>();
        ExecutorService executor = Executors.newFixedThreadPool(peakIndices.size());
        for (Integer peakIndex : peakIndices) {
            LocalDateTime date = countAndNews.getGraph().get(peakIndex).getRawDate();
            newsFetchers.put(peakIndex, executor.submit(
                    new TopNewsFetcherThread(id, date.getDayOfMonth(), date.getMonthOfYear(), date.getYear())));
        }
        // retrieve news fetchers results
        executor.shutdown();
        java.util.Iterator<Entry<Integer, Future<ArrayList<NewsItem>>>> iterator = newsFetchers.entrySet()
                .iterator();
        while (iterator.hasNext()) {
            Entry<Integer, Future<ArrayList<NewsItem>>> entry = iterator.next();
            ArrayList<NewsItem> result = entry.getValue().get();
            if (result != null) {
                for (NewsItem newsitem : result) {
                    countAndNews.getGraph().get(entry.getKey()).getNews().add(newsitem.toShortString());
                }
            }
        }
    }

    env.setData(countAndNews);

    return env;
}

From source file:com.restservice.serviceLogic.ResultLogic.java

License:Open Source License

/**
 * Request handler for getting the count per hour statistic
 * /*from  w  w w  . j  a v a  2  s .co m*/
 * @param id
 *            search term index
 * @param lang
 *            iso language code of the language (all languages are selected
 *            if this parameter is null)
 * 
 * @return envelope containing a status message and the number of
 *         positive/negative tweets per hour
 * @throws SQLException
 */
public Envelope getSentimentPerHour(Long id, String lang) throws SQLException {

    SentimentPerQueryPerDate data;
    Envelope env = new Envelope();

    // TODO: Filling these zeros shouldn't been done three times (twice
    // here and once in getCountPerHour). Fix it! See ticket #86
    data = transactor.getSentimentPerHour(id, lang);

    ArrayList<LocalDateTime> oldDatesPositive = new ArrayList<>();
    ArrayList<Integer> newCountsPositive = new ArrayList<Integer>();
    ArrayList<LocalDateTime> newDatesPositive = new ArrayList<LocalDateTime>();
    ArrayList<LocalDateTime> oldDatesNegative = new ArrayList<>();
    ArrayList<Integer> newCountsNegative = new ArrayList<Integer>();
    ArrayList<LocalDateTime> newDatesNegative = new ArrayList<LocalDateTime>();

    // Reset minutes, seconds and miliseconds to 0
    if (!data.getPositiveCounts().getDates().isEmpty()) {
        for (LocalDateTime curDate : data.getPositiveCounts().getDates()) {
            oldDatesPositive.add(new LocalDateTime(curDate.getYear(), curDate.getMonthOfYear(),
                    curDate.getDayOfMonth(), curDate.getHourOfDay(), 0));
        }
    }
    if (!data.getNegativeCounts().getDates().isEmpty()) {
        for (LocalDateTime curDate : data.getNegativeCounts().getDates()) {
            oldDatesNegative.add(new LocalDateTime(curDate.getYear(), curDate.getMonthOfYear(),
                    curDate.getDayOfMonth(), curDate.getHourOfDay(), 0));
        }
    }

    // Get first date from both (positive or negative) and fill the
    // other one with leading zero counts
    if (!oldDatesPositive.isEmpty() && !oldDatesNegative.isEmpty()) {
        // The first positive date is earlier than the first negative
        // date
        if (oldDatesPositive.get(0).compareTo(oldDatesNegative.get(0)) == -1) {
            LocalDateTime curDate = oldDatesPositive.get(0);
            while (!curDate.equals(oldDatesNegative.get(0))) {
                newCountsNegative.add(0);
                newDatesNegative.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
        // The first negative date is earlier than the first positive
        // date
        else if (oldDatesPositive.get(0).compareTo(oldDatesNegative.get(0)) == 1) {
            LocalDateTime curDate = oldDatesNegative.get(0);
            while (!curDate.equals(oldDatesPositive.get(0))) {
                newCountsPositive.add(0);
                newDatesPositive.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
    }

    // Fill hours that have 0 counts for positive tweets
    if (!oldDatesPositive.isEmpty()) {
        newDatesPositive.add(oldDatesPositive.get(0));
        newCountsPositive.add(data.getPositiveCounts().getCounts().get(0));
        for (int i = 1; i < oldDatesPositive.size(); i++) {
            if (!oldDatesPositive.get(i - 1).plusHours(1).equals(oldDatesPositive.get(i))) {
                LocalDateTime startDate = oldDatesPositive.get(i - 1);
                LocalDateTime endDate = oldDatesPositive.get(i);
                while (!startDate.equals(endDate)) {
                    startDate = startDate.plusHours(1);
                    if (startDate.equals(endDate)) {
                        newDatesPositive.add(oldDatesPositive.get(i));
                        newCountsPositive.add(data.getPositiveCounts().getCounts().get(i));
                    } else {
                        newCountsPositive.add(0);
                        newDatesPositive.add(startDate);
                    }

                }
            } else {
                newDatesPositive.add(oldDatesPositive.get(i));
                newCountsPositive.add(data.getPositiveCounts().getCounts().get(i));
            }
        }
    }

    // Fill hours that have 0 counts for negative tweets
    if (!oldDatesNegative.isEmpty()) {
        newDatesNegative.add(oldDatesNegative.get(0));
        newCountsNegative.add(data.getNegativeCounts().getCounts().get(0));
        for (int i = 1; i < oldDatesNegative.size(); i++) {
            if (!oldDatesNegative.get(i - 1).plusHours(1).equals(oldDatesNegative.get(i))) {
                LocalDateTime startDate = oldDatesNegative.get(i - 1);
                LocalDateTime endDate = oldDatesNegative.get(i);
                while (!startDate.equals(endDate)) {
                    startDate = startDate.plusHours(1);
                    if (startDate.equals(endDate)) {
                        newDatesNegative.add(oldDatesNegative.get(i));
                        newCountsNegative.add(data.getNegativeCounts().getCounts().get(i));
                    } else {
                        newCountsNegative.add(0);
                        newDatesNegative.add(startDate);
                    }

                }
            } else {
                newDatesNegative.add(oldDatesNegative.get(i));
                newCountsNegative.add(data.getNegativeCounts().getCounts().get(i));
            }
        }
    }

    // Fill negative with zeros when only positive exists
    if (!newDatesPositive.isEmpty() && newDatesNegative.isEmpty()) {
        for (LocalDateTime curDate : newDatesPositive) {
            newCountsNegative.add(0);
            newDatesNegative.add(curDate);
        }
    }
    // Fill positive with zeros when only negative exists
    else if (newDatesPositive.isEmpty() && !newDatesNegative.isEmpty()) {
        for (LocalDateTime curDate : newDatesNegative) {
            newCountsPositive.add(0);
            newDatesPositive.add(curDate);
        }
    }

    // Get last date from both (positive or negative) and fill the other
    // one with trailing zero counts
    if (!newDatesPositive.isEmpty() && !newDatesNegative.isEmpty()) {
        // The last positive date is later than the last negative date
        if (newDatesPositive.get(newDatesPositive.size() - 1)
                .compareTo(newDatesNegative.get(newDatesNegative.size() - 1)) == -1) {
            LocalDateTime curDate = newDatesPositive.get(newDatesPositive.size() - 1);
            while (!curDate.equals(newDatesNegative.get(newDatesNegative.size() - 1))) {
                newCountsNegative.add(0);
                newDatesNegative.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
        // The last negative date is later than the last positive date
        else if (newDatesPositive.get(newDatesPositive.size() - 1)
                .compareTo(newDatesNegative.get(newDatesNegative.size() - 1)) == 1) {
            LocalDateTime curDate = newDatesNegative.get(newDatesNegative.size() - 1);
            while (!curDate.equals(newDatesPositive.get(newDatesPositive.size() - 1))) {
                newCountsPositive.add(0);
                newDatesPositive.add(curDate);
                curDate = curDate.plusHours(1);
            }
        }
    }

    data.getPositiveCounts().setCounts(newCountsPositive);
    data.getPositiveCounts().setDates(newDatesPositive);
    data.getPositiveCounts().updateDateStrings();

    data.getNegativeCounts().setCounts(newCountsNegative);
    data.getNegativeCounts().setDates(newDatesNegative);
    data.getNegativeCounts().updateDateStrings();

    env.setData(data);

    return env;
}

From source file:com.the.todo.command.ToDoEdit.java

License:MIT License

private Type checkChangeTaskType(LocalDateTime startDate, LocalDateTime endDate) {

    if ((startDate.equals(ToDo.INVALID_DATE)) && (endDate.equals(ToDo.INVALID_DATE))) {
        return Type.FLOATING;
    } else if ((startDate.equals(ToDo.INVALID_DATE)) && (endDate != null)) {
        return Type.DEADLINE;
    } else {/*from   ww  w  .  ja  v  a2 s .c o  m*/
        return Type.TIMED;
    }

}

From source file:graphene.util.time.JodaTimeUtil.java

License:Apache License

public static void test_localDateTime() {
    System.out.println("Test LocalDateTime");
    final LocalDateTime ldt1 = new LocalDateTime();
    final java.sql.Timestamp ts = toSQLTimestamp(ldt1);
    final LocalDateTime ldt2 = toLocalDateTime(ts);
    System.out.println("LocalDateTime 1 = " + ldt1);
    System.out.println("Timestamp       = " + ts);
    System.out.println("LocalDateTime 2 = " + ldt2);
    if (!ldt2.equals(ldt1)) {
        throw new IllegalStateException();
    }/*ww w .  jav  a2  s.  com*/
}

From source file:nl.gmt.data.contrib.joda.PersistentLocalDateTime.java

License:Apache License

@Override
public boolean equals(Object x, Object y) throws HibernateException {
    if (x == y) {
        return true;
    }/* w w w.  j a v a  2  s . c  om*/
    if (x == null || y == null) {
        return false;
    }
    LocalDateTime dtx = (LocalDateTime) x;
    LocalDateTime dty = (LocalDateTime) y;
    return dtx.equals(dty);
}

From source file:org.mifosplatform.infrastructure.reportmailingjob.domain.ReportMailingJob.java

License:Mozilla Public License

/** 
 * Update the ReportMailingJob entity /*w  w w . j  a va  2 s.  c  o m*/
 * 
 * @param jsonCommand JsonCommand object
 * @return map of string to object
 **/
public Map<String, Object> update(final JsonCommand jsonCommand) {
    final Map<String, Object> actualChanges = new LinkedHashMap<>();

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.NAME_PARAM_NAME, this.name)) {
        final String name = jsonCommand.stringValueOfParameterNamed(ReportMailingJobConstants.NAME_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.NAME_PARAM_NAME, name);

        this.name = name;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.DESCRIPTION_PARAM_NAME,
            this.description)) {
        final String description = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.DESCRIPTION_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.DESCRIPTION_PARAM_NAME, description);

        this.description = description;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.RECURRENCE_PARAM_NAME,
            this.recurrence)) {
        final String recurrence = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.RECURRENCE_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.RECURRENCE_PARAM_NAME, recurrence);

        this.recurrence = recurrence;
    }

    if (jsonCommand.isChangeInBooleanParameterNamed(ReportMailingJobConstants.IS_ACTIVE_PARAM_NAME,
            this.isActive)) {
        final boolean isActive = jsonCommand
                .booleanPrimitiveValueOfParameterNamed(ReportMailingJobConstants.IS_ACTIVE_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.IS_ACTIVE_PARAM_NAME, isActive);

        this.isActive = isActive;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.EMAIL_RECIPIENTS_PARAM_NAME,
            this.emailRecipients)) {
        final String emailRecipients = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_RECIPIENTS_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_RECIPIENTS_PARAM_NAME, emailRecipients);

        this.emailRecipients = emailRecipients;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.EMAIL_SUBJECT_PARAM_NAME,
            this.emailSubject)) {
        final String emailSubject = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_SUBJECT_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_SUBJECT_PARAM_NAME, emailSubject);

        this.emailSubject = emailSubject;
    }

    if (jsonCommand.isChangeInStringParameterNamed(ReportMailingJobConstants.EMAIL_MESSAGE_PARAM_NAME,
            this.emailMessage)) {
        final String emailMessage = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_MESSAGE_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_MESSAGE_PARAM_NAME, emailMessage);

        this.emailMessage = emailMessage;
    }

    if (jsonCommand.isChangeInStringParameterNamed(
            ReportMailingJobConstants.STRETCHY_REPORT_PARAM_MAP_PARAM_NAME, this.stretchyReportParamMap)) {
        final String stretchyReportParamMap = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.STRETCHY_REPORT_PARAM_MAP_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.STRETCHY_REPORT_PARAM_MAP_PARAM_NAME,
                stretchyReportParamMap);

        this.stretchyReportParamMap = stretchyReportParamMap;
    }

    final ReportMailingJobEmailAttachmentFileFormat emailAttachmentFileFormat = ReportMailingJobEmailAttachmentFileFormat
            .instance(this.emailAttachmentFileFormat);

    if (jsonCommand.isChangeInIntegerParameterNamed(
            ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME,
            emailAttachmentFileFormat.getId())) {
        final Integer emailAttachmentFileFormatId = jsonCommand.integerValueOfParameterNamed(
                ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME,
                emailAttachmentFileFormatId);

        final ReportMailingJobEmailAttachmentFileFormat newEmailAttachmentFileFormat = ReportMailingJobEmailAttachmentFileFormat
                .instance(emailAttachmentFileFormatId);
        this.emailAttachmentFileFormat = newEmailAttachmentFileFormat.getValue();
    }

    final String newStartDateTimeString = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME);

    if (!StringUtils.isEmpty(newStartDateTimeString)) {
        final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat())
                .withLocale(jsonCommand.extractLocale());
        final LocalDateTime newStartDateTime = LocalDateTime.parse(newStartDateTimeString, dateTimeFormatter);
        final LocalDateTime oldStartDateTime = (this.startDateTime != null)
                ? new LocalDateTime(this.startDateTime)
                : null;

        if ((oldStartDateTime != null) && !newStartDateTime.equals(oldStartDateTime)) {
            actualChanges.put(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME, newStartDateTimeString);

            this.startDateTime = newStartDateTime.toDate();
        }
    }

    Long currentStretchyReportId = null;

    if (this.stretchyReport != null) {
        currentStretchyReportId = this.stretchyReport.getId();
    }

    if (jsonCommand.isChangeInLongParameterNamed(ReportMailingJobConstants.STRETCHY_REPORT_ID_PARAM_NAME,
            currentStretchyReportId)) {
        final Long updatedStretchyReportId = jsonCommand
                .longValueOfParameterNamed(ReportMailingJobConstants.STRETCHY_REPORT_ID_PARAM_NAME);
        actualChanges.put(ReportMailingJobConstants.STRETCHY_REPORT_ID_PARAM_NAME, updatedStretchyReportId);
    }

    return actualChanges;
}