Java Code Examples for net.sf.mpxj.Task#getWBS()

The following examples show how to use net.sf.mpxj.Task#getWBS() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastTrackReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Extract the outline level from a task's WBS attribute.
 *
 * @param task Task instance
 * @return outline level
 */
private Integer getOutlineLevel(Task task)
{
   String value = task.getWBS();
   Integer result = Integer.valueOf(1);
   if (value != null && value.length() > 0)
   {
      String[] path = WBS_SPLIT_REGEX.split(value);
      result = Integer.valueOf(path.length);
   }
   return result;
}
 
Example 2
Source File: PrimaveraPMFileWriter.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Writes a WBS entity to the PM XML file.
 *
 * @param mpxj MPXJ Task entity
 */
private void writeWBS(Task mpxj)
{
   if (mpxj.getUniqueID().intValue() != 0)
   {
      WBSType xml = m_factory.createWBSType();
      m_project.getWBS().add(xml);
      String code = mpxj.getWBS();
      code = code == null || code.length() == 0 ? DEFAULT_WBS_CODE : code;

      Task parentTask = mpxj.getParentTask();
      Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();

      xml.setCode(code);
      xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
      xml.setName(mpxj.getName());

      xml.setObjectId(mpxj.getUniqueID());
      xml.setParentObjectId(parentObjectID);
      xml.setProjectObjectId(PROJECT_OBJECT_ID);
      xml.setSequenceNumber(Integer.valueOf(m_wbsSequence++));

      xml.setStatus("Active");
   }

   writeChildTasks(mpxj);
}