本文整理汇总了Java中org.apache.jackrabbit.oak.api.PropertyState.isArray方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyState.isArray方法的具体用法?Java PropertyState.isArray怎么用?Java PropertyState.isArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jackrabbit.oak.api.PropertyState
的用法示例。
在下文中一共展示了PropertyState.isArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProperty
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
/**
* @see org.apache.jackrabbit.api.security.user.Authorizable#getProperty(String)
*/
@Override
public Value[] getProperty(String relPath) throws RepositoryException {
String oakPath = getOakPath(relPath);
Tree tree = getTree();
Value[] values = null;
PropertyState property = getAuthorizableProperty(tree, getLocation(tree, oakPath), true);
if (property != null) {
if (property.isArray()) {
List<Value> vs = ValueFactoryImpl.createValues(property, namePathMapper);
values = vs.toArray(new Value[vs.size()]);
} else {
values = new Value[]{ValueFactoryImpl.createValue(property, namePathMapper)};
}
}
return values;
}
示例2: equal
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
/**
* Checks whether the given two property states are equal. They are
* considered equal if their names and types match, they have an equal
* number of values, and each of the values is equal with the
* corresponding value in the other property.
*
* @param a first property state
* @param b second property state
* @return {@code true} if the properties are equal, {@code false} otherwise
*/
public static boolean equal(PropertyState a, PropertyState b) {
if (Objects.equal(a.getName(), b.getName())
&& Objects.equal(a.getType(), b.getType())) {
Type<?> type = a.getType();
if (a.isArray()) {
return a.count() == b.count()
&& Iterables.elementsEqual(
(Iterable<?>) a.getValue(type),
(Iterable<?>) b.getValue(type));
} else {
return Objects.equal(a.getValue(type), b.getValue(type));
}
} else {
return false;
}
}
示例3: getPropertyNext
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
/**
* short-cut for using NodeBuilder. See {@code getNext(NodeState)}
*/
static String getPropertyNext(@Nonnull final NodeBuilder node, final int lane) {
checkNotNull(node);
String next = "";
PropertyState ps = node.getProperty(NEXT);
if (ps != null) {
if (ps.isArray()) {
int count = ps.count();
if (count > 0 && count > lane) {
next = ps.getValue(Type.STRING, lane);
}
} else {
next = ps.getValue(Type.STRING);
}
}
return next;
}
示例4: getName
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@CheckForNull
public String getName(String name, @Nullable String defaultValue) {
PropertyState property = tree.getProperty(name);
if (property != null && !property.isArray()) {
return mapper.getJcrName(property.getValue(STRING));
} else {
return defaultValue;
}
}
示例5: getLong
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public long getLong(String name, long defaultValue) {
PropertyState property = tree.getProperty(name);
if (property != null && !property.isArray()) {
return property.getValue(LONG);
} else {
return defaultValue;
}
}
示例6: getStringInternal
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@CheckForNull
private static String getStringInternal(Tree tree,
String propertyName,
Type<String> type) {
PropertyState property = tree.getProperty(propertyName);
if (property != null && !property.isArray()) {
return property.getValue(type);
} else {
return null;
}
}
示例7: assignFrom
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Nonnull
public PropertyBuilder<T> assignFrom(PropertyState property) {
if (property != null) {
setName(property.getName());
if (property.isArray()) {
isArray = true;
setValues((Iterable<T>) property.getValue(type.getArrayType()));
} else {
isArray = false;
setValue(property.getValue(type));
}
}
return this;
}
示例8: convert
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public static PropertyState convert(PropertyState state, Type<?> type) {
if (type == state.getType()
|| (type == Type.UNDEFINED && !state.isArray())
|| (type == Type.UNDEFINEDS && state.isArray())) {
return state;
} else {
return createProperty(state.getName(), state.getValue(type), type);
}
}
示例9: getDefaultValues
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Override
public Value[] getDefaultValues() {
PropertyState property =
definition.getProperty(JcrConstants.JCR_DEFAULTVALUES);
if (property == null) {
return null;
} else if (property.isArray()) {
List<Value> values = ValueFactoryImpl.createValues(property, mapper);
return values.toArray(NO_VALUES);
} else {
Value value = ValueFactoryImpl.createValue(property, mapper);
return new Value[] { value };
}
}
示例10: getDefinition
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
private PropertyDefinition getDefinition(PropertyState property) throws RepositoryException {
String propertyName = property.getName();
int propertyType = property.getType().tag();
boolean isMultiple = property.isArray();
return getPropertyDefinition(propertyName, isMultiple, propertyType, true);
}
示例11: resetToDefaultValue
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
private void resetToDefaultValue(NodeBuilder dest, PropertyState p)
throws RepositoryException {
ImmutableTree tree = new ImmutableTree(dest.getNodeState());
PropertyDefinition def = ntMgr.getDefinition(tree, p, true);
Value[] values = def.getDefaultValues();
if (values != null) {
if (p.isArray()) {
p = PropertyStates.createProperty(p.getName(), values);
dest.setProperty(p);
} else if (values.length > 0) {
p = PropertyStates.createProperty(p.getName(), values[0]);
dest.setProperty(p);
}
}
}
示例12: getIndexNode
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
/**
* Get the node with the index definition for the given property, if there
* is an applicable index with data.
*
* @param propertyName the property name
* @param filter the filter (which contains information of all supertypes,
* unless the filter matches all types)
* @return the node where the index definition (metadata) is stored (the
* parent of ":index"), or null if no index definition or index data
* node was found
*/
@Nullable
NodeState getIndexNode(NodeState node, String propertyName, Filter filter) {
// keep a fallback to a matching index def that has *no* node type constraints
// (initially, there is no fallback)
NodeState fallback = null;
NodeState state = node.getChildNode(INDEX_DEFINITIONS_NAME);
for (ChildNodeEntry entry : state.getChildNodeEntries()) {
NodeState index = entry.getNodeState();
PropertyState type = index.getProperty(TYPE_PROPERTY_NAME);
if (type == null || type.isArray() || !getType().equals(type.getValue(Type.STRING))) {
continue;
}
if (contains(index.getNames(PROPERTY_NAMES), propertyName)) {
NodeState indexContent = index.getChildNode(INDEX_CONTENT_NODE_NAME);
if (!indexContent.exists()) {
continue;
}
Set<String> supertypes = getSuperTypes(filter);
if (index.hasProperty(DECLARING_NODE_TYPES)) {
if (supertypes != null) {
for (String typeName : index.getNames(DECLARING_NODE_TYPES)) {
if (supertypes.contains(typeName)) {
// TODO: prefer the most specific type restriction
return index;
}
}
}
} else if (supertypes == null) {
return index;
} else if (fallback == null) {
// update the fallback
fallback = index;
}
}
}
return fallback;
}
示例13: setPropertyNext
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
/**
* set the value of the :next at the given position. If the property :next won't be there by the
* time this method is invoked it won't perform any action
*
* @param node
* @param value
* @param lane
*/
static void setPropertyNext(@Nonnull final NodeBuilder node,
final String value, final int lane) {
if (node != null && value != null && lane >= 0 && lane < OrderedIndex.LANES) {
PropertyState next = node.getProperty(NEXT);
if (next != null) {
String[] values;
if (next.isArray()) {
values = Iterables.toArray(next.getValue(Type.STRINGS), String.class);
if (values.length < OrderedIndex.LANES) {
// it could be we increased the number of lanes and running on some existing
// content
LOG.debug("topping-up the number of lanes.");
List<String> vv = Lists.newArrayList(values);
for (int i = vv.size(); i < OrderedIndex.LANES; i++) {
vv.add("");
}
values = vv.toArray(new String[0]);
}
} else {
values = Iterables.toArray(EMPTY_NEXT, String.class);
values[0] = next.getValue(Type.STRING);
}
values[lane] = value;
setPropertyNext(node, values);
}
}
}
示例14: OrderedPropertyIndexEditor
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public OrderedPropertyIndexEditor(NodeBuilder definition, NodeState root,
IndexUpdateCallback callback) {
super(definition, root, callback);
// configuring propertyNames
Set<String> pns = null;
PropertyState names = definition.getProperty(IndexConstants.PROPERTY_NAMES);
if (names != null) {
String value = names.getValue(Type.NAME, 0);
if (Strings.isNullOrEmpty(value)) {
LOG.warn("Empty value passed as propertyNames. Index not properly configured. Ignoring.");
} else {
if (names.isArray() && names.count() > 1) {
LOG.debug("Only single value supported. '{}' only will be used.", value);
}
pns = Collections.singleton(value);
this.properlyConfigured = true;
}
}
this.propertyNames = pns;
// configuring direction
String propertyDirection = definition.getString(OrderedIndex.DIRECTION);
if (propertyDirection == null) {
// LOG.debug("Using default direction for sorting: {}", this.direction);
} else {
OrderDirection dir = OrderDirection.fromString(propertyDirection);
if (dir == null) {
LOG.warn("An unknown direction has been specified for sorting: '{}'. Using default one. {}",
propertyDirection, this.direction);
} else {
this.direction = dir;
}
}
// initialising the stopwatch.
swl = new StopwatchLogger(OrderedPropertyIndexEditor.class);
}
示例15: isIndexNodeType
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public static boolean isIndexNodeType(NodeState state, String typeIn) {
if (!isIndexNodeType(state)) {
return false;
}
PropertyState type = state.getProperty(TYPE_PROPERTY_NAME);
return type != null && !type.isArray()
&& type.getValue(Type.STRING).equals(typeIn);
}