multistatus.appendChild(responseElement);
responseElement.appendChild(hrefElement);
Map<Property, String> setMap = getNodeListAsMap(propsToSet);
Map<Property, String> removeMap = getNodeListAsMap(propsToRemove);
TripleCollection contentGraph = hierarchyNode.getGraph();
for(Map.Entry<Property, String> entry : setMap.entrySet()){
Property property = entry.getKey();
if(property.ns.equalsIgnoreCase(davUri)){
if(protectedProps.contains(property.prop)){
propForbidden.appendChild(responseDoc
.createElementNS(davUri, property.prop));
} else {
UriRef predicate = new UriRef(property.value());
Lock writeLock = hierarchyNode.writeLock();
writeLock.lock();
try {
Iterator<Resource> valIter = hierarchyNode.getObjects(predicate);
replaceProp(subject, predicate, valIter, contentGraph, entry);
} finally {
writeLock.unlock();
}
propOk.appendChild(responseDoc.createElementNS(davUri, property.prop));
}
} else {
UriRef predicate = new UriRef(property.value());
Lock writeLock = hierarchyNode.writeLock();
writeLock.lock();
try {
Iterator<Resource> valIter = hierarchyNode.getObjects(predicate);
replaceProp(subject, predicate, valIter, contentGraph, entry);
} finally {
writeLock.unlock();
}
propOk.appendChild(responseDoc.createElementNS(property.ns, "R:" + property.prop));
}
}
for(Map.Entry<Property, String> entry : removeMap.entrySet()){
Property property = entry.getKey();
if(davProps.contains(property.prop)){
propForbidden.appendChild(responseDoc
.createElementNS(davUri, property.prop));
} else {
UriRef predicate = new UriRef(property.value());
Lock writeLock = hierarchyNode.writeLock();
writeLock.lock();
try {
Iterator<Resource> valIter = hierarchyNode.getObjects(predicate);
Set<Triple> triplesToBeRemoved = new HashSet<Triple>();
while (valIter.hasNext()) {
triplesToBeRemoved.add(new TripleImpl(subject, predicate, valIter.next()));
}
contentGraph.removeAll(triplesToBeRemoved);
} finally {
writeLock.unlock();
}
propOk.appendChild(responseDoc.createElementNS(property.ns, property.prop));