예제 #1
0
 public PEXSubject(String identifier, PEXSubjectCollection collection)
     throws ExecutionException, PermissionsLoadingException {
   this.identifier = identifier;
   this.collection = collection;
   this.baked = collection.getCalculatedSubject(identifier);
   this.data = new PEXSubjectData(baked.data(), collection.getPlugin());
   this.transientData = new PEXSubjectData(baked.transientData(), collection.getPlugin());
 }
예제 #2
0
 @Override
 public Optional<String> getOption(Set<Context> contexts, String key) {
   time().onGetOption().startTimingIfSync();
   try {
     Preconditions.checkNotNull(contexts, "contexts");
     Preconditions.checkNotNull(key, "key");
     return baked.getOption(parSet(contexts), key);
   } finally {
     time().onGetOption().stopTimingIfSync();
   }
 }
예제 #3
0
 @Override
 public List<Subject> getParents(final Set<Context> contexts) {
   time().onGetParents().startTimingIfSync();
   try {
     Preconditions.checkNotNull(contexts, "contexts");
     return Lists.transform(
         baked.getParents(parSet(contexts)),
         input -> collection.getPlugin().getSubjects(input.getKey()).get(input.getValue()));
   } finally {
     time().onGetParents().stopTimingIfSync();
   }
 }
예제 #4
0
 @Override
 public Tristate getPermissionValue(Set<Context> contexts, String permission) {
   time().onGetPermission().startTimingIfSync();
   try {
     Preconditions.checkNotNull(contexts, "contexts");
     Preconditions.checkNotNull(permission, "permission");
     int ret = baked.getPermission(parSet(contexts), permission);
     return ret == 0 ? Tristate.UNDEFINED : ret > 0 ? Tristate.TRUE : Tristate.FALSE;
   } finally {
     time().onGetPermission().stopTimingIfSync();
   }
 }