@Override public void setLength( long length ) { getRepositoryItemAttributes().setLength( length ); }
@Override public long getLength() { return getRepositoryItemAttributes().getLength(); }
@Override public boolean isContentGenerated() { return getRepositoryItemAttributes().containsKey( ContentGenerator.CONTENT_GENERATOR_ID ); }
@Override public void setContentGeneratorId( String contentGeneratorId ) { if ( StringUtils.isBlank( contentGeneratorId ) ) { // rempve it from attributes getRepositoryItemAttributes().remove( ContentGenerator.CONTENT_GENERATOR_ID ); } else { // add it to attributes getRepositoryItemAttributes().put( ContentGenerator.CONTENT_GENERATOR_ID, contentGeneratorId ); } }
@Override public String getContentGeneratorId() { if ( isContentGenerated() ) { return getRepositoryItemAttributes().get( ContentGenerator.CONTENT_GENERATOR_ID ); } else { return null; } }
@Override public void upgrade() { super.upgrade(); getRepositoryItemAttributes().setLength( length ); }
public static void storeItem(final Repository repository, final ResourceStoreRequest request, final InputStream in, final String mimeType, final Map<String, String> userAttributes) throws Exception { final DefaultStorageFileItem fItem = new DefaultStorageFileItem(repository, request, true, true, new PreparedContentLocator(in, mimeType, ContentLocator.UNKNOWN_LENGTH)); if (userAttributes != null) { fItem.getRepositoryItemAttributes().putAll(userAttributes); } repository.storeItem(false, fItem); }
public void storeItem( ResourceStoreRequest request, InputStream is, Map<String, String> userAttributes ) throws UnsupportedStorageOperationException, IllegalOperationException, StorageException, AccessDeniedException { if ( !checkConditions( request, getResultingActionOnWrite( request ) ) ) { throw new AccessDeniedException( request, "Operation does not fills needed requirements!" ); } DefaultStorageFileItem fItem = new DefaultStorageFileItem( this, request, true, true, new PreparedContentLocator( is, getMimeSupport().guessMimeTypeFromPath( getMimeRulesSource(), request.getRequestPath() ) ) ); if ( userAttributes != null ) { fItem.getRepositoryItemAttributes().putAll( userAttributes ); } storeItem( false, fItem ); }