Example usage for java.util Calendar JULY

List of usage examples for java.util Calendar JULY

Introduction

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

Prototype

int JULY

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

Click Source Link

Document

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

Usage

From source file:org.sakaiproject.sitestats.impl.chart.ChartServiceImpl.java

private Map<Integer, String> getMonthNamesMap() {
    monthNamesMap = new HashMap<Integer, String>();
    monthNamesMap.put(Calendar.JANUARY, msgs.getString("mo_jan"));
    monthNamesMap.put(Calendar.FEBRUARY, msgs.getString("mo_feb"));
    monthNamesMap.put(Calendar.MARCH, msgs.getString("mo_mar"));
    monthNamesMap.put(Calendar.APRIL, msgs.getString("mo_apr"));
    monthNamesMap.put(Calendar.MAY, msgs.getString("mo_may"));
    monthNamesMap.put(Calendar.JUNE, msgs.getString("mo_jun"));
    monthNamesMap.put(Calendar.JULY, msgs.getString("mo_jul"));
    monthNamesMap.put(Calendar.AUGUST, msgs.getString("mo_ago"));
    monthNamesMap.put(Calendar.SEPTEMBER, msgs.getString("mo_sep"));
    monthNamesMap.put(Calendar.OCTOBER, msgs.getString("mo_oct"));
    monthNamesMap.put(Calendar.NOVEMBER, msgs.getString("mo_nov"));
    monthNamesMap.put(Calendar.DECEMBER, msgs.getString("mo_dec"));
    return monthNamesMap;
}

From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java

public static String[] mapMonths(DateFormatSymbols symbols) {
    String[] months = new String[12];

    String[] localeMonths = symbols.getMonths();

    months[0] = localeMonths[Calendar.JANUARY];
    months[1] = localeMonths[Calendar.FEBRUARY];
    months[2] = localeMonths[Calendar.MARCH];
    months[3] = localeMonths[Calendar.APRIL];
    months[4] = localeMonths[Calendar.MAY];
    months[5] = localeMonths[Calendar.JUNE];
    months[6] = localeMonths[Calendar.JULY];
    months[7] = localeMonths[Calendar.AUGUST];
    months[8] = localeMonths[Calendar.SEPTEMBER];
    months[9] = localeMonths[Calendar.OCTOBER];
    months[10] = localeMonths[Calendar.NOVEMBER];
    months[11] = localeMonths[Calendar.DECEMBER];

    return months;
}

From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java

public static String[] mapShortMonths(DateFormatSymbols symbols) {
    String[] months = new String[12];

    String[] localeMonths = symbols.getShortMonths();

    months[0] = localeMonths[Calendar.JANUARY];
    months[1] = localeMonths[Calendar.FEBRUARY];
    months[2] = localeMonths[Calendar.MARCH];
    months[3] = localeMonths[Calendar.APRIL];
    months[4] = localeMonths[Calendar.MAY];
    months[5] = localeMonths[Calendar.JUNE];
    months[6] = localeMonths[Calendar.JULY];
    months[7] = localeMonths[Calendar.AUGUST];
    months[8] = localeMonths[Calendar.SEPTEMBER];
    months[9] = localeMonths[Calendar.OCTOBER];
    months[10] = localeMonths[Calendar.NOVEMBER];
    months[11] = localeMonths[Calendar.DECEMBER];

    return months;
}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.// w w w  .  j a  v  a  2  s .c o  m
 *
 * @deprecated Moved to the demo applications that require it.
 */
