#51 2019-05-13 11:16:14

Patryx
Member
Registered: 2019-03-25

Re: Additional Report Executors - the example doesn't work

Great news!
Thank you Eduardo and your team!
I look forward to getting such an e-mail.

Offline

#52 2019-05-14 07:18:16

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Additional Report Executors - the example doesn't work

Hi Patryx,

I sent you the preview release link by email. Remember this is just a preview release, so backup any important data you may have, just in any case. First, please test with the exact code above so we can be sure that this works in your installation too. Of course, the DB-configuration and inserts in the code may be commented out.

Regards,
Eduardo

Offline

#53 2019-05-14 11:51:07

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Additional Report Executors - the example doesn't work

Hi Patryx,

for completeness, I will post your questions here:

Patryx wrote:

Meanwhile do you know if in nextRow() method I am able to read all data of current row? Is there any variable like RSTableRow available?

Regards,
Eduardo

Offline

#54 2019-05-14 11:51:29

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Additional Report Executors - the example doesn't work

Hi Patryx,

you can override the method
net.datenwerke.rs.base.service.reportengines.table.output.generator.TableOutputGenerator.addField(Object,
CellFormatter)

You can download the reportserver sources and take a look at this class:

net.datenwerke.rs.base.service.reportengines.table.output.generator.HTMLOutputGenerator

This class might help you with your exporter.

The class uses the
net.datenwerke.rs.base.service.reportengines.table.output.generator.TableOutputGenerator
interface in an analogous way as the script for creating the HTML Export of the dynamic lists.

Regards,
Eduardo

Offline

#55 2019-05-14 11:52:26

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Additional Report Executors - the example doesn't work

Hi Patryx,

Patryx wrote:

Do you know if there is possible to read under class MyGenerator sth from GLOBALS:

reportExecService = GLOBALS.getInstance(ReportExecutorService.class)
dbPoolService = GLOBALS.getInstance(DbPoolService.class)

because GLOBALS are not visible under class.

Maybe only solution is to read these services before and pass them to constructor of class in specifying provider?

I have to use in close() method reportExecService.execute(...) and I need dbPoolService because I read sql connection from current tablereport in such a way:

        def ds = tableReport.getDatasourceContainer().getDatasource();
        def conn = dbPoolService.getConnection(ds.getConnectionConfig(), new StandardConnectionConfig()).get();
    def sql = Sql.newInstance(conn);

2. According to the version, is there any possibility to influence on text showing as notification in upper-right corner? Now I can see text but I donlt know if I can change i tor how to use it to show for example error

Regards,
Eduardo

Offline

#56 2019-05-14 11:57:55

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Additional Report Executors - the example doesn't work

Hi Patryx,

1. You can always @inject services into your class. Either directly as field parameters or into the class constructor.
An example can be seen here: net.datenwerke.rs.base.service.reportengines.table.output.generator.TableOutputGeneratorImpl

@Inject
protected static Provider<ReportServerService> reportServerService;

A constructor injection example can be found here:
net.datenwerke.rs.core.service.reportmanager.ReportServiceImpl

@Inject
	public ReportServiceImpl(
		Provider<EntityManager> entityManagerProvider,
		HookHandlerService hookHandler,
		@ReportServerReportTypes Provider<Set<Class<? extends Report>>> installedReportTypes,
		SecurityService securityService,
		EntityClonerService entityCloner,
		ReportParameterService reportParameterService,
		TerminalService terminalService,
		Provider<AuthenticatorService> authenticatorServiceProvider
	) {
		this.entityManagerProvider = entityManagerProvider;
		this.hookHandler = hookHandler;
		this.installedReportTypes = installedReportTypes;
		this.securityService = securityService;
		this.entityCloner = entityCloner;
		this.reportParameterService = reportParameterService;
		this.terminalService = terminalService;
		this.authenticatorServiceProvider = authenticatorServiceProvider;
	}

2. In the actual version, you get the message defined. This is not configurable. If you have an error, you can throw an exception. For example, throw a new IllegalArgumentException().

Regards,
Eduardo

Offline

#57 2019-05-14 12:44:53

Patryx
Member
Registered: 2019-03-25

Re: Additional Report Executors - the example doesn't work

I decided to use version with injected fields.

I imported:

import com.google.inject.Inject;
import com.google.inject.Provider;

and I added to my class:

    @Inject
    protected static Provider<ReportExecutorService> reportExecService;

    @Inject
    protected static Provider<DbPoolService> dbPoolService;

When method close() is fired I check if reportExecService and dbPoolService are not null.
Unfortunately they are null.

