
com.mntviews.jreport.JRInputSourceDB Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mnt-report Show documentation
Show all versions of mnt-report Show documentation
JasperReport server engine
package com.mntviews.jreport;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import net.sf.jasperreports.engine.JRDataSource;
@JsonDeserialize(builder = JRInputSourceDB.Builder.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class JRInputSourceDB extends JRInputSource {
@JsonProperty("connection")
private final JRConnection connection;
private JRInputSourceDB(Builder builder) {
JRProfile jrProfile = JRContext.findProfile();
JRConnection jrConnection = jrProfile.getJrConnection();
if (builder.jrConnection != null
&& builder.jrConnection.getTag() != null
&& builder.jrConnection.getTag().equalsIgnoreCase((JRContext.DEFAULT_CONNECTION_TAG))) {
this.connection = JRConnection.clone(jrConnection);
} else
this.connection = builder.jrConnection;
}
@JsonIgnore
public JRConnection getJRConnection() {
return connection;
}
public static JRInputSourceDB clone(JRInputSourceDB jrInputSourceDB) {
return JRInputSourceDB.custom().build();
}
@Override
JRDataSource find() {
return null;
}
public static Builder custom() {
return new Builder();
}
@JsonPOJOBuilder
public static class Builder {
private JRConnection jrConnection;
@JsonProperty("connection")
Builder withConnection(JRConnection connection) {
this.jrConnection = connection;
return this;
}
public JRInputSourceDB build() {
return new JRInputSourceDB(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy