Example usage for java.util Calendar NOVEMBER

List of usage examples for java.util Calendar NOVEMBER

Introduction

In this page you can find the example usage for java.util Calendar NOVEMBER.

Prototype

int NOVEMBER

To view the source code for java.util Calendar NOVEMBER.

Click Source Link

Document

Value of the #MONTH field indicating the eleventh month of the year in the Gregorian and Julian calendars.

Usage

From source file:org.energyos.espi.common.test.EspiFactory.java

public static UsagePoint newUsagePoint(RetailCustomer retailCustomer) {
    UsagePoint usagePoint = newSimpleUsagePoint();

    usagePoint.setRetailCustomer(retailCustomer);
    usagePoint.addMeterReading(newMeterReading());
    usagePoint.addElectricPowerUsageSummary(newElectricPowerUsageSummary());
    usagePoint.addElectricPowerQualitySummary(newElectricPowerQualitySummary());
    usagePoint.setLocalTimeParameters(newLocalTimeParameters());

    usagePoint.getRelatedLinks().add(new LinkType("related", usagePoint.getSelfHref() + "/MeterReading"));
    usagePoint.getRelatedLinks()// www.java2 s. c  o m
            .add(new LinkType("related", usagePoint.getSelfHref() + "/ElectricPowerUsageSummary"));
    usagePoint.getRelatedLinks()
            .add(new LinkType("related", usagePoint.getSelfHref() + "/ElectricPowerQualitySummary"));
    usagePoint.setSelfLink(new LinkType("self", usagePoint.getSelfHref()));
    usagePoint.setUpLink(new LinkType("up", usagePoint.getUpHref()));

    GregorianCalendar published = new GregorianCalendar(2012, Calendar.NOVEMBER, 15, 0, 0, 0);
    published.setTimeZone(TimeZone.getTimeZone("UTC"));
    usagePoint.setPublished(published);

    GregorianCalendar updated = new GregorianCalendar(2012, Calendar.OCTOBER, 24, 0, 0, 0);
    updated.setTimeZone(TimeZone.getTimeZone("UTC"));
    usagePoint.setUpdated(updated);

    return usagePoint;
}

From source file:com.mycompany.CRMFly.serviceLayer.ClientsServiceImpl.java

@Transactional
public Map<Date, Double> getSumsFotDates(Clients client) {
    Long id = client.getId();//from w  w  w .j a v  a 2  s. c o m

    Calendar calendar = new GregorianCalendar();
    Integer monthDifference = 0;
    if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL
            || calendar.get(Calendar.MONTH) == Calendar.JULY
            || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) {
        monthDifference = 0;
    } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY
            || calendar.get(Calendar.MONTH) == Calendar.AUGUST
            || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) {
        monthDifference = -1;
    } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE
            || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER
            || calendar.get(Calendar.MONTH) == Calendar.DECEMBER)
        monthDifference = -2;
    //     Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH);
    calendar.add(Calendar.MONTH, monthDifference);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    //      calendar.add(Calendar.DAY_OF_MONTH, dayDifference-1);

    Date beginningOfQuarter = calendar.getTime();
    Double thisQuarterSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackOne = calendar.getTime();
    Double QuarterBackOneSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackTwo = calendar.getTime();
    Double QuarterBackTwoSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackThree = calendar.getTime();
    Double QuarterBackThreeSum = 0.0;

    List<Contracts> contracts = clientsDAO.getContractsForClient(id);
    HashMap<Date, Double> sums = new HashMap<Date, Double>();
    for (Contracts contract : contracts) {
        Date date = contract.getBegin_date();
        if (date.after(beginningOfQuarter))
            thisQuarterSum += contract.getTotalSum();
        else if (date.after(QuarterBackOne))
            QuarterBackOneSum += contract.getTotalSum();
        else if (date.after(QuarterBackTwo))
            QuarterBackTwoSum += contract.getTotalSum();
        else if (date.after(QuarterBackThree))
            QuarterBackThreeSum += contract.getTotalSum();
    }
    sums.put(beginningOfQuarter, thisQuarterSum);
    sums.put(QuarterBackOne, QuarterBackOneSum);
    sums.put(QuarterBackTwo, QuarterBackTwoSum);
    sums.put(QuarterBackThree, QuarterBackThreeSum);
    return sums;
}

