コード例 #1
0
  @Override
  public boolean deleteEntity(Session s1, String id) throws WPISuiteException {
    if (s1 == null) {
      throw new WPISuiteException("Null Session.");
    }
    User theUser = s1.getUser();
    Project[] model = this.getEntity(id);
    if (model[0].getPermission(theUser).equals(Permission.WRITE)
        || theUser.getRole().equals(Role.ADMIN)) {
      Model m = data.delete(data.retrieve(project, "idNum", id).get(0));
      logger.log(Level.INFO, "ProjectManager deleting project <" + id + ">");

      return (m != null) ? true : false;
    } else {
      logger.log(
          Level.WARNING, "ProjectManager Delete attempted by user with insufficient permission");
      throw new UnauthorizedException(
          "You do not have the required permissions to perform this action.");
    }
  }
コード例 #2
0
 public void deleteCommitment(Commitment model) {
   db.delete(model);
 }