checkAndSanitize( RepositoryFilenameUtils.escape( element.getName(), pur.getReservedChars() ) + RepositoryObjectType.DATABASE.getExtension() ) ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate( createdDate ).versioned( VERSION_SHARED_OBJECTS ).build();
file = new RepositoryFile.Builder( checkAndSanitize( element.getName() + element.getRepositoryElementType().getExtension() ) ).versioned( true ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate( versionDate != null ? versionDate.getTime() : new Date() ).description( RepositoryFile.DEFAULT_LOCALE,
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();
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(
new RepositoryFile.Builder( RepositoryFilenameUtils.escape( databaseConnection.getName() + RepositoryObjectType.DATABASE.getExtension(), cachedReservedChars ) ).title( RepositoryFile.DEFAULT_LOCALE, databaseConnection.getName() ).versioned( true ).build(); file = repository.createFile( getDatabaseParentFolderId(), file, new NodeRepositoryFileData( databaseHelper
.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() ) .title( v.getTitle() ).versioned( v.isVersioned() ).versionId( v.getVersionId() ).originalParentFolderPath( v.getOriginalParentFolderPath() ).deletedDate( unmarshalDate( v.getDeletedDate() ) ).hidden( v.isHidden() ).schedulable( !v .isNotSchedulable() ).aclNode( v.isAclNode() ).build();
/** * Creates a new file that is known to not exist * * @param filePath * the full path to the file * @param data * the data to be stored in the file * @param createParentDirs * indicates of the directory structure should be created if it doesn't exist * @param versionMessage * the version message * @return the newly create {@code IRepositoryFile} or {@code null} if it couldn't be created */ protected RepositoryFile createFile( final String filePath, final IRepositoryFileData data, final boolean createParentDirs, final boolean versioned, final String versionMessage ) { final String path = RepositoryFilenameUtils.getFullPath( filePath ); final String filename = RepositoryFilenameUtils.getName( filePath ); final RepositoryFile parentDir = getFolder( path, createParentDirs, createParentDirs, versionMessage ); if ( null == parentDir ) { return null; } return repository.createFile( parentDir.getId(), new RepositoryFile.Builder( filename ).versioned( versioned ) .build(), data, versionMessage ); } }
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; }
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() ); } }
protected RepositoryFile createSampleFile( final String parentFolderPath, final String fileName, final String sampleString, final boolean sampleBoolean, final int sampleInteger, boolean versioned ) throws Exception { RepositoryFile parentFolder = repo.getFile( parentFolderPath ); final SampleRepositoryFileData content = new SampleRepositoryFileData( sampleString, sampleBoolean, sampleInteger ); return repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( fileName ).versioned( versioned ).build(), content, null ); }
private RepositoryFile buildRepositoryFile( String fileName, String extension, String baseFileName ) { RepositoryFile.Builder fileBuilder = new RepositoryFile.Builder( fileName ) .hidden( hidden ) .versioned( true ); // Default versioned to true so that we're keeping history if ( isKettleExtension( extension ) ) { fileBuilder.title( RepositoryFile.DEFAULT_LOCALE, baseFileName ); } return fileBuilder.build(); }
private static RepositoryFile getRootFolder( final Session session ) throws RepositoryException { Node node = session.getRootNode(); RepositoryFile file = new RepositoryFile.Builder( node.getIdentifier(), "" ).folder( true ).versioned( false ).path( //$NON-NLS-1$ JcrStringHelper.pathDecode( node.getPath() ) ).build(); return file; }
@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() ); }
public void createElement( String namespace, IMetaStoreElementType elementType, IMetaStoreElement element ) throws MetaStoreException { RepositoryFile elementTypeFolder = validateElementTypeRepositoryFolder( namespace, elementType ); RepositoryFile elementFile = new RepositoryFile.Builder( PurRepository.checkAndSanitize( element.getName() ) ).title( element.getName() ) .versioned( false ).build(); DataNode elementDataNode = new DataNode( PurRepository.checkAndSanitize( element.getName() ) ); elementToDataNode( element, elementDataNode ); RepositoryFile createdFile = pur.createFile( elementTypeFolder.getId(), elementFile, new NodeRepositoryFileData( elementDataNode ), null ); element.setId( createdFile.getId().toString() ); // Verify existence. if ( pur.getFileById( createdFile.getId() ) == null ) { throw new RuntimeException( "Unable to verify creation of element '" + element.getName() + "' in folder: " + elementTypeFolder.getPath() ); } }
@Override public void createNamespace( String namespace ) throws MetaStoreException { if ( namespaceExists( namespace ) ) { throw new MetaStoreNamespaceExistsException( "Namespace '" + namespace + "' can not be created, it already exists" ); } RepositoryFile namespaceFolder = new RepositoryFile.Builder( namespace ).folder( true ).versioned( false ).build(); pur.createFolder( namespacesFolder.getId(), namespaceFolder, "Created namespace" ); }