Exemplo n.º 1
0
 /**
  * Check in (that is: complete) the default task. This is either the current task managed by
  * <code>SynergyTaskManager</code> or, if none is managed, the default task.<br>
  * In case no task has yet been created by <code>SynergyTaskManager</code> AND no default task is
  * set, then this is an error.<br>
  * However, if the task that was created by <code>SynergyTaskManager</code> has already been
  * checked in AND no default task is set, then it is assumed that all files that were checked out
  * are already checked in because checking in a task checks in all files associated with it.
  *
  * @param logger a logger.
  * @param comment a comment for checkin.
  * @param ccmAddr current Synergy session ID. Used to run in multi-session.
  * @throws ScmException
  */
 public void checkinDefaultTask(ScmLogger logger, String comment, String ccmAddr)
     throws ScmException {
   if (logger.isDebugEnabled()) {
     logger.debug("Synergy : Entering checkinDefaultTask method of SynergyTaskManager");
   }
   switch (currentTaskState) {
     case TASK_STATE_NONE:
       // if a default task is set, then check in that
       // otherwise we have an error
       if (SynergyUtil.getDefaultTask(logger, ccmAddr) != 0) {
         SynergyUtil.checkinDefaultTask(logger, comment, ccmAddr);
       } else {
         throw new ScmException(
             "Check in not possible: no default task is set and "
                 + "no task has been created with SynergyTaskManager.");
       }
       break;
     case TASK_STATE_CREATED:
       SynergyUtil.checkinTask(logger, currentTaskNumber, comment, ccmAddr);
       currentTaskState = TASK_STATE_COMPLETED;
       break;
     case TASK_STATE_COMPLETED:
       // if a default task is set, then check in that
       // otherwise do nothing, as all tasks and all files with them have
       // been checked in
       if (SynergyUtil.getDefaultTask(logger, ccmAddr) != 0) {
         SynergyUtil.checkinDefaultTask(logger, comment, ccmAddr);
       } else {
         if (logger.isDebugEnabled()) {
           logger.debug(
               "Synergy : No check in necessary as default task and "
                   + "all tasks created with SynergyTaskManager have already been checked in.");
         }
       }
       break;
     default:
       throw new IllegalStateException(
           "Programming error: SynergyTaskManager is in unkown state.");
   }
 }