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(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour) 

Source Link

Document

Constructs an instance set to the specified date and time using ISOChronology.

Usage

From source file:me.vertretungsplan.parser.NotCompatibleParser.java

License:Mozilla Public License

@Override
public SubstitutionSchedule getSubstitutionSchedule()
        throws IOException, JSONException, CredentialInvalidException {
    SubstitutionSchedule v = SubstitutionSchedule.fromData(scheduleData);
    v.setLastChange(new LocalDateTime(2017, 10, 18, 12, 4));
    SubstitutionScheduleDay today = new SubstitutionScheduleDay();
    today.setDate(new LocalDate(2018, 1, 1));

    Substitution subst = new Substitution();
    subst.setLesson("0");
    subst.setClasses(new HashSet<>(getAllClasses()));
    subst.setType("siehe Nachrichten");
    subst.setDesc(//from w  w w .j  a v  a  2s.c o  m
            "Der Vertretungsplan kann von dieser Schule nicht mehr abgerufen werden. Genauere Informationen"
                    + " findest du unter \"Nachrichten\".");
    subst.setColor("#F44336");
    today.addSubstitution(subst);

    today.addMessage(
            "Aus technischen Grnden kann der Vertretungsplan dieser Schule mit dieser App nicht mehr "
                    + "abgerufen werden. "
                    + (scheduleData.getApi().equals("dsbmobile")
                            ? "Als Alternative kannst du vorerst die offizielle " + "App \"DSBmobile\" nutzen. "
                            : "")
                    + "Falls Sie eine Lehrkraft oder Schulleiter/-in an der Schule sind, melden Sie sich "
                    + "bitte unter info@vertretungsplan.me bei uns, um herauszufinden, wie der Plan wieder in die App "
                    + "aufgenommen werden kann. Falls Sie die Pro-Version der App gekauft haben, knnen wir "
                    + "Ihnen das Geld zurckerstatten, wenn Sie sich per E-Mail an info@vertretungsplan.me bei uns melden.");

    v.addDay(today);

    v.setClasses(getAllClasses());
    v.setTeachers(new ArrayList<String>());

    return v;
}

From source file:me.vertretungsplan.parser.NotCompatibleParser.java

License:Mozilla Public License

@Override
public LocalDateTime getLastChange() throws IOException, JSONException, CredentialInvalidException {
    return new LocalDateTime(2017, 10, 18, 12, 4);
}

From source file:org.devgateway.eudevfin.financial.dao.CustomFinancialTransactionDao.java

License:Open Source License

/**
 * @see CustomFinancialTransactionService#findByReportingYearAndDraftFalse(Integer)
 * @param year//from  www  .  j a  va 2 s  .c  o  m
 * @return
 */
@ServiceActivator(inputChannel = "findCustomTransactionByReportingYearAndDraftFalseChannel")
public List<CustomFinancialTransaction> findByReportingYearAndDraftFalse(final Integer year) {
    final LocalDateTime start = new LocalDateTime(year, 1, 1, 0, 0);
    final LocalDateTime end = new LocalDateTime(year, 12, 31, 23, 59);

    return this.getRepo().findByReportingYearBetweenAndDraftFalse(start, end);
}

From source file:org.devgateway.eudevfin.financial.dao.CustomFinancialTransactionDao.java

License:Open Source License

/**
 * @see CustomFinancialTransactionService#findByReportingYearAndDraftFalseAndFormTypeNotIn(Integer)
 * @param year//from w ww.  ja  v  a 2 s . c o m
 * @return
 */
@ServiceActivator(inputChannel = "findCustomTransactionByReportingYearAndDraftFalseAndFormTypeNotInChannel")
public List<CustomFinancialTransaction> findByReportingYearAndDraftFalseAndFormTypeNotIn(final Integer year,
        @Header("notFormType") final Collection<String> notFormType) {
    final LocalDateTime start = new LocalDateTime(year, 1, 1, 0, 0);
    final LocalDateTime end = new LocalDateTime(year, 12, 31, 23, 59);

    return this.getRepo().findByReportingYearBetweenAndDraftFalseAndFormTypeNotIn(start, end, notFormType);
}

From source file:org.devgateway.eudevfin.financial.dao.CustomFinancialTransactionDao.java

License:Open Source License

/**
 * @see CustomFinancialTransactionService#findByReportingYearAndDraftFalseAndFormTypeIn(Integer)
 * @param year/* w ww. j a v  a  2s  . c  om*/
 * @return
 */
@ServiceActivator(inputChannel = "findCustomTransactionByReportingYearAndApprovedTrueAndFormTypeInChannel")
public List<CustomFinancialTransaction> findByReportingYearAndApprovedTrueAndFormTypeIn(final Integer year,
        @Header("notFormType") final Collection<String> notFormType) {
    final LocalDateTime start = new LocalDateTime(year, 1, 1, 0, 0);
    final LocalDateTime end = new LocalDateTime(year, 12, 31, 23, 59);

    return this.getRepo().findByReportingYearBetweenAndApprovedTrueAndFormTypeIn(start, end, notFormType);
}

