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

The following examples show how to use net.sf.mpxj.Task#setHyperlink() . 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: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method is used to extract the task hyperlink attributes
 * from a block of data and call the appropriate modifier methods
 * to configure the specified task object.
 *
 * @param task task instance
 * @param data hyperlink data block
 */
private void processHyperlinkData(Task task, byte[] data)
{
   if (data != null)
   {
      int offset = 12;
      String hyperlink;
      String address;
      String subaddress;

      offset += 12;
      hyperlink = MPPUtility.getUnicodeString(data, offset);
      offset += ((hyperlink.length() + 1) * 2);

      offset += 12;
      address = MPPUtility.getUnicodeString(data, offset);
      offset += ((address.length() + 1) * 2);

      offset += 12;
      subaddress = MPPUtility.getUnicodeString(data, offset);

      task.setHyperlink(hyperlink);
      task.setHyperlinkAddress(address);
      task.setHyperlinkSubAddress(subaddress);
   }
}
 
Example 2
Source File: MPP8Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method is used to extract the task hyperlink attributes
 * from a block of data and call the appropriate modifier methods
 * to configure the specified task object.
 *
 * @param task task instance
 * @param data hyperlink data block
 */
private void processHyperlinkData(Task task, byte[] data)
{
   if (data != null)
   {
      int offset = 12;
      String hyperlink;
      String address;
      String subaddress;

      offset += 12;
      hyperlink = MPPUtility.getUnicodeString(data, offset);
      offset += ((hyperlink.length() + 1) * 2);

      offset += 12;
      address = MPPUtility.getUnicodeString(data, offset);
      offset += ((address.length() + 1) * 2);

      offset += 12;
      subaddress = MPPUtility.getUnicodeString(data, offset);

      task.setHyperlink(hyperlink);
      task.setHyperlinkAddress(address);
      task.setHyperlinkSubAddress(subaddress);
   }
}
 
Example 3
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method is used to extract the task hyperlink attributes
 * from a block of data and call the appropriate modifier methods
 * to configure the specified task object.
 *
 * @param task task instance
 * @param data hyperlink data block
 */
private void processHyperlinkData(Task task, byte[] data)
{
   if (data != null)
   {
      int offset = 12;
      String hyperlink;
      String address;
      String subaddress;

      offset += 12;
      hyperlink = MPPUtility.getUnicodeString(data, offset);
      offset += ((hyperlink.length() + 1) * 2);

      offset += 12;
      address = MPPUtility.getUnicodeString(data, offset);
      offset += ((address.length() + 1) * 2);

      offset += 12;
      subaddress = MPPUtility.getUnicodeString(data, offset);

      task.setHyperlink(hyperlink);
      task.setHyperlinkAddress(address);
      task.setHyperlinkSubAddress(subaddress);
   }
}
 
Example 4
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method is used to extract the task hyperlink attributes
 * from a block of data and call the appropriate modifier methods
 * to configure the specified task object.
 *
 * @param task task instance
 * @param data hyperlink data block
 */
private void processHyperlinkData(Task task, byte[] data)
{
   if (data != null)
   {
      int offset = 12;
      String hyperlink;
      String address;
      String subaddress;

      offset += 12;
      hyperlink = MPPUtility.getUnicodeString(data, offset);
      offset += ((hyperlink.length() + 1) * 2);

      offset += 12;
      address = MPPUtility.getUnicodeString(data, offset);
      offset += ((address.length() + 1) * 2);

      offset += 12;
      subaddress = MPPUtility.getUnicodeString(data, offset);

      task.setHyperlink(hyperlink);
      task.setHyperlinkAddress(address);
      task.setHyperlinkSubAddress(subaddress);
   }
}
 
Example 5
Source File: GanttProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Recursively read a task, and any sub tasks.
 *
 * @param mpxjParent Parent for the MPXJ tasks
 * @param gpTask GanttProject task
 */
