Esempio n. 1
0
  public static void update(Time entity) {
    entity.Milestone = Milestone.findById(entity.Task.Milestone.id);

    validation.valid(entity);
    if (validation.hasErrors()) {
      flash.error(Messages.get("scaffold.validation"));
      render("@edit", entity);
    }

    entity = entity.merge();
    entity.save();
    flash.success(Messages.get("scaffold.updated", "Time"));
    index();
  }
Esempio n. 2
0
  public static void save(Time entity) {
    entity.createdBy = User.find("byUserName", Security.connected()).<User>first();

    if (entity.Task != null) {
      entity.Milestone = Milestone.findById(entity.Task.Milestone.id);
    } else if (entity.Issue != null) {
      entity.Milestone = Milestone.findById(entity.Issue.Milestone.id);
    }

    validation.valid(entity);
    if (validation.hasErrors()) {
      flash.error(Messages.get("scaffold.validation"));
      render("@create", entity);
    }
    entity.save();
    flash.success(Messages.get("scaffold.created", "Time"));

    if (entity.Task != null) {
      Tasks.show(entity.Task.id);
    } else {
      Issues.show(entity.Issue.id);
    }
  }
Esempio n. 3
0
 public static void edit(java.lang.Long id) {
   Time entity = Time.findById(id);
   render(entity);
 }
Esempio n. 4
0
 public static void delete(java.lang.Long id) {
   Time entity = Time.findById(id);
   entity.delete();
   index();
 }
Esempio n. 5
0
 public static void index() {
   List<Time> entities = models.Time.all().fetch();
   render(entities);
 }