Refine search
protected String toSafeName(String key) { return ISO9075.encode(Text.escapeIllegalJcrChars(key)); }
private String decode(String input) { return ISO9075.decode(input); //XML names cannot begin e.g. the character "0", but it's not a problem in YAML } }
/** * encode handle for a JackRabbit search * @param handle the page handle * @return handle encoded ISO9075 */ public static String encodeISO9075(String handle) { return ISO9075.encodePath(handle); }
String pName = ISO9075.encode(session.getJCRName(ACLTemplate.P_NODE_PATH)); int ancestorCnt = absPath.getAncestorCount(); stmt.append(")["); for (int i = 0; i <= ancestorCnt; i++) { String path = Text.getRelativeParent(jcrPath, i); if (i > 0) { stmt.append(" or "); for (NodeIterator it = result.getNodes(); it.hasNext();) { Node aceNode = it.nextNode(); String accessControlledNodePath = Text.getRelativeParent(aceNode.getPath(), 2); Path acPath = session.getQPath(accessControlledNodePath);
public String encode(String name) { return ISO9075.encode(name); }
/** * Encodes <code>path</code> as specified in ISO 9075. Please note that * the character '<code>[</code>' is not encoded but rather interpreted as * the start of an index in a path segment. * * @param path the <code>String</code> to encode. * @return the encoded <code>String</code>. */ public static String encodePath(String path) { String[] names = Text.explode(path, '/', true); StringBuffer encoded = new StringBuffer(path.length()); for (int i = 0; i < names.length; i++) { // detect index String index = null; int idx = names[i].indexOf('['); if (idx != -1) { index = names[i].substring(idx); names[i] = names[i].substring(0, idx); } encoded.append(encode(names[i])); if (index != null) { encoded.append(index); } if (i < names.length - 1) { encoded.append('/'); } } return encoded.toString(); }
buffer.append("."); } else { buffer.append(ISO9075.encodePath(commonPathPrefix)); String[] parts = Text.explode(property, '/'); if (commonPathPrefix != null) { buffer.append(ISO9075.encodePath(commonPathPrefix)); buffer.append("/"); buffer.append(ISO9075.encode( resolvePropertyName(parts[i]))); buffer.append(ISO9075.encode( resolveChildNodeName(parts[i])));
/** * Write the name and updated the namespace declarations if needed. * * @param name name to write * @throws IOException if an I/O error occurs */ private void writeJcrName(String name) throws IOException { if (name == null) { return; } String prefix = Text.getNamespacePrefix(name); if (!prefix.equals(NamespaceRegistry.PREFIX_EMPTY)) { // update namespace declaration writeNamespaceDeclaration(prefix); prefix += ":"; } String localName = Text.getLocalName(name); String encLocalName = (ANY.equals(localName)) ? ANY : ISO9075.encode(Text.getLocalName(name)); String resolvedName = prefix + encLocalName; // check for '-' and '+' boolean quotesNeeded = (name.indexOf('-') >= 0 || name.indexOf('+') >= 0); if (quotesNeeded) { out.write("'"); out.write(resolvedName); out.write("'"); } else { out.write(resolvedName); } }
if (needsEscaping(name, i)) { encode('_', encoded); } else { encoded.append(name.charAt(i)); encode(name.charAt(i), encoded); encode(name.charAt(i), encoded); } else { if (needsEscaping(name, i)) { encode('_', encoded); } else { encoded.append(name.charAt(i));
/** * * @param encodedFileName * @param useMultiByte * @return */ public static String fileNameDecode( String encodedFileName, boolean useMultiByte ) { if ( useMultiByte ) { return Text.unescapeIllegalJcrChars( ISO9075.decode( encodedFileName ) ); } else { return Text.unescapeIllegalJcrChars( encodedFileName ); } }
path = value; pathConstraint = ISO9075.encodePath(path) + "//*"; } else if (property.equals(TYPE)) { String[] nts = Text.explode(value, ','); if (nts.length > 0) { for (String nt : nts) {
final String path = ISO9075.encodePath(name); try { if ( node.hasProperty(path) ) { if ( name.charAt(pos) == '/' ) { if ( lastPos + 1 < pos ) { sb.append(Text.escapeIllegalJcrChars(name.substring(lastPos + 1, pos))); sb.append(Text.escapeIllegalJcrChars(name.substring(lastPos + 1))); final String oldKey = ISO9075.encodePath(name); if (node.hasProperty(oldKey)) { final Property prop = node.getProperty(oldKey);
String pName = ISO9075.encode(session.getJCRName(ACLTemplate.P_NODE_PATH)); int ancestorCnt = absPath.getAncestorCount(); stmt.append(")["); for (int i = 0; i <= ancestorCnt; i++) { String path = Text.getRelativeParent(jcrPath, i); if (i > 0) { stmt.append(" or "); for (NodeIterator it = result.getNodes(); it.hasNext();) { Node aceNode = it.nextNode(); String accessControlledNodePath = Text.getRelativeParent(aceNode.getPath(), 2); Path acPath = session.getQPath(accessControlledNodePath);
public String encode(char c) { return ISO9075.encode(Character.toString(c)); }
/** * Encodes <code>path</code> as specified in ISO 9075. Please note that * the character '<code>[</code>' is not encoded but rather interpreted as * the start of an index in a path segment. * * @param path the <code>String</code> to encode. * @return the encoded <code>String</code>. */ public static String encodePath(String path) { String[] names = Text.explode(path, '/', true); StringBuffer encoded = new StringBuffer(path.length()); for (int i = 0; i < names.length; i++) { // detect index String index = null; int idx = names[i].indexOf('['); if (idx != -1) { index = names[i].substring(idx); names[i] = names[i].substring(0, idx); } encoded.append(encode(names[i])); if (index != null) { encoded.append(index); } if (i < names.length - 1) { encoded.append('/'); } } return encoded.toString(); }
buffer.append("."); } else { buffer.append(ISO9075.encodePath(commonPathPrefix)); String[] parts = Text.explode(property, '/'); if (commonPathPrefix != null) { buffer.append(ISO9075.encodePath(commonPathPrefix)); buffer.append("/"); buffer.append(ISO9075.encode( resolvePropertyName(parts[i]))); buffer.append(ISO9075.encode( resolveChildNodeName(parts[i])));
/** * Write the name and updated the namespace declarations if needed. * * @param name name to write * @throws IOException if an I/O error occurs */ private void writeJcrName(String name) throws IOException { if (name == null) { return; } String prefix = Text.getNamespacePrefix(name); if (!prefix.equals(NamespaceRegistry.PREFIX_EMPTY)) { // update namespace declaration writeNamespaceDeclaration(prefix); prefix += ":"; } String localName = Text.getLocalName(name); String encLocalName = (ANY.equals(localName)) ? ANY : ISO9075.encode(Text.getLocalName(name)); String resolvedName = prefix + encLocalName; // check for '-' and '+' boolean quotesNeeded = (name.indexOf('-') >= 0 || name.indexOf('+') >= 0); if (quotesNeeded) { out.write("'"); out.write(resolvedName); out.write("'"); } else { out.write(resolvedName); } }
if (needsEscaping(name, i)) { encode('_', encoded); } else { encoded.append(name.charAt(i)); encode(name.charAt(i), encoded); encode(name.charAt(i), encoded); } else { if (needsEscaping(name, i)) { encode('_', encoded); } else { encoded.append(name.charAt(i));