incodehq / incode-platform

Combines incode.org modules and isisaddons.org into a single set of modules.
http://platform.incode.org
Apache License 2.0
8 stars 9 forks source link

wkt-excel: Download in multiple formats (eg raw entities, and discovered DTOs) with a selector #33

Open danhaywood opened 6 years ago

danhaywood commented 6 years ago

from https://github.com/isisaddons-legacy/isis-wicket-excel/issues/4


introduce this into Isis applib:

public interface Mapper<S,T> {

```
Class<? extends S> getSourceClass();
Class<? extends T> getTargetClass();

@Programmatic
T map(S s);
```

}

Then search for domain classes that implement:

@DomainService(nature=DOMAIN)
public CountryToDto implements Mapper<Country, CountryDto> {
   public CountryDto map(Country c) { ... }
}

@DomainService(nature=DOMAIN)
public CountryToRowHandler implements Mapper<Country, CountryRowHandler> {
   public CountryRowHandler map(Country c) { ... }
}

and provide a drop-down selector to choose how to export (as Country, as CountryDto, as CountryRowHandler etc).

```
```