Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, 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
View
33 ...t/tsk-mng-backend/src/main/java/org/tsk/mng/backend/Impl/UserManagementBEServiceImpl.java
@@ -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);
View
28 ...ent/tsk-mng-backend/src/main/java/org/tsk/mng/backend/service/TaskMangementBEService.java
@@ -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.