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.mb.framework.util.DateTimeUtil.java

/**
 * This method is used for getting short description of month by the number
 * of month//from  ww w  . j  a v  a  2s . 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:org.polymap.kaps.ui.filter.VertraegeStabuFilter.java

protected Query<VertragComposite> createFilterQuery(final IFilterEditorSite site,
        final KapsRepository repository) {

    Integer quartal = null;/*from w w  w  .  j  a  v a  2s  . c om*/
    try {
        quartal = Integer.parseInt((String) site.getFieldValue("Quartal"));
    } catch (Exception e) {
        showError("Quartal fehlt", "Bitte whlen Sie ein Quartal aus.");
        return null;
    }
    Integer jahr = null;
    try {
        jahr = Integer.parseInt((String) site.getFieldValue("Jahr"));
    } catch (Exception e) {
        showError("Jahr fehlt", "Bitte whlen Sie ein Jahr aus.");
        return null;
    }

    Calendar lowerCal = new GregorianCalendar();
    lowerCal.set(Calendar.YEAR, jahr);
    lowerCal.set(Calendar.DAY_OF_MONTH, 1);
    lowerCal.set(Calendar.HOUR_OF_DAY, 0);
    lowerCal.set(Calendar.MINUTE, 0);
    lowerCal.set(Calendar.SECOND, 0);
    lowerCal.set(Calendar.MILLISECOND, 0);

    Calendar upperCal = new GregorianCalendar();
    upperCal.setTime(lowerCal.getTime());

    switch (quartal) {
    case 1:
        lowerCal.set(Calendar.MONTH, Calendar.JANUARY);
        upperCal.set(Calendar.MONTH, Calendar.APRIL);
        break;
    case 2:
        lowerCal.set(Calendar.MONTH, Calendar.APRIL);
        upperCal.set(Calendar.MONTH, Calendar.JULY);
        break;
    case 3:
        lowerCal.set(Calendar.MONTH, Calendar.JULY);
        upperCal.set(Calendar.MONTH, Calendar.OCTOBER);
        break;
    case 4:
        lowerCal.set(Calendar.MONTH, Calendar.OCTOBER);
        upperCal.roll(Calendar.YEAR, true);
        upperCal.set(Calendar.MONTH, Calendar.JANUARY);
        break;
    default:
        throw new IllegalStateException("Quartal " + quartal + " unbekannt!");
    }

    FlurstueckComposite flurstueckTemplate = QueryExpressions.templateFor(FlurstueckComposite.class);
    VertragComposite vertragTemplate = QueryExpressions.templateFor(VertragComposite.class);

    BooleanExpression dExpr = null;
    BooleanExpression vExpr = null;
    {
        Query<VertragComposite> vertraege = repository().findEntities(VertragComposite.class,
                QueryExpressions.and(QueryExpressions.ge(vertragTemplate.vertragsDatum(), lowerCal.getTime()),
                        QueryExpressions.lt(vertragTemplate.vertragsDatum(), upperCal.getTime())),
                0, -1);

        for (VertragComposite kv : vertraege) {
            BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.vertrag(), kv);
            if (vExpr == null) {
                vExpr = newExpr;
            } else {
                vExpr = QueryExpressions.or(vExpr, newExpr);
            }
        }

    }
    // falls keine Vertrge gefunden werden, wrden spter alle Flurstcke
    // selektiert -> StackOverFlow
    if (vExpr != null) {
        BooleanExpression nExpr = null;
        {
            Query<NutzungComposite> nutzungen = repository().findEntities(NutzungComposite.class, null, 0, -1);
            for (NutzungComposite nutzung : nutzungen) {
                if (nutzung.isAgrar().get() == null || nutzung.isAgrar().get() == Boolean.FALSE) {
                    BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.nutzung(), nutzung);
                    if (nExpr == null) {
                        nExpr = newExpr;
                    } else {
                        nExpr = QueryExpressions.or(nExpr, newExpr);
                    }
                }
            }
        }

        GemeindeComposite gemeinde = (GemeindeComposite) site.getFieldValue("gemeinde");
        BooleanExpression gExpr = null;
        if (gemeinde != null) {
            GemarkungComposite gemarkungTemplate = QueryExpressions.templateFor(GemarkungComposite.class);
            Query<GemarkungComposite> gemarkungen = repository().findEntities(GemarkungComposite.class,
                    QueryExpressions.eq(gemarkungTemplate.gemeinde(), gemeinde), 0, -1);
            for (GemarkungComposite gemarkung : gemarkungen) {
                BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.gemarkung(), gemarkung);
                if (gExpr == null) {
                    gExpr = newExpr;
                } else {
                    gExpr = QueryExpressions.or(gExpr, newExpr);
                }
            }
        }

        BooleanExpression expr = vExpr;
        if (nExpr != null) {
            expr = expr == null ? nExpr : QueryExpressions.and(expr, nExpr);
        }
        if (gExpr != null) {
            expr = expr == null ? gExpr : QueryExpressions.and(expr, gExpr);
        }

        Query<FlurstueckComposite> allFlurstuecke = repository.findEntities(FlurstueckComposite.class, expr, 0,
                getMaxResults());

        for (FlurstueckComposite flurstueck : allFlurstuecke) {
            BooleanExpression newExpr = QueryExpressions.eq(vertragTemplate.identity(),
                    flurstueck.vertrag().get().identity().get());
            if (dExpr == null) {
                dExpr = newExpr;
            } else {
                dExpr = QueryExpressions.or(dExpr, newExpr);
            }
        }
        // flurstcksfilter angegeben und keine flurstcke gefunden
        if (dExpr == null) {
            dExpr = QueryExpressions.eq(vertragTemplate.identity(), "nothing");
        }
    } else {
        dExpr = QueryExpressions.eq(vertragTemplate.identity(), "nothing");
    }

    BooleanExpression geeignetExpr = QueryExpressions.eq(vertragTemplate.fuerAuswertungGeeignet(),
            Boolean.TRUE);

    if (dExpr != null) {
        dExpr = QueryExpressions.and(dExpr, geeignetExpr);
    } else {
        dExpr = geeignetExpr;
    }

    return repository().findEntities(VertragComposite.class, dExpr, 0, getMaxResults());
}

