protected StorageItem retrieveVirtualPath( ResourceStoreRequest request, RequestRoute route ) throws ItemNotFoundException { ResourceStoreRequest req = new ResourceStoreRequest( route.getOriginalRequestPath() ); DefaultStorageCollectionItem result = new DefaultStorageCollectionItem( this, req, true, false ); result.getItemContext().putAll( request.getRequestContext() ); return result; }
public Collection<StorageItem> list() throws AccessDeniedException, NoSuchResourceStoreException, IllegalOperationException, ItemNotFoundException, StorageException { if ( isVirtual() ) { return getStore().list( getResourceStoreRequest() ); } else { Repository repo = getRepositoryItemUid().getRepository(); Collection<StorageItem> result = repo.list( false, this ); correctPaths( result ); return result; } }
/** * This method "normalizes" the paths back to the "level" from where the original item was requested. * * @param list */ protected void correctPaths( Collection<StorageItem> list ) { for ( StorageItem item : list ) { if ( getPath().endsWith( RepositoryItemUid.PATH_SEPARATOR ) ) { ( (AbstractStorageItem) item ).setPath( getPath() + item.getName() ); } else { ( (AbstractStorageItem) item ).setPath( getPath() + RepositoryItemUid.PATH_SEPARATOR + item.getName() ); } } }
public void createCollection( ResourceStoreRequest request, Map<String, String> userAttributes ) throws UnsupportedStorageOperationException, IllegalOperationException, StorageException, AccessDeniedException { if ( !checkConditions( request, getResultingActionOnWrite( request ) ) ) { throw new AccessDeniedException( request, "Operation does not fills needed requirements!" ); } DefaultStorageCollectionItem coll = new DefaultStorageCollectionItem( this, request, true, true ); if ( userAttributes != null ) { coll.getRepositoryItemAttributes().putAll( userAttributes ); } storeItem( false, coll ); }
new DefaultStorageCollectionItem( repository, request, target.canRead(), target.canWrite() ); coll.setModified( target.lastModified() ); coll.setCreated( target.lastModified() ); result = coll;
item = new DefaultStorageCollectionItem( this, request, true, false );
@SuppressWarnings("deprecation") @Override public Collection<StorageItem> list() throws AccessDeniedException, NoSuchResourceStoreException, IllegalOperationException, StorageException { Collection<StorageItem> result; try { result = super.list(); } catch (ItemNotFoundException e) { result = new LinkedList<>(); } Set<String> items = new TreeSet<>(Arrays.asList(dir.getItems())); for (StorageItem i : result) { items.remove(i.getName()); items.remove(i.getName() + "/"); } for (String item : items) { if (!item.endsWith("/")) { result.add(new DirectoryItemStorageItem(repository, dir.storagePath() + "/" + item)); } } return result; } }
@Override public StorageItem call() throws ItemNotFoundException, IllegalOperationException, IOException, AccessDeniedException { final ResourceStoreRequest newreq = new ResourceStoreRequest( getRequest() ); newreq.setRequestLocalOnly( getRequest().isRequestLocalOnly() ); newreq.setRequestRemoteOnly( getRequest().isRequestRemoteOnly() ); StorageItem item = getRepository().retrieveItem( newreq ); getRequest().addProcessedRepository( getRepository() ); if ( item instanceof StorageCollectionItem ) { item = new DefaultStorageCollectionItem( groupRepository, newreq, true, false ); } return item; }
new DefaultStorageCollectionItem( this, req, true, false ); repositories.getItemContext().putAll( request.getRequestContext() ); repoItem = new DefaultStorageCollectionItem( this, req, true, false ); repoItem.getItemContext().putAll( request.getRequestContext() );