public TreeResource(Resource resource) { this.name = resource.getName(); this.parentName = resource.getParentName(); this.uri = resource.getURI(); }
public Map<String, Resource> indexResources(String rootURI) { String entity = get(uri(rootURI)); Map<String, Resource> index = createIndexFromEntity(rootURI, entity); addBreadcrumbs(index); return index; }
public Map<String, Resource> indexResources(String rootURI, String rootPath, String syntax, String includes) { Map<String, Resource> index = createIndexFromPaths(rootURI, rootPath, syntax, includes); addBreadcrumbs(index); return index; }
private void collectBreadcrumbs(List<String> breadcrumbs, Resource resource, Map<String, Resource> index) { if (resource.hasParent()) { String parentName = resource.getParentName(); breadcrumbs.add(0, parentName); Resource parent = index.get(parentName); if (parent != null) { collectBreadcrumbs(breadcrumbs, parent, index); } } }
protected void addBreadcrumbs(Map<String, Resource> index) { for (Resource resource : index.values()) { List<String> breadcrumbs = new ArrayList<>(); collectBreadcrumbs(breadcrumbs, resource, index); resource.setBreadcrumbs(breadcrumbs); } }
public LoadFromConfluence(String username, String password) { this(new RESTClient(Type.XML, username, password)); }
public IndexFromXWiki(String username, String password) { this(username, password, new ToLowerCase()); }
private String get(String uri) { return client.get(uri); }
protected String entity(Resource resource, Type type) { return resource.getContent(); }
private void put(String uri, String entity) { client.put(uri, entity); }
protected String resolveName(String input){ return nameResolver.resolve(input); }
public UploadToREST(Type type, String username, String password) { this.client = new RESTClient(type, username, password); }
public IndexFromRedmine(String username, String password) { this(username, password, new ToLowerCase()); }
private String get(String uri) { return client.get(uri); }
public IndexFromRedmine(String username, String password, ResourceNameResolver nameResolver) { super(new RESTClient(Type.JSON, username, password), nameResolver); }
public LoadFromREST(Type type, String username, String password) { this.client = new RESTClient(type, username, password); }
public IndexFromConfluence(String username, String password) { this(new RESTClient(Type.XML, username, password)); }
public IndexFromXWiki(String username, String password, ResourceNameResolver nameResolver) { super(new RESTClient(Type.JSON, username, password), nameResolver); }