public static RepositoryDirectory build( String parentPath, org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile, Boolean isAdmin ) { RepositoryDirectory repositoryDirectory = new RepositoryDirectory(); repositoryDirectory.setParent( parentPath ); repositoryDirectory.setName( repositoryFile.getName() ); repositoryDirectory.setPath( repositoryFile.getPath() ); repositoryDirectory.setObjectId( () -> (String) repositoryFile.getId() ); repositoryDirectory.setHidden( repositoryFile.isHidden() && !isAdmin ); repositoryDirectory.setDate( repositoryFile.getLastModifiedDate() != null ? repositoryFile.getLastModifiedDate() : repositoryFile.getCreatedDate() ); return repositoryDirectory; }
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 RepositoryFile internalUpdateFile( final Session session, final PentahoJcrConstants pentahoJcrConstants, final RepositoryFile file, final IRepositoryFileData content, final String versionMessage ) throws RepositoryException { if ( isKioskEnabled() ) { throw new RuntimeException( Messages.getInstance().getString( "JcrRepositoryFileDao.ERROR_0006_ACCESS_DENIED" ) ); //$NON-NLS-1$ } Assert.notNull( file ); Assert.isTrue( !file.isFolder() ); Assert.notNull( content ); // Get repository file info and acl info of parent RepositoryFileAcl acl = aclDao.getAcl( file.getId() ); // Invoke accessVoterManager to see if we have access to perform this operation if ( !accessVoterManager.hasAccess( file, RepositoryFilePermission.WRITE, acl, PentahoSessionHolder.getSession() ) ) { return null; } lockHelper.addLockTokenToSessionIfNecessary( session, pentahoJcrConstants, file.getId() ); JcrRepositoryFileUtils.checkoutNearestVersionableFileIfNecessary( session, pentahoJcrConstants, file.getId() ); JcrRepositoryFileUtils.updateFileNode( session, pentahoJcrConstants, file, content, findTransformerForWrite( content.getClass() ) ); session.save(); JcrRepositoryFileUtils.checkinNearestVersionableFileIfNecessary( session, pentahoJcrConstants, file.getId(), versionMessage, file.getCreatedDate() != null ? file.getCreatedDate() : new java.util.Date(), true ); lockHelper.removeLockTokenFromSessionIfNecessary( session, pentahoJcrConstants, file.getId() ); return JcrRepositoryFileUtils.nodeIdToFile( session, pentahoJcrConstants, pathConversionHelper, lockHelper, file .getId() ); }
appended = true; if ( expectedFile.getCreatedDate() != null ) { description.appendText( appended ? "," : "" ); description.appendText( "createdDate=" ); description.appendText( expectedFile.getCreatedDate().toString() ); appended = true;
@Override public boolean matchesSafely( final RepositoryFile file ) { return ( expectedFile.getId() != null ? expectedFile.getId().equals( file.getId() ) : true ) && ( expectedFile.getName() != null ? expectedFile.getName().equals( file.getName() ) : true ) && ( expectedFile.getTitle() != null ? expectedFile.getTitle().equals( file.getTitle() ) : true ) && ( expectedFile.getPath() != null ? expectedFile.getPath().equals( file.getPath() ) : true ) && ( expectedFile.getCreatedDate() != null ? expectedFile.getCreatedDate().equals( file.getCreatedDate() ) : true ) && ( expectedFile.getLastModifiedDate() != null ? expectedFile.getLastModifiedDate().equals( file.getLastModifiedDate() ) : true ) && ( expectedFile.getVersionId() != null ? expectedFile.getVersionId().equals( file.getVersionId() ) : true ) && ( expectedFile.getDeletedDate() != null ? expectedFile.getDeletedDate().equals( file.getDeletedDate() ) : true ); }
if ( file.isVersioned() ) { JcrRepositoryFileUtils.checkinNearestVersionableNodeIfNecessary( session, pentahoJcrConstants, fileNode, versionMessage, file.getCreatedDate(), false );
f.setCreatedDate( marshalDate( v.getCreatedDate() ) );
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() ); } }