Example usage for org.joda.time LocalDateTime toDate

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

Introduction

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

Prototype

@SuppressWarnings("deprecation")
public Date toDate() 

Source Link

Document

Get the date time as a java.util.Date.

Usage

From source file:com.enonic.cms.core.search.result.DateHistogramFacetResultSetXmlCreator.java

License:Open Source License

private String getTimeAsFormattedString(final DateHistogramFacetResultEntry result) {
    LocalDateTime localDateTime = new LocalDateTime(result.getTime());

    return CmsDateAndTimeFormats.printAs_XML_TIMESTAMP(localDateTime.toDate());
}

From source file:com.evinceframework.web.dojo.json.conversion.LocalDateTimePrimitiveWriter.java

License:Apache License

@Override
public void writeValue(JsonGenerator generator, LocalDateTime value) throws IOException {
    generator.writeStartObject();/*from  ww  w  .  j  ava  2 s  .c  om*/
    generator.writeStringField("_customType", "Date");
    generator.writeStringField("_value", DateTimePrimitiveWriter.dateFormat.format(value.toDate()));
    generator.writeEndObject();
}

From source file:com.fujitsu.dc.core.model.impl.es.doc.OEntityDocHandler.java

License:Apache License

/**
 * OEntityWrapper? ID???DocHandler???./*w  ww .  ja  v a2  s . c o  m*/
 * @param typeName ES?type??
 * @param oEntityWrapper OEntityWrapper
 * @param metadata 
 */
@SuppressWarnings("unchecked")
protected void initInstance(String typeName, OEntityWrapper oEntityWrapper, EdmDataServices metadata) {
    this.type = typeName;
    // ??uuidES ID????
    this.id = oEntityWrapper.getUuid();
    // OEntity Wrapper????? Version, hiddenField??
    this.hiddenFields = oEntityWrapper.getMetadata();
    // Cell????UnitUser???
    resolveUnitUserName();
    String etag = oEntityWrapper.getEtag();
    if (etag != null && etag.length() > 1) {
        this.version = Long.valueOf(etag.substring(0, etag.indexOf("-")));
    }

    // ?
    EdmEntitySet entitySet = oEntityWrapper.getEntitySet();
    EdmEntityType eType = entitySet.getType();

    // ???NavProp?
    List<EdmNavigationProperty> navProps = eType.getDeclaredNavigationProperties().toList();
    for (EdmNavigationProperty np : navProps) {
        // NavProp???????
        EdmMultiplicity mf = np.getFromRole().getMultiplicity();
        EdmMultiplicity mt = np.getToRole().getMultiplicity();

        // Association?Multiplicity????????MANY??ONE??????
        // NavigationProperty?URL??l????
        if (EdmMultiplicity.ONE.equals(mt) && EdmMultiplicity.MANY.equals(mf)) {
            // TODO 
            log.debug("many to one");

        }
    }

    // ?????????????
    for (OProperty<?> prop : oEntityWrapper.getProperties()) {
        // ???????Dynamic Property?Declared Property???
        String propName = prop.getName();
        EdmProperty edmProperty = eType.findProperty(propName);

        // ?Property?DynamicProperty????
        if (edmProperty != null) {
            // ??
            // TODO ??????????? ?????????????
            // ????????????

            // ?????.
            Object value = prop.getValue();
            if ("__published".equals(propName)) {
                OProperty<LocalDateTime> propD = (OProperty<LocalDateTime>) prop;
                LocalDateTime ldt = propD.getValue();
                this.published = ldt.toDateTime().getMillis();
            } else if ("__updated".equals(propName)) {
                OProperty<LocalDateTime> propD = (OProperty<LocalDateTime>) prop;
                LocalDateTime ldt = propD.getValue();
                this.updated = ldt.toDateTime().getMillis();
            } else {
                CollectionKind ck = edmProperty.getCollectionKind();
                if (edmProperty.getType().isSimple()) {
                    if (ck.equals(CollectionKind.List)) {
                        // ?????
                        if (value == null || value instanceof OCollection<?>) {
                            this.staticFields.put(prop.getName(),
                                    getSimpleList(edmProperty.getType(), (OCollection<OObject>) value));
                        } else {
                            throw DcCoreException.OData.REQUEST_FIELD_FORMAT_ERROR.params(prop.getName());
                        }
                    } else {
                        value = getSimpleValue(prop, edmProperty.getType());

                        // Property?Simple?????????????
                        this.staticFields.put(prop.getName(), value);
                    }
                } else {
                    String complexTypeName = edmProperty.getType().getFullyQualifiedTypeName();
                    if (ck.equals(CollectionKind.List)) {
                        // CollectionKind?List???????
                        this.staticFields.put(prop.getName(), getComplexList(
                                (OCollection<OComplexObject>) prop.getValue(), metadata, complexTypeName));
                    } else {
                        // Property?Complex?????ComplexType????
                        this.staticFields.put(prop.getName(), getComplexType(prop, metadata, complexTypeName));
                    }
                }
            }
        } else {
            // Dynamic??String,Integer,Float,Boolean??
            Object propValue = prop.getValue();
            if ("Edm.DateTime".equals(prop.getType().getFullyQualifiedTypeName())) {
                OProperty<LocalDateTime> propD = (OProperty<LocalDateTime>) prop;
                LocalDateTime ldt = propD.getValue();
                if (ldt != null) {
                    propValue = "\\/Date(" + ldt.toDateTime().toDate().getTime() + ")\\/";
                }
            }

            this.dynamicFields.put(prop.getName(), propValue);
        }
    }
}

