Skip to content

Commit

Permalink
FIX CdR null
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Mar 8, 2019
1 parent c50ef40 commit 8a878f3
Showing 1 changed file with 22 additions and 1 deletion.
Expand Up @@ -11,6 +11,7 @@

import javax.ejb.EJBException;

import it.cnr.contab.config00.sto.bulk.V_struttura_organizzativaBulk;
import it.cnr.jada.comp.ComponentException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -540,7 +541,27 @@ public Forward doSelezionaContesto(ActionContext context, Integer esercizio, Str
})
.filter(CdrBulk.class::isInstance)
.map(CdrBulk.class::cast)
.orElse(null));
.orElseGet(() -> {
if (Optional.ofNullable(uo).filter(x -> !x.equalsIgnoreCase("null")).isPresent()) {
try {
return createCRUDComponentSession().find(
context.getUserContext(),
V_struttura_organizzativaBulk.class,
"findCDRCollegatiUO",
ui.getUnita_organizzativa(),
ui.getEsercizio()
).stream()
.filter(CdrBulk.class::isInstance)
.map(CdrBulk.class::cast)
.findAny()
.orElse(null);
} catch (RemoteException|ComponentException e) {
throw new RuntimeException(e);
}
}
return null;
})
);
userContext.getAttributes().put("bootstrap", true);
bp.setBootstrap(true);
context.setUserContext(userContext);
Expand Down

0 comments on commit 8a878f3

Please sign in to comment.