From source file:netmason.support.graphics.GanttDisplay.java

/**
 * Creates a sample dataset for a Gantt chart, using sub-tasks. In general,
 * you won't hard-code the dataset in this way - it's done here so that the
 * demo is self-contained./* w  w w  .j a  v a  2 s. c  om*/
 * 
 * @return The dataset.
 */
private IntervalCategoryDataset createSampleDataset() {

    final Task t1 = new Task("Write Proposal", date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001));
    t1.setPercentComplete(1.00);
    s1.add(t1);

    final Task t2 = new Task("Obtain Approval", date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001));
    t2.setPercentComplete(1.00);
    s1.add(t2);

    // here is a task split into two subtasks...
    final Task t3 = new Task("Requirements Analysis", date(10, Calendar.APRIL, 2001),
            date(5, Calendar.MAY, 2001));
    final Task st31 = new Task("Requirements 1", date(10, Calendar.APRIL, 2001),
            date(25, Calendar.APRIL, 2001));
    st31.setPercentComplete(1.0);
    final Task st32 = new Task("Requirements 2", date(1, Calendar.MAY, 2001), date(5, Calendar.MAY, 2001));
    st32.setPercentComplete(1.0);
    t3.addSubtask(st31);
    t3.addSubtask(st32);
    s1.add(t3);

    // and another...
    final Task t4 = new Task("Design Phase", date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    final Task st41 = new Task("Design 1", date(6, Calendar.MAY, 2001), date(10, Calendar.MAY, 2001));
    st41.setPercentComplete(1.0);
    final Task st42 = new Task("Design 2", date(15, Calendar.MAY, 2001), date(20, Calendar.MAY, 2001));
    st42.setPercentComplete(1.0);
    final Task st43 = new Task("Design 3", date(23, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    st43.setPercentComplete(0.50);
    t4.addSubtask(st41);
    t4.addSubtask(st42);
    t4.addSubtask(st43);
    s1.add(t4);

    final Task t5 = new Task("Design Signoff", date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001));
    s1.add(t5);

    final Task t6 = new Task("Alpha Implementation", date(3, Calendar.JUNE, 2001),
            date(31, Calendar.JULY, 2001));
    t6.setPercentComplete(0.60);

    s1.add(t6);

    final Task t7 = new Task("Design Review", date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001));
    t7.setPercentComplete(0.0);
    s1.add(t7);

    final Task t8 = new Task("Revised Design Signoff", date(10, Calendar.AUGUST, 2001),
            date(10, Calendar.AUGUST, 2001));
    t8.setPercentComplete(0.0);
    s1.add(t8);

    final Task t9 = new Task("Beta Implementation", date(12, Calendar.AUGUST, 2001),
            date(12, Calendar.SEPTEMBER, 2001));
    t9.setPercentComplete(0.0);
    s1.add(t9);

    final Task t10 = new Task("Testing", date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001));
    t10.setPercentComplete(0.0);
    s1.add(t10);

    final Task t11 = new Task("Final Implementation", date(1, Calendar.NOVEMBER, 2001),
            date(15, Calendar.NOVEMBER, 2001));
    t11.setPercentComplete(0.0);
    s1.add(t11);

    final Task t12 = new Task("Signoff", date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001));
    t12.setPercentComplete(0.0);
    s1.add(t12);

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

    return collection;
}

