/**
* @return Only the privileges which the specified user has (not countingprivileges they have as a result of being a member of roles)
*/
@Transient protected Set<UserGeneralPrivilegeInfo> getPrivilegesForUser(AppUserInfo user){
Set<UserGeneralPrivilegeInfo> privilegesForUser=new LinkedHashSet<UserGeneralPrivilegeInfo>();
for ( UserGeneralPrivilegeInfo privilege : this.getUserPrivilegesDirect()) {
if (privilege.getUser().equals(user)) {
privilegesForUser.add(privilege);
}
}
return Collections.unmodifiableSet(privilegesForUser);
}

Example 9

From project alphaportal_dev, under directory /sys-src/alphaportal/web/src/main/java/alpha/portal/webapp/listener/.

/**
* Adds the arguments used by this program that aren't already provided by the generic {@code LDAPCommandLineTool} framework.
* @param parser The argument parser to which the arguments should be added.
* @throws ArgumentException If a problem occurs while adding the arguments.
*/
@Override() public void addNonLDAPArguments(final ArgumentParser parser) throws ArgumentException {
this.parser=parser;
String description="The base DN to use for the search. This must be " + "provided.";
baseDN=new DNArgument('b',"baseDN",true,1,"{dn}",description);
parser.addArgument(baseDN);
description="The scope to use for the search. It should be 'base', " + "'one', 'sub', or 'subord'. If this is not provided, then " + "a default scope of 'sub' will be used.";
final LinkedHashSet<String> allowedScopes=new LinkedHashSet<String>(4);
allowedScopes.add("base");
allowedScopes.add("one");
allowedScopes.add("sub");
allowedScopes.add("subord");
scopeStr=new StringArgument('s',"scope",false,1,"{scope}",description,allowedScopes,"sub");
parser.addArgument(scopeStr);
description="Follow any referrals encountered during processing.";
followReferrals=new BooleanArgument('R',"followReferrals",description);
parser.addArgument(followReferrals);
description="Generate terse output with minimal additional information.";
terseMode=new BooleanArgument('t',"terse",description);
parser.addArgument(terseMode);
description="Specifies the length of time in milliseconds to sleep " + "before repeating the same search. If this is not " + "provided, then the search will only be performed once.";
repeatIntervalMillis=new IntegerArgument('i',"repeatIntervalMillis",false,1,"{millis}",description,0,Integer.MAX_VALUE);
parser.addArgument(repeatIntervalMillis);
description="Specifies the number of times that the search should be " + "performed. If this argument is present, then the " + "--repeatIntervalMillis argument must also be provided to "+ "specify the length of time between searches. If "+ "--repeatIntervalMillis is used without --numSearches, "+ "then the search will be repeated until the tool is "+ "interrupted.";
numSearches=new IntegerArgument('n',"numSearches",false,1,"{count}",description,1,Integer.MAX_VALUE);
parser.addArgument(numSearches);
parser.addDependentArgumentSet(numSearches,repeatIntervalMillis);
}

Example 12

From project androidquery, under directory /src/com/androidquery/auth/.

/**
* Return all interfaces that the given class implements as Set, including ones implemented by superclasses. <p>If the class itself is an interface, it gets returned as sole interface.
* @param clazz the class to analyze for interfaces
* @param classLoader the ClassLoader that the interfaces need to be visible in(may be <code>null</code> when accepting all declared interfaces)
* @return all interfaces that the given object implements as Set
*/
public static Set<Class> getAllInterfacesForClassAsSet(Class clazz,ClassLoader classLoader){
Assert.notNull(clazz,"Class must not be null");
if (clazz.isInterface() && isVisible(clazz,classLoader)) {
return Collections.singleton(clazz);
}
Set<Class> interfaces=new LinkedHashSet<Class>();
while (clazz != null) {
Class<?>[] ifcs=clazz.getInterfaces();
for ( Class<?> ifc : ifcs) {
interfaces.addAll(getAllInterfacesForClassAsSet(ifc,classLoader));
}
clazz=clazz.getSuperclass();
}
return interfaces;
}

Example 60

From project ElasticSearchExample, under directory /src/main/java/de/jetwick/ese/ui/.

/**
* Asserts that the given {@code Iterable} contains the given values, in any order.
* @param info contains information about the assertion.
* @param actual the given {@code Iterable}.
* @param values the values that are expected to be in the given {@code Iterable}.
* @throws NullPointerException if the array of values is {@code null}.
* @throws IllegalArgumentException if the array of values is empty.
* @throws AssertionError if the given {@code Iterable} is {@code null}.
* @throws AssertionError if the given {@code Iterable} does not contain the given values.
*/
public void assertContains(AssertionInfo info,Iterable<?> actual,Object[] values){
checkIsNotNullAndNotEmpty(values);
assertNotNull(info,actual);
Set<Object> notFound=new LinkedHashSet<Object>();
for ( Object value : values) {
if (!iterableContains(actual,value)) {
notFound.add(value);
}
}
if (notFound.isEmpty()) {
return;
}
throw failures.failure(info,shouldContain(actual,values,notFound,comparisonStrategy));
}

Example 67

From project fest-util, under directory /src/main/java/org/fest/util/.