예제 #1
0
  private void createTable(Division main) throws WingException {
    // Get all our parameters
    String id = parameters.getParameter("versionID", null);

    Table table = main.addTable("version", 1, 1);

    Row header = table.addRow(Row.ROLE_HEADER);
    header.addCellContent(T_column1);
    header.addCellContent(T_column2);
    header.addCellContent(T_column3);
    header.addCellContent(T_column4);

    VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class);
    Version version = versioningService.getVersion(context, Integer.parseInt(id));

    Row row = table.addRow();
    row.addCell().addContent(version.getVersionNumber());
    row.addCell().addContent(version.getEperson().getEmail());
    row.addCell().addContent(new DCDate(version.getVersionDate()).toString());
    row.addCell().addContent(version.getSummary());

    List fields = main.addList("fields", List.TYPE_FORM);
    Composite addComposite = fields.addItem().addComposite("summary");
    addComposite.setLabel(T_column4);
    addComposite.addTextArea("summary");
  }
 @Override
 public boolean isLastVersion(VersionHistory versionHistory, Version version) {
   List<Version> versions = versionHistory.getVersions();
   if (CollectionUtils.isEmpty(versions)) {
     return false;
   }
   Version last = versions.iterator().next();
   return last.equals(version);
 }
 @Override
 public Version getVersion(VersionHistory versionHistory, Item item) {
   List<Version> versions = versionHistory.getVersions();
   for (Version v : versions) {
     if (v.getItem().getID() == item.getID()) {
       return v;
     }
   }
   return null;
 }
예제 #4
0
파일: Version.java 프로젝트: jmarton/DSpace
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    Class<?> objClass = HibernateProxyHelper.getClassWithoutInitializingProxy(o);
    if (getClass() != objClass) {
      return false;
    }

    final Version that = (Version) o;
    if (this.getID() != that.getID()) {
      return false;
    }

    return true;
  }
 @Override
 public boolean isFirstVersion(VersionHistory versionHistory, Version version) {
   List<Version> versions = versionHistory.getVersions();
   Version first = versions.get(versions.size() - 1);
   return first.equals(version);
 }