From source file:ubic.gemma.core.analysis.preprocess.batcheffects.BatchInfoPopulationServiceTest.java

@Test
public void testDatesToBatchD() {
    BatchInfoPopulationHelperServiceImpl ser = new BatchInfoPopulationHelperServiceImpl();
    Calendar cal = Calendar.getInstance();
    cal.set(2004, Calendar.APRIL, 10, 10, 1, 1);
    Date d = cal.getTime();//ww  w.  j  a va 2 s .c  om

    Collection<Date> dates = new HashSet<>();

    dates.add(d);
    dates.add(DateUtils.addHours(d, 200)); // merged back, even though gap is big.
    dates.add(DateUtils.addHours(d, 201)); // merge back
    dates.add(DateUtils.addHours(d, 202)); // merge back
    dates.add(DateUtils.addHours(d, 203)); // merge back
    dates.add(DateUtils.addHours(d, 301)); // new batch
    dates.add(DateUtils.addHours(d, 302)); // merge back
    dates.add(DateUtils.addHours(d, 402)); // singleton merged.

    Map<String, Collection<Date>> actual = ser.convertDatesToBatches(dates);
    this.debug(actual);
    Set<String> s = new HashSet<>(actual.keySet());
    assertEquals(2, s.size());

}

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

/**
 * Creates a sample dataset for a Gantt chart, using sub-tasks.  In general, you won't 
 * hard-code the dataset in this way - it's done here so that the demo is self-contained.
 *
 * @return The dataset./*  www  .j a v  a 2s  .c o  m*/
 */
private IntervalCategoryDataset createSampleDataset() {

    final TaskSeries s1 = new TaskSeries("Scheduled");

    final Task t1 = new Task("Write Proposal", date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001));
    t1.setPercentComplete(1.00);
    s1.add(t1);

    final Task t2 = new Task("Obtain Approval", date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001));
    t2.setPercentComplete(1.00);
    s1.add(t2);

    // here is a task split into two subtasks...
    final Task t3 = new Task("Requirements Analysis", date(10, Calendar.APRIL, 2001),
            date(5, Calendar.MAY, 2001));
    final Task st31 = new Task("Requirements 1", date(10, Calendar.APRIL, 2001),
            date(25, Calendar.APRIL, 2001));
    st31.setPercentComplete(1.0);
    final Task st32 = new Task("Requirements 2", date(1, Calendar.MAY, 2001), date(5, Calendar.MAY, 2001));
    st32.setPercentComplete(1.0);
    t3.addSubtask(st31);
    t3.addSubtask(st32);
    s1.add(t3);

    // and another...
    final Task t4 = new Task("Design Phase", date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    final Task st41 = new Task("Design 1", date(6, Calendar.MAY, 2001), date(10, Calendar.MAY, 2001));
    st41.setPercentComplete(1.0);
    final Task st42 = new Task("Design 2", date(15, Calendar.MAY, 2001), date(20, Calendar.MAY, 2001));
    st42.setPercentComplete(1.0);
    final Task st43 = new Task("Design 3", date(23, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    st43.setPercentComplete(0.50);
    t4.addSubtask(st41);
    t4.addSubtask(st42);
    t4.addSubtask(st43);
    s1.add(t4);

    final Task t5 = new Task("Design Signoff", date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001));
    s1.add(t5);

    final Task t6 = new Task("Alpha Implementation", date(3, Calendar.JUNE, 2001),
            date(31, Calendar.JULY, 2001));
    t6.setPercentComplete(0.60);

    s1.add(t6);

    final Task t7 = new Task("Design Review", date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001));
    t7.setPercentComplete(0.0);
    s1.add(t7);

    final Task t8 = new Task("Revised Design Signoff", date(10, Calendar.AUGUST, 2001),
            date(10, Calendar.AUGUST, 2001));
    t8.setPercentComplete(0.0);
    s1.add(t8);

    final Task t9 = new Task("Beta Implementation", date(12, Calendar.AUGUST, 2001),
            date(12, Calendar.SEPTEMBER, 2001));
    t9.setPercentComplete(0.0);
    s1.add(t9);

    final Task t10 = new Task("Testing", date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001));
    t10.setPercentComplete(0.0);
    s1.add(t10);

    final Task t11 = new Task("Final Implementation", date(1, Calendar.NOVEMBER, 2001),
            date(15, Calendar.NOVEMBER, 2001));
    t11.setPercentComplete(0.0);
    s1.add(t11);

    final Task t12 = new Task("Signoff", date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001));
    t12.setPercentComplete(0.0);
    s1.add(t12);

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

    return collection;
}

