protected List<SelectItem> readExecutionPeriodItems() {

    final ExecutionSemester minimumExecutionPeriod = getMinimumExecutionPeriod();
    final List<ExecutionSemester> notClosedExecutionPeriods =
        ExecutionSemester.readNotClosedExecutionPeriods();
    Collections.sort(notClosedExecutionPeriods);

    final List<SelectItem> result = new ArrayList<SelectItem>();
    for (final ExecutionSemester notClosedExecutionPeriod : notClosedExecutionPeriods) {
      if (minimumExecutionPeriod == null
          || notClosedExecutionPeriod.isAfterOrEquals(minimumExecutionPeriod)) {
        result.add(
            new SelectItem(
                notClosedExecutionPeriod.getExternalId(),
                notClosedExecutionPeriod.getName()
                    + " "
                    + notClosedExecutionPeriod.getExecutionYear().getYear()));
      }
    }
    return result;
  }
Пример #2
0
  private VirtualPath getVirtualPath(Site site, Container container) {

    List<Content> contents = site.getPathTo(container);

    final VirtualPath filePath = new VirtualPath();

    for (Content content : contents.subList(1, contents.size())) {
      filePath.addNode(
          0,
          new VirtualPathNode(
              content.getClass().getSimpleName().substring(0, 1) + content.getExternalId(),
              content.getName().getContent()));
    }

    String authorName = site.getAuthorName();
    filePath.addNode(
        0,
        new VirtualPathNode(
            "Site" + site.getExternalId(),
            authorName == null ? "Site" + site.getExternalId() : authorName));

    ExecutionSemester executionSemester = site.getExecutionPeriod();
    if (executionSemester == null) {
      filePath.addNode(0, new VirtualPathNode("Intemporal", "Intemporal"));
    } else {
      filePath.addNode(
          0,
          new VirtualPathNode(
              "EP" + executionSemester.getExternalId(), executionSemester.getName()));

      ExecutionYear executionYear = executionSemester.getExecutionYear();
      filePath.addNode(
          0, new VirtualPathNode("EY" + executionYear.getExternalId(), executionYear.getYear()));
    }

    filePath.addNode(0, new VirtualPathNode("Courses", "Courses"));
    return filePath;
  }