@Test public void testGetCorrelatedWildcardPrefix() { assertEquals("", getCorrelatedWildcardPrefix("foo")); assertEquals("", getCorrelatedWildcardPrefix("foo:bar")); assertEquals("", getCorrelatedWildcardPrefix("foo/bar")); assertEquals("", getCorrelatedWildcardPrefix("foobar")); assertEquals("", getCorrelatedWildcardPrefix("foobaz")); assertEquals("foo/*123", getCorrelatedWildcardPrefix("foo/*123/bar/*456/baz")); assertEquals("ecm:acp/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/name")); assertEquals("ecm:acp/*1/acl/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/principal")); assertEquals("ecm:acp/*1/acl/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/permission")); assertEquals("ecm:acp/*1/acl/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/grant")); assertEquals("ecm:acp/*1/acl/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/creator")); assertEquals("ecm:acp/*1/acl/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/begin")); assertEquals("ecm:acp/*1/acl/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/end")); assertEquals("ecm:acp/*1/acl/*1", getCorrelatedWildcardPrefix("ecm:acl/*1/status")); }
@Override public String getCorrelatedWildcardPrefix(String name) { if (name.startsWith(NXQL.ECM_TAG)) { if (name.equals(NXQL.ECM_TAG)) { return CORRELATED_ECM_TAG_IMPLICIT; } else if (CORRELATED_ECM_TAG.matcher(name).matches()) { return name; } else { return ""; } } Matcher m = CORRELATED_WILDCARD_SPLIT.matcher(name); if (!m.matches()) { return ""; } String start = m.group(2); String wildcard = m.group(3); String end = m.group(4); if (start.equals(NXQL.ECM_ACL)) { if (end.equals(NXQL.ECM_ACL_NAME)) { return KEY_ACP + '/' + wildcard; } else { return KEY_ACP + '/' + wildcard + '/' + KEY_ACL + '/' + wildcard; } } else { return m.group(1); } }
DBSQueryOptimizer extends QueryOptimizer { @Override public String getCorrelatedWildcardPrefix(String name) { if (name.startsWith(NXQL.ECM_TAG)) { if (name.equals(NXQL.ECM_TAG)) { return CORRELATED_ECM_TAG_IMPLICIT; } else if (CORRELATED_ECM_TAG.matcher(name).matches()) { return name; } else { return ""; } } Matcher m = CORRELATED_WILDCARD_SPLIT.matcher(name); if (!m.matches()) { return ""; } String start = m.group(2); String wildcard = m.group(3); String end = m.group(4); if (start.equals(NXQL.ECM_ACL)) { if (end.equals(NXQL.ECM_ACL_NAME)) { return KEY_ACP + '/' + wildcard; } else { return KEY_ACP + '/' + wildcard + '/' + KEY_ACL + '/' + wildcard; } } else { return m.group(1); } } }
DBSQueryOptimizer extends QueryOptimizer { @Override public String getCorrelatedWildcardPrefix(String name) { if (name.startsWith(NXQL.ECM_TAG)) { if (name.equals(NXQL.ECM_TAG)) { return CORRELATED_ECM_TAG_IMPLICIT; } else if (CORRELATED_ECM_TAG.matcher(name).matches()) { return name; } else { return ""; } } Matcher m = CORRELATED_WILDCARD_SPLIT.matcher(name); if (!m.matches()) { return ""; } String start = m.group(2); String wildcard = m.group(3); String end = m.group(4); if (start.equals(NXQL.ECM_ACL)) { if (end.equals(NXQL.ECM_ACL_NAME)) { return KEY_ACP + '/' + wildcard; } else { return KEY_ACP + '/' + wildcard + '/' + KEY_ACL + '/' + wildcard; } } else { return m.group(1); } }  }
DBSQueryOptimizer extends QueryOptimizer { @Override public String getCorrelatedWildcardPrefix(String name) { if (name.startsWith(NXQL.ECM_TAG)) { if (name.equals(NXQL.ECM_TAG)) { return CORRELATED_ECM_TAG_IMPLICIT; } else if (CORRELATED_ECM_TAG.matcher(name).matches()) { return name; } else { return ""; } } Matcher m = CORRELATED_WILDCARD_SPLIT.matcher(name); if (!m.matches()) { return ""; } String start = m.group(2); String wildcard = m.group(3); String end = m.group(4); if (start.equals(NXQL.ECM_ACL)) { if (end.equals(NXQL.ECM_ACL_NAME)) { return KEY_ACP + '/' + wildcard; } else { return KEY_ACP + '/' + wildcard + '/' + KEY_ACL + '/' + wildcard; } } else { return m.group(1); } }  @Override String getCorrelatedWildcardPrefix(String name); }
DBSQueryOptimizer extends QueryOptimizer { @Override public String getCorrelatedWildcardPrefix(String name) { if (name.startsWith(NXQL.ECM_TAG)) { if (name.equals(NXQL.ECM_TAG)) { return CORRELATED_ECM_TAG_IMPLICIT; } else if (CORRELATED_ECM_TAG.matcher(name).matches()) { return name; } else { return ""; } } Matcher m = CORRELATED_WILDCARD_SPLIT.matcher(name); if (!m.matches()) { return ""; } String start = m.group(2); String wildcard = m.group(3); String end = m.group(4); if (start.equals(NXQL.ECM_ACL)) { if (end.equals(NXQL.ECM_ACL_NAME)) { return KEY_ACP + '/' + wildcard; } else { return KEY_ACP + '/' + wildcard + '/' + KEY_ACL + '/' + wildcard; } } else { return m.group(1); } }  @Override String getCorrelatedWildcardPrefix(String name);  }