- AtomicInteger issues = new AtomicInteger();
- AtomicBoolean excepted = new AtomicBoolean(false);
-
- graph.forEachObject(parameter, ISSUE.Issue_HasContext_Inverse, new AsyncMultiProcedure<Resource>() {
- @Override
- public void execute(AsyncReadGraph graph, Resource result) {
- issues.incrementAndGet();
- }
- @Override
- public void finished(AsyncReadGraph graph) {
-
- }
- @Override
- public void exception(AsyncReadGraph graph, Throwable throwable) {
- if(excepted.compareAndSet(false, true))
- procedure.exception(graph, throwable);
- }
- });
-
- graph.forEachObject(parameter, ISSUE.Issue_ContextList_Element_Inverse, new AsyncMultiProcedure<Resource>() {
- @Override
- public void execute(AsyncReadGraph graph, Resource result) {
- issues.incrementAndGet();
- }
- @Override
- public void finished(AsyncReadGraph graph) {
-
- }
- @Override
- public void exception(AsyncReadGraph graph, Throwable throwable) {
- if(excepted.compareAndSet(false, true))
- procedure.exception(graph, throwable);
- }
- });
-
- if(excepted.get()) return;
-
- if (issues.get() == 0) {
- // This content does not have directly attached issues, try to look
- // for some in the child components.
- graph.asyncRequest(new ChildMaxIssueSeverity(parameter, parameter2, parameter3), procedure);
- } else {
- // Try local issues first
- graph.asyncRequest(new MaxIssueSeveritySingle(parameter), new AsyncProcedure<Severity>() {
- @Override
- public void execute(AsyncReadGraph graph, Severity maxSeverity) {
- if (maxSeverity == null)
- // No severity for local issues, try children next.
- graph.asyncRequest(new ChildMaxIssueSeverity(parameter, parameter2, parameter3), procedure);
- else
- procedure.execute(graph, maxSeverity);
- }
- @Override
- public void exception(AsyncReadGraph graph, Throwable throwable) {
- if(excepted.compareAndSet(false, true))
- procedure.exception(graph, throwable);
- }
- });