Package org.dspace.versioning

Examples of org.dspace.versioning.Version


            if (AuthorizeManager.authorizeActionBoolean(context, item,
                    Constants.WRITE) || item.canEdit())
            {
                VersioningService versioningService = new DSpace()
                        .getSingletonService(VersioningService.class);
                Version version = versioningService.createNewVersion(context,
                        itemID, summary);
                WorkspaceItem wsi = WorkspaceItem.findByItem(context,
                        version.getItem());

                context.commit();

                return wsi.getID();
View Full Code Here


            }
            context.commit();

            // Retrieve the latest version of our history (IF any is even
            // present)
            Version latestVersion = versionHistory.getLatestVersion();
            if (latestVersion == null)
            {
                return null;
            }
            else
            {
                return latestVersion.getItemID();
            }

        }
        catch (Exception ex)
        {
View Full Code Here

        try
        {
            Integer versionID = Integer.parseInt(stringVersionID);
            VersioningService versioningService = new DSpace()
                    .getSingletonService(VersioningService.class);
            Version version = versioningService.getVersion(context, versionID);
            if (version != null)
            {
                result = version.getSummary();
            }

        }
        catch (Exception ex)
        {
View Full Code Here

          }
        }
      }

      // Check if we have a history for the item
      Version latestVersion;
      try {
        latestVersion = VersionUtil.checkLatestVersion(context, item);
      } catch (SQLException e) {
        throw new PluginException(e.getMessage());
      }

      if (latestVersion != null) {
        if (latestVersion != null
            && latestVersion.getItemID() != item.getID()) {
          // We have a newer version
          Item latestVersionItem = latestVersion.getItem();
          if (latestVersionItem.isArchived()) {
            // Available, add a link for the user alerting him that
            // a new version is available
            newVersionAvailable = true;
            try {
View Full Code Here


        for (String id : idsString.split(","))
        {
            VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class);
            Version version = null;

            if(StringUtils.isNotBlank(id))
            {
                version = versioningService.getVersion(context, Integer.parseInt(id));
            }

            if(version!=null)
            {
                Row row = table.addRow();
          row.addCell().addContent(version.getVersionNumber());
                addItemIdentifier(row.addCell(), version.getItem());

                EPerson editor = version.getEperson();
                row.addCell().addXref("mailto:" + editor.getEmail(), editor.getFullName());
                row.addCell().addContent(new DCDate(version.getVersionDate()).toString());
                row.addCell().addContent(version.getSummary());
            }
    }

    }
View Full Code Here

            Collection col = Collection.create(context);
            WorkspaceItem is = WorkspaceItem.create(context, col, false);

            originalItem = InstallItem.installItem(context, is);

            Version version = versioningService.createNewVersion(context, originalItem.getID(), summary);
            WorkspaceItem wsi = WorkspaceItem.findByItem(context, version.getItem());

            versionedItem = InstallItem.installItem(context, wsi);
            context.restoreAuthSystemState();
            context.commit();
        }
View Full Code Here

    @Test
    public void testVersionFind(){
        VersionHistory versionHistory = versioningService.findVersionHistory(context, originalItem.getID());
        assertThat("testFindVersionHistory", versionHistory, notNullValue());
        Version version = versionHistory.getVersion(versionedItem);
        assertThat("testFindVersion", version, notNullValue());
    }
View Full Code Here

    @Test
    public void testVersionSummary() throws Exception
    {
        //Start by creating a new item !
        VersionHistory versionHistory = versioningService.findVersionHistory(context, originalItem.getID());
        Version version = versionHistory.getVersion(versionedItem);
        assertThat("Test_version_summary", summary, equalTo(version.getSummary()));
    }
View Full Code Here

        // manage if versionID is not came by request
        VersionHistory history = VersionUtil.retrieveVersionHistory(context,
                item);
        if (versionID == null || versionID.isEmpty())
        {
            Version version = history.getVersion(item);
            if (version != null)
            {
                versionID = String.valueOf(version.getVersionId());
            }
        }
        String submit = UIUtil.getSubmitButton(request, "submit");
        if (submit != null && submit.equals("submit_cancel"))
        {
View Full Code Here

        //Check if we have a history for the item
        VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class);
        VersionHistory history = versioningService.findVersionHistory(context, item.getID());

        if(history != null){
            Version latestVersion = retrieveLatestVersion(history, item);
            if(latestVersion != null && latestVersion.getItemID() != item.getID())
            {
                //We have a newer version
                Item latestVersionItem = latestVersion.getItem();
                if(latestVersionItem.isArchived())
                {
                    //Available, add a link for the user alerting him that a new version is available
                    addVersionNotice(mainDivision, latestVersionItem, T_new_version_head, T_new_version_help, true);
                }else{
View Full Code Here

TOP

Related Classes of org.dspace.versioning.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.