use of org.apache.jackrabbit.spi.PropertyId in project jackrabbit by apache.
the class URIResolverImpl method getPropertyId.
/**
* @inheritDoc
*/
public PropertyId getPropertyId(String uri, SessionInfo sessionInfo) throws RepositoryException {
IdURICache cache = getCache(sessionInfo.getWorkspaceName());
ItemId id = cache.getItemId(uri);
if (id != null) {
if (!id.denotesNode()) {
return (PropertyId) id;
}
}
// separate parent uri and property JCRName
String parentUri = Text.getRelativeParent(uri, 1, true);
// make sure propName is unescaped
String propName = Text.unescape(Text.getName(uri, true));
// retrieve parent node id
NodeId parentId = getNodeId(parentUri, sessionInfo, false);
// build property id
try {
Name name = service.getNamePathResolver(sessionInfo).getQName(propName);
PropertyId propertyId = service.getIdFactory().createPropertyId(parentId, name);
cache.add(uri, propertyId);
return propertyId;
} catch (NameException e) {
throw new RepositoryException(e);
}
}
Aggregations