From source file:edu.ucsb.nceas.ezid.test.EZIDServiceTest.java

/** Generate a timestamp for use in IDs. */
public static String generateTimeString() {
    StringBuffer guid = new StringBuffer();

    // Create a calendar to get the date formatted properly
    String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    Calendar calendar = new GregorianCalendar(pdt);
    Date trialTime = new Date();
    calendar.setTime(trialTime);//from   www .ja va2 s .c o m
    guid.append(calendar.get(Calendar.YEAR));
    guid.append(calendar.get(Calendar.DAY_OF_YEAR));
    guid.append(calendar.get(Calendar.HOUR_OF_DAY));
    guid.append(calendar.get(Calendar.MINUTE));
    guid.append(calendar.get(Calendar.SECOND));
    guid.append(calendar.get(Calendar.MILLISECOND));
    double random = Math.random();
    guid.append(random);

    return guid.toString();
}

From source file:org.sakaiproject.util.CalendarUtil.java

void initDates() {
    Calendar calendarSunday = Calendar.getInstance();
    Calendar calendarMonday = Calendar.getInstance();
    Calendar calendarTuesday = Calendar.getInstance();
    Calendar calendarWednesday = Calendar.getInstance();
    Calendar calendarThursday = Calendar.getInstance();
    Calendar calendarFriday = Calendar.getInstance();
    Calendar calendarSaturday = Calendar.getInstance();

    calendarSunday.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
    calendarMonday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
    calendarTuesday.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
    calendarWednesday.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
    calendarThursday.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
    calendarFriday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
    calendarSaturday.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);

    dateSunday = calendarSunday.getTime();
    dateMonday = calendarMonday.getTime();
    dateTuesday = calendarTuesday.getTime();
    dateWednesday = calendarWednesday.getTime();
    dateThursday = calendarThursday.getTime();
    dateFriday = calendarFriday.getTime();
    dateSaturday = calendarSaturday.getTime();

    Calendar calendarJanuary = Calendar.getInstance();
    Calendar calendarFebruary = Calendar.getInstance();
    Calendar calendarMarch = Calendar.getInstance();
    Calendar calendarApril = Calendar.getInstance();
    Calendar calendarMay = Calendar.getInstance();
    Calendar calendarJune = Calendar.getInstance();
    Calendar calendarJuly = Calendar.getInstance();
    Calendar calendarAugust = Calendar.getInstance();
    Calendar calendarSeptember = Calendar.getInstance();
    Calendar calendarOctober = Calendar.getInstance();
    Calendar calendarNovember = Calendar.getInstance();
    Calendar calendarDecember = Calendar.getInstance();

    calendarJanuary.set(Calendar.MONTH, Calendar.JANUARY);
    calendarFebruary.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendarMarch.set(Calendar.MONTH, Calendar.MARCH);
    calendarApril.set(Calendar.MONTH, Calendar.APRIL);
    calendarMay.set(Calendar.MONTH, Calendar.MAY);
    calendarJune.set(Calendar.MONTH, Calendar.JUNE);
    calendarJuly.set(Calendar.MONTH, Calendar.JULY);
    calendarAugust.set(Calendar.MONTH, Calendar.AUGUST);
    calendarSeptember.set(Calendar.MONTH, Calendar.SEPTEMBER);
    calendarOctober.set(Calendar.MONTH, Calendar.OCTOBER);
    calendarNovember.set(Calendar.MONTH, Calendar.NOVEMBER);
    calendarDecember.set(Calendar.MONTH, Calendar.DECEMBER);

    dateJanuary = calendarJanuary.getTime();
    dateFebruary = calendarFebruary.getTime();
    dateMarch = calendarMarch.getTime();
    dateApril = calendarApril.getTime();
    dateMay = calendarMay.getTime();/*from  w  w  w .  j  av  a2s  .com*/
    dateJune = calendarJune.getTime();
    dateJuly = calendarJuly.getTime();
    dateAugust = calendarAugust.getTime();
    dateSeptember = calendarSeptember.getTime();
    dateOctober = calendarOctober.getTime();
    dateNovember = calendarNovember.getTime();
    dateDecember = calendarDecember.getTime();

}

