use of org.apache.jackrabbit.spi.PropertyInfo in project jackrabbit by apache.
the class BatchTest method testSetPathValue.
public void testSetPathValue() throws RepositoryException {
NodeId nid = getNodeId(testPath);
Name propName = resolver.getQName("pathProp");
QValue v = rs.getQValueFactory().create(resolver.getQPath(testPath));
Batch b = rs.createBatch(si, nid);
b.addProperty(nid, propName, v);
rs.submit(b);
PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
assertFalse(pi.isMultiValued());
assertEquals(v, pi.getValues()[0]);
assertEquals(PropertyType.PATH, pi.getType());
pi = getPropertyInfo(nid, propName);
assertEquals(v.getPath(), pi.getValues()[0].getPath());
assertEquals(v, pi.getValues()[0]);
assertEquals(PropertyType.PATH, pi.getType());
}
use of org.apache.jackrabbit.spi.PropertyInfo in project jackrabbit by apache.
the class BatchTest method testSetBooleanValue.
public void testSetBooleanValue() throws RepositoryException {
NodeId nid = getNodeId(testPath);
Name propName = resolver.getQName("booleanProp");
QValue v = rs.getQValueFactory().create(false);
Batch b = rs.createBatch(si, nid);
b.addProperty(nid, propName, v);
rs.submit(b);
PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
assertFalse(pi.isMultiValued());
assertFalse(pi.getValues()[0].getBoolean());
assertEquals(PropertyType.BOOLEAN, pi.getType());
pi = getPropertyInfo(nid, propName);
assertFalse(pi.getValues()[0].getBoolean());
assertEquals(PropertyType.BOOLEAN, pi.getType());
}
use of org.apache.jackrabbit.spi.PropertyInfo in project jackrabbit by apache.
the class RepositoryServiceImpl method getItemInfos.
@Override
public Iterator<? extends ItemInfo> getItemInfos(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException {
// currently: missing prop-names with child-NodeInfo
if (itemId.denotesNode()) {
List<ItemInfo> l = new ArrayList<ItemInfo>();
NodeInfo nInfo = getNodeInfo(sessionInfo, (NodeId) itemId);
l.add(nInfo);
// at least add propertyInfos for the meta-props already known from the
// nodeInfo.
l.addAll(buildPropertyInfos(nInfo));
return l.iterator();
} else {
PropertyInfo pInfo = getPropertyInfo(sessionInfo, (PropertyId) itemId);
return Iterators.singleton(pInfo);
}
}
use of org.apache.jackrabbit.spi.PropertyInfo in project jackrabbit by apache.
the class ItemInfoCacheImpl method put.
/**
* This implementation cached the item by its id and if the id
* is uuid based but has no path, also by its path.
*/
public void put(ItemInfo info, long generation) {
ItemId id = info.getId();
Entry<? extends ItemInfo> entry = info.denotesNode() ? new Entry<NodeInfo>((NodeInfo) info, generation) : new Entry<PropertyInfo>((PropertyInfo) info, generation);
put(id, entry);
if (id.getUniqueID() != null && id.getPath() == null) {
put(info.getPath(), entry);
}
}
use of org.apache.jackrabbit.spi.PropertyInfo in project jackrabbit by apache.
the class WorkspaceItemStateFactory method createPropertyState.
/**
* Creates the PropertyState with information retrieved from the <code>RepositoryService</code>.
*/
public PropertyState createPropertyState(PropertyId propertyId, PropertyEntry entry) throws ItemNotFoundException, RepositoryException {
try {
// Get item info from cache and use it if up to date
Entry<PropertyInfo> cached = cache.getPropertyInfo(propertyId);
ItemInfo info;
if (isUpToDate(cached, entry)) {
info = cached.info;
} else {
// otherwise retrieve item info from service and cache the whole batch
Iterator<? extends ItemInfo> infos = service.getItemInfos(sessionInfo, propertyId);
info = first(infos, cache, entry.getGeneration());
if (info == null || info.denotesNode()) {
throw new ItemNotFoundException("PropertyId: " + propertyId);
}
}
assertMatchingPath(info, entry);
return createPropertyState((PropertyInfo) info, entry);
} catch (PathNotFoundException e) {
throw new ItemNotFoundException(e);
}
}
Aggregations