44import it .eng .knowage .engine .api .export .dashboard .DashboardExporter ;
55import it .eng .knowage .engine .api .export .dashboard .Style ;
66import it .eng .spagobi .commons .SingletonConfig ;
7+ import it .eng .spagobi .user .UserProfileManager ;
78import it .eng .spagobi .utilities .assertion .Assert ;
89import it .eng .spagobi .utilities .exceptions .SpagoBIRuntimeException ;
910import org .apache .log4j .Logger ;
@@ -55,7 +56,7 @@ public DashboardPdfExporter(String userUniqueIdentifier, Locale locale) {
5556
5657 public byte [] getBinaryData (JSONObject template ) throws JSONException {
5758
58- String creationUser ;
59+ String executionUser ;
5960
6061 if (template == null ) {
6162 throw new SpagoBIRuntimeException ("Unable to get template for dashboard" );
@@ -65,12 +66,12 @@ public byte[] getBinaryData(JSONObject template) throws JSONException {
6566
6667 JSONObject drivers = transformDriversForDatastore (getDrivers (template ));
6768 JSONObject parameters = transformParametersForDatastore (template , getParametersFromBody (template ));
68- creationUser = template . getString ( "creationUser" );
69+ executionUser = UserProfileManager . getProfile (). getSpagoBIUserProfile (). getUserId ( );
6970
7071 try (PDDocument document = new PDDocument (MemoryUsageSetting .setupTempFileOnly ())) {
7172 String widgetId = template .getString ("id" );
7273
73- exportTableWidget (document , template , widgetId , creationUser , selections , drivers , parameters );
74+ exportTableWidget (document , template , widgetId , executionUser , selections , drivers , parameters );
7475
7576 ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ();
7677 document .save (byteArrayOutputStream );
@@ -82,7 +83,7 @@ public byte[] getBinaryData(JSONObject template) throws JSONException {
8283 }
8384 }
8485
85- private void exportTableWidget (PDDocument document , JSONObject widget , String widgetId , String creationUser , Map <String , Map <String , JSONArray >> selections , JSONObject drivers , JSONObject parameters ) {
86+ private void exportTableWidget (PDDocument document , JSONObject widget , String widgetId , String executionUser , Map <String , Map <String , JSONArray >> selections , JSONObject drivers , JSONObject parameters ) {
8687 try {
8788 JSONObject settings = widget .optJSONObject ("settings" );
8889
@@ -152,7 +153,7 @@ private void exportTableWidget(PDDocument document, JSONObject widget, String wi
152153 }
153154 }
154155 }
155- buildFirstPageHeaders (table , settings , groupsAndColumnsMap , columnsOrdered , creationUser , font , extraValueLabel , extraValue );
156+ buildFirstPageHeaders (table , settings , groupsAndColumnsMap , columnsOrdered , executionUser , font , extraValueLabel , extraValue );
156157 }
157158
158159 rows = dataStore .getJSONArray ("rows" );
@@ -209,8 +210,8 @@ private void initColumnWidths(JSONArray columnsOrdered, Map<String, JSONArray> c
209210 }
210211 }
211212
212- private void buildFirstPageHeaders (BaseTable table , JSONObject settings , Map <String , String > groupsAndColumnsMap , JSONArray columnsOrdered , String creationUser , PDFont font , String extraValueLabel , String extraValueField ) throws JSONException {
213- createDocumentInformationRow (table , font , creationUser , extraValueLabel , extraValueField );
213+ private void buildFirstPageHeaders (BaseTable table , JSONObject settings , Map <String , String > groupsAndColumnsMap , JSONArray columnsOrdered , String executionUser , PDFont font , String extraValueLabel , String extraValueField ) throws JSONException {
214+ createDocumentInformationRow (table , font , executionUser , extraValueLabel , extraValueField );
214215
215216 if (!groupsAndColumnsMap .isEmpty ()) {
216217 Row <PDPage > groupHeaderRow = table .createRow (15f );
@@ -273,29 +274,29 @@ private void styleHeaderCell(JSONObject settings, Cell<PDPage> headerCell, PDFon
273274 }
274275 }
275276
276- private void createDocumentInformationRow (BaseTable table , PDFont font , String creationUser , String extraValueLabel , String extraValue ) {
277+ private void createDocumentInformationRow (BaseTable table , PDFont font , String executionUser , String extraValueLabel , String extraValue ) {
277278 try {
278279
279280 String executionDateLabel ;
280- String creationUserLabel ;
281+ String executionUserLabel ;
281282
282283 if (this .locale .toString ().equals ("sk_SK" )) {
283284 executionDateLabel = "Dátum vytvorenia: " ;
284- creationUserLabel = "Vytvoril: " ;
285+ executionUserLabel = "Vytvoril: " ;
285286 } else if (this .locale .toString ().equals ("it_IT" )) {
286287 executionDateLabel = "Data di esecuzione: " ;
287- creationUserLabel = "Utente di creazione : " ;
288+ executionUserLabel = "Utente di esecuzione : " ;
288289 } else {
289290 executionDateLabel = "Execution Date: " ;
290- creationUserLabel = "Creation User: " ;
291+ executionUserLabel = "Execution User: " ;
291292 }
292293
293294 PDPage page = table .getCurrentPage ();
294295
295296 String executionDate = LocalDateTime .now ().format (DateTimeFormatter .ofPattern ("dd/MM/yyyy HH:mm:ss" ));
296297
297298 String line1 = executionDateLabel + executionDate ;
298- String line2 = creationUserLabel + creationUser ;
299+ String line2 = executionUserLabel + executionUser ;
299300 String line3 = null ;
300301 boolean isExtraValuePresent = extraValueLabel != null && !extraValueLabel .isEmpty () && extraValue != null && !extraValue .isEmpty ();
301302 if (isExtraValuePresent ) {
0 commit comments