Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
import com.cognifide.slice.api.link.Link;
import com.cognifide.slice.api.link.LinkBuilder;
import com.cognifide.slice.api.link.LinkBuilderFactory;
import com.cognifide.slice.cq.qualifier.RequestedLink;
import com.google.inject.Inject;

public class EventModel {
    private final LinkBuilderFactory linkBuilderFactory;
    private final Link requestedLink;

    @Inject
    public TextModel2EventModel(LinkBuilderFactory linkBuilderFactory, @RequestedLink Link requestedLink) {
        this.linkBuilderFactory = linkBuilderFactory;
        this.requestedLink = requestedLink;
    }
    public String getPrintLink() {
        LinkBuilder linkBuilder = linkBuilderFactory.getLinkBuilder(requestedLink);
        linkBuilder.addSelector("print").setExtension("pdf"); // it will retain query string and suffix
        return linkBuilder.toString();
    }
    ...
}

...