@Test public void testNodetypeString() { final Mapping m = new Mapping("/content:2:nt:file"); assertNotNull("nt:file must match", m.getResourceType("/content/foo1", "nt:file")); assertEquals("foo1", m.getResourceType("/content/foo1", "nt:file")); assertNull(m.getResourceType("/content/foo1", "nt:unstructured")); assertNull(m.getResourceType("/content/foo1", "some:type")); }
String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; }
Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } }
Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(String definition); }
Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(String definition); @Override String toString(); }
Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(String definition); @Override String toString(); static final String DEFAULT_NODE_TYPE; }