From source file:com.gst.infrastructure.campaigns.sms.domain.SmsCampaign.java

License:Apache License

private SmsCampaign(final String campaignName, final Integer campaignType, final Integer triggerType,
        final Report businessRuleId, final Long providerId, final String paramValue, final String message,
        final LocalDate submittedOnDate, final AppUser submittedBy, final String recurrence,
        final LocalDateTime localDateTime) {
    this.campaignName = campaignName;
    this.campaignType = campaignType;
    this.triggerType = SmsCampaignTriggerType.fromInt(triggerType).getValue();
    this.businessRuleId = businessRuleId;
    this.providerId = providerId;
    this.paramValue = paramValue;
    this.status = SmsCampaignStatus.PENDING.getValue();
    this.message = message;
    this.submittedOnDate = submittedOnDate.toDate();
    this.submittedBy = submittedBy;
    this.recurrence = recurrence;
    LocalDateTime recurrenceStartDate = new LocalDateTime();
    this.isVisible = true;
    if (localDateTime != null) {
        this.recurrenceStartDate = localDateTime.toDate();
    } else {/*www  . ja v a  2  s .  c  o  m*/
        this.recurrenceStartDate = recurrenceStartDate.toDate();
    }
}

From source file:com.gst.infrastructure.campaigns.sms.service.SmsCampaignWritePlatformServiceJpaImpl.java

License:Apache License

private void updateTriggerDates(Long campaignId) {
    final SmsCampaign smsCampaign = this.smsCampaignRepository.findOne(campaignId);
    if (smsCampaign == null) {
        throw new SmsCampaignNotFound(campaignId);
    }//from  w  ww . ja v  a 2 s  .c o m
    LocalDateTime nextTriggerDate = smsCampaign.getNextTriggerDate();
    smsCampaign.setLastTriggerDate(nextTriggerDate.toDate());
    // calculate new trigger date and insert into next trigger date

    /**
     * next run time has to be in the future if not calculate a new future
     * date
     */
    LocalDate nextRuntime = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(),
            smsCampaign.getNextTriggerDate().toLocalDate(), nextTriggerDate.toLocalDate());
    if (nextRuntime.isBefore(DateUtils.getLocalDateOfTenant())) { // means
                                                                  // next
                                                                  // run
                                                                  // time is
                                                                  // in the
                                                                  // past
                                                                  // calculate
                                                                  // a new
                                                                  // future
                                                                  // date
        nextRuntime = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(),
                smsCampaign.getNextTriggerDate().toLocalDate(), DateUtils.getLocalDateOfTenant());
    }
    final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();
    final String dateString = nextRuntime.toString() + " " + getTime.getHourOfDay() + ":"
            + getTime.getMinuteOfHour() + ":" + getTime.getSecondOfMinute();
    final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
    final LocalDateTime newTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);

    smsCampaign.setNextTriggerDate(newTriggerDateWithTime.toDate());
    this.smsCampaignRepository.saveAndFlush(smsCampaign);
}

