Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: dvirgu/tsk-mng-repository
...
head fork: dvirgu/tsk-mng-repository
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 25, 2012
anara dvir fucked up 8489d4e
33 tsk-mng-parent/tsk-mng-backend/src/main/java/org/tsk/mng/backend/Impl/UserManagementBEServiceImpl.java
View
@@ -69,23 +69,44 @@ public UserBE addSuperiorToUser(UserBE superior, UserBE worker) throws Operation
throw new OperationFailureException("no mail in superior/worker");
}
+ //
UserDT workerDT = userDao.getByPK(workerPK);
UserDT superiorDT = userDao.getByPK(superiorPK);
if (!isUserExistInTheSystem(workerDT)) {
- throw new OperationFailureException("worker " + workerPK + " is not exist in the system");
+ throw new OperationFailureException("worker " + worker + " does not exist in the system");
}
if (!isUserExistInTheSystem(superiorDT)) {
- throw new OperationFailureException("superior " + superiorPK + "is not exist in the system");
+ throw new OperationFailureException("superior " + superior + "does not exist in the system");
+ }
+ logger.info("Worker: " + worker + " and Superior: " + superior + " were found");
+
+ //adding superior to the worker and either adding worker to superior
+
+ //check whether the Worker has Superior already
+ UserDT currentSuperior = workerDT.getSuperior();
+ if (currentSuperior != null) {
+ String msg = "Suprior: " + currentSuperior.getNickName() + " already setted as Superior of " + worker;
+ logger.info(msg);
+ throw new OperationFailureException(msg);
}
- workerDT.setSuperior(superiorDT);
+ //setting the superior as superior of the worker
+ worker.setSuperior(superior);
+ //adding the worker to superior workers list
+ superior.addWorker(worker);
+
+ workerDT = TransformerUtil.dozerConvert(worker, UserDT.class);
+ superiorDT = TransformerUtil.dozerConvert(superior, UserDT.class);
if (!userDao.updateUserAndVerify(workerDT)) {
- throw new OperationFailureException("error occuer when tryied to save user " + workerPK);
+ throw new OperationFailureException("error occuer when tryied to save user " + worker);
+ }
+ if (!userDao.updateUserAndVerify(superiorDT)) {
+ throw new OperationFailureException("error occuer when tryid to save user " + superiorPK);
}
- logger.info(superiorPK + " has added as superior of " + workerPK + ", the changes been updated in DB");
+ logger.info(superiorPK + " has added as superior of " + worker + ", the changes been updated in DB");
- retValue = TransformerUtil.dozerConvert(workerDT, UserBE.class);
+ retValue = worker;
} catch (Exception e) {
logger.error(e.getMessage(),e);
28 tsk-mng-parent/tsk-mng-backend/src/main/java/org/tsk/mng/backend/service/TaskMangementBEService.java
View
@@ -5,13 +5,41 @@
public interface TaskMangementBEService {
+ /**
+ *
+ * @param user
+ * @param task
+ * @return
+ */
UserBE assignUserToTask(UserBE user, TaskBE task);
+ /**
+ *
+ * @param user
+ * @return
+ */
TaskBE getUserTasks(UserBE user);
+ /**
+ *
+ * @param user
+ * @param task
+ * @return
+ */
TaskBE removeTaskFromUser(UserBE user, TaskBE task);
+ /**
+ *
+ * @param task
+ * @return
+ */
TaskBE updateTask(TaskBE task);
+ /**
+ *
+ * @param task
+ * @param dependentTask
+ * @return
+ */
UserBE addDependencyToTask(TaskBE task, TaskBE dependentTask);
}

No commit comments for this range

Something went wrong with that request. Please try again.