private static IntervalCategoryDataset createGanttDataset1() {

    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.icesoft.faces.component.selectinputdate.SelectInputDateRenderer.java

/**
 * @param symbols/* w ww  .j av a 2s .c o m*/
 * @return months - String[] containing localized month names
 */
public static String[] mapMonths(DateFormatSymbols symbols) {
    String[] months = new String[12];

    String[] localeMonths = symbols.getMonths();

    months[0] = localeMonths[Calendar.JANUARY];
    months[1] = localeMonths[Calendar.FEBRUARY];
    months[2] = localeMonths[Calendar.MARCH];
    months[3] = localeMonths[Calendar.APRIL];
    months[4] = localeMonths[Calendar.MAY];
    months[5] = localeMonths[Calendar.JUNE];
    months[6] = localeMonths[Calendar.JULY];
    months[7] = localeMonths[Calendar.AUGUST];
    months[8] = localeMonths[Calendar.SEPTEMBER];
    months[9] = localeMonths[Calendar.OCTOBER];
    months[10] = localeMonths[Calendar.NOVEMBER];
    months[11] = localeMonths[Calendar.DECEMBER];

    return months;
}

From source file:org.celllife.idart.gui.patient.AddPatient.java

/**
 * checks if the given date is valid//from w w  w.j av  a 2 s  .  c  o m
 * 
 * @param strDay
 *            String
 * @param strMonth
 *            String
 * @param strYear
 *            String
 * @return true if the date is valid else false
 */
public boolean dateOkay(String strDay, String strMonth, String strYear) {

    boolean result = false;

    try {

        int day = Integer.parseInt(strDay);

        // check the year
        if (strYear.length() != 4)
            return result;
        int year = Integer.parseInt(strYear);

        // get the int value for the string month (e.g. January)
        // int month = Integer.parseInt(strMonth);
        int month = -1;
        for (int i = 0; i < cmbDOBMonth.getItemCount(); i++) {
            if (strMonth.equals(cmbDOBMonth.getItem(i))) {
                month = i;
            }
        }

        switch (month) {
        case -1:
            result = false;
            break;
        case Calendar.FEBRUARY:
            if (day <= 29) {
                GregorianCalendar greg = new GregorianCalendar();
                if (day == 29 & greg.isLeapYear(year)) {
                    result = true;
                } else {
                    if (day == 29) {
                        result = false;
                    } else {
                        result = true;
                    }
                }
            } else {
                result = false;
            }
            break;
        case Calendar.JANUARY | Calendar.MARCH | Calendar.MAY | Calendar.JULY | Calendar.AUGUST
                | Calendar.OCTOBER | Calendar.DECEMBER:
            if (day <= 31) {
                result = true;
            } else {
                result = false;
            }
            break;
        default:
            result = true;
            break;
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
    }

    return result;

}

From source file:ddf.catalog.source.solr.SolrProviderTest.java

@Test()
public void testDateDuring() throws Exception {

    deleteAllIn(provider);//from  w  ww  . j  av a 2  s  . com

    DateTime now = new DateTime();
    addMetacardWithModifiedDate(now);

    /** POSITIVE CASE **/
    Filter filter = filterBuilder.dateIsDuring(Metacard.MODIFIED, dateBeforeNow(now), dateAfterNow(now));
    List<Result> results = getResultsForFilteredQuery(filter);
    assertEquals(1, results.size());

    /** NEGATIVE CASES **/
    filter = filterBuilder.dateIsDuring(Metacard.MODIFIED, getCannedTime(1980, Calendar.JANUARY, 1, 3),
            dateBeforeNow(now));
    results = getResultsForFilteredQuery(filter);
    assertEquals(0, results.size());

    filter = filterBuilder.dateIsDuring(Metacard.MODIFIED, dateAfterNow(now),
            getCannedTime(2035, Calendar.JULY, 23, 46));
    results = getResultsForFilteredQuery(filter);
    assertEquals(0, results.size());
}

From source file:org.nuxeo.ecm.core.TestSQLRepositoryAPI.java

@Test
public void testImport() throws Exception {
    DocumentModel folder = new DocumentModelImpl("/", "folder", "Folder");
    folder.setProperty("dublincore", "title", "the title");
    folder = session.createDocument(folder);
    session.save();/*from  ww w .j  a v a2 s.co  m*/
    String folderId = folder.getId();

    // create a version by import
    String id; // versionable
    String vid; // ver id
    String pid; // proxy id
    if (folderId.length() == 36) {
        id = "aaaaaaaa-1234-1234-1234-fedcba987654";
        vid = "12345678-1234-1234-1234-fedcba987654";
        pid = "00000000-1234-1234-1234-fedcba987654";
    } else {
        id = "888001";
        vid = "777002";
        pid = "666003";
    }
    String typeName = "File";
    DocumentRef parentRef = null;
    String name = "foobar";
    DocumentModel ver = new DocumentModelImpl((String) null, typeName, vid, new Path(name), null, null,
            parentRef, null, null, null, null);
    Calendar vcr = new GregorianCalendar(2009, Calendar.JANUARY, 1, 2, 3, 4);
    ver.putContextData(CoreSession.IMPORT_VERSION_VERSIONABLE_ID, id);
    ver.putContextData(CoreSession.IMPORT_VERSION_CREATED, vcr);
    ver.putContextData(CoreSession.IMPORT_VERSION_LABEL, "v1");
    ver.putContextData(CoreSession.IMPORT_VERSION_DESCRIPTION, "v descr");
    ver.putContextData(CoreSession.IMPORT_IS_VERSION, Boolean.TRUE);
    ver.putContextData(CoreSession.IMPORT_VERSION_IS_LATEST, Boolean.TRUE);
    ver.putContextData(CoreSession.IMPORT_VERSION_IS_LATEST_MAJOR, Boolean.FALSE);
    ver.putContextData(CoreSession.IMPORT_VERSION_MAJOR, Long.valueOf(3));
    ver.putContextData(CoreSession.IMPORT_VERSION_MINOR, Long.valueOf(14));
    ver.putContextData(CoreSession.IMPORT_LIFECYCLE_POLICY, "v lcp");
    ver.putContextData(CoreSession.IMPORT_LIFECYCLE_STATE, "v lcst");
    ver.setProperty("dublincore", "title", "Ver title");
    Calendar mod = new GregorianCalendar(2008, Calendar.JULY, 14, 12, 34, 56);
    ver.setProperty("dublincore", "modified", mod);
    session.importDocuments(Collections.singletonList(ver));
    session.save();

    reopenSession();
    ver = session.getDocument(new IdRef(vid));
    // assertEquals(name, doc.getName()); // no path -> no name...
    assertEquals("Ver title", ver.getProperty("dublincore", "title"));
    assertEquals(mod, ver.getProperty("dublincore", "modified"));
    assertEquals("v lcp", ver.getLifeCyclePolicy());
    assertEquals("v lcst", ver.getCurrentLifeCycleState());
    assertEquals(Long.valueOf(3), ver.getProperty("uid", "major_version"));
    assertEquals(Long.valueOf(14), ver.getProperty("uid", "minor_version"));
    assertTrue(ver.isVersion());
    assertFalse(ver.isProxy());
    // lookup version by label
    VersionModel versionModel = new VersionModelImpl();
    versionModel.setLabel("v1");
    ver = session.getVersion(id, versionModel);
    assertNotNull(ver);
    assertEquals(vid, ver.getId());
    assertEquals("v descr", versionModel.getDescription());
    assertEquals(vcr, versionModel.getCreated());

    // create a proxy by import
    typeName = CoreSession.IMPORT_PROXY_TYPE;
    parentRef = new IdRef(folderId);
    name = "myproxy";
    DocumentModel proxy = new DocumentModelImpl((String) null, typeName, pid, new Path(name), null, null,
            parentRef, null, null, null, null);
    proxy.putContextData(CoreSession.IMPORT_PROXY_TARGET_ID, vid);
    proxy.putContextData(CoreSession.IMPORT_PROXY_VERSIONABLE_ID, id);
    session.importDocuments(Collections.singletonList(proxy));
    session.save();

    reopenSession();
    proxy = session.getDocument(new IdRef(pid));
    assertEquals(name, proxy.getName());
    assertEquals("Ver title", proxy.getProperty("dublincore", "title"));
    assertEquals(mod, proxy.getProperty("dublincore", "modified"));
    assertEquals("v lcp", proxy.getLifeCyclePolicy());
    assertEquals("v lcst", proxy.getCurrentLifeCycleState());
    assertFalse(proxy.isVersion());
    assertTrue(proxy.isProxy());

    // create a normal doc by import
    typeName = "File";
    parentRef = new IdRef(folderId);
    name = "mydoc";
    DocumentModel doc = new DocumentModelImpl((String) null, typeName, id, new Path(name), null, null,
            parentRef, null, null, null, null);
    doc.putContextData(CoreSession.IMPORT_LIFECYCLE_POLICY, "lcp");
    doc.putContextData(CoreSession.IMPORT_LIFECYCLE_STATE, "lcst");
    Calendar lockCreated = new GregorianCalendar(2011, Calendar.JANUARY, 1, 5, 5, 5);
    doc.putContextData(CoreSession.IMPORT_LOCK_OWNER, "bob");
    doc.putContextData(CoreSession.IMPORT_LOCK_CREATED, lockCreated);
    doc.putContextData(CoreSession.IMPORT_CHECKED_IN, Boolean.TRUE);
    doc.putContextData(CoreSession.IMPORT_BASE_VERSION_ID, vid);
    doc.putContextData(CoreSession.IMPORT_VERSION_MAJOR, Long.valueOf(8));
    doc.putContextData(CoreSession.IMPORT_VERSION_MINOR, Long.valueOf(1));
    doc.setProperty("dublincore", "title", "Live title");
    session.importDocuments(Collections.singletonList(doc));
    session.save();

    reopenSession();
    doc = session.getDocument(new IdRef(id));
    assertEquals(name, doc.getName());
    assertEquals("Live title", doc.getProperty("dublincore", "title"));
    assertEquals(folderId, doc.getParentRef().toString());
    assertEquals("lcp", doc.getLifeCyclePolicy());
    assertEquals("lcst", doc.getCurrentLifeCycleState());
    assertEquals(Long.valueOf(8), doc.getProperty("uid", "major_version"));
    assertEquals(Long.valueOf(1), doc.getProperty("uid", "minor_version"));
    assertTrue(doc.isLocked());
    assertEquals("bob", doc.getLockInfo().getOwner());
    assertEquals(lockCreated, doc.getLockInfo().getCreated());
    assertFalse(doc.isVersion());
    assertFalse(doc.isProxy());
}

From source file:org.nuxeo.ecm.core.TestSQLRepositoryAPI.java

/**
 * Check that lifecycle and dc:issued can be updated on a version. (Fields defined in
 * SQLDocumentLive#VERSION_WRITABLE_PROPS).
 *//*from  w w  w  .  ja va2s . c  o  m*/
@Test
public void testVersionUpdatableFields() throws Exception {
    Calendar cal1 = new GregorianCalendar(2008, Calendar.JULY, 14, 12, 34, 56);
    Calendar cal2 = new GregorianCalendar(2010, Calendar.JANUARY, 1, 0, 0, 0);
    Calendar cal3 = new GregorianCalendar(2010, Calendar.APRIL, 11, 11, 11, 11);

    DocumentModel root = session.getRootDocument();
    DocumentModel doc = new DocumentModelImpl(root.getPathAsString(), "doc", "File");

    doc = session.createDocument(doc);
    doc.setProperty("dublincore", "title", "t1");
    doc.setProperty("dublincore", "issued", cal1);
    doc = session.saveDocument(doc);

    session.checkIn(doc.getRef(), null, null);
    session.checkOut(doc.getRef());
    doc.setProperty("dublincore", "title", "t2");
    doc.setProperty("dublincore", "issued", cal2);
    doc = session.saveDocument(doc);

    // get version
    DocumentModel ver = session.getLastDocumentVersion(doc.getRef());
    assertTrue(ver.isVersion());
    assertEquals("project", ver.getCurrentLifeCycleState());
    assertEquals("t1", ver.getProperty("dublincore", "title"));
    assertEquals(cal1, ver.getProperty("dublincore", "issued"));

    // change lifecycle
    ver.followTransition("approve");
    // change dc:issued
    ver.setProperty("dublincore", "issued", cal3);
    session.saveDocument(ver);
    session.save();

    reopenSession();
    doc = session.getDocument(new PathRef("/doc"));
    ver = session.getLastDocumentVersion(doc.getRef());
    assertEquals("t1", ver.getProperty("dublincore", "title"));
    assertEquals("approved", ver.getCurrentLifeCycleState());
    assertEquals(cal3, ver.getProperty("dublincore", "issued"));
}