From source file:com.gst.infrastructure.campaigns.sms.service.SmsCampaignWritePlatformServiceJpaImpl.java

License:Apache License

@Transactional
@Override//from  www.ja  v a 2  s . com
public CommandProcessingResult activateSmsCampaign(Long campaignId, JsonCommand command) {
    final AppUser currentUser = this.context.authenticatedUser();

    this.smsCampaignValidator.validateActivation(command.json());

    final SmsCampaign smsCampaign = this.smsCampaignRepository.findOne(campaignId);

    if (smsCampaign == null) {
        throw new SmsCampaignNotFound(campaignId);
    }

    final Locale locale = command.extractLocale();
    final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
    final LocalDate activationDate = command.localDateValueOfParameterNamed("activationDate");

    smsCampaign.activate(currentUser, fmt, activationDate);

    this.smsCampaignRepository.saveAndFlush(smsCampaign);

    if (smsCampaign.isDirect()) {
        insertDirectCampaignIntoSmsOutboundTable(smsCampaign);
    } else if (smsCampaign.isSchedule()) {

        /**
         * if recurrence start date is in the future calculate next trigger
         * date if not use recurrence start date us next trigger date when
         * activating
         */
        LocalDate nextTriggerDate = null;
        if (smsCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
            nextTriggerDate = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(),
                    smsCampaign.getRecurrenceStartDate(), DateUtils.getLocalDateOfTenant());
        } else {
            nextTriggerDate = smsCampaign.getRecurrenceStartDate();
        }
        // to get time of tenant
        final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();

        final String dateString = nextTriggerDate.toString() + " " + getTime.getHourOfDay() + ":"
                + getTime.getMinuteOfHour() + ":" + getTime.getSecondOfMinute();
        final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
        final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);

        smsCampaign.setNextTriggerDate(nextTriggerDateWithTime.toDate());
        this.smsCampaignRepository.saveAndFlush(smsCampaign);
    }

    /*
     * if campaign is direct insert campaign message into sms outbound table
     * else if its a schedule create a job process for it
     */
    return new CommandProcessingResultBuilder() //
            .withCommandId(command.commandId()) //
            .withEntityId(smsCampaign.getId()) //
            .build();
}

From source file:com.gst.infrastructure.campaigns.sms.service.SmsCampaignWritePlatformServiceJpaImpl.java

License:Apache License

@Transactional
@Override//from www  .  j  a v  a  2  s. c o  m
public CommandProcessingResult reactivateSmsCampaign(final Long campaignId, JsonCommand command) {

    this.smsCampaignValidator.validateActivation(command.json());

    final AppUser currentUser = this.context.authenticatedUser();

    final SmsCampaign smsCampaign = this.smsCampaignRepository.findOne(campaignId);

    if (smsCampaign == null) {
        throw new SmsCampaignNotFound(campaignId);
    }

    final Locale locale = command.extractLocale();
    final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
    final LocalDate reactivationDate = command.localDateValueOfParameterNamed("activationDate");
    smsCampaign.reactivate(currentUser, fmt, reactivationDate);
    if (smsCampaign.isDirect()) {
        insertDirectCampaignIntoSmsOutboundTable(smsCampaign);
    } else if (smsCampaign.isSchedule()) {

        /**
         * if recurrence start date is in the future calculate next trigger
         * date if not use recurrence start date us next trigger date when
         * activating
         */
        LocalDate nextTriggerDate = null;
        if (smsCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
            nextTriggerDate = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(),
                    smsCampaign.getRecurrenceStartDate(), DateUtils.getLocalDateOfTenant());
        } else {
            nextTriggerDate = smsCampaign.getRecurrenceStartDate();
        }
        // to get time of tenant
        final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();

        final String dateString = nextTriggerDate.toString() + " " + getTime.getHourOfDay() + ":"
                + getTime.getMinuteOfHour() + ":" + getTime.getSecondOfMinute();
        final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
        final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);

        smsCampaign.setNextTriggerDate(nextTriggerDateWithTime.toDate());
    }
    this.smsCampaignRepository.saveAndFlush(smsCampaign);

    return new CommandProcessingResultBuilder() //
            .withEntityId(smsCampaign.getId()) //
            .build();

}

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

