Example usage for org.joda.time LocalDateTime LocalDateTime

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

Introduction

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

Prototype

public LocalDateTime() 

Source Link

Document

Constructs an instance set to the current local time evaluated using ISO chronology in the default zone.

Usage

From source file:com.esofthead.mycollab.community.common.service.AppPropertiesServiceImpl.java

License:Open Source License

@Override
public String getSysId() {
    return properties.getProperty("id", UUID.randomUUID().toString() + new LocalDateTime().getMillisOfSecond());
}

From source file:com.esofthead.mycollab.core.SystemProperties.java

License:Open Source License

public static String getId() {
    return properties.getProperty("id", UUID.randomUUID().toString() + new LocalDateTime().getMillisOfSecond());
}

From source file:com.esofthead.mycollab.license.LicenseInfo.java

License:Open Source License

public boolean isExpired() {
    return expireDate.before(new LocalDateTime().toDate());
}

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 {/*from   w  w  w  . j ava2s  .  c  om*/
        this.recurrenceStartDate = recurrenceStartDate.toDate();
    }
}

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

License:Apache License

public static SmsCampaign instance(final AppUser submittedBy, final Report report, final JsonCommand command) {

    final String campaignName = command.stringValueOfParameterNamed(SmsCampaignValidator.campaignName);
    final Long campaignType = command.longValueOfParameterNamed(SmsCampaignValidator.campaignType);
    final Long triggerType = command.longValueOfParameterNamed(SmsCampaignValidator.triggerType);
    final Long providerId = command.longValueOfParameterNamed(SmsCampaignValidator.providerId);
    final String paramValue = command.jsonFragment(SmsCampaignValidator.paramValue);

    final String message = command.stringValueOfParameterNamed(SmsCampaignValidator.message);
    LocalDate submittedOnDate = new LocalDate();
    if (command.hasParameter(SmsCampaignValidator.submittedOnDateParamName)) {
        submittedOnDate = command.localDateValueOfParameterNamed(SmsCampaignValidator.submittedOnDateParamName);
    }/*from w  w  w  .java 2s . c o m*/
    String recurrence = null;

    LocalDateTime recurrenceStartDate = new LocalDateTime();
    if (SmsCampaignTriggerType.fromInt(triggerType.intValue()).isSchedule()) {
        final Locale locale = command.extractLocale();
        String dateTimeFormat = null;
        if (command.hasParameter(SmsCampaignValidator.dateTimeFormat)) {
            dateTimeFormat = command.stringValueOfParameterNamed(SmsCampaignValidator.dateTimeFormat);
            final DateTimeFormatter fmt = DateTimeFormat.forPattern(dateTimeFormat).withLocale(locale);
            if (command.hasParameter(SmsCampaignValidator.recurrenceStartDate)) {
                recurrenceStartDate = LocalDateTime.parse(
                        command.stringValueOfParameterNamed(SmsCampaignValidator.recurrenceStartDate), fmt);
            }
            recurrence = constructRecurrence(command);
        }
    } else {
        recurrenceStartDate = null;
    }

    return new SmsCampaign(campaignName, campaignType.intValue(), triggerType.intValue(), report, providerId,
            paramValue, message, submittedOnDate, submittedBy, recurrence, recurrenceStartDate);
}

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

License:Apache License

private LocalDateTime tenantDateTime() {
    LocalDateTime today = new LocalDateTime();
    final FineractPlatformTenant tenant = ThreadLocalContextUtil.getTenant();

    if (tenant != null) {
        final DateTimeZone zone = DateTimeZone.forID(tenant.getTimezoneId());
        if (zone != null) {
            today = new LocalDateTime(zone);
        }//ww  w.  j a  v a 2 s .  c  om
    }
    return today;
}

From source file:com.gst.infrastructure.core.service.DateUtils.java

License:Apache License

public static LocalDateTime getLocalDateTimeOfTenant() {

    LocalDateTime today = new LocalDateTime();

    final DateTimeZone zone = getDateTimeZoneOfTenant();
    if (zone != null) {
        today = new LocalDateTime(zone);
    }/*from  w  ww  .j a v a2 s. c  o m*/

    return today;
}

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

License:Apache License

