Nomad PIM
Code Snippet - Create a task entity
As of December 12th, 2009, the development of Nomad PIM has been discontinued

Description

Create a task entity with a date and description.

Requirements

Current subversion trunk for:
org.nomadpim.coredata management, commonly used non-ui stuff
module/core/trunk
org.nomadpim.module.schedule The schedule module contains the calendar, the schedule view and the overview view and provides extension points for adding additional information to the schedule view. The event and task entity types are contained in this module.
module/schedule/trunk

Code


import org.nomadpim.core.CoreFacade;
import org.nomadpim.core.entity.IEntity;
import org.nomadpim.core.util.date.DateUtil;
import org.nomadpim.core.util.date.ScopedDate;
import org.nomadpim.core.util.date.TimeUnit;
import org.nomadpim.module.schedule.task.Task;
   
...

{   
   IEntity task = CoreFacade.getContainer(Task.TYPE_NAME).create();
   
   // Only TimeUnit.DAY and TimeUnit.MINUTE are supported 
   // by the schedule view
   task.set(Task.DATE, new ScopedDate(
                             DateUtil.day(2006, 8, 26), 
                             TimeUnit.DAY)); 
   task.set(Task.DESCRIPTION, "some task description");
}