1515import goc .webtemplate .Constants ;
1616import goc .webtemplate .ContextualFooter ;
1717import goc .webtemplate .CustomSearch ;
18+ import goc .webtemplate .FeedbackLink ;
1819import goc .webtemplate .FooterLink ;
1920import goc .webtemplate .FooterSection ;
2021import goc .webtemplate .HeaderMenu ;
3738import goc .webtemplate .component .jsonentities .AppTop ;
3839import goc .webtemplate .component .jsonentities .CDTSEnvironment ;
3940import goc .webtemplate .component .jsonentities .CDTSEnvironmentList ;
40- import goc .webtemplate .component .jsonentities .FeedbackLink ;
41+ import goc .webtemplate .component .jsonentities .Feedback ;
4142import goc .webtemplate .component .jsonentities .Footer ;
4243import goc .webtemplate .component .jsonentities .IPreFooter ;
4344import goc .webtemplate .component .jsonentities .PreFooter ;
@@ -104,8 +105,13 @@ private enum Themes { GCWEB, GCINTRANET }
104105 private Link applicationTitle = new Link ();
105106 private IntranetTitle intranetTitle = null ;
106107 private String languageLinkUrl = "" ;
107- private String feedbackUrl = this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbackurl" );
108- private String feedbackUrlFr = this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbackurl_fr" );
108+ private FeedbackLink feedbackLink = new FeedbackLink (Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "goc.webtemplate.showfeedbacklink" )),
109+ this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbackurl" ),
110+ this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbackurl_fr" ),
111+ this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbacktext" ),
112+ this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbacktext_fr" ),
113+ this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbacktheme" ),
114+ this .getResourceBundleString ("cdn" , "goc.webtemplate.feedbacksection" ));
109115 private List <Link > contactLinks = null ;
110116 private LeavingSecureSiteWarning leavingSecureSiteWarning = new LeavingSecureSiteWarning (
111117 Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "leavingsecuresitewarning.enabled" )),
@@ -120,7 +126,6 @@ private enum Themes { GCWEB, GCINTRANET }
120126 private boolean showPreContent = Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "goc.webtemplate.showprecontent" ));
121127 private boolean showPostContent = Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "goc.webtemplate.showpostcontent" ));
122128 private boolean showLanguageLink = Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "goc.webtemplate.showlanguagelink" ));
123- private boolean showFeedbackLink = Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "goc.webtemplate.showfeedbacklink" ));
124129 private boolean showSharePageLink = Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "goc.webtemplate.showsharepagelink" ));
125130 private boolean showFeatures = Boolean .parseBoolean (this .getResourceBundleString ("cdn" , "goc.webtemplate.showfeatures" ));
126131 private List <Constants .SocialMediaSites > sharePageMediaSites = new ArrayList <Constants .SocialMediaSites >();
@@ -503,7 +508,7 @@ public void setUseSRI(boolean value) {
503508 }
504509
505510 /**
506- * Returns the version of the CDN files to use to build the page. (e.g v4_1_0 )
511+ * Returns the version of the CDN files to use to build the page. (e.g v5_0_0 )
507512 *
508513 * Set at application level via "wettemplate_version" property in cdn.properties,
509514 * can be overriden programatically.
@@ -524,7 +529,7 @@ public String getTemplateVersion() {
524529 }
525530
526531 /**
527- * Sets the version of the CDN files to use to build the page. (e.g v4_1_0 )
532+ * Sets the version of the CDN files to use to build the page. (e.g v5_0_0 )
528533 *
529534 * Set at application level via "wettemplate_version" property in cdn.properties,
530535 * can be overriden programatically.
@@ -1043,64 +1048,100 @@ public void setSharePageMediaSites(List<Constants.SocialMediaSites> value) {
10431048 *
10441049 * Set at application level via "goc.webtemplate.showfeedbacklink" property in cdn.properties,
10451050 * can be overriden programatically.
1051+ *
1052+ * * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10461053 */
1054+ @ Deprecated
10471055 public boolean getShowFeedbackLink () {
10481056 this .initializeOnce ();
1049- return this .showFeedbackLink ;
1057+ return this .feedbackLink . isEnabled () ;
10501058 }
10511059
10521060 /**
10531061 * Sets whether the FeedBack link of the footer is to be displayed.
10541062 *
10551063 * Set at application level via "goc.webtemplate.showfeedbacklink" property in cdn.properties,
10561064 * can be overriden programatically.
1065+ *
1066+ * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10571067 */
1068+ @ Deprecated
10581069 public void setShowFeedbackLink (boolean value ) {
1059- this .showFeedbackLink = value ;
1070+ this .feedbackLink . setEnabled ( value ) ;
10601071 }
10611072
10621073 /**
10631074 * Returns the FeedBack link URL.
10641075 *
10651076 * Set at application level via "goc.webtemplate.feedbackurl" property in cdn.properties,
10661077 * can be overriden programatically.
1078+ *
1079+ * * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10671080 */
1081+ @ Deprecated
10681082 public String getFeedbackUrl () {
10691083 this .initializeOnce ();
1070- return this .feedbackUrl ;
1084+ return this .feedbackLink . getUrl () ;
10711085 }
10721086
10731087 /**
10741088 * Sets the FeedBack link URL.
10751089 *
10761090 * Set at application level via "goc.webtemplate.feedbackurl" property in cdn.properties,
10771091 * can be overriden programatically.
1092+ *
1093+ * * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10781094 */
1095+ @ Deprecated
10791096 public void setFeedbackUrl (String value ) {
1080- this .feedbackUrl = value ;
1097+ this .feedbackLink . setUrl ( value ) ;
10811098 }
10821099
10831100 /**
10841101 * Returns the french FeedBack link URL.
10851102 *
10861103 * Set at application level via "goc.webtemplate.feedbackurl_fr" property in cdn.properties,
10871104 * can be overriden programatically.
1105+ *
1106+ * * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10881107 */
1108+ @ Deprecated
10891109 public String getFeedbackUrlFr () {
10901110 this .initializeOnce ();
1091- return this .feedbackUrlFr ;
1111+ return this .feedbackLink . getUrlFr () ;
10921112 }
10931113
10941114 /**
10951115 * Sets the french FeedBack link URL.
10961116 *
10971117 * Set at application level via "goc.webtemplate.feedbackurl_fr" property in cdn.properties,
1098- * can be overriden programatically.
1118+ * can be overriden programmatically.
1119+ *
1120+ * * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10991121 */
1122+ @ Deprecated
11001123 public void setFeedbackUrlFr (String value ) {
1101- this .feedbackUrlFr = value ;
1124+ this .feedbackLink .setUrlFr (value );
1125+ }
1126+
1127+ /**
1128+ * Returns the FeedbackLink object used as configuration
1129+ *
1130+ * Configuration can be set at application level in cdn.properties, or set programmatically at runtime.
1131+ */
1132+ public FeedbackLink getFeedbackLink () {
1133+ this .initializeOnce ();
1134+ return this .feedbackLink ;
11021135 }
11031136
1137+ /**
1138+ * Sets the FeedbackLink object used as configuration
1139+ *
1140+ * Configuration can be set at application level in cdn.properties, or set programattically at runtime.
1141+ */
1142+ public void setFeedbackLink (FeedbackLink value ) {
1143+ this .feedbackLink = value ;
1144+ }
11041145
11051146 /**
11061147 * Returns a unique string to identify a web page. Used by user to identify the screen where an issue occured.
@@ -2013,22 +2054,44 @@ private AppTop buildAppTop() {
20132054 return appTop ;
20142055 }
20152056
2057+ /**
2058+ * Builds the Feedback object
2059+ */
2060+ private Feedback buildFeedback (FeedbackLink feedbackLink )
2061+ {
2062+ Feedback feedback = new Feedback ();
2063+ feedback .setEnabled (this .feedbackLink .isEnabled ());
2064+
2065+ Boolean isFrenchCulture = this .getTwoLetterCultureLanguage ().toUpperCase ().equals (Constants .FRENCH_ACCRONYM .toUpperCase ());
2066+
2067+ if (!Utility .isNullOrEmpty (this .feedbackLink .getText ()) || !Utility .isNullOrEmpty (this .feedbackLink .getSection ()) || !Utility .isNullOrEmpty (this .feedbackLink .getTheme ()))
2068+ {
2069+ feedback .setSection (feedbackLink .getSection ());
2070+ feedback .setTheme (feedbackLink .getTheme ());
2071+ feedback .setText ((isFrenchCulture && !Utility .isNullOrEmpty (this .feedbackLink .getTextFr ())) ? feedbackLink .getTextFr () : feedbackLink .getText ());
2072+ feedback .setHref ((isFrenchCulture && !Utility .isNullOrEmpty (this .feedbackLink .getUrlFr ())) ? feedbackLink .getUrlFr () : feedbackLink .getUrl ());
2073+ }
2074+ else if (!Utility .isNullOrEmpty (this .feedbackLink .getUrl ()))
2075+ {
2076+ feedback .setLegacyBtnUrl ((isFrenchCulture && !Utility .isNullOrEmpty (this .feedbackLink .getUrlFr ())) ? this .feedbackLink .getUrlFr () : this .feedbackLink .getUrl ());
2077+ }
2078+
2079+ return feedback ;
2080+ }
2081+
20162082 /**
20172083 * Builds the "PreFooter" object needed in rendering the CDTS setup JSON
20182084 * (assumes initializeOnce() was called)
20192085 */
20202086 private IPreFooter buildPreFooter (boolean isTransactional , boolean isUnilingualError ) {
20212087 if (!isTransactional ) {
20222088 if (!isUnilingualError ) {
2023- return new PreFooter (
2089+ return new PreFooter (
20242090 null , //no need for cdnEnv now that we're using CDTS setup function
20252091 JsonValueUtils .getNonEmptyString (this .getVersionIdentifier ()),
20262092 this .buildDateModified (),
20272093 this .showPostContent ,
2028- new FeedbackLink (this .showFeedbackLink ,
2029- (this .getTwoLetterCultureLanguage ().toUpperCase ().equals (Constants .ENGLISH_ACCRONYM .toUpperCase ()) || Utility .isNullOrEmpty (this .getFeedbackUrlFr ()) ?
2030- this .feedbackUrl :
2031- this .feedbackUrlFr ) ),
2094+ buildFeedback (this .getFeedbackLink ()),
20322095 new ShareList (this .showSharePageLink , this .sharePageMediaSites ),
20332096 JsonValueUtils .getNonEmptyString (this .getScreenIdentifier ())
20342097 );
@@ -2042,7 +2105,7 @@ private IPreFooter buildPreFooter(boolean isTransactional, boolean isUnilingualE
20422105 JsonValueUtils .getNonEmptyString (this .getVersionIdentifier ()),
20432106 this .buildDateModified (),
20442107 false , //showPostContent,
2045- new FeedbackLink (false , null ),
2108+ new Feedback (false , null , null , null , null , null ),
20462109 new ShareList (false , null ),
20472110 JsonValueUtils .getNonEmptyString (this .getScreenIdentifier ())
20482111 );
0 commit comments