public VersionSummary getVersionSummary( Serializable fileId, Serializable versionId ) { RepositoryFile file = getFile( fileId, versionId ); List<String> labels = new ArrayList<String>(); return new VersionSummary( fileId, ( versionId != null ? versionId : fileId ), false, file.getCreatedDate(), file.getCreatorId(), StringUtils.EMPTY, labels ); }
private static VersionSummary toVersionSummary( final PentahoJcrConstants pentahoJcrConstants, final VersionHistory versionHistory, final Version version ) throws RepositoryException { List<String> labels = Arrays.asList( versionHistory.getVersionLabels( version ) ); // get custom Hitachi Vantara properties (i.e. author and message) Node nodeAtVersion = getNodeAtVersion( pentahoJcrConstants, version ); String author = "BASE_VERSION"; if ( nodeAtVersion.hasProperty( pentahoJcrConstants.getPHO_VERSIONAUTHOR() ) ) { author = nodeAtVersion.getProperty( pentahoJcrConstants.getPHO_VERSIONAUTHOR() ).getString(); } String message = null; if ( nodeAtVersion.hasProperty( pentahoJcrConstants.getPHO_VERSIONMESSAGE() ) ) { message = nodeAtVersion.getProperty( pentahoJcrConstants.getPHO_VERSIONMESSAGE() ).getString(); } boolean aclOnlyChange = false; if ( nodeAtVersion.hasProperty( pentahoJcrConstants.getPHO_ACLONLYCHANGE() ) && nodeAtVersion.getProperty( pentahoJcrConstants.getPHO_ACLONLYCHANGE() ).getBoolean() ) { aclOnlyChange = true; } return new VersionSummary( version.getName(), versionHistory.getVersionableIdentifier(), aclOnlyChange, version .getCreated().getTime(), author, message, labels ); }
@Override public List<VersionSummary> getVersionSummaries( final Serializable fileId ) { List<VersionSummary> sums = new ArrayList<VersionSummary>(); List<FrozenFileRecord> records = versionManager.getVersions( fileId ); for ( FrozenFileRecord record : records ) { sums.add( new VersionSummary( record.getVersionId(), record.getFile().getId(), false, record.getDate(), record .getAuthor(), record.getVersionMessage(), new ArrayList<String>( 0 ) ) ); } return sums; }
@Override public VersionSummary getVersionSummary( final Serializable fileId, final Serializable versionId ) { FrozenFileRecord r = null; if ( versionId == null ) { r = versionManager.getLatestVersion( fileId ); } else { r = versionManager.getFileAtVersion( fileId, versionId ); } return new VersionSummary( r.getVersionId(), r.getFile().getId(), false, r.getDate(), r.getAuthor(), r .getVersionMessage(), new ArrayList<String>( 0 ) ); }
@Override public VersionSummary unmarshal( final VersionSummaryDto v ) { return new VersionSummary( v.getId(), v.getVersionedFileId(), v.isAclOnlyChange(), v.getDate(), v.getAuthor(), v.getMessage(), v.getLabels() ); }