Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FORMS-833 : Migrate the provider of the marker value of the url for a formResponse to the module notifygru forms #173

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import fr.paris.lutece.plugins.forms.business.QuestionHome;
import fr.paris.lutece.plugins.forms.service.entrytype.EntryTypeComment;
import fr.paris.lutece.plugins.forms.util.FormsConstants;
import fr.paris.lutece.plugins.forms.web.admin.MultiviewFormResponseDetailsJspBean;
import fr.paris.lutece.plugins.genericattributes.business.Entry;
import fr.paris.lutece.plugins.genericattributes.business.Field;
import fr.paris.lutece.plugins.genericattributes.service.entrytype.EntryTypeServiceManager;
Expand All @@ -67,24 +66,18 @@
import fr.paris.lutece.portal.service.i18n.I18nService;
import fr.paris.lutece.portal.service.util.AppLogService;
import fr.paris.lutece.portal.service.util.AppPathService;
import fr.paris.lutece.portal.service.util.AppPropertiesService;
import fr.paris.lutece.util.url.UrlItem;

public abstract class GenericFormsProvider implements IProvider
{
// MESSAGE
private static final String MESSAGE_DESCRIPTION = "forms.marker.provider.url.admin.detail.reponse.description";
private static final String MESSAGE_FO_DESCRIPTION = "forms.marker.provider.url.fo.detail.reponse.description";
private static final String MESSAGE_CREATION_DATE = "forms.marker.provider.url.detail.reponse.creation_date";
private static final String MESSAGE_UPDATE_DATE = "forms.marker.provider.url.detail.reponse.update_date";
private static final String MESSAGE_STATUS = "forms.marker.provider.url.detail.reponse.status";
private static final String MESSAGE_STATUS_UPDATE_DATE = "forms.marker.provider.url.detail.reponse.status_update_date";

// PROPERTY
private static final String PROPERTY_LUTECE_ADMIN_PROD_URL = "lutece.admin.prod.url";
// MARKS
private static final String MARK_POSITION = "position_";
private static final String MARK_URL_ADMIN_RESPONSE = "url_admin_forms_response_detail";
private static final String MARK_URL_FO_RESPONSE = "url_fo_forms_response_detail";
private static final String MARK_CREATION_DATE = "creation_date";
private static final String MARK_UPDATE_DATE = "update_date";
Expand Down Expand Up @@ -171,30 +164,7 @@ public Collection<InfoMarker> provideMarkerValues( )
AppLogService.debug( "Adding infomarker " + notifyMarker.getMarker( ) + "=" + notifyMarker.getValue( ) );
}
result.addAll( markers.values( ) );

InfoMarker notifyMarkerAdminUrl = new InfoMarker( MARK_URL_ADMIN_RESPONSE );
UrlItem adminUrl = new UrlItem( AppPropertiesService.getProperty( PROPERTY_LUTECE_ADMIN_PROD_URL ) + MultiviewFormResponseDetailsJspBean.CONTROLLER_JSP_NAME_WITH_PATH );
adminUrl.addParameter( FormsConstants.PARAMETER_TARGET_VIEW, PARAMETER_VIEW_FORM_RESPONSE_DETAILS );
adminUrl.addParameter( PARAMETER_ID_FORM_RESPONSES, _formResponse.getId( ) );
notifyMarkerAdminUrl.setValue( adminUrl.getUrl( ) );
result.add( notifyMarkerAdminUrl );

InfoMarker notifyMarkerFOUrl = new InfoMarker( MARK_URL_FO_RESPONSE );
UrlItem url = new UrlItem( AppPathService.getProdUrl( _request ) + AppPathService.getPortalUrl( ) );
url.addParameter( FormsConstants.PARAMETER_PAGE, PARAMETER_PAGE_FORM_RESPONSE );
url.addParameter( FormsConstants.PARAMETER_TARGET_VIEW, PARAMETER_VIEW_FORM_RESPONSE_DETAILS_FO );
url.addParameter( PARAMETER_ID_FORM_RESPONSES_FO, _formResponse.getId( ) );
notifyMarkerFOUrl.setValue( url.getUrl( ) );
result.add( notifyMarkerFOUrl );

InfoMarker creationDateMarker = new InfoMarker( MARK_CREATION_DATE );
creationDateMarker.setValue( _formResponse.getCreation( ).toString( ) );
InfoMarker updateDateMarker = new InfoMarker( MARK_UPDATE_DATE );
updateDateMarker.setValue( _formResponse.getCreation( ).toString( ) );
InfoMarker statusMarker = new InfoMarker( MARK_STATUS );
statusMarker.setValue( String.valueOf( _formResponse.isPublished( ) ) );
InfoMarker updateStatusDateMarker = new InfoMarker( MARK_STATUS_UPDATE_DATE );
updateStatusDateMarker.setValue( _formResponse.getUpdateStatus( ).toString( ) );
return result;
}

Expand All @@ -217,9 +187,6 @@ public static Collection<InfoMarker> getProviderMarkerDescriptions( Form form )
notifyMarker.setDescription( formQuestion.getTitle( ) );
collectionNotifyMarkers.add( notifyMarker );
}
InfoMarker notifyMarkerAdminURl = new InfoMarker( MARK_URL_ADMIN_RESPONSE );
notifyMarkerAdminURl.setDescription( I18nService.getLocalizedString( MESSAGE_DESCRIPTION, I18nService.getDefaultLocale( ) ) );
collectionNotifyMarkers.add( notifyMarkerAdminURl );

InfoMarker notifyMarkerFOURl = new InfoMarker( MARK_URL_FO_RESPONSE );
notifyMarkerFOURl.setDescription( I18nService.getLocalizedString( MESSAGE_FO_DESCRIPTION, I18nService.getDefaultLocale( ) ) );
Expand Down