public static boolean addEntry()

in src/main/java/org/apache/sling/jcr/base/util/AccessControlUtil.java [247:279]


	public static boolean addEntry(AccessControlList acl, Principal principal, Privilege privileges[], boolean isAllow, @SuppressWarnings("rawtypes") Map restrictions)
    															throws UnsupportedRepositoryOperationException, RepositoryException {
		Map<String, Value> restrictionsMap = null;
		Map<String, Value[]> mvRestrictionsMap = null;
		if (restrictions != null) {
			// restrictions arg expected to be Map<String, Value>
			// mvRestrictions arg expected to be Map<String, Value[]>
			Set<?> entrySet = ((Map<?, ?>)restrictions).entrySet();
			for (Object entry : entrySet) {
				Map.Entry<?, ?> me = (Map.Entry<?, ?>)entry;
				Object value = me.getValue();
				if (value != null) {
					String key = String.valueOf(me.getKey());
					if (value instanceof Value) {
						if (restrictionsMap == null) {
							restrictionsMap = new HashMap<>();
						}
						restrictionsMap.put(key, (Value)value);
					} else if (value instanceof Value[]) {
						if (mvRestrictionsMap == null) {
							mvRestrictionsMap = new HashMap<>();
						}
						mvRestrictionsMap.put(key, (Value[])value);
					} else {
						//some other data type?
						throw new IllegalArgumentException("the values in the restrictions argument must be either a Value or Value[] object");
					}
				}
			}
		}
		
		return addEntry(acl, principal, privileges, isAllow, restrictionsMap, mvRestrictionsMap);
    }