Package org.dspace.versioning

Examples of org.dspace.versioning.VersionHistory


        try
        {

            VersioningService versioningService = new DSpace()
                    .getSingletonService(VersioningService.class);
            VersionHistory versionHistory = versioningService
                    .findVersionHistory(context, itemId);

            for (String id : versionIDs)
            {
                versioningService.removeVersion(context, Integer.parseInt(id));
            }
            context.commit();

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


     * @param item
     * @return true or false
     */
    public static boolean isLatest(Context context, Item item)
    {
        VersionHistory history = retrieveVersionHistory(context, item);
        return (history == null || history.getLatestVersion().getItem().getID() == item
                .getID());
    }
View Full Code Here

     * @param item
     * @return true or false
     */
    public static boolean hasVersionHistory(Context context, Item item)
    {
        VersionHistory history = retrieveVersionHistory(context, item);
        return (history != null);
    }
View Full Code Here

     */
    public static Version checkLatestVersion(Context context, Item item)
            throws SQLException
    {

        VersionHistory history = retrieveVersionHistory(context, item);

        if (history != null)
        {
            List<Version> allVersions = history.getVersions();
            for (Version version : allVersions)
            {
                if (version.getItem().isArchived()
                        || AuthorizeManager.isAdmin(context,
                                item.getOwningCollection()))
View Full Code Here

    boolean newVersionAvailable = false;
    boolean showVersionWorkflowAvailable = false;
    boolean hasVersionButton = false;
    boolean hasVersionHistory = false;
   
    VersionHistory history = null;
    List<Version> historyVersions = new ArrayList<Version>();
    String latestVersionHandle = null;
    String latestVersionURL = null;
    if (versioningEnabled) {
      try {
        if(item.canEdit()) {
          if (VersionUtil.isLatest(context, item) && item.isArchived()) {
            hasVersionButton = true;
          }
        }
      } catch (SQLException e) {
        throw new PluginException(e.getMessage());
      }

      if (VersionUtil.hasVersionHistory(context, item)) {
        hasVersionHistory = true;
        history = VersionUtil.retrieveVersionHistory(context, item);
        for(Version versRow : history.getVersions()) { 
         
                //Skip items currently in submission
                try {
            if(VersionUtil.isItemInSubmission(context, versRow.getItem()))
            {
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"))
        {
            // Pressed the cancel button, redirect us to the item page
            response.sendRedirect(request.getContextPath() + "/handle/"
                    + item.getHandle());
            context.complete();
            return;
        }
        else if (submit != null && submit.equals("submit_delete"))
        {
            String[] versionIDs = request.getParameterValues("remove");
            Integer result = doDeleteVersions(request, itemID, versionIDs);
            if (result != null)
            {
                response.sendRedirect(request.getContextPath()
                        + "/tools/history?delete=true&itemID="+history.getLatestVersion().getItemID());
            }
            else
            {
                // We have removed everything, redirect us to the home page !
                response.sendRedirect(request.getContextPath());
View Full Code Here

            }
        }



        VersionHistory versionHistory = retrieveVersionHistory(item);
        if(versionHistory!=null)
        {
            Division main = createMain(body);
            createTable(main, versionHistory, isItemView, item);
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())
            {
View Full Code Here

TOP

Related Classes of org.dspace.versioning.VersionHistory

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.