From source file:org.techytax.util.DateHelper.java

public static Date getLastDayOfFirstMonthOfNextQuarter(Date date) {
    int month = getMonth(date);
    int year = getYear(date);
    Calendar cal = new GregorianCalendar();
    cal.set(Calendar.YEAR, year);
    Date lastDay = null;/*www.j  a  va 2  s. c  o  m*/
    switch (month) {
    case 0:
    case 1:
    case 2:
    case 3:
        cal.set(Calendar.MONTH, Calendar.APRIL);
        cal.set(Calendar.DAY_OF_MONTH, 30);
        lastDay = cal.getTime();
        break;
    case 4:
    case 5:
    case 6:
        cal.set(Calendar.MONTH, Calendar.JULY);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        lastDay = cal.getTime();
        break;
    case 7:
    case 8:
    case 9:
        cal.set(Calendar.MONTH, Calendar.OCTOBER);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        lastDay = cal.getTime();
        break;
    case 10:
    case 11:
        cal.add(Calendar.YEAR, 1);
        cal.set(Calendar.MONTH, Calendar.JANUARY);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        lastDay = cal.getTime();
        break;
    default:
        break;
    }
    return lastDay;
}

From source file:moviemanager.backend.PersonManagerTest.java

@Test //(expected = IllegalArgumentException.class)
public void createPersonWithIncorrectArgument() {
    log.info("Testing creating person with incorrect arguments...");

    String personName = "John Doe (createIncorrectly)";

    // null argument
    try {//from w w w  . jav  a2s .  c  o m
        personManager.createPerson(null);
    } catch (IllegalArgumentException ex) {
        log.debug("Creating person with argument null threw "
                + IllegalArgumentException.class.getCanonicalName() + ".");
    }

    Calendar calendar = new GregorianCalendar(1987, Calendar.APRIL, 27);
    Person person = new Person(personName, calendar);
    personManager.createPerson(person);
    assertNotNull(person);

    // name set to null
    try {
        person.setName(null);
        personManager.createPerson(person);
    } catch (IllegalArgumentException ex) {
        log.debug("Creating person with name null threw " + IllegalArgumentException.class.getCanonicalName()
                + ".");
    }

    // blank name
    try {
        person.setName("");
        personManager.createPerson(person);
    } catch (IllegalArgumentException ex) {
        log.debug("Creating person with blank name threw " + IllegalArgumentException.class.getCanonicalName()
                + ".");
    }

}

From source file:gov.nih.nci.cabig.caaers.security.AdverseEventReportDaoSecurityTest.java

private ExpeditedAdverseEventReport createReport() {
    CtcTerm term = ctcTermDao.getById(3012);
    AdverseEvent newEvent = new AdverseEvent();
    newEvent.setGrade(Grade.MILD);//from ww  w .  java  2  s.c o m
    newEvent.getAdverseEventCtcTerm().setCtcTerm(term);
    newEvent.setExpected(Boolean.FALSE);
    newEvent.setHospitalization(Hospitalization.NO);
    newEvent.setStartDate((new Timestamp(DateUtils.createDate(2004, Calendar.APRIL, 25).getTime() + 600000)));
    ExpeditedAdverseEventReport newReport = Fixtures.createSavableExpeditedReport();
    newReport.addAdverseEvent(newEvent);
    newReport.setReportingPeriod(reportingPeriodDao.getById(-14));

    return newReport;
}