From source file:org.spring.data.gemfire.cache.SpringGemfireTemplateTests.java

@Before
public void setup() {
    assertNotNull("The '/Customers' Region was not properly configured and initialized!", customers);

    if (customers.isEmpty()) {
        assertEquals(0, customers.size());

        put("Jon", "Doe", createDate(1959, Calendar.FEBRUARY, 14));
        put("Jane", "Doe", createDate(1966, Calendar.APRIL, 4));
        put("Fro", "Doe", createDate(2002, Calendar.DECEMBER, 16));

        expectedCustomers = new ArrayList<>(3);
        expectedCustomers.add(put("Sour", "Doe", createDate(1983, Calendar.OCTOBER, 31)));
        expectedCustomers.add(put("Pie", "Doe", createDate(1988, Calendar.NOVEMBER, 22)));
        expectedCustomers.add(put("Cookie", "Doe", createDate(1991, Calendar.MAY, 27)));

        assertFalse(expectedCustomers.isEmpty());
        assertEquals(3, expectedCustomers.size());
    }/*  w w  w.  j a  v  a2s . com*/
}

From source file:com.mycompany.CRMFly.serviceLayer.ProductsServiceImpl.java

@Transactional
public Map<Date, Double> getSumsFotDates(Products product) {
    Long id = product.getId();//from  w w  w  . j  a  v  a2s .c  o  m

    Calendar calendar = new GregorianCalendar();
    Integer monthDifference = 0;
    if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL
            || calendar.get(Calendar.MONTH) == Calendar.JULY
            || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) {
        monthDifference = 0;
    } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY
            || calendar.get(Calendar.MONTH) == Calendar.AUGUST
            || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) {
        monthDifference = -1;
    } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE
            || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER
            || calendar.get(Calendar.MONTH) == Calendar.DECEMBER)
        monthDifference = -2;
    Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH);
    calendar.add(Calendar.MONTH, monthDifference);
    calendar.add(Calendar.DAY_OF_MONTH, dayDifference - 1);

    Date beginningOfQuarter = calendar.getTime();
    Double thisQuarterSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackOne = calendar.getTime();
    Double QuarterBackOneSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackTwo = calendar.getTime();
    Double QuarterBackTwoSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackThree = calendar.getTime();
    Double QuarterBackThreeSum = 0.0;

    List<PositionsInContract> positions = productsDAO.getContractPositionsForProduct(id);
    HashMap<Date, Double> sums = new HashMap<Date, Double>();
    for (PositionsInContract position : positions) {
        Long posID = position.getId();
        Contracts contract = productsDAO.getContractForPosition(posID);
        Date date = contract.getBegin_date();
        if (date.after(beginningOfQuarter))
            thisQuarterSum += position.getPrice() * position.getQuantity();
        else if (date.after(QuarterBackOne))
            QuarterBackOneSum += position.getPrice() * position.getQuantity();
        else if (date.after(QuarterBackTwo))
            QuarterBackTwoSum += position.getPrice() * position.getQuantity();
        else if (date.after(QuarterBackThree))
            QuarterBackThreeSum += position.getPrice() * position.getQuantity();
    }
    sums.put(beginningOfQuarter, thisQuarterSum);
    sums.put(QuarterBackOne, QuarterBackOneSum);
    sums.put(QuarterBackTwo, QuarterBackTwoSum);
    sums.put(QuarterBackThree, QuarterBackThreeSum);
    return sums;
}