Should I add sth when I create such a class?

When I tried the second option with injcection in constructor I got an error:

net.datenwerke.gxtdto.client.servercommunication.exceptions.ServerCallFailedException: The report could not be executed: Could not find matching constructor for: MyGenerator()
<br>	at net.datenwerke.rs.core.server.reportexport.ReportExportRpcServiceImpl.exportSkipDownload(ReportExportRpcServiceImpl.java:274)
<br>	at 
...

My code:

	@Inject
	public MyGenerator(
		Provider<ReportExecutorService> reportExecServiceProvider,
		Provider<DbPoolService> dbPoolServiceProvider) {
		
		super();
		this.reportExecService = reportExecServiceProvider;
		this.dbPoolService = dbPoolServiceProvider;
	}


...

/* specify provider */
def provider = [
	provideGenerators : { ->
		return [new MyGenerator()]

	}
] as TableOutputGeneratorProviderHookAdapter

Last edited by Patryx (2019-05-14 13:54:44)

Offline

#58 2019-05-15 07:17:24

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Additional Report Executors - the example doesn't work

Hi Patryx,

yes, you are right, I forgot to mention you have to instantiate the object through the injector.

you can replace the provider with:

final MyGenerator myGenerator = GLOBALS.injector.getInstance(MyGenerator.class);

/* specify provider */
def provider = [
	provideGenerators : { ->
		return [myGenerator]
	}
] as TableOutputGeneratorProviderHookAdapter

/* plugin hook */
GLOBALS.services.callbackRegistry.attachHook(HOOK_NAME, TableOutputGeneratorProviderHook.
class, provider)

The important part is the MyGenerator instanciation:
final MyGenerator myGenerator = GLOBALS.injector.getInstance(MyGenerator.class);

Regards,
Eduardo

Offline

#59 2019-05-15 08:20:21

Patryx
Member
Registered: 2019-03-25

Re: Additional Report Executors - the example doesn't work

Hi,
Yes, you are right - it helps smile.
1. How can I influence on the name of button which should depend on chosen language?
I mean text "My Format":
AddReportExportFormatProvider provider = new AddReportExportFormatProvider(new TableReportDtoDec(), "My Format", "MY_CUSTOM_FORMAT", "").

2. And second one - can I get rid of the suffix "-Export" and only have my chosen one? I also noticed the word "Export" doesn't change according to language, why?
I have to have just a text: "Show on map", so "-Export" etc looks ridiculous in general smile

3. Do you have button names etc saved in file or in database? How can I get dictionary of used names (for en, pl etc)?

Last edited by Patryx (2019-05-15 09:15:40)

Offline

#60 2019-05-21 13:41:53

Patryx
Member
Registered: 2019-03-25

Re: Additional Report Executors - the example doesn't work

I noticed that in files with properties like:
ReportServer\src\net\datenwerke\rs\core\client\reportexporter\locale\ReportExporterMessages_xx.properties  where xx is the language shortcut.
there is a property:
exportReportTo={0}-Export

In every language is the same (word: Export). Is it possible if you at least translate word "Export" to the right language?

The best solution will be opportunity to influence on the name in configuration or possibility to set somwhere a flag to omit this word in writen export formats.


I found the file:
ReportServer\src\net\datenwerke\rs\core\client\reportexpoerter\hookers\ReportViewExportButtonHooker.java:

		/* create first large button */
		final ReportExporter first = exporterIt.next();
		TextButton exportBtn = null;
		if(exporterIt.hasNext())
			exportBtn = new DwSplitButton(ReportExporterMessages.INSTANCE.exportReportTo(first.getExportTitle()));
		else
			exportBtn = new DwTextButton(ReportExporterMessages.INSTANCE.exportReportTo(first.getExportTitle()));

		exportBtn.setArrowAlign(ButtonArrowAlign.RIGHT);
		if(null != first.getIcon())
			exportBtn.setIcon(first.getIcon());
		exportBtn.addSelectHandler(new SelectHandler() {
			
			@Override
			public void onSelect(SelectEvent event) {
				first.displayConfiguration(report, info.getExecuteReportToken(), true, new ConfigurationFinishedCallback() {
					@Override
					public void success() {
						List<ReportExecutorMainPanelView> views = mainPanel.getViews();
						if (! validateViews(views))
							return;
						
						first.export(report, info.getExecuteReportToken());		
					}
				});
			}
		});

		toolbar.add(exportBtn);

So it would be easy to change it by your team to have influence on it somehow.

Last edited by Patryx (2019-05-21 13:54:44)

Offline

Board footer

Powered by FluxBB