*/
private void performLabelOperation(String resourcePath) throws JDOMException, SlideException {
String labelHeader = WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), "UTF-8");
String labeledResourceUri = getResourceUri(resourcePath, labelHeader);
NodeRevisionDescriptors revisionDescriptors =
content.retrieve( slideToken, labeledResourceUri);
NodeRevisionDescriptor revisionDescriptor =
content.retrieve( slideToken, revisionDescriptors);
ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(token, revisionDescriptors, revisionDescriptor);
if (resourceKind instanceof Version) {
if (DeltavConstants.E_REMOVE.equals(operation)) {
PropertyHelper.removeElementFromProperty(revisionDescriptor,
P_LABEL_NAME_SET,
E_LABEL_NAME,
label);
content.store(slideToken, revisionDescriptors.getUri(), revisionDescriptor, null);
}
if (DeltavConstants.E_SET.equals(operation)) {
try {
NodeRevisionDescriptor alreadyLabeledDescriptor =
versioningHelper.retrieveLabeledRevision(revisionDescriptors.getUri(),
label);
PropertyHelper.removeElementFromProperty(alreadyLabeledDescriptor,
P_LABEL_NAME_SET,
E_LABEL_NAME,
label);
content.store(slideToken, revisionDescriptors.getUri(), alreadyLabeledDescriptor, null);
}
catch (LabeledRevisionNotFoundException e) {
// there is no version with the given label so far,
// so we can perform the <set> operation without any preparation
}
}
if (DeltavConstants.E_ADD.equals(operation) ||
DeltavConstants.E_SET.equals(operation) ) {
PropertyHelper.addElementToProperty(revisionDescriptor,
P_LABEL_NAME_SET,
E_LABEL_NAME,
label);
content.store(slideToken, revisionDescriptors.getUri(), revisionDescriptor, null);
}
}
}