@Test void testAddNullParent() { Package pack = mock(Package.class); when(pack.getId()).thenReturn("pack"); when(pack.getParent()).thenReturn(null); assertThrows(NullParentPackageNotSuException.class, () -> repo.add(pack)); }
@Override public void add(Package pack) { if (isActionPermitted(pack, CREATE)) { createAcl(pack); delegate().add(pack); } else { if (pack.getParent() == null) { throw new NullParentPackageNotSuException(); } else { throw new PackagePermissionDeniedException(getPermissionForAction(CREATE), pack); } } }
PackageRepositorySecurityDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Package> { @Override public void add(Package pack) { if (isActionPermitted(pack, CREATE)) { createAcl(pack); delegate().add(pack); } else { if (pack.getParent() == null) { throw new NullParentPackageNotSuException(); } else { throw new PackagePermissionDeniedException(getPermissionForAction(CREATE), pack); } } } }
PackageRepositorySecurityDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Package> { @Override public void add(Package pack) { if (isActionPermitted(pack, CREATE)) { createAcl(pack); delegate().add(pack); } else { if (pack.getParent() == null) { throw new NullParentPackageNotSuException(); } else { throw new PackagePermissionDeniedException(getPermissionForAction(CREATE), pack); } } } PackageRepositorySecurityDecorator(
      Repository<Package> delegateRepository,
      MutableAclService mutableAclService,
      UserPermissionEvaluator userPermissionEvaluator); }
PackageRepositorySecurityDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Package> { @Override public void add(Package pack) { if (isActionPermitted(pack, CREATE)) { createAcl(pack); delegate().add(pack); } else { if (pack.getParent() == null) { throw new NullParentPackageNotSuException(); } else { throw new PackagePermissionDeniedException(getPermissionForAction(CREATE), pack); } } } PackageRepositorySecurityDecorator(
      Repository<Package> delegateRepository,
      MutableAclService mutableAclService,
      UserPermissionEvaluator userPermissionEvaluator); @Override boolean isActionPermitted(Package updatedPack, Action action); @Override boolean isActionPermitted(Object id, Action action); @Override void throwPermissionException(Package pack, Action action); @Override Package findOneById(Object id); @Override void add(Package pack); @Override void update(Package pack); @Override Integer add(Stream<Package> packages); @Override void createAcl(Package pack); @Override void deleteAcl(Object id); @Override void deleteAcl(Package pack); @Override void updateAcl(Package pack); }
PackageRepositorySecurityDecorator extends AbstractRowLevelSecurityRepositoryDecorator<Package> { @Override public void add(Package pack) { if (isActionPermitted(pack, CREATE)) { createAcl(pack); delegate().add(pack); } else { if (pack.getParent() == null) { throw new NullParentPackageNotSuException(); } else { throw new PackagePermissionDeniedException(getPermissionForAction(CREATE), pack); } } } PackageRepositorySecurityDecorator(
      Repository<Package> delegateRepository,
      MutableAclService mutableAclService,
      UserPermissionEvaluator userPermissionEvaluator); @Override boolean isActionPermitted(Package updatedPack, Action action); @Override boolean isActionPermitted(Object id, Action action); @Override void throwPermissionException(Package pack, Action action); @Override Package findOneById(Object id); @Override void add(Package pack); @Override void update(Package pack); @Override Integer add(Stream<Package> packages); @Override void createAcl(Package pack); @Override void deleteAcl(Object id); @Override void deleteAcl(Package pack); @Override void updateAcl(Package pack);  }