public PhotonRequestState (@Nonnull final PhotonGlobalStatePerApp aState) { this (aState.getMenuTree (), aState.getMenuTree () == null ? null : aState.getMenuTree ().getDefaultMenuItem (), GlobalLocaleManager.getInstance ().getDefaultLocale ()); }
@Nonnull public SimpleURL getLinkToMenuItem (@Nonnull @Nonempty final String sAppID, @Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final Locale aDisplayLocale, @Nonnull final String sMenuItemID) { // Get the servlet path from the app ID final String sServletPath = PhotonGlobalState.state (sAppID).getServletPath (); // Prepend the context path final String sBasePath = aRequestScope.getContextPath () + sServletPath; return m_aRequestParamHdl.buildURL (aRequestScope, sBasePath, aDisplayLocale, sMenuItemID); }
@Nonnull @Nonempty public String getServletPath () throws IllegalStateException { final String ret = internalGetServletPath (); if (StringHelper.hasNoText (ret)) throw new IllegalStateException ("No servlet path specified!"); return ret; }
@Override protected void initMenu () { // Determine backend // Required before menu! SMPMetaManager.initBackendFromConfiguration (); // Create all menu items { final MenuTree aMenuTree = new MenuTree (); MenuPublic.init (aMenuTree); PhotonGlobalState.state (CApplicationID.APP_ID_PUBLIC).setMenuTree (aMenuTree); } { final MenuTree aMenuTree = new MenuTree (); MenuSecure.init (aMenuTree); PhotonGlobalState.state (CApplicationID.APP_ID_SECURE).setMenuTree (aMenuTree); } }
@Nonnull public static PhotonGlobalStatePerApp state (@Nonnull @Nonempty final String sAppID) { ValueEnforcer.notEmpty (sAppID, "AppID"); final PhotonGlobalState aGlobalState = getInstance (); return aGlobalState.m_aStateMap.computeIfAbsent (sAppID, k -> { // By default set first app ID as default if (!aGlobalState.hasDefaultApplicationID ()) aGlobalState.setDefaultApplicationID (sAppID); return new PhotonGlobalStatePerApp (); }); }
.setServletPath (AbstractPublicApplicationServlet.SERVLET_DEFAULT_PATH); PhotonGlobalState.state (CApplicationID.APP_ID_SECURE) .setServletPath (AbstractSecureApplicationServlet.SERVLET_DEFAULT_PATH); PhotonGlobalState.getInstance ().setDefaultApplicationID (CApplicationID.APP_ID_PUBLIC);
@Override protected void initMenu () { // Determine backend // Required before menu! SMPMetaManager.initBackendFromConfiguration (); // Create all menu items { final MenuTree aMenuTree = new MenuTree (); MenuPublic.init (aMenuTree); PhotonGlobalState.state (CApplicationID.APP_ID_PUBLIC).setMenuTree (aMenuTree); } { final MenuTree aMenuTree = new MenuTree (); MenuSecure.init (aMenuTree); PhotonGlobalState.state (CApplicationID.APP_ID_SECURE).setMenuTree (aMenuTree); } }
if (aMenuTree == null) aMenuTree = aAppGlobalState.getMenuTree (); if (aMenuTree != null)
@Nonnull @ReturnsMutableCopy public static ICommonsMap <String, String> getAppIDToServletPathMap () { final ICommonsMap <String, String> ret = new CommonsHashMap <> (); getInstance ().m_aStateMap.forEach ( (sAppID, aState) -> ret.put (sAppID, aState.getServletPath ())); return ret; } }
public static boolean containsAnyApplicationServletPathMapping () { return getInstance ().m_aStateMap.containsAnyValue (x -> x.internalGetServletPath () != null); }