private void readTask(ChildTaskContainer mpxjParent, net.sf.mpxj.ganttproject.schema.Task gpTask)
{
   Task mpxjTask = mpxjParent.addTask();
   mpxjTask.setUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1));
   mpxjTask.setName(gpTask.getName());
   mpxjTask.setPercentageComplete(gpTask.getComplete());
   mpxjTask.setPriority(getPriority(gpTask.getPriority()));
   mpxjTask.setHyperlink(gpTask.getWebLink());

   Duration duration = Duration.getInstance(NumberHelper.getDouble(gpTask.getDuration()), TimeUnit.DAYS);
   mpxjTask.setDuration(duration);

   if (duration.getDuration() == 0)
   {
      mpxjTask.setMilestone(true);
   }
   else
   {
      mpxjTask.setStart(gpTask.getStart());
      mpxjTask.setFinish(m_mpxjCalendar.getDate(gpTask.getStart(), mpxjTask.getDuration(), false));
   }

   mpxjTask.setConstraintDate(gpTask.getThirdDate());
   if (mpxjTask.getConstraintDate() != null)
   {
      // TODO: you don't appear to be able to change this setting in GanttProject
      // task.getThirdDateConstraint()
      mpxjTask.setConstraintType(ConstraintType.START_NO_EARLIER_THAN);
   }

   readTaskCustomFields(gpTask, mpxjTask);

   m_eventManager.fireTaskReadEvent(mpxjTask);

   // TODO: read custom values

   //
   // Process child tasks
   //
   for (net.sf.mpxj.ganttproject.schema.Task childTask : gpTask.getTask())
   {
      readTask(mpxjTask, childTask);
   }
}
 
Example 6
Source File: SynchroReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Extract data for a single task.
 *
 * @param parent task parent
 * @param row Synchro task data
 */
private void processTask(ChildTaskContainer parent, MapRow row) throws IOException
{
   Task task = parent.addTask();
   task.setName(row.getString("NAME"));
   task.setGUID(row.getUUID("UUID"));
   task.setText(1, row.getString("ID"));
   task.setDuration(row.getDuration("PLANNED_DURATION"));
   task.setRemainingDuration(row.getDuration("REMAINING_DURATION"));
   task.setHyperlink(row.getString("URL"));
   task.setPercentageComplete(row.getDouble("PERCENT_COMPLETE"));
   task.setNotes(getNotes(row.getRows("COMMENTARY")));
   task.setMilestone(task.getDuration() != null && task.getDuration().getDuration() == 0);

   ProjectCalendar calendar = m_calendarMap.get(row.getUUID("CALENDAR_UUID"));
   if (calendar != m_project.getDefaultCalendar())
   {
      task.setCalendar(calendar);
   }

   switch (row.getInteger("STATUS").intValue())
   {
      case 1: // Planned
      {
         task.setStart(row.getDate("PLANNED_START"));
         if (task.getStart() != null && task.getDuration() != null)
         {
            task.setFinish(task.getEffectiveCalendar().getDate(task.getStart(), task.getDuration(), false));
         }
         break;
      }

      case 2: // Started
      {
         task.setActualStart(row.getDate("ACTUAL_START"));
         task.setStart(task.getActualStart());
         task.setFinish(row.getDate("ESTIMATED_FINISH"));
         if (task.getFinish() == null)
         {
            task.setFinish(row.getDate("PLANNED_FINISH"));
         }
         break;
      }

      case 3: // Finished
      {
         task.setActualStart(row.getDate("ACTUAL_START"));
         task.setActualFinish(row.getDate("ACTUAL_FINISH"));
         task.setPercentageComplete(Double.valueOf(100.0));
         task.setStart(task.getActualStart());
         task.setFinish(task.getActualFinish());
         break;
      }
   }

   setConstraints(task, row);

   processChildTasks(task, row);

   m_taskMap.put(task.getGUID(), task);

   List<MapRow> predecessors = row.getRows("PREDECESSORS");
   if (predecessors != null && !predecessors.isEmpty())
   {
      m_predecessorMap.put(task, predecessors);
   }

   List<MapRow> resourceAssignmnets = row.getRows("RESOURCE_ASSIGNMENTS");
   if (resourceAssignmnets != null && !resourceAssignmnets.isEmpty())
   {
      processResourceAssignments(task, resourceAssignmnets);
   }
}