@Override public int count() { return delegate.count(); } }
@Override public int count() { return delegate.count(); } }
@Override public int count() { return ps.count(); }
@Override public int count() { return ps.count(); }
@Override public int count() { return parsed().count(); }
private static boolean isJcrAll(@CheckForNull PropertyState property) { return property != null && property.count() == 1 && property.getValue(Type.LONG, 0) == DYNAMIC_ALL_BITS; } }
/** * Utility method for creating {@code Value}s based on a {@code PropertyState}. * @param property The property state * @return A list of new {@code Value} instances */ public List<Value> createValues(PropertyState property) { List<Value> values = Lists.newArrayList(); for (int i = 0; i < property.count(); i++) { values.add(newValue(property, i, namePathMapper)); } return values; }
private static boolean isJcrAll(@Nullable PropertyState property) { return property != null && property.count() == 1 && property.getValue(Type.LONG, 0) == DYNAMIC_ALL_BITS; } }
private static boolean isJcrAll(@Nullable PropertyState property) { return property != null && property.count() == 1 && property.getValue(Type.LONG, 0) == DYNAMIC_ALL_BITS; } }
@Override protected boolean isSmall(Template template) { PropertyTemplate[] properties = template.getPropertyTemplates(); PropertyState mixins = template.getMixinTypes(); return properties.length == 0 && (mixins == null || mixins.count() == 0); }
private static Set<String> getValueKeys(PropertyState property, ValuePattern pattern) { Set<String> keys = new HashSet<>(); if (property != null && property.getType().tag() != PropertyType.BINARY && property.count() != 0) { keys.addAll(encode(PropertyValues.create(property), pattern)); } return keys; } }
private static Set<String> getValueKeys(PropertyState property, ValuePattern pattern) { Set<String> keys = new HashSet<>(); if (property != null && property.getType().tag() != PropertyType.BINARY && property.count() != 0) { keys.addAll(encode(PropertyValues.create(property), pattern)); } return keys; } }
private static int estimateMemoryUsage(PropertyState propertyState) { if (propertyState == null) { return 0; } int size = OBJECT_HEADER_SIZE; size += StringUtils.estimateMemoryUsage(propertyState.getName()); for (int k = 0; k < propertyState.count(); k++) { String s = propertyState.getValue(STRING, k); size += StringUtils.estimateMemoryUsage(s); } return size; }
public static String toString(PropertyState property) { String name = property.getName(); Type<?> type = property.getType(); if (type == Type.BINARIES) { return name + " = [" + property.count() + " binaries]"; } else if (type == Type.BINARY) { return name + " = {" + getBinarySize(property) + " bytes}"; } else { return name + " = " + property.getValue(type); } }
public static String toString(PropertyState property) { String name = property.getName(); Type<?> type = property.getType(); if (type == Type.BINARIES) { return name + " = [" + property.count() + " binaries]"; } else if (type == Type.BINARY) { return name + " = {" + getBinarySize(property) + " bytes}"; } else { return name + " = " + property.getValue(type); } }
static RestrictionPattern create(PropertyState stringProperty) { if (stringProperty.count() == 1) { return new HasPropertyPattern(stringProperty.getValue(Type.STRING)); } else { return RestrictionPattern.EMPTY; } }
static void assertMemberList(@NotNull Tree groupTree, int cntRefTrees, int cnt) { Tree list = groupTree.getChild(REP_MEMBERS_LIST); assertTrue(list.exists()); assertEquals(cntRefTrees, list.getChildrenCount(5)); for (Tree c : list.getChildren()) { PropertyState repMembers = c.getProperty(REP_MEMBERS); assertNotNull(repMembers); assertTrue(SIZE_TH == repMembers.count() || cnt == repMembers.count()); } }
@Test public void testAsPropertyStateSingleList() throws Exception { PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, ImmutableList.of(mockTextValue("a", PropertyType.STRING)), PropInfo.MultipleStatus.MULTIPLE); PropertyState ps = propInfo.asPropertyState(mockPropDef(PropertyType.STRING, true)); assertTrue(ps.isArray()); assertEquals(1, ps.count()); }
@Test public void testAsPropertyStateMultiples() throws Exception { PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, ImmutableList.of(mockTextValue("a", PropertyType.STRING), mockTextValue("b", PropertyType.STRING))); PropertyState ps = propInfo.asPropertyState(mockPropDef(PropertyType.STRING, true)); assertTrue(ps.isArray()); assertEquals(2, ps.count()); }
@Test public void testSyncExternalUserDepth0() throws Exception { syncConfig.user().setMembershipNestingDepth(0); ExternalUser externalUser = idp.getUser(USER_ID); sync(externalUser, SyncResult.Status.ADD); Tree tree = r.getTree(userManager.getAuthorizable(USER_ID).getPath()); PropertyState extPrincipalNames = tree.getProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES); assertNotNull(extPrincipalNames); assertEquals(0, extPrincipalNames.count()); }