Пример #1
0
 private void fillBlogEntry(ContextBuilder context, BlogEntry entry) {
   context.put("id", entry.getId());
   context.put("reference", entry.getReference());
   context.put("title", entry.getTitle());
   context.put("text", wiki2html(entry.getText()));
   context.put("plainText", wiki2text(entry.getText()));
   DateAndTime date = entry.getDateAndTime();
   context.put("date", date.toString(Date.FORMAT_LONGMONTH_DAY_YEAR));
   context.put("rssDate", date.toString(DateAndTime.FORMAT_RFC822));
   fillComments(context, entry);
 }
Пример #2
0
 public static DateAndTime getSentTime(Message msg) {
   Date date;
   try {
     date = msg.getSentDate();
   } catch (MessagingException ex) {
     throw new RuntimeException(ex);
   }
   if (date == null) return null;
   DateAndTime result = new DateAndTime(date);
   if (result.isFuture()) result = DateAndTime.now();
   return result;
 }
Пример #3
0
 @Override
 public void ensureIntegrity() {
   super.ensureIntegrity();
   updateNumber();
   if (!isTypeSet()) setType(scrum.client.issues.Issue.INIT_TYPE);
   if (!isDateSet()) setDate(DateAndTime.now());
   if (isAcceptDateSet() || isCloseDateSet()) setPublished(true);
 }
Пример #4
0
  @Override
  public void onSelectProject(GwtConversation conversation, String projectId) {
    Project project = projectDao.getById(projectId);
    User user = conversation.getSession().getUser();
    if (!project.isVisibleFor(user))
      throw new PermissionDeniedException(
          "Project '" + project + "' is not visible for user '" + user + "'");

    project.setLastOpenedDateAndTime(DateAndTime.now());
    conversation.setProject(project);
    user.setCurrentProject(project);
    ProjectUserConfig config = project.getUserConfig(user);
    config.touch();

    conversation.sendToClient(project);
    conversation.sendToClient(project.getSprints());
    conversation.sendToClient(project.getSprintReports());
    conversation.sendToClient(project.getParticipants());
    for (Requirement requirement : project.getProductBacklogRequirements()) {
      conversation.sendToClient(requirement);
      conversation.sendToClient(requirement.getEstimationVotes());
    }
    for (Requirement requirement : project.getCurrentSprint().getRequirements()) {
      conversation.sendToClient(requirement);
      conversation.sendToClient(requirement.getTasksInSprint());
    }
    conversation.sendToClient(project.getQualitys());
    conversation.sendToClient(project.getUserConfigs());
    conversation.sendToClient(project.getWikipages());
    conversation.sendToClient(project.getImpediments());
    conversation.sendToClient(project.getRisks());
    conversation.sendToClient(project.getLatestProjectEvents(5));
    conversation.sendToClient(project.getCalendarEvents());
    conversation.sendToClient(project.getFiles());
    conversation.sendToClient(project.getOpenIssues());
    conversation.sendToClient(project.getReleases());
    conversation.sendToClient(project.getBlogEntrys());

    sendToClients(conversation, config);
  }
Пример #5
0
  @Override
  public void onCreateEntity(GwtConversation conversation, String type, Map properties) {
    String id = (String) properties.get("id");
    if (id == null) throw new NullPointerException("id == null");

    ADao dao = getDaoService().getDaoByName(type);
    AEntity entity = dao.newEntityInstance(id);
    entity.updateProperties(properties);
    User currentUser = conversation.getSession().getUser();
    Project currentProject = conversation.getProject();

    if (entity instanceof Numbered) {
      ((Numbered) entity).updateNumber();
    }

    if (entity instanceof Project) {
      Project project = (Project) entity;
      project.addParticipant(currentUser);
      project.addAdmin(currentUser);
      project.addProductOwner(currentUser);
      project.addScrumMaster(currentUser);
      project.addTeamMember(currentUser);
    }

    if (entity instanceof Comment) {
      Comment comment = (Comment) entity;
      comment.setDateAndTime(DateAndTime.now());
      postProjectEvent(
          conversation,
          comment.getAuthor().getName() + " commented on " + comment.getParent(),
          comment.getParent());
      currentProject.updateHomepage(comment.getParent(), true);
    }

    if (entity instanceof ChatMessage) {
      ChatMessage chatMessage = (ChatMessage) entity;
      chatMessage.setDateAndTime(DateAndTime.now());
    }

    if (entity instanceof Impediment) {
      Impediment impediment = (Impediment) entity;
      impediment.setDate(Date.today());
    }

    if (entity instanceof Issue) {
      Issue issue = (Issue) entity;
      issue.setDate(DateAndTime.now());
      issue.setCreator(currentUser);
    }

    if (entity instanceof Task) {
      Task task = (Task) entity;
      Requirement requirement = task.getRequirement();
      requirement.setRejectDate(null);
      requirement.setClosed(false);
      sendToClients(conversation, requirement);
    }

    if (entity instanceof BlogEntry) {
      BlogEntry blogEntry = (BlogEntry) entity;
      blogEntry.setDateAndTime(DateAndTime.now());
      blogEntry.addAuthor(currentUser);
    }

    if (entity instanceof Change) {
      Change change = (Change) entity;
      change.setDateAndTime(DateAndTime.now());
      change.setUser(currentUser);
    }

    if (!(entity instanceof Transient)) dao.saveEntity(entity);

    sendToClients(conversation, entity);

    if (entity instanceof Requirement) {
      Requirement requirement = (Requirement) entity;
      Requirement epic = requirement.getEpic();
      String value = null;
      if (epic != null) {
        value = epic.getReferenceAndLabel();
        Change change =
            changeDao.postChange(epic, currentUser, "@split", null, requirement.getReference());
        conversation.sendToClient(change);
      }
      Change change = changeDao.postChange(requirement, currentUser, "@created", null, value);
      conversation.sendToClient(change);
    }

    if (entity instanceof Task
        || entity instanceof Wikipage
        || entity instanceof Risk
        || entity instanceof Impediment
        || entity instanceof Issue
        || entity instanceof BlogEntry) {
      Change change = changeDao.postChange(entity, currentUser, "@created", null, null);
      conversation.sendToClient(change);
    }

    if (currentUser != null && currentProject != null) {
      ProjectUserConfig config = currentProject.getUserConfig(currentUser);
      config.touch();
      sendToClients(conversation, config);
    }
  }