Package com.agiletec.plugins.jpversioning.aps.system.services.versioning

Examples of com.agiletec.plugins.jpversioning.aps.system.services.versioning.ContentVersion


  }
 
  @Override
  public String preview() {
    try {
      ContentVersion contentVersion = this.getContentVersion();
      Content currentContent = this.getVersioningManager().getContent(contentVersion);
      this.setContent(currentContent);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "preview");
      return FAILURE;
View Full Code Here


 
  @Override
  public String recover() {
    Content content = null;
    try {
      ContentVersion contentVersion = this.getContentVersion();
      if (null == contentVersion) {
        throw new RuntimeException("Null content version : versionid " + this.getVersionId());
      }
      List<String> trashedResources = this.getTrashedResources();
      if (null != trashedResources && trashedResources.size() > 0) {
View Full Code Here

    }
    return versions;
  }
 
  public ContentVersion getContentVersion(long versionId) {
    ContentVersion version = null
    try {
      version = this.getVersioningManager().getVersion(versionId);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getContentVersion");
      throw new RuntimeException("Errore in estrazione versione contenuto, id versione " + versionId, t);
View Full Code Here

    }
    return this._trashRemovedResources;
  }
 
  private void loadTrashResources() throws Exception {
    ContentVersion contentVersion = this.getContentVersion();
    String contentXml = contentVersion.getXml();
    Document doc = this.loadContentDocumentDOM(contentXml);     
    List<String> resourceIds = this.loadResourcesIdFromContentDocumentDOM(doc);
    List<String> archivedResources = this.getArchivedResourcesId(resourceIds);
    if (null != resourceIds && resourceIds.size() > 0 ) {
      this._trashedResources = this.getTrashedResourcesId(resourceIds, archivedResources);
View Full Code Here

    return versions;
  }
 
  @Override
  public ContentVersion getContentVersion(long id) {
    ContentVersion version = null
    try {
      version = this.getVersioningManager().getVersion(id);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getContentVersion");
      throw new RuntimeException("Errore in estrazione versione contenuto, id versione " + id, t);
View Full Code Here

    return latestVersions;
  }
 
  @Override
  public ContentVersion getContentVersion(long id) {
    ContentVersion version = null
    try {
      version = this.getVersioningManager().getVersion(id);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "viewVersions");
      throw new RuntimeException("Error loading content version of id " + id, t);
View Full Code Here

    VersionFinderAction action = (VersionFinderAction) this.getAction();
    List<Long> lastVersionsId = action.getLatestVersions();
    assertEquals(1, lastVersionsId.size());
    assertEquals(3, lastVersionsId.get(0).longValue());
   
    ContentVersion contentVersion = action.getContentVersion(3);
    assertEquals(3, contentVersion.getId());
    assertEquals("1.0", contentVersion.getVersion());
    assertEquals(1, contentVersion.getOnlineVersion());
    assertEquals("ART1", contentVersion.getContentId());
    assertEquals("ART", contentVersion.getContentType());
    assertEquals("Articolo 3", contentVersion.getDescr());
    assertNotNull(contentVersion.getVersionDate());
    assertNotNull(contentVersion.getXml());
  }
View Full Code Here

    versions = this._versioningManager.getLastVersions("ART", null);
    this.checkVersionIds(new long[] { 3 }, versions);
  }
 
  public void testGetVersion() throws Throwable {
    ContentVersion contentVersion = this._versioningManager.getVersion(10000);
    assertNull(contentVersion)
    long id = 1;
    contentVersion = this._versioningManager.getVersion(id);
    assertEquals(id, contentVersion.getId());
    assertEquals("ART1", contentVersion.getContentId());
    assertEquals("ART", contentVersion.getContentType());
    assertEquals("Articolo", contentVersion.getDescr());
    assertEquals(Content.STATUS_DRAFT, contentVersion.getStatus());
    assertNotNull(contentVersion.getXml());
    assertEquals("13/02/2005", DateConverter.getFormattedDate(contentVersion.getVersionDate(), "dd/MM/yyyy"));
    assertEquals("0.0", contentVersion.getVersion());
    assertEquals(0, contentVersion.getOnlineVersion());
    assertTrue(contentVersion.isApproved());
    assertEquals("admin", contentVersion.getUsername());
  }
View Full Code Here

    assertTrue(contentVersion.isApproved());
    assertEquals("admin", contentVersion.getUsername());
  }
 
  public void testGetLastVersion() throws Throwable {
    ContentVersion contentVersion = this._versioningManager.getLastVersion("CNG12");
    assertNull(contentVersion);
    contentVersion = this._versioningManager.getLastVersion("ART1");
    assertEquals(3, contentVersion.getId());
    assertEquals("ART1", contentVersion.getContentId());
    assertEquals("ART", contentVersion.getContentType());
    assertEquals("Articolo 3", contentVersion.getDescr());
    assertEquals(Content.STATUS_READY, contentVersion.getStatus());
    assertNotNull(contentVersion.getXml());
    assertEquals("15/02/2005", DateConverter.getFormattedDate(contentVersion.getVersionDate(), "dd/MM/yyyy"));
    assertEquals("1.0", contentVersion.getVersion());
    assertEquals(1, contentVersion.getOnlineVersion());
    assertTrue(contentVersion.isApproved());
    assertEquals("mainEditor", contentVersion.getUsername());
  }
View Full Code Here

    assertEquals("mainEditor", contentVersion.getUsername());
  }
 
  public void testSaveGetDeleteVersion() throws Throwable {
    ((VersioningManager) this._versioningManager).saveContentVersion("ART102");
    ContentVersion contentVersion = this._versioningManager.getLastVersion("ART102");
    assertEquals(4, contentVersion.getId());
    assertEquals("ART102", contentVersion.getContentId());
    assertEquals("ART", contentVersion.getContentType());
    assertEquals("Contenuto 2 Customers", contentVersion.getDescr());
    assertEquals(Content.STATUS_DRAFT, contentVersion.getStatus());
    assertNotNull(contentVersion.getXml());
    assertEquals("15/12/2007", DateConverter.getFormattedDate(contentVersion.getVersionDate(), "dd/MM/yyyy"));
    assertEquals("1.0", contentVersion.getVersion());
    assertEquals(1, contentVersion.getOnlineVersion());
    assertTrue(contentVersion.isApproved());
    assertEquals("admin", contentVersion.getUsername());
   
    this._versioningManager.deleteVersion(contentVersion.getId());
    assertNull(this._versioningManager.getLastVersion("ART102"));
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpversioning.aps.system.services.versioning.ContentVersion

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.