Refine search
@Override public void propertyAdded(PropertyState after) throws CommitFailedException { String name = after.getName(); if (JcrConstants.JCR_PRIMARYTYPE.equals(name)) { if (NT_REP_CUG_POLICY.equals(after.getValue(Type.STRING)) && !REP_CUG_POLICY.equals(parentName)) { throw accessViolation(23, "Attempt create Cug node with different name than 'rep:cugPolicy'."); } } }
@Override public void propertyChanged(PropertyState before, PropertyState after) throws CommitFailedException { String name = after.getName(); if (JcrConstants.JCR_PRIMARYTYPE.equals(name)) { if (NT_REP_CUG_POLICY.equals(before.getValue(Type.STRING)) || NT_REP_CUG_POLICY.equals(after.getValue(Type.STRING))) { throw accessViolation(20, "Attempt to change primary type of/to CUG policy."); } } }
@Override public void propertyAdded(PropertyState after) throws CommitFailedException { String name = after.getName(); if (JcrConstants.JCR_PRIMARYTYPE.equals(name)) { if (NT_REP_CUG_POLICY.equals(after.getValue(Type.STRING)) && !REP_CUG_POLICY.equals(parentName)) { throw accessViolation(23, "Attempt create Cug node with different name than 'rep:cugPolicy'."); } } }
@Override public void propertyChanged(PropertyState before, PropertyState after) throws CommitFailedException { String name = after.getName(); if (JcrConstants.JCR_PRIMARYTYPE.equals(name)) { if (NT_REP_CUG_POLICY.equals(before.getValue(Type.STRING)) || NT_REP_CUG_POLICY.equals(after.getValue(Type.STRING))) { throw accessViolation(20, "Attempt to change primary type of/to CUG policy."); } } }
private static int getMaxCount(NodeBuilder node, boolean added) { long max = 0; for (PropertyState p : node.getProperties()) { if (!p.getName().startsWith(COUNT_PROPERTY_PREFIX)) { continue; } long x = p.getValue(Type.LONG); if (added == x > 0) { max = Math.max(max, Math.abs(x)); } } max = Math.min(Integer.MAX_VALUE, max); return (int) max; }
private static int getMaxCount(NodeBuilder node, boolean added) { long max = 0; for (PropertyState p : node.getProperties()) { if (!p.getName().startsWith(COUNT_PROPERTY_PREFIX)) { continue; } long x = p.getValue(Type.LONG); if (added == x > 0) { max = Math.max(max, Math.abs(x)); } } max = Math.min(Integer.MAX_VALUE, max); return (int) max; }
private static int getMaxCount(NodeBuilder node, boolean added) { long max = 0; for (PropertyState p : node.getProperties()) { if (!p.getName().startsWith(COUNT_PROPERTY_PREFIX)) { continue; } long x = p.getValue(Type.LONG); if (added == x > 0) { max = Math.max(max, Math.abs(x)); } } max = Math.min(Integer.MAX_VALUE, max); return (int) max; }
@Override public void propertyChanged(final PropertyState before, final PropertyState after) throws CommitFailedException { if (JCR_PRIMARYTYPE.equals(after.getName())) { String nodeType = after.getValue(Type.STRING); LOG.debug("Found {}/jcr:primaryType = {}", path, nodeType); if (!nodeType.equals(NT_REP_AUTHORIZABLE_FOLDER) && expectAuthorizableFolder(path)) { LOG.info("Changed {}/jcr:primaryType from {} to {}", path, nodeType, NT_REP_AUTHORIZABLE_FOLDER); currentBuilder.setProperty(JCR_PRIMARYTYPE, NT_REP_AUTHORIZABLE_FOLDER, Type.NAME); } } }
private PropertyState processBinary(PropertyState property) { Type<?> type = property.getType(); if (type == BINARY) { processBinary(property.getValue(Type.BINARY), property.getName()); } else if (type == BINARIES) { for (Blob blob : property.getValue(BINARIES)) { processBinary(blob, property.getName()); } } return property; }
@Override public void propertyChanged(final PropertyState before, final PropertyState after) throws CommitFailedException { if (JCR_PRIMARYTYPE.equals(after.getName())) { String nodeType = after.getValue(Type.STRING); LOG.debug("Found {}/jcr:primaryType = {}", path, nodeType); if (!nodeType.equals(NT_REP_AUTHORIZABLE_FOLDER) && expectAuthorizableFolder(path)) { LOG.info("Changed {}/jcr:primaryType from {} to {}", path, nodeType, NT_REP_AUTHORIZABLE_FOLDER); currentBuilder.setProperty(JCR_PRIMARYTYPE, NT_REP_AUTHORIZABLE_FOLDER, Type.NAME); } } }
private PropertyState binaryCheck(PropertyState property) { Type<?> type = property.getType(); if (type == BINARY) { binaryCheck(property.getValue(Type.BINARY), property.getName()); } else if (type == BINARIES) { for (Blob blob : property.getValue(BINARIES)) { binaryCheck(blob, property.getName()); } } return property; }
@NotNull private Iterable<String> getVersionLabels(@NotNull String historyRelPath, @NotNull String versionId) throws CommitFailedException { List<String> labels = new ArrayList<String>(); NodeBuilder labelNode = getVersionLabelsFor(historyRelPath); for (PropertyState ps : labelNode.getProperties()) { if (Type.REFERENCE == ps.getType()) { if (versionId.equals(ps.getValue(Type.REFERENCE))) { labels.add(ps.getName()); } } } return labels; }
@Nonnull private Iterable<String> getVersionLabels(@Nonnull String historyRelPath, @Nonnull String versionId) throws CommitFailedException { List<String> labels = new ArrayList<String>(); NodeBuilder labelNode = getVersionLabelsFor(historyRelPath); for (PropertyState ps : labelNode.getProperties()) { if (Type.REFERENCE == ps.getType()) { if (versionId.equals(ps.getValue(Type.REFERENCE))) { labels.add(ps.getName()); } } } return labels; }
@NotNull private Iterable<String> getVersionLabels(@NotNull String historyRelPath, @NotNull String versionId) throws CommitFailedException { List<String> labels = new ArrayList<String>(); NodeBuilder labelNode = getVersionLabelsFor(historyRelPath); for (PropertyState ps : labelNode.getProperties()) { if (Type.REFERENCE == ps.getType()) { if (versionId.equals(ps.getValue(Type.REFERENCE))) { labels.add(ps.getName()); } } } return labels; }
private static void merge(NodeBuilder parent, PropertyState ours, PropertyState theirs) { Calendar o = parse(ours.getValue(Type.DATE)); Calendar t = parse(theirs.getValue(Type.DATE)); if (JCR_CREATED.equals(ours.getName())) { parent.setProperty(ours.getName(), pick(o, t, true)); } else { parent.setProperty(ours.getName(), pick(o, t, false)); } }
private static String toString(PropertyState ps) { StringBuilder val = new StringBuilder(); val.append(ps.getName()).append("<").append(ps.getType()).append(">"); if (ps.getType() == BINARY) { String v = BLOB_LENGTH.apply(ps.getValue(BINARY)); val.append(" = {").append(v).append("}"); } else if (ps.getType() == BINARIES) { String v = transform(ps.getValue(BINARIES), BLOB_LENGTH).toString(); val.append("[").append(ps.count()).append("] = ").append(v); } else if (ps.isArray()) { val.append("[").append(ps.count()).append("] = ").append(ps.getValue(STRINGS)); } else { val.append(" = ").append(ps.getValue(STRING)); } return ps.getName() + "<" + ps.getType() + ">" + val.toString(); }
@NotNull public Iterable<String> getVersionLabels(@NotNull String identifier) throws RepositoryException { checkNotNull(identifier); Tree versionLabels = getVersionLabelsTree(); List<String> labels = new ArrayList<String>(); for (PropertyState p : versionLabels.getProperties()) { if (p.getType() == Type.REFERENCE && identifier.equals(p.getValue(Type.REFERENCE))) { labels.add(p.getName()); } } return labels; }
@NotNull public Iterable<String> getVersionLabels(@NotNull String identifier) throws RepositoryException { checkNotNull(identifier); Tree versionLabels = getVersionLabelsTree(); List<String> labels = new ArrayList<String>(); for (PropertyState p : versionLabels.getProperties()) { if (p.getType() == Type.REFERENCE && identifier.equals(p.getValue(Type.REFERENCE))) { labels.add(p.getName()); } } return labels; }