use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class VersionManagerImpl method resolveMergeConflict.
public void resolveMergeConflict(NodeState nodeState, NodeState versionState, boolean done) throws RepositoryException {
NodeId vId = versionState.getNodeId();
PropertyState mergeFailedState = nodeState.getPropertyState(NameConstants.JCR_MERGEFAILED);
QValue[] vs = mergeFailedState.getValues();
NodeId[] mergeFailedIds = new NodeId[vs.length - 1];
for (int i = 0, j = 0; i < vs.length; i++) {
NodeId id = workspaceManager.getIdFactory().createNodeId(vs[i].getString());
if (!id.equals(vId)) {
mergeFailedIds[j] = id;
j++;
}
// else: the version id is being solved by this call and not
// part of 'jcr:mergefailed' any more
}
PropertyState predecessorState = nodeState.getPropertyState(NameConstants.JCR_PREDECESSORS);
vs = predecessorState.getValues();
int noOfPredecessors = (done) ? vs.length + 1 : vs.length;
NodeId[] predecessorIds = new NodeId[noOfPredecessors];
int i = 0;
while (i < vs.length) {
predecessorIds[i] = workspaceManager.getIdFactory().createNodeId(vs[i].getString());
i++;
}
if (done) {
predecessorIds[i] = vId;
}
Operation op = ResolveMergeConflict.create(nodeState, mergeFailedIds, predecessorIds, done);
workspaceManager.execute(op);
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class BinaryTest method testBinaryTwiceNewProperty.
public void testBinaryTwiceNewProperty() throws Exception {
Node test = testRootNode.addNode("test");
Property p = test.setProperty("prop", generateValue());
QValue qv1 = getQValue(p);
test.setProperty("prop", generateValue());
QValue qv2 = getQValue(p);
assertFalse(qv1.equals(qv2));
superuser.save();
assertEquals(qv2, getQValue(p));
assertDisposed(qv1);
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class BinaryTest method testRevertSettingExistingBinary.
public void testRevertSettingExistingBinary() throws Exception {
Node test = testRootNode.addNode("test");
Binary b = superuser.getValueFactory().createBinary(generateValue());
Property p = test.setProperty("prop", b);
QValue qv1 = getQValue(p);
superuser.save();
Binary b2 = superuser.getValueFactory().createBinary(generateValue());
test.setProperty("prop", b2);
QValue qv2 = getQValue(p);
assertFalse(qv1.equals(qv2));
superuser.refresh(false);
assertEquals(qv1, getQValue(p));
assertSame(qv1, getQValue(p));
assertFalse(qv2.equals(getQValue(p)));
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueFactoryLogger method create.
public QValue create(final InputStream value) throws RepositoryException, IOException {
final String methodName = "create(InputStream)";
final Object[] args = new Object[] { value };
final IOException[] ex = new IOException[1];
QValue result = (QValue) execute(new Callable() {
public Object call() throws RepositoryException {
try {
return qValueFactory.create(value);
} catch (IOException e) {
ex[0] = e;
return null;
}
}
}, methodName, args);
if (ex[0] != null) {
throw ex[0];
}
return result;
}
use of org.apache.jackrabbit.spi.QValue in project jackrabbit by apache.
the class QValueFactoryLogger method create.
public QValue create(final File value) throws RepositoryException, IOException {
final String methodName = "create(File)";
final Object[] args = new Object[] { value };
final IOException[] ex = new IOException[1];
QValue result = (QValue) execute(new Callable() {
public Object call() throws RepositoryException {
try {
return qValueFactory.create(value);
} catch (IOException e) {
ex[0] = e;
return null;
}
}
}, methodName, args);
if (ex[0] != null) {
throw ex[0];
}
return result;
}
Aggregations