convert method
Converts input
and returns the result of the conversion.
Implementation
@override
ActiveLock<O>? convert(XmlElement input) {
final lockScopeNode = input.getElement(WebDavElementNames.lockscope,
namespace: input.namespaceUri);
final lockTypeNode = input.getElement(WebDavElementNames.locktype,
namespace: input.namespaceUri);
final depthNode = input.getElement(WebDavElementNames.depth,
namespace: input.namespaceUri);
final ownerNode = input.getElement(WebDavElementNames.owner,
namespace: input.namespaceUri);
final timeoutNode = input.getElement(WebDavElementNames.timeout,
namespace: input.namespaceUri);
final lockTokenNode = input.getElement(WebDavElementNames.locktoken,
namespace: input.namespaceUri);
final lockRootNode = input.getElement(WebDavElementNames.lockroot,
namespace: input.namespaceUri);
if (!(lockScopeNode != null && lockTypeNode != null && depthNode != null)) {
return null;
}
final lockScope = lockScopeParser.convert(lockScopeNode);
if (lockScope == null) {
throw WebDavParserDataError("Can't parse ${WebDavElementNames.lockscope}",
data: input);
}
final depth = depthParser.convert(depthNode);
if (depth == null) {
throw WebDavParserDataError("Can't parse ${WebDavElementNames.depth}",
data: input);
}
return ActiveLock(
lockScope: lockScope,
isWriteLock: lockTypeParser.convert(lockTypeNode) ?? false,
depth: depth,
owner: ownerNode != null ? ownerParser?.convert(ownerNode) : null,
timeout: timeoutNode != null ? timeoutParser?.convert(timeoutNode) : null,
lockToken: lockTokenNode != null
? lockTokenParser?.convert(lockTokenNode)
: null,
lockRoot:
lockRootNode != null ? lockRootParser.convert(lockRootNode) : null,
);
}