public RepositoryFile internalGetFile( File f ) { RepositoryFile file = null; if ( f.exists() ) { String jcrPath = f.getAbsolutePath().substring( rootDir.getAbsolutePath().length() ); if ( jcrPath.length() == 0 ) { jcrPath = "/"; } else if ( IS_WINDOWS ) { jcrPath = FilenameUtils.separatorsToUnix( jcrPath ); } file = new RepositoryFile.Builder( f.getAbsolutePath(), f.getName() ).createdDate( new Date( f.lastModified() ) ) .lastModificationDate( new Date( f.lastModified() ) ).folder( f.isDirectory() ).versioned( false ).path( jcrPath ).versionId( f.getName() ).locked( false ).lockDate( null ).lockMessage( null ).lockOwner( null ).title( f.getName() ).description( f.getName() ).locale( null ).fileSize( f.length() ).build(); } return file; }
new RepositoryFile.Builder( id, name ).createdDate( created ).creatorId( creatorId ).lastModificationDate( lastModified ).folder( folder ).versioned( versioned ).path( path ).versionId( versionId ).fileSize( fileSize ).locked( locked ).lockDate( lockDate ).hidden( hidden ).schedulable( schedulable ) .lockMessage( lockMessage ).lockOwner( lockOwner ).title( title ).description( description ).locale( pentahoLocale.toString() ).localePropertiesMap( localePropertiesMap ).aclNode( aclNode ).build();
public void lockFile( final Serializable fileId, final String message ) { if ( !hasAccess( fileId, EnumSet.of( WRITE ) ) ) { throw new UnifiedRepositoryException( "access denied" ); } FileRecord r = idManager.getFileById( fileId ); if ( r.getFile().getLockOwner() != null ) { throw new IllegalStateException( "file is already locked" ); } r.setFile( new RepositoryFile.Builder( r.getFile() ).lockOwner( currentUserProvider.getUser() ).lockDate( new Date() ).lockMessage( message ).locked( true ).build() ); }
.lockDate( unmarshalDate( v.getLockDate() ) ).locked( v.isLocked() ).lockMessage( v.getLockMessage() ).lockOwner( v.getLockOwner() ) .title( v.getTitle() ).versioned( v.isVersioned() ).versionId( v.getVersionId() ).originalParentFolderPath( v.getOriginalParentFolderPath() ).deletedDate( unmarshalDate( v.getDeletedDate() ) ).hidden( v.isHidden() ).schedulable( !v
public Builder( final RepositoryFile other ) { this( other.getName() ); synchronized ( other ) { this.id( other.getId() ).path( other.getPath() ).createdDate( other.getCreatedDate() ).creatorId( other.getCreatorId() ).fileSize( other.getFileSize() ).folder( other.isFolder() ).lastModificationDate( other.getLastModifiedDate() ).versioned( other.isVersioned() ).hidden( other.isHidden() ).schedulable( other.isSchedulable() ).versionId( other.getVersionId() ).locked( other.isLocked() ).lockDate( other.getLockDate() ).lockOwner( other.getLockOwner() ).lockMessage( other.getLockMessage() ).title( other.getTitle() ).description( other.getDescription() ).locale( other.getLocale() ).originalParentFolderPath( other.getOriginalParentFolderPath() ).deletedDate( other.getDeletedDate() ).localePropertiesMap( other.getLocalePropertiesMap() ).aclNode( other.isAclNode() ); } }
@Override public void restoreFileAtVersion( final Serializable fileId, final Serializable versionId, final String versionMessage ) { FrozenFileRecord restored = versionManager.restoreVersion( fileId, versionId, currentUserProvider.getUser(), versionMessage, new Date() ); FileRecord fileRecord = idManager.getFileById( fileId ); fileRecord.setData( restored.getData() ); fileRecord.setMetadata( restored.getMetadata() ); // reset properties that aren't versioned RepositoryFile orig = fileRecord.getFile(); fileRecord.setFile( new RepositoryFile.Builder( restored.getFile() ).locked( orig.isLocked() ).lockDate( orig.getLockDate() ).lockMessage( orig.getLockMessage() ).lockOwner( orig.getLockOwner() ).build() ); }
public void unlockFile( final Serializable fileId ) { if ( !hasAccess( fileId, EnumSet.of( WRITE ) ) ) { throw new UnifiedRepositoryException( "access denied" ); } FileRecord r = idManager.getFileById( fileId ); if ( r.getFile().getLockOwner() == null ) { throw new IllegalStateException( "file is not locked" ); } r.setFile( new RepositoryFile.Builder( r.getFile() ).lockOwner( null ).lockDate( null ).lockMessage( null ) .locked( false ).build() ); }