From source file:ch.puzzle.itc.mobiliar.business.generator.control.extracted.ResourceDependencyResolverServiceTest.java

@Test
public void testFindNearestRelease() {
    // given//from  w  w w . j  ava 2s . co m
    Calendar cal = new GregorianCalendar();

    cal.set(2001, Calendar.JANUARY, 1);
    ReleaseEntity release1 = createRelease(1, new Date(cal.getTimeInMillis()));

    cal.set(2013, Calendar.JANUARY, 1);
    ReleaseEntity release2 = createRelease(2, new Date(cal.getTimeInMillis()));

    cal.set(2013, Calendar.JANUARY, 23);
    ReleaseEntity release3 = createRelease(3, new Date(cal.getTimeInMillis()));

    cal.set(2013, Calendar.AUGUST, 8);
    ReleaseEntity release4 = createRelease(4, new Date(cal.getTimeInMillis()));

    cal.set(2013, Calendar.DECEMBER, 31);
    ReleaseEntity release5 = createRelease(5, new Date(cal.getTimeInMillis()));

    cal.set(2014, Calendar.NOVEMBER, 10);
    ReleaseEntity release6 = createRelease(6, new Date(cal.getTimeInMillis()));

    SortedSet<ReleaseEntity> releases = new TreeSet<ReleaseEntity>();

    // when only past release exists
    releases.add(release1);
    cal.set(2013, Calendar.JANUARY, 10);
    ReleaseEntity nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis()));

    // then
    assertEquals(release1.getId(), nearestRelease.getId());

    // when there are multiple past releases
    releases.add(release2);
    releases.add(release3);
    cal.set(2013, Calendar.FEBRUARY, 10);
    nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis()));

    // then
    assertEquals(release3.getId(), nearestRelease.getId());

    // when there is one future release
    releases.add(release4);
    cal.set(2013, Calendar.FEBRUARY, 10);
    nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis()));

    // then
    assertEquals(release4.getId(), nearestRelease.getId());

    // when there are multiple future releases
    cal.set(2013, Calendar.AUGUST, 9);
    releases.add(release5);
    releases.add(release6);
    nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis()));

    // then
    Assert.assertEquals(release5.getId(), nearestRelease.getId());
}

From source file:Negocio.Produccion.Planificacion.GanttDemo.java

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.//  ww w  . j a v a 2 s .co m
 */
public static IntervalCategoryDataset createDataset() {

    final TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
            new SimpleTimePeriod(date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
            new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
            new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
            new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001))));

    final TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
            new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
            new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
            new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
            new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001))));

    final TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}

From source file:com.mb.framework.util.DateTimeUtil.java

/**
 * This method is used for getting short description of month by the number
 * of month//  ww  w. j a  v  a 2 s  . co m
 * 
 * @param mthNum
 * @return
 */
public static String getMonthShortDesc(int mthNum) {
    String mthShortDesc;

    switch (mthNum) {
    case Calendar.JANUARY: {
        mthShortDesc = DateTimeConstants.SHORT_JANUARY;
        break;
    }
    case Calendar.FEBRUARY: {
        mthShortDesc = DateTimeConstants.SHORT_FEBRUARY;
        break;
    }
    case Calendar.MARCH: {
        mthShortDesc = DateTimeConstants.SHORT_MARCH;
        break;
    }
    case Calendar.APRIL: {
        mthShortDesc = DateTimeConstants.SHORT_APRIL;
        break;
    }
    case Calendar.MAY: {
        mthShortDesc = DateTimeConstants.SHORT_MAY;
        break;
    }
    case Calendar.JUNE: {
        mthShortDesc = DateTimeConstants.SHORT_JUNE;
        break;
    }
    case Calendar.JULY: {
        mthShortDesc = DateTimeConstants.SHORT_JULY;
        break;
    }
    case Calendar.AUGUST: {
        mthShortDesc = DateTimeConstants.SHORT_AUGUST;
        break;
    }
    case Calendar.SEPTEMBER: {
        mthShortDesc = DateTimeConstants.SHORT_SEPTEMBER;
        break;
    }
    case Calendar.OCTOBER: {
        mthShortDesc = DateTimeConstants.SHORT_OCTOBER;
        break;
    }
    case Calendar.NOVEMBER: {
        mthShortDesc = DateTimeConstants.SHORT_NOVEMBER;
        break;
    }
    case Calendar.DECEMBER: {
        mthShortDesc = DateTimeConstants.SHORT_DECEMBER;
        break;
    }
    default: {
        mthShortDesc = "";
        break;
    }
    }

    return mthShortDesc;
}

