All pastes #447003 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-18 19:50 UTC
rendered paste body
    /**
     * Return an Info type class describing the Asset, Collection or Folder
     * pointed to by the path parameter. 
     * @param path A String representing a name based path to an Asset, Collection or Folder in EMS.
     * @return An Object that is either an instance of AssetInfo or WorkspaceOnfo. 
     */
	public Object getItemAtPath(String path) {
		if(path.equals("/" + this.rootCollectionInfo.getName()))
			return this.rootCollectionInfo;
		
		Object item = null;
		String[] paths = path.split("/");
		String wsUuid = this.rootCollectionInfo.getUuid();
		
		for(int i = 2; i < paths.length; i++) {
			item = getItemByName(wsUuid, paths[i]);
			if((item != null) && (item instanceof WorkspaceInfo))
				wsUuid = ((WorkspaceInfo)item).getUuid();
			else
				return item;
		}
		return item;
	}