License:Apache License

/** 
 * ReportMailingJob private constructor 
 **///w w w. ja va2 s  .  co  m
private ReportMailingJob(final String name, final String description, final LocalDateTime startDateTime,
        final String recurrence, final String emailRecipients, final String emailSubject,
        final String emailMessage, final ReportMailingJobEmailAttachmentFileFormat emailAttachmentFileFormat,
        final Report stretchyReport, final String stretchyReportParamMap,
        final LocalDateTime previousRunDateTime, final LocalDateTime nextRunDateTime,
        final ReportMailingJobPreviousRunStatus previousRunStatus, final String previousRunErrorLog,
        final String previousRunErrorMessage, final boolean isActive, final boolean isDeleted,
        final AppUser runAsUser) {
    this.name = name;
    this.description = description;
    this.startDateTime = null;

    if (startDateTime != null) {
        this.startDateTime = startDateTime.toDate();
    }

    this.recurrence = recurrence;
    this.emailRecipients = emailRecipients;
    this.emailSubject = emailSubject;
    this.emailMessage = emailMessage;
    this.emailAttachmentFileFormat = emailAttachmentFileFormat.getValue();
    this.stretchyReport = stretchyReport;
    this.stretchyReportParamMap = stretchyReportParamMap;
    this.previousRunDateTime = null;

    if (previousRunDateTime != null) {
        this.previousRunDateTime = previousRunDateTime.toDate();
    }

    this.nextRunDateTime = null;

    if (nextRunDateTime != null) {
        this.nextRunDateTime = nextRunDateTime.toDate();
    }

    this.previousRunStatus = null;

    if (previousRunStatus != null) {
        this.previousRunStatus = previousRunStatus.getValue();
    }

    if (numberOfRuns == null) {
        this.numberOfRuns = 0;
    }

    this.previousRunErrorLog = previousRunErrorLog;
    this.previousRunErrorMessage = previousRunErrorMessage;
    this.isActive = isActive;
    this.isDeleted = isDeleted;
    this.runAsUser = runAsUser;
}

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

License:Apache License

/** 
 * Update the ReportMailingJob entity //from w w w . j a v  a2  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
            .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.gst.portfolio.calendar.domain.Calendar.java

License:Apache License

public static Calendar fromJson(final JsonCommand command) {

    // final Long entityId = command.getSupportedEntityId();
    // final Integer entityTypeId =
    // CalendarEntityType.valueOf(command.getSupportedEntityType().toUpperCase()).getValue();
    Date meetingtime = null;/*from   w  ww .jav a 2s . co  m*/
    final String title = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue());
    final String description = command
            .stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue());
    final String location = command
            .stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue());
    final LocalDate startDate = command
            .localDateValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue());
    final LocalDate endDate = command
            .localDateValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue());
    final Integer duration = command
            .integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue());
    final Integer typeId = command
            .integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue());
    final boolean repeating = command
            .booleanPrimitiveValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue());
    final Integer remindById = command
            .integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue());
    final Integer firstReminder = command
            .integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue());
    final Integer secondReminder = command
            .integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue());
    final LocalDateTime time = command
            .localTimeValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue());
    if (time != null) {
        meetingtime = time.toDate();
    }
    final String recurrence = Calendar.constructRecurrence(command, null);

    return new Calendar(title, description, location, startDate, endDate, duration, typeId, repeating,
            recurrence, remindById, firstReminder, secondReminder, meetingtime);
}