From source file:com.netflix.simianarmy.basic.BasicCalendar.java

/**
 * Load holidays.//  ww w. j a v  a 2 s . com
 *
 * @param year
 *            the year
 */
protected void loadHolidays(int year) {
    holidays.clear();
    // these aren't all strictly holidays, but days when engineers will likely
    // not be in the office to respond to rampaging monkeys

    // new years, or closest work day
    holidays.add(workDayInYear(year, Calendar.JANUARY, 1));

    // 3rd monday == MLK Day
    holidays.add(dayOfYear(year, Calendar.JANUARY, Calendar.MONDAY, 3));

    // 3rd monday == Presidents Day
    holidays.add(dayOfYear(year, Calendar.FEBRUARY, Calendar.MONDAY, 3));

    // last monday == Memorial Day
    holidays.add(dayOfYear(year, Calendar.MAY, Calendar.MONDAY, -1));

    // 4th of July, or closest work day
    holidays.add(workDayInYear(year, Calendar.JULY, 4));

    // first monday == Labor Day
    holidays.add(dayOfYear(year, Calendar.SEPTEMBER, Calendar.MONDAY, 1));

    // second monday == Columbus Day
    holidays.add(dayOfYear(year, Calendar.OCTOBER, Calendar.MONDAY, 2));

    // veterans day, Nov 11th, or closest work day
    holidays.add(workDayInYear(year, Calendar.NOVEMBER, 11));

    // 4th thursday == Thanksgiving
    holidays.add(dayOfYear(year, Calendar.NOVEMBER, Calendar.THURSDAY, 4));

    // 4th friday == "black friday", monkey goes shopping!
    holidays.add(dayOfYear(year, Calendar.NOVEMBER, Calendar.FRIDAY, 4));

    // christmas eve
    holidays.add(dayOfYear(year, Calendar.DECEMBER, 24));
    // christmas day
    holidays.add(dayOfYear(year, Calendar.DECEMBER, 25));
    // day after christmas
    holidays.add(dayOfYear(year, Calendar.DECEMBER, 26));

    // new years eve
    holidays.add(dayOfYear(year, Calendar.DECEMBER, 31));

    // mark the holiday set with the year, so on Jan 1 it will automatically
    // recalculate the holidays for next year
    holidays.add(year);
}

From source file:edu.northwestern.bioinformatics.studycalendar.dao.reporting.ScheduledActivitiesReportRowDaoTest.java

public void testSearchWithStartDateFilter_Pos() {
    MutableRange<Date> range = new MutableRange<Date>();
    range.setStart(DateUtils.createDate(2006, Calendar.NOVEMBER, 5));
    filters.setActualActivityDate(range);
    assertSearchWithResults(NEG_19, NEG_18, NEG_17);
}

From source file:edu.northwestern.bioinformatics.studycalendar.dao.reporting.ScheduledActivitiesReportRowDaoTest.java

public void testSearchWithStartDateFilter_Neg() {
    MutableRange<Date> range = new MutableRange<Date>();
    range.setStart(DateUtils.createDate(2006, Calendar.NOVEMBER, 15));
    filters.setActualActivityDate(range);
    assertSearchWithResults(NEG_19, NEG_18);
}