use of it.cnr.contab.util00.bulk.HelpBulk in project sigla-main by consiglionazionaledellericerche.
the class HelpResource method get.
@Override
public Response get(HttpServletRequest request, String jspName, String bpName) throws Exception {
String helpBaseURL = Optional.ofNullable(System.getProperty("help.base.url")).orElseGet(() -> {
return SpringUtil.getBean(UtilService.class).getHelpBaseURL();
});
UserContext userContext = new WSUserContext("HELP", null, new Integer(Calendar.getInstance().get(Calendar.YEAR)), null, null, null);
final Optional<HelpBulk> findByBPName = Optional.ofNullable(crudComponentSession.find(userContext, HelpBulk.class, "find", new HelpBulk().bpName(bpName))).filter(List.class::isInstance).map(List.class::cast).orElse(null).stream().findAny();
if (findByBPName.isPresent()) {
helpBaseURL += findByBPName.get().getHelpUrl();
} else {
final Optional<HelpBulk> findByJSPName = Optional.ofNullable(crudComponentSession.find(userContext, HelpBulk.class, "find", new HelpBulk().page(jspName))).filter(List.class::isInstance).map(List.class::cast).orElse(null).stream().findAny();
if (findByJSPName.isPresent()) {
helpBaseURL += UriUtils.encode(findByJSPName.get().getHelpUrl(), Charset.defaultCharset());
}
}
return Response.seeOther(new URI(helpBaseURL)).build();
}
use of it.cnr.contab.util00.bulk.HelpBulk in project sigla-main by consiglionazionaledellericerche.
the class CRUDHelpBP method writeToolbar.
@Override
protected void writeToolbar(JspWriter jspwriter, Button[] abutton) throws IOException, ServletException {
String helpBaseURL = Optional.ofNullable(System.getProperty("help.base.url")).orElseGet(() -> {
return SpringUtil.getBean(UtilService.class).getHelpBaseURL();
});
final List<Button> buttons = Arrays.stream(createToolbar()).collect(Collectors.toList());
final Optional<String> helpURL = Optional.ofNullable(getModel()).filter(HelpBulk.class::isInstance).map(HelpBulk.class::cast).flatMap(helpBulk -> Optional.ofNullable(helpBulk.getHelpUrl()));
if (helpURL.isPresent()) {
Button buttonHelp = new Button(Config.getHandler().getProperties(getClass()), "CRUDToolbar.help");
buttonHelp.setHref("javascript:doHelp('".concat(helpBaseURL).concat(helpURL.get()).concat("')"));
buttons.add(buttonHelp);
}
super.writeToolbar(jspwriter, buttons.toArray(new Button[buttons.size()]));
}
use of it.cnr.contab.util00.bulk.HelpBulk in project sigla-main by consiglionazionaledellericerche.
the class CRUDHelpAction method doRiportaSelezioneAccesso.
/**
* Gestisce un HookForward di ritorno da un risultato di una ricerca (SelezionatoreBP)
*/
public Forward doRiportaSelezioneAccesso(ActionContext context) throws java.rmi.RemoteException {
CRUDBP bp = (CRUDBP) context.getBusinessProcess();
Optional.ofNullable(context.getCaller()).map(HookForward.class::cast).map(hookForward -> hookForward.getParameter("focusedElement")).filter(AssBpAccessoBulk.class::isInstance).map(AssBpAccessoBulk.class::cast).ifPresent(assBpAccessoBulk -> {
Optional.ofNullable(bp.getModel()).map(HelpBulk.class::cast).ifPresent(helpBulk -> {
helpBulk.setBpName(assBpAccessoBulk.getBusinessProcess());
});
});
return context.findDefaultForward();
}
Aggregations