示例#1
0
 @PUT
 @Path("{id}")
 @UnitOfWork
 public Project amend(Project project) {
   if (project.getInitiatorId() != null) {
     User author = userDao.get(project.getInitiatorId());
     if (author == null) {
       throw new IllegalArgumentException("Author id is incorrect");
     }
     project = project.withInitiator(author);
   }
   return projectDao.saveOrUpdate(project);
 }
示例#2
0
 @POST
 @UnitOfWork
 public Project save(@Context User user, Project project) {
   return projectDao.saveOrUpdate(
       project.withInitiator(user).withStartDate(Calendar.getInstance().getTime()));
 }