Esempio n. 1
0
  public static void setNotifierConfiguration(String id, PropertyTree config, Project project) {
    PropertyTree current = getSubTree(KEY_NOTIFIERS).getSubTree(project.getId()).getSubTree(id);

    for (String name : config.getPropertyNames()) {
      current.setProperty(name, config.getProperty(name));
    }
  }
Esempio n. 2
0
  public void layout() {
    super.layout();

    add(CSSPackageResource.getHeaderContribution(getClass(), "change.css"));

    Project project = getProject();
    String id = getPageParameters().getString("id");

    if (project == null) {
      notFoundError();
      return;
    }

    String prefix = "";
    Project root = getProject();
    File searchDir = getStorage().getWorkingDirectory(getProject());
    while (root.getParent() != null) {
      prefix = searchDir.getName() + File.separatorChar + prefix;
      root = root.getParent();
      searchDir = searchDir.getParentFile();
    }
    final String stripPrefix = prefix;

    ChangeSet changeSet = Manager.getInstance().getScmService().getChangeSet(root, id);
    if (changeSet == null) {
      notFoundError();
      return;
    }

    revision = changeSet.getId();
    ((HibernateRequestCycle) getRequestCycle()).getHibernateSession().refresh(changeSet);

    if (changeSet.getPrevious() != null) {
      PageParameters params = getProjectPageParameters();
      params.add("id", changeSet.getPrevious().getId());

      addLink(new BookmarkableMenuLink(getClass(), params, "\u25c0 previous changeset"));
    }
    if (changeSet.getNext() != null) {
      PageParameters params = getProjectPageParameters();
      params.add("id", changeSet.getNext().getId());

      addLink(new BookmarkableMenuLink(getClass(), params, "\u25ba next changeset"));
    }

    add(new ChangeSetPanel("changeset", changeSet, stripPrefix));
  }
  public static List<ScmChange> getChanges(Project project, String path) {
    Session session = ((HibernateStorage) Manager.getStorageInstance()).getHibernateSession();

    String prefix = "";
    java.io.File searchDir = Manager.getStorageInstance().getWorkingDirectory(project);
    while (project.getParent() != null) {
      prefix = searchDir.getName() + java.io.File.separatorChar + prefix;
      project = project.getParent();
      searchDir = searchDir.getParentFile();
    }

    Query q =
        session.createQuery(
            "from ScmChange c where c.set.id.project = :project and name = :path order by c.set.date desc");
    q.setEntity("project", project);
    q.setString("path", prefix + path);

    return q.list();
  }
Esempio n. 4
0
  public void layout() {
    super.layout();
    project = getProject();
    add(CSSPackageResource.getHeaderContribution(AdminApplication.class, "admin.css"));

    Form projectConfig =
        new Form("projectconfig") {
          @Override
          protected void onSubmit() {
            Session session = ((HibernateStorage) getStorage()).getHibernateSession();
            Transaction tx = session.beginTransaction();
            session.update(project);
            tx.commit();
          }
        };
    projectConfig.add(new ChangeProjectDropDownChoice("project"));

    TextField alias = new TextField("alias", new PropertyModel(project, "alias"));
    alias.setVisible(!project.equals(StoredProject.getDefault()));
    projectConfig.add(alias);
    projectConfig.add(new Label("defaultalias", project.getName()));

    CheckBox disabled = new CheckBox("disabled", new PropertyModel(project, "disabled"));
    disabled.setVisible(!project.equals(StoredProject.getDefault()));
    disabled.setEnabled(!project.isDisabled() || getStorage().canEnableProject(project));
    projectConfig.add(disabled);

    projectConfig.add(
        new ConfigurationItemPanel(
            "timeenabled",
            StoredProject.CONFIGURATION_TIMETRACKING_ENABLED,
            project.getConfiguration(),
            null,
            project,
            false,
            1));
    projectConfig.add(
        new ConfigurationItemPanel(
            "timerequired",
            StoredProject.CONFIGURATION_TIMETRACKING_REQUIRED,
            project.getConfiguration(),
            null,
            project,
            false,
            2));
    projectConfig.add(
        new ConfigurationItemPanel(
            "timeburndown",
            StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN,
            project.getConfiguration(),
            null,
            project,
            false,
            3));
    projectConfig.add(
        new ConfigurationItemPanel(
            "timeweekend",
            StoredProject.CONFIGURATION_TIMETRACKING_IGNOREWEEKEND,
            project.getConfiguration(),
            null,
            project,
            false,
            4));
    projectConfig.add(new OnePressSubmitButton("submitProjConfig"));
    add(projectConfig);
  }
Esempio n. 5
0
 public static PropertyTree getNotifierConfiguration(String id, Project project) {
   return getSubTree(KEY_NOTIFIERS).getSubTree(project.getId()).getSubTree(id);
 }
Esempio n. 6
0
 public static Set<String> getNotifierList(Project project) {
   return getSubTree(KEY_NOTIFIERS).getSubTree(project.getId()).getSubTreeIds();
 }
Esempio n. 7
0
 public static void removeNotifierConfiguration(String id, Project project) {
   getSubTree(KEY_NOTIFIERS).getSubTree(project.getId()).removeSubTree(id);
 }
Esempio n. 8
0
 public static void addNotifierConfiguration(String id, PropertyTree config, Project project) {
   getSubTree(KEY_NOTIFIERS).getSubTree(project.getId()).addSubTree(id, config);
 }