versionDate != null ? versionDate.getTime() : new Date() ).description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build(); + element.getRepositoryElementType().getExtension() ) ).versioned( true ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate( versionDate != null ? versionDate.getTime() : new Date() ).description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build();
new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build(); checkAndSanitize( element.getName() + element.getRepositoryElementType().getExtension() ) ) .title( RepositoryFile.DEFAULT_LOCALE, element.getName() ) .description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).versioned( VERSION_SHARED_OBJECTS ).build();
@Override public void createElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException { RepositoryFile namespaceFile = validateNamespace( namespace ); IMetaStoreElementType existingType = getElementTypeByName( namespace, elementType.getName() ); if ( existingType != null ) { throw new MetaStoreElementTypeExistsException( Collections.singletonList( existingType ), "Can not create element type with id '" + elementType.getId() + "' because it already exists" ); } RepositoryFile elementTypeFile = new RepositoryFile.Builder( elementType.getName() ).folder( true ).versioned( false ).build(); RepositoryFile folder = pur.createFolder( namespaceFile.getId(), elementTypeFile, null ); elementType.setId( folder.getId().toString() ); // In this folder there is a hidden file which contains the description // and the other future properties of the element type // RepositoryFile detailsFile = new RepositoryFile.Builder( ELEMENT_TYPE_DETAILS_FILENAME ).folder( false ).title( ELEMENT_TYPE_DETAILS_FILENAME ).description( elementType.getDescription() ).hidden( true ).build(); DataNode dataNode = getElementTypeDataNode( elementType ); pur.createFile( folder.getId(), detailsFile, new NodeRepositoryFileData( dataNode ), null ); elementType.setMetaStoreName( getName() ); }
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();
return builder.path( v.getPath() ).createdDate( unmarshalDate( v.getCreatedDate() ) ).creatorId( v.getCreatorId() ).description( v.getDescription() ) .folder( v.isFolder() ).fileSize( v.getFileSize() ).lastModificationDate( unmarshalDate( v.getLastModifiedDate() ) ).locale( v.getLocale() ) .lockDate( unmarshalDate( v.getLockDate() ) ).locked( v.isLocked() ).lockMessage( v.getLockMessage() ).lockOwner( v.getLockOwner() )
@Override public RepositoryFile createFile( final Serializable parentFolderId, final RepositoryFile file, final IRepositoryFileData data, final RepositoryFileAcl acl, final String versionMessage ) { Validate.isTrue( !file.isFolder() ); if ( !hasAccess( parentFolderId, EnumSet.of( WRITE ) ) ) { throw new AccessDeniedException( "access denied" ); } FileRecord parentFolder = idManager.getFileById( parentFolderId ); RepositoryFile fileFromRepo = new RepositoryFile.Builder( file ).path( parentFolder.getPath() + RepositoryFile.SEPARATOR + file.getName() ) .title( findTitle( file ) ).description( findDesc( file ) ).build(); RepositoryFileAcl aclFromRepo = new RepositoryFileAcl.Builder( acl ).build(); FileRecord fileRecord = new FileRecord( fileFromRepo, data, aclFromRepo, new HashMap<String, Serializable>() ); idManager.register( fileRecord ); process( fileRecord, null ); parentFolder.addChild( fileRecord ); if ( file.isVersioned() ) { versionManager.createVersion( fileRecord.getFile().getId(), currentUserProvider.getUser(), versionMessage, new Date() ); } return fileRecord.getFile(); }
@Override public RepositoryFile updateFile( final RepositoryFile file, final IRepositoryFileData data, final String versionMessage ) { Validate.isTrue( !file.isFolder() ); if ( !hasAccess( file.getId(), EnumSet.of( WRITE ) ) ) { throw new AccessDeniedException( "access denied" ); } FileRecord fileRecord = idManager.getFileById( file.getId() ); fileRecord.setFile( new RepositoryFile.Builder( file ).title( findTitle( file ) ).description( findDesc( file ) ) .build() ); IRepositoryFileData oldData = fileRecord.getData(); fileRecord.setData( data ); process( fileRecord, oldData ); if ( file.isVersioned() ) { versionManager.createVersion( fileRecord.getFile().getId(), currentUserProvider.getUser(), versionMessage, new Date() ); } return fileRecord.getFile(); }
@Override public RepositoryFile createFolder( final Serializable parentFolderId, final RepositoryFile file, final RepositoryFileAcl acl, final String versionMessage ) { Validate.isTrue( file.isFolder() ); Validate.isTrue( !file.isVersioned() ); if ( !hasAccess( parentFolderId, EnumSet.of( WRITE ) ) ) { throw new AccessDeniedException( "access denied" ); } FileRecord parentFolder = idManager.getFileById( parentFolderId ); RepositoryFile fileFromRepo = new RepositoryFile.Builder( file ).path( parentFolder.getPath() + ( parentFolder.getPath().endsWith( RepositoryFile.SEPARATOR ) ? "" : RepositoryFile.SEPARATOR ) + file.getName() ).title( findTitle( file ) ).description( findDesc( file ) ).build(); RepositoryFileAcl aclFromRepo = new RepositoryFileAcl.Builder( acl ).build(); FileRecord fileRecord = new FileRecord( fileFromRepo, null, aclFromRepo, new HashMap<String, Serializable>() ); idManager.register( fileRecord ); parentFolder.addChild( fileRecord ); return fileRecord.getFile(); }
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; }
@Override public RepositoryFile updateFolder( RepositoryFile folder, String versionMessage ) { Validate.isTrue( folder.isFolder() ); if ( !hasAccess( folder.getId(), EnumSet.of( WRITE ) ) ) { throw new AccessDeniedException( "access denied" ); } FileRecord fileRecord = idManager.getFileById( folder.getId() ); fileRecord.setFile( new RepositoryFile.Builder( folder ).hidden( folder.isHidden() ).title( findTitle( folder ) ) .description( findDesc( folder ) ).aclNode( folder.isAclNode() ).build() ); if ( folder.isVersioned() ) { versionManager.createVersion( fileRecord.getFile().getId(), currentUserProvider.getUser(), versionMessage, new Date() ); } return fileRecord.getFile(); }
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() ); } }