From source file:org.devgateway.eudevfin.projects.repository.CustomProjectRepositoryImpl.java

@Override
public Page<Project> performSearch(String name, String type, LocalDateTime startDate, LocalDateTime stopDate,
        Organization financingInstitution, String implementingOrganization, Area geographicFocus, String status,
        Pageable pageable) {//from   ww w .  j  av  a 2 s . c o  m

    StringBuilder queryBuilder = new StringBuilder("FROM Project pr JOIN pr.areas ar WHERE 1=1");

    LocalDateTime startFrom = null, stopFrom = null, startTo = null, stopTo = null;

    if (name != null) {
        queryBuilder.append(" AND (lower(pr.name) like :name)");
    }

    if (type != null) {
        queryBuilder.append(" AND pr.type=:type");
    }

    if (startDate != null) {
        startFrom = new LocalDateTime(startDate.getYear(), 1, 1, 0, 0);
        startTo = new LocalDateTime(startDate.getYear(), 12, 31, 0, 0);
        queryBuilder.append(" AND pr.startDate BETWEEN :startFrom AND :startTo");
    }

    if (stopDate != null) {
        stopFrom = new LocalDateTime(stopDate.getYear(), 1, 1, 0, 0);
        stopTo = new LocalDateTime(stopDate.getYear(), 12, 31, 0, 0);
        queryBuilder.append(" AND pr.stopDate BETWEEN :stopFrom AND :stopTo");
    }

    if (financingInstitution != null) {
        queryBuilder.append(" AND pr.extendingAgency=:financingInstitution");
    }

    if (implementingOrganization != null) {
        queryBuilder.append(" AND (lower(pr.implementingOrganization) like :implOrg)");
    }

    if (geographicFocus != null) {
        queryBuilder.append(" AND ar.code=:code");
    }

    if (status != null) {
        queryBuilder.append(" AND pr.status=:status");
    }

    Query query = em.createQuery("SELECT pr " + queryBuilder.toString());
    query.setMaxResults(pageable.getPageSize());
    query.setFirstResult(pageable.getOffset());

    Query countQuery = em.createQuery("SELECT count(pr) " + queryBuilder.toString());

    if (name != null) {
        setQueriesParameter(query, countQuery, "name", "%" + name.toLowerCase() + "%");
    }
    if (type != null) {
        setQueriesParameter(query, countQuery, "type", type);
    }
    if (startDate != null) {
        setQueriesParameter(query, countQuery, "startFrom", startFrom);
        setQueriesParameter(query, countQuery, "startTo", startTo);
    }
    if (stopDate != null) {
        setQueriesParameter(query, countQuery, "stopFrom", stopFrom);
        setQueriesParameter(query, countQuery, "stopTo", stopTo);
    }
    if (financingInstitution != null) {
        setQueriesParameter(query, countQuery, "financingInstitution", financingInstitution);
    }
    if (implementingOrganization != null) {
        setQueriesParameter(query, countQuery, "implOrg", "%" + implementingOrganization.toLowerCase() + "%");
    }
    if (geographicFocus != null) {
        setQueriesParameter(query, countQuery, "code", geographicFocus.getCode());
    }
    if (status != null) {
        setQueriesParameter(query, countQuery, "status", status);
    }

    long maxResults = (Long) countQuery.getSingleResult();

    @SuppressWarnings("rawtypes")
    List resultList = query.getResultList();

    @SuppressWarnings("unchecked")
    PageImpl<Project> result = new PageImpl<Project>(resultList, pageable, maxResults);

    return result;
}

From source file:org.devgateway.eudevfin.sheetexp.iati.transformer.AbstractElementTransformer.java

License:Open Source License

protected Date findLastDayOfYear(final int year) {
    return new LocalDateTime(year, 12, 31, 7, 7).toDate();
}

From source file:org.devgateway.eudevfin.sheetexp.iati.transformer.AbstractElementTransformer.java

License:Open Source License

protected Date findFirstDayOfYear(final int year) {
    return new LocalDateTime(year, 1, 1, 7, 7).toDate();
}

From source file:org.devgateway.eudevfin.ui.common.models.YearToLocalDateTimeModel.java

License:Open Source License

@Override
public void setObject(Integer object) {
    if (object == null)
        originalModel.setObject(null);/*  ww  w .j  a va  2  s .  co m*/
    else
        originalModel.setObject(new LocalDateTime(object, 1, 1, 0, 0));
    // 1st January 00:00 at the current year
}

From source file:org.gnucash.android.ui.chart.PieChartActivity.java

License:Apache License

/**
 * Since JellyBean, the onDateSet() method of the DatePicker class is called twice i.e. once when
 * OK button is pressed and then when the DatePickerDialog is dismissed. It is a known bug.
 *///from  w  w  w  . ja  v a 2  s. c o m
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
    if (view.isShown()) {
        mChartDate = new LocalDateTime(year, monthOfYear + 1, dayOfMonth, 0, 0);
        setData(true);
    }
}