Example usage for java.util Calendar APRIL

List of usage examples for java.util Calendar APRIL

Introduction

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

Prototype

int APRIL

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

Click Source Link

Document

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

Usage

From source file:com.icesoft.faces.component.selectinputdate.SelectInputDateRenderer.java

/**
 * @param symbols/*from   ww  w .  j a  v  a 2 s  .  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.motechproject.server.ws.RegistrarServiceTest.java

@Test
public void queryUpcomingCare() throws ValidationException {
    Integer staffId = 1, facilityId = 2, motechId = 3;

    List<ExpectedEncounter> expectedEncounters = new ArrayList<ExpectedEncounter>();
    List<ExpectedObs> expectedObs = new ArrayList<ExpectedObs>();

    Calendar calendar = Calendar.getInstance();

    Care encounterCare1 = new Care();
    encounterCare1.setName("EncounterCare1");
    calendar.set(2010, Calendar.APRIL, 4);
    encounterCare1.setDate(calendar.getTime());
    Care encounterCare2 = new Care();
    encounterCare2.setName("EncounterCare2");
    calendar.set(2010, Calendar.DECEMBER, 12);
    encounterCare2.setDate(calendar.getTime());
    Care obsCare1 = new Care();
    obsCare1.setName("ObsCare1");
    calendar.set(2010, Calendar.OCTOBER, 10);
    obsCare1.setDate(calendar.getTime());
    Care obsCare2 = new Care();
    obsCare2.setName("ObsCare2");
    calendar.set(2010, Calendar.JANUARY, 1);
    obsCare2.setDate(calendar.getTime());
    Care[] upcomingCares = { obsCare2, encounterCare1, obsCare1, encounterCare2 };

    org.openmrs.Patient patient = new org.openmrs.Patient(1);

    expect(registrarBean.isValidIdCheckDigit(staffId)).andReturn(true);
    expect(openmrsBean.getStaffBySystemId(staffId.toString())).andReturn(new User(1));
    expect(registrarBean.isValidIdCheckDigit(facilityId)).andReturn(true);
    expect(registrarBean.getFacilityById(facilityId)).andReturn(new Facility());
    expect(registrarBean.isValidMotechIdCheckDigit(motechId)).andReturn(true);
    expect(openmrsBean.getPatientByMotechId(motechId.toString())).andReturn(patient);
    expect(patientModelConverter.patientToWebService(eq(patient), eq(true))).andReturn(new Patient());

    expect(registrarBean.getUpcomingExpectedEncounters(patient)).andReturn(expectedEncounters);
    expect(registrarBean.getUpcomingExpectedObs(patient)).andReturn(expectedObs);
    expect(careModelConverter.upcomingToWebServiceCares(expectedEncounters, expectedObs, false))
            .andReturn(upcomingCares);//  www .ja  v  a  2  s.  c o  m

    replay(registrarBean, patientModelConverter, openmrsBean, careModelConverter);

    Patient wsPatient = regWs.queryUpcomingCare(staffId, facilityId, motechId);

    verify(registrarBean, patientModelConverter, openmrsBean, careModelConverter);
    verify(registrarBean, patientModelConverter, openmrsBean, careModelConverter);

    assertNotNull("Patient result is null", wsPatient);
    Care[] cares = wsPatient.getCares();
    assertNotNull("Patient cares is null", cares);
    assertEquals(4, cares.length);
    assertEquals(obsCare2.getName(), cares[0].getName());
    assertEquals(obsCare2.getDate(), cares[0].getDate());
    assertEquals(encounterCare1.getName(), cares[1].getName());
    assertEquals(encounterCare1.getDate(), cares[1].getDate());
    assertEquals(obsCare1.getName(), cares[2].getName());
    assertEquals(obsCare1.getDate(), cares[2].getDate());
    assertEquals(encounterCare2.getName(), cares[3].getName());
    assertEquals(encounterCare2.getDate(), cares[3].getDate());
}

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  v a2 s. c om*/
@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"));
}