Search in sources :

Example 1 with HelpBulk

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();
}
Also used : UtilService(it.cnr.contab.spring.service.UtilService) UserContext(it.cnr.jada.UserContext) WSUserContext(it.cnr.contab.utenze00.bp.WSUserContext) WSUserContext(it.cnr.contab.utenze00.bp.WSUserContext) List(java.util.List) HelpBulk(it.cnr.contab.util00.bulk.HelpBulk) URI(java.net.URI)

Example 2 with HelpBulk

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()]));
}
Also used : UtilService(it.cnr.contab.spring.service.UtilService) Button(it.cnr.jada.util.jsp.Button) HelpBulk(it.cnr.contab.util00.bulk.HelpBulk)

Example 3 with HelpBulk

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();
}
Also used : CRUDBP(it.cnr.jada.util.action.CRUDBP) HelpBulk(it.cnr.contab.util00.bulk.HelpBulk) CRUDAction(it.cnr.jada.util.action.CRUDAction) Optional(java.util.Optional) AssBpAccessoBulk(it.cnr.contab.utenze00.bulk.AssBpAccessoBulk) Forward(it.cnr.jada.action.Forward) ActionContext(it.cnr.jada.action.ActionContext) HookForward(it.cnr.jada.action.HookForward) SelezionatoreListaBP(it.cnr.jada.util.action.SelezionatoreListaBP) HookForward(it.cnr.jada.action.HookForward) CRUDBP(it.cnr.jada.util.action.CRUDBP) AssBpAccessoBulk(it.cnr.contab.utenze00.bulk.AssBpAccessoBulk)

Aggregations

HelpBulk (it.cnr.contab.util00.bulk.HelpBulk)3 UtilService (it.cnr.contab.spring.service.UtilService)2 WSUserContext (it.cnr.contab.utenze00.bp.WSUserContext)1 AssBpAccessoBulk (it.cnr.contab.utenze00.bulk.AssBpAccessoBulk)1 UserContext (it.cnr.jada.UserContext)1 ActionContext (it.cnr.jada.action.ActionContext)1 Forward (it.cnr.jada.action.Forward)1 HookForward (it.cnr.jada.action.HookForward)1 CRUDAction (it.cnr.jada.util.action.CRUDAction)1 CRUDBP (it.cnr.jada.util.action.CRUDBP)1 SelezionatoreListaBP (it.cnr.jada.util.action.SelezionatoreListaBP)1 Button (it.cnr.jada.util.jsp.Button)1 URI (java.net.URI)1 List (java.util.List)1 Optional (java.util.Optional)1