/** * Same as <code>getAsString</code> but with a trimmed return value. * * @param sFieldName * The field name to query. May be <code>null</code>. * @return <code>null</code> if no such parameter name is present. * @since 9.0.2 */ @Nullable default String getAsStringTrimmed (@Nullable final String sFieldName) { return StringHelper.trim (getAsString (sFieldName)); }
/** * Same as <code>getAsString</code> but with a trimmed return value. * * @param sFieldName * The field name to query. May be <code>null</code>. * @param sDefault * The value to be returned if the retrieved value is <code>null</code> . * @return <code>null</code> if no such parameter name is present. * @since 9.0.2 */ @Nullable default String getAsStringTrimmed (@Nullable final String sFieldName, @Nullable final String sDefault) { return StringHelper.trim (getAsString (sFieldName, sDefault)); } }
/** * Helper method to get the request value without falling back to the provided * default value. * * @return <code>null</code> if no such request value is present */ @Nullable protected final String getRequestValueWithoutDefault () { return getParams ().getAsString (getFieldName (), null); }
/** * Check if the login process is in progress * * @param aRequestScope * Request scope * @return <code>true</code> if it is in progress * @since 3.4.0 */ @OverrideOnDemand protected boolean isLoginInProgress (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope) { return CLogin.REQUEST_ACTION_VALIDATE_LOGIN_CREDENTIALS.equals (aRequestScope.params () .getAsString (CLogin.REQUEST_PARAM_ACTION)); }
/** * Get the current login name * * @param aRequestScope * Request scope * @return <code>null</code> if no login name was present * @since 3.4.0 */ @Nullable @OverrideOnDemand protected String getLoginName (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope) { return aRequestScope.params ().getAsString (CLogin.REQUEST_ATTR_USERID); }
/** * Get the current password * * @param aRequestScope * Request scope * @return <code>null</code> if no password was present * @since 3.4.0 */ @Nullable @OverrideOnDemand protected String getPassword (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope) { return aRequestScope.params ().getAsString (CLogin.REQUEST_ATTR_PASSWORD); }
/** * Get the provided query string from the parameter map. By default the value * of parameter {@link #PARAM_QUERY} is used. * * @param aLEC * The layout execution context. * @return <code>null</code> if no such request parameter is present. */ @Nullable @OverrideOnDemand protected String getQueryString (@Nonnull final LECTYPE aLEC) { return aLEC.params ().getAsString (PARAM_QUERY); }
/** * Get the value of the request - optionally falling back to the provided * default value if no such request parameter is present * * @return A single request value as string. */ @Nonnull public final String getRequestValue () { return getParams ().getAsString (getFieldName (), getDefaultValue ()); }
@Nonnull @ReturnsMutableCopy public PhotonRequestParameters getParametersFromRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final IMenuTree aMenuTree) { final PhotonRequestParameters ret = new PhotonRequestParameters (); ret.setLocaleFromString (GlobalLocaleManager.getInstance (), aRequestScope.params ().getAsString (getRequestParamNameLocale ())); ret.setMenuItemFromString (aMenuTree, aRequestScope.params ().getAsString (getRequestParamNameMenuItem ())); return ret; }
@Override @Nullable protected ISMPServiceInformation getSelectedObject (@Nonnull final WebPageExecutionContext aWPEC, @Nullable final String sID) { final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory (); final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr (); final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr (); final String sServiceGroupID = aWPEC.params ().getAsString (FIELD_SERVICE_GROUP_ID); final IParticipantIdentifier aServiceGroupID = aIdentifierFactory.parseParticipantIdentifier (sServiceGroupID); final ISMPServiceGroup aServiceGroup = aServiceGroupMgr.getSMPServiceGroupOfID (aServiceGroupID); final String sDocTypeIDScheme = aWPEC.params ().getAsString (FIELD_DOCTYPE_ID_SCHEME); final String sDocTypeIDValue = aWPEC.params ().getAsString (FIELD_DOCTYPE_ID_VALUE); final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.createDocumentTypeIdentifier (sDocTypeIDScheme, sDocTypeIDValue); return aServiceInfoMgr.getSMPServiceInformationOfServiceGroupAndDocumentType (aServiceGroup, aDocTypeID); }
@Override @Nullable protected ISMPServiceInformation getSelectedObject (@Nonnull final WebPageExecutionContext aWPEC, @Nullable final String sID) { final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory (); final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr (); final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr (); final String sServiceGroupID = aWPEC.params ().getAsString (FIELD_SERVICE_GROUP_ID); final IParticipantIdentifier aServiceGroupID = aIdentifierFactory.parseParticipantIdentifier (sServiceGroupID); final ISMPServiceGroup aServiceGroup = aServiceGroupMgr.getSMPServiceGroupOfID (aServiceGroupID); final String sDocTypeIDScheme = aWPEC.params ().getAsString (FIELD_DOCTYPE_ID_SCHEME); final String sDocTypeIDValue = aWPEC.params ().getAsString (FIELD_DOCTYPE_ID_VALUE); final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.createDocumentTypeIdentifier (sDocTypeIDScheme, sDocTypeIDValue); return aServiceInfoMgr.getSMPServiceInformationOfServiceGroupAndDocumentType (aServiceGroup, aDocTypeID); }
/** * Get the value of the checkbox of the request parameter with the given name. * * @param sFieldName * Request parameter name. May be <code>null</code>. * @param bDefaultValue * the default value to be returned, if no request attribute is present * @return <code>true</code> if the checkbox is checked, <code>false</code> if * it is not checked and the default value otherwise. */ default boolean isCheckBoxChecked (@Nullable final String sFieldName, final boolean bDefaultValue) { if (StringHelper.hasText (sFieldName)) { // Is the checked value present? final String sRequestValue = getAsString (sFieldName); if (sRequestValue != null) return true; // Check if the hidden parameter for "checkbox is contained in the // request" is present? // If so it means the checkbox parameter is part of the request, but the // checkbox is not checked if (containsKey (RequestHelper.getCheckBoxHiddenFieldName (sFieldName))) return false; } // Neither nor - default! return bDefaultValue; }
@Override @Nullable protected ISMPRedirect getSelectedObject (@Nonnull final WebPageExecutionContext aWPEC, @Nullable final String sID) { final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory (); final String sServiceGroupID = aWPEC.params ().getAsString (FIELD_SERVICE_GROUP_ID); final IParticipantIdentifier aServiceGroupID = aIdentifierFactory.parseParticipantIdentifier (sServiceGroupID); final ISMPServiceGroup aServiceGroup = SMPMetaManager.getServiceGroupMgr () .getSMPServiceGroupOfID (aServiceGroupID); if (aServiceGroup != null) { final String sDocTypeID = aWPEC.params ().getAsString (FIELD_DOCTYPE_ID); final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.parseDocumentTypeIdentifier (sDocTypeID); if (aDocTypeID != null) { final ISMPRedirectManager aRedirectMgr = SMPMetaManager.getRedirectMgr (); return aRedirectMgr.getSMPRedirectOfServiceGroupAndDocumentType (aServiceGroup, aDocTypeID); } } return null; }
@Override @Nullable protected ISMPRedirect getSelectedObject (@Nonnull final WebPageExecutionContext aWPEC, @Nullable final String sID) { final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory (); final String sServiceGroupID = aWPEC.params ().getAsString (FIELD_SERVICE_GROUP_ID); final IParticipantIdentifier aServiceGroupID = aIdentifierFactory.parseParticipantIdentifier (sServiceGroupID); final ISMPServiceGroup aServiceGroup = SMPMetaManager.getServiceGroupMgr () .getSMPServiceGroupOfID (aServiceGroupID); if (aServiceGroup != null) { final String sDocTypeID = aWPEC.params ().getAsString (FIELD_DOCTYPE_ID); final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.parseDocumentTypeIdentifier (sDocTypeID); if (aDocTypeID != null) { final ISMPRedirectManager aRedirectMgr = SMPMetaManager.getRedirectMgr (); return aRedirectMgr.getSMPRedirectOfServiceGroupAndDocumentType (aServiceGroup, aDocTypeID); } } return null; }
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final PhotonUnifiedResponse aAjaxResponse) throws Exception { // Resolve language final String sLanguage = aRequestScope.params ().getAsString (LANGUAGE_ID); Locale aLanguage = LocaleCache.getInstance ().getLocale (sLanguage); if (aLanguage == null) { // None or invalid locale specified - use default from constructor aLanguage = m_aDefaultLocale; } // Main action final IJsonObject aData = getText (aLanguage); aAjaxResponse.json (aData); aAjaxResponse.enableCaching (ResponseHelperSettings.getExpirationSeconds ()); } }
final String sProcessIDScheme = aWPEC.params ().getAsString (FIELD_PROCESS_ID_SCHEME); final String sProcessIDValue = aWPEC.params ().getAsString (FIELD_PROCESS_ID_VALUE); final IProcessIdentifier aProcessID = aIdentifierFactory.createProcessIdentifier (sProcessIDScheme, sProcessIDValue); if (aProcess != null) final String sTransportProfile = aWPEC.params ().getAsString (FIELD_TRANSPORT_PROFILE); final ISMPEndpoint aEndpoint = aProcess.getEndpointOfTransportProfile (sTransportProfile); if (aEndpoint != null)
@Override protected boolean isActionAllowed (@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final EWebPageFormAction eFormAction, @Nullable final ISMPRedirect aSelectedObject) { if (eFormAction == EWebPageFormAction.VIEW || eFormAction == EWebPageFormAction.COPY || eFormAction == EWebPageFormAction.EDIT || eFormAction == EWebPageFormAction.DELETE) { final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory (); final String sServiceGroupID = aWPEC.params ().getAsString (FIELD_SERVICE_GROUP_ID); final IParticipantIdentifier aServiceGroupID = aIdentifierFactory.parseParticipantIdentifier (sServiceGroupID); final ISMPServiceGroup aServiceGroup = SMPMetaManager.getServiceGroupMgr () .getSMPServiceGroupOfID (aServiceGroupID); if (aServiceGroup != null) { final String sDocTypeID = aWPEC.params ().getAsString (FIELD_DOCTYPE_ID); final IDocumentTypeIdentifier aDocTypeID = aIdentifierFactory.parseDocumentTypeIdentifier (sDocTypeID); if (aDocTypeID != null) { aWPEC.getRequestScope ().attrs ().putIn (ATTR_SERVICE_GROUP, aServiceGroup); aWPEC.getRequestScope ().attrs ().putIn (ATTR_DOCTYPE_ID, aDocTypeID); return true; } } return false; } return super.isActionAllowed (aWPEC, eFormAction, aSelectedObject); }
@Nonnull final PhotonUnifiedResponse aAjaxResponse) throws Exception final String sLoginName = aLEC.params ().getAsString (CLogin.REQUEST_ATTR_USERID); final String sPassword = aLEC.params ().getAsString (CLogin.REQUEST_ATTR_PASSWORD);
@Nonnull final PhotonUnifiedResponse aAjaxResponse) throws Exception final String sLoginName = aLEC.params ().getAsString (CLogin.REQUEST_ATTR_USERID); final String sPassword = aLEC.params ().getAsString (CLogin.REQUEST_ATTR_PASSWORD);
final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr (); final String sProcessIDScheme = aWPEC.params ().getAsString (FIELD_PROCESS_ID_SCHEME); final String sProcessIDValue = aWPEC.params ().getAsString (FIELD_PROCESS_ID_VALUE); final IProcessIdentifier aProcessID = aIdentifierFactory.createProcessIdentifier (sProcessIDScheme, sProcessIDValue);