@Override public boolean hasVersionLabel( String label ) throws RepositoryException { return versionLabels().hasProperty(label); }
@Override public boolean hasVersionLabel( String label ) throws RepositoryException { return versionLabels().hasProperty(label); }
@SuppressWarnings( "deprecation" ) private void removeVersionFromMergeFailedProperty( AbstractJcrNode targetNode, Version version ) throws RepositoryException { if (!targetNode.hasProperty(JcrLexicon.MERGE_FAILED)) { throw new VersionException(JcrI18n.versionNotInMergeFailed.text(version.getName(), targetNode.getPath())); } AbstractJcrProperty prop = targetNode.getProperty(JcrLexicon.MERGE_FAILED); Value[] values = prop.getValues(); List<Value> newValues = new ArrayList<Value>(); String uuidString = version.getUUID(); int matchIndex = -1; for (int i = 0; i < values.length; i++) { if (uuidString.equals(values[i].getString())) { matchIndex = i; } else { newValues.add(values[i]); } } if (matchIndex == -1) { throw new VersionException(JcrI18n.versionNotInMergeFailed.text(version.getName(), targetNode.getPath())); } if (newValues.isEmpty()) { // remove the property without looking at the node's "checked out" status targetNode.removeProperty(prop); } else { ((JcrMultiValueProperty)prop).internalSetValue(newValues.toArray(new Value[newValues.size()])); } }
@SuppressWarnings( "deprecation" ) private void removeVersionFromMergeFailedProperty( AbstractJcrNode targetNode, Version version ) throws RepositoryException { if (!targetNode.hasProperty(JcrLexicon.MERGE_FAILED)) { throw new VersionException(JcrI18n.versionNotInMergeFailed.text(version.getName(), targetNode.getPath())); } AbstractJcrProperty prop = targetNode.getProperty(JcrLexicon.MERGE_FAILED); Value[] values = prop.getValues(); List<Value> newValues = new ArrayList<Value>(); String uuidString = version.getUUID(); int matchIndex = -1; for (int i = 0; i < values.length; i++) { if (uuidString.equals(values[i].getString())) { matchIndex = i; } else { newValues.add(values[i]); } } if (matchIndex == -1) { throw new VersionException(JcrI18n.versionNotInMergeFailed.text(version.getName(), targetNode.getPath())); } if (newValues.isEmpty()) { // remove the property without looking at the node's "checked out" status targetNode.removeProperty(prop); } else { ((JcrMultiValueProperty)prop).internalSetValue(newValues.toArray(new Value[newValues.size()])); } }
if (targetNode.hasProperty(JcrLexicon.MERGE_FAILED)) { JcrValue[] existingValues = targetNode.getProperty(JcrLexicon.MERGE_FAILED).getValues();
if (targetNode.hasProperty(JcrLexicon.MERGE_FAILED)) { JcrValue[] existingValues = targetNode.getProperty(JcrLexicon.MERGE_FAILED).getValues();
@Override public JcrVersionNode getBaseVersion() throws UnsupportedRepositoryOperationException, RepositoryException { checkSession(); if (!hasProperty(JcrLexicon.BASE_VERSION)) { throw new UnsupportedRepositoryOperationException(JcrI18n.requiresVersionable.text()); } NodeKey baseVersionKey = ((NodeKeyReference)getProperty(JcrLexicon.BASE_VERSION).getValue().value()).getNodeKey(); try { return (JcrVersionNode)session().node(baseVersionKey, null); } catch (NodeNotFoundInParentException | ItemNotFoundException e) { // this should only happen if multiple threads are performing non-atomic checkin/checkout flows on the same node // see MODE-2418 throw new VersionException(JcrI18n.cannotLocateBaseVersion.text(baseVersionKey, getPath()), e); } }
@Override public JcrVersionNode getBaseVersion() throws UnsupportedRepositoryOperationException, RepositoryException { checkSession(); if (!hasProperty(JcrLexicon.BASE_VERSION)) { throw new UnsupportedRepositoryOperationException(JcrI18n.requiresVersionable.text()); } NodeKey baseVersionKey = ((NodeKeyReference)getProperty(JcrLexicon.BASE_VERSION).getValue().value()).getNodeKey(); try { return (JcrVersionNode)session().node(baseVersionKey, null); } catch (NodeNotFoundInParentException | ItemNotFoundException e) { // this should only happen if multiple threads are performing non-atomic checkin/checkout flows on the same node // see MODE-2418 throw new VersionException(JcrI18n.cannotLocateBaseVersion.text(baseVersionKey, getPath()), e); } }
assertFalse(session.getNode("/record").hasProperty("111")); assertFalse(session.getNode("/record").hasProperty("222")); assertTrue(session.getNode("/record").hasProperty("111")); assertTrue(session.getNode("/record").hasProperty("222")); assertEquals("111", session.getNode("/record").getProperty("111").getString()); assertEquals("222", session.getNode("/record").getProperty("222").getString());
if (!node.hasProperty(JcrLexicon.BASE_VERSION)) {
if (!node.hasProperty(JcrLexicon.BASE_VERSION)) {
if (!referencedNode.hasProperty(propertyName)) { String readablePath = path.getString(namespaces()); String workspaceName = session().workspaceName();
if (!referencedNode.hasProperty(propertyName)) { String readablePath = path.getString(namespaces()); String workspaceName = session().workspaceName();