/** 
 * create a new instance of the ReportmailingJob for a new entry 
 * //www  . j a va  2  s  .  c o  m
 * @return ReportMailingJob object
 **/
public static ReportMailingJob newInstance(JsonCommand jsonCommand, final Report stretchyReport,
        final AppUser runAsUser) {
    final String name = jsonCommand.stringValueOfParameterNamed(ReportMailingJobConstants.NAME_PARAM_NAME);
    final String description = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.DESCRIPTION_PARAM_NAME);
    final String recurrence = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.RECURRENCE_PARAM_NAME);
    final boolean isActive = jsonCommand
            .booleanPrimitiveValueOfParameterNamed(ReportMailingJobConstants.IS_ACTIVE_PARAM_NAME);
    final String emailRecipients = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_RECIPIENTS_PARAM_NAME);
    final String emailSubject = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_SUBJECT_PARAM_NAME);
    final String emailMessage = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.EMAIL_MESSAGE_PARAM_NAME);
    final String stretchyReportParamMap = jsonCommand
            .stringValueOfParameterNamed(ReportMailingJobConstants.STRETCHY_REPORT_PARAM_MAP_PARAM_NAME);
    final Integer emailAttachmentFileFormatId = jsonCommand
            .integerValueOfParameterNamed(ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME);
    final ReportMailingJobEmailAttachmentFileFormat emailAttachmentFileFormat = ReportMailingJobEmailAttachmentFileFormat
            .newInstance(emailAttachmentFileFormatId);
    LocalDateTime startDateTime = new LocalDateTime();

    if (jsonCommand.hasParameter(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME)) {
        final String startDateTimeString = jsonCommand
                .stringValueOfParameterNamed(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME);

        if (startDateTimeString != null) {
            final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat())
                    .withLocale(jsonCommand.extractLocale());
            startDateTime = LocalDateTime.parse(startDateTimeString, dateTimeFormatter);
        }
    }

    return new ReportMailingJob(name, description, startDateTime, recurrence, emailRecipients, emailSubject,
            emailMessage, emailAttachmentFileFormat, stretchyReport, stretchyReportParamMap, null,
            startDateTime, null, null, null, isActive, false, runAsUser);
}

From source file:com.heisenberg.impl.WorkflowEngineImpl.java

License:Apache License

public DeployResult validateAndDeploy(WorkflowImpl workflow) {
    Exceptions.checkNotNull(workflow, "processBuilder");
    if (log.isDebugEnabled())
        log.debug("Deploying process");
    workflow.deployedTime = new LocalDateTime();

    DeployResult deployResult = new DeployResult();

    // throws an exception if there are errors 
    WorkflowValidator validator = new WorkflowValidator(this);
    workflow.visit(validator);/*w  w w . ja va2  s  .  com*/
    ParseIssues issues = validator.getIssues();
    deployResult.setIssues(issues);

    if (!issues.hasErrors()) {
        workflow.id = workflowStore.createWorkflowId(workflow);
        deployResult.setWorkflowId(workflow.id);

        workflowStore.insertWorkflow(workflow);
        workflowCache.put(workflow);
    }

    return deployResult;
}

From source file:com.makotogo.mobile.datetimepickerexample.MainActivity.java

License:Apache License

private void createButtonChooseDateTime() {
    Button button = (Button) safeFindViewById(R.id.button_choosedatetime);
    button.setOnClickListener(new View.OnClickListener() {
        @Override/*from  ww  w .  j a v  a  2  s  .  co  m*/
        public void onClick(View v) {
            FragmentManager fragmentManager = getFragmentManager();
            // If there is already a Date displayed, use that.
            Date dateToUse = (mLocalDateTime == null) ? new LocalDateTime().toDate() : mLocalDateTime.toDate();
            DateTimePickerFragment datePickerFragment = FragmentFactory.createDatePickerFragment(dateToUse,
                    "The", DateTimePickerFragment.BOTH, new DateTimePickerFragment.ResultHandler() {
                        @Override
                        public void setDate(Date result) {
                            mLocalDateTime = new LocalDateTime(result.getTime());
                            updateDateTimeTextView();
                        }
                    });
            datePickerFragment.show(fragmentManager, DateTimePickerFragment.DIALOG_TAG);
        }
    });
}