private boolean shouldDecorateResource(Resource resource) { if (isProject(resource)) { Project project = (Project) resource; return project.getId() != null && countRoles(project.getId()) == 0; } return false; }
public void decorate(Resource resource, DecoratorContext context) { if (shouldDecorateResource(resource)) { Project project = (Project) resource; roleManager.affectDefaultRolesToResource(project.getId()); } }