Commit 558b4d0e832345a2fdf913097ae3eb72bb7aee9f
1 parent
b7dbc28a
Exists in
master
Implementação dos recursos de relatório
Showing
5 changed files
with
424 additions
and
0 deletions
Show diff stats
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportDataSource.java
0 → 100644
... | ... | @@ -0,0 +1,113 @@ |
1 | +package br.com.centralit.esi.api.resource.model; | |
2 | + | |
3 | +import javax.persistence.AttributeOverride; | |
4 | +import javax.persistence.AttributeOverrides; | |
5 | +import javax.persistence.Column; | |
6 | +import javax.persistence.Embedded; | |
7 | +import javax.persistence.Entity; | |
8 | +import javax.persistence.FetchType; | |
9 | +import javax.persistence.GeneratedValue; | |
10 | +import javax.persistence.GenerationType; | |
11 | +import javax.persistence.Id; | |
12 | +import javax.persistence.ManyToOne; | |
13 | +import javax.persistence.Table; | |
14 | + | |
15 | +import br.com.centralit.esi.api.data.model.DataObject; | |
16 | +import br.com.centralit.esi.api.design.model.Flow; | |
17 | +import br.com.centralit.esi.api.domain.model.Domain; | |
18 | +import br.com.centralit.framework.json.Views; | |
19 | +import br.com.centralit.framework.model.arquitetura.PersistentObject; | |
20 | + | |
21 | +import com.fasterxml.jackson.annotation.JsonView; | |
22 | + | |
23 | +@Entity | |
24 | +@Table(name="RES_ReportDataSource") | |
25 | +public class ReportDataSource extends PersistentObject { | |
26 | + | |
27 | + /** | |
28 | + * | |
29 | + */ | |
30 | + private static final long serialVersionUID = -1378383432960623032L; | |
31 | + | |
32 | + @Id | |
33 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
34 | + @JsonView({Views.GenericView.class }) | |
35 | + protected Long id; | |
36 | + | |
37 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
38 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
39 | + private Domain type; | |
40 | + | |
41 | + @ManyToOne(fetch=FetchType.LAZY, optional=true) | |
42 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
43 | + protected DataObject dataObject; | |
44 | + | |
45 | + @ManyToOne(fetch=FetchType.LAZY, optional=true) | |
46 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
47 | + private Flow flow; | |
48 | + | |
49 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
50 | + @Embedded | |
51 | + @AttributeOverrides({ | |
52 | + @AttributeOverride(name="expressionType", column = @Column(name="expression_type")), | |
53 | + @AttributeOverride(name="constant", column = @Column(name="expression_constant")), | |
54 | + @AttributeOverride(name="scriptCode.script", column = @Column(name="expression_script")), | |
55 | + @AttributeOverride(name="scriptCode.engineType", column = @Column(name="expression_engineType")) | |
56 | + }) | |
57 | + private ReportExpression expression; | |
58 | + | |
59 | + @Column(nullable = true) | |
60 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
61 | + private String outputAttributeName; | |
62 | + | |
63 | + @Override | |
64 | + public Long getId() { | |
65 | + return this.id; | |
66 | + } | |
67 | + | |
68 | + public Domain getType() { | |
69 | + return type; | |
70 | + } | |
71 | + | |
72 | + public void setType(Domain type) { | |
73 | + this.type = type; | |
74 | + } | |
75 | + | |
76 | + public DataObject getDataObject() { | |
77 | + return dataObject; | |
78 | + } | |
79 | + | |
80 | + public void setDataObject(DataObject dataObject) { | |
81 | + this.dataObject = dataObject; | |
82 | + } | |
83 | + | |
84 | + public Flow getFlow() { | |
85 | + return flow; | |
86 | + } | |
87 | + | |
88 | + public void setFlow(Flow flow) { | |
89 | + this.flow = flow; | |
90 | + } | |
91 | + | |
92 | + public String getOutputAttributeName() { | |
93 | + return outputAttributeName; | |
94 | + } | |
95 | + | |
96 | + public void setOutputAttributeName(String outputAttributeName) { | |
97 | + this.outputAttributeName = outputAttributeName; | |
98 | + } | |
99 | + | |
100 | + public void setId(Long id) { | |
101 | + this.id = id; | |
102 | + } | |
103 | + | |
104 | + public ReportExpression getExpression() { | |
105 | + return expression; | |
106 | + } | |
107 | + | |
108 | + public void setExpression(ReportExpression expression) { | |
109 | + this.expression = expression; | |
110 | + } | |
111 | + | |
112 | + | |
113 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportExpression.java
0 → 100644
... | ... | @@ -0,0 +1,89 @@ |
1 | +package br.com.centralit.esi.api.resource.model; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | + | |
5 | +import javax.persistence.Basic; | |
6 | +import javax.persistence.Embeddable; | |
7 | +import javax.persistence.Embedded; | |
8 | +import javax.persistence.FetchType; | |
9 | +import javax.persistence.Lob; | |
10 | + | |
11 | +import org.hibernate.annotations.Type; | |
12 | + | |
13 | +import br.com.centralit.esi.api.design.model.ScriptCode; | |
14 | +import br.com.centralit.esi.api.enumerated.ExpressionTypeEnum; | |
15 | +import br.com.centralit.framework.json.Views; | |
16 | + | |
17 | +import com.fasterxml.jackson.annotation.JsonView; | |
18 | + | |
19 | +@Embeddable | |
20 | +public class ReportExpression implements Serializable { | |
21 | + | |
22 | + /** | |
23 | + * | |
24 | + */ | |
25 | + private static final long serialVersionUID = 1795388490044351994L; | |
26 | + | |
27 | + @JsonView({Views.GenericView.class }) | |
28 | + private ExpressionTypeEnum expressionType; | |
29 | + | |
30 | + @JsonView({ Views.GenericView.class}) | |
31 | + @Lob | |
32 | + @Basic(fetch = FetchType.LAZY) | |
33 | + @Type(type="org.hibernate.type.StringClobType") | |
34 | + private String constantValue; | |
35 | + | |
36 | + @Embedded | |
37 | + @JsonView({ Views.GenericView.class}) | |
38 | + private ScriptCode scriptCode; | |
39 | + | |
40 | + /** | |
41 | + * @return the expressionType | |
42 | + */ | |
43 | + public ExpressionTypeEnum getExpressionType() { | |
44 | + return expressionType; | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * @param expressionType the expressionType to set | |
49 | + */ | |
50 | + public void setExpressionType(ExpressionTypeEnum expressionType) { | |
51 | + this.expressionType = expressionType; | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * @return the constantValue | |
56 | + */ | |
57 | + public String getConstantValue() { | |
58 | + return constantValue; | |
59 | + } | |
60 | + | |
61 | + /** | |
62 | + * @param constantValue the constantValue to set | |
63 | + */ | |
64 | + public void setConstantValue(String constantValue) { | |
65 | + this.constantValue = constantValue; | |
66 | + } | |
67 | + | |
68 | + /** | |
69 | + * @return the scriptCode | |
70 | + */ | |
71 | + public ScriptCode getScriptCode() { | |
72 | + return scriptCode; | |
73 | + } | |
74 | + | |
75 | + /** | |
76 | + * @param scriptCode the scriptCode to set | |
77 | + */ | |
78 | + public void setScriptCode(ScriptCode scriptCode) { | |
79 | + this.scriptCode = scriptCode; | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * @return the serialversionuid | |
84 | + */ | |
85 | + public static long getSerialversionuid() { | |
86 | + return serialVersionUID; | |
87 | + } | |
88 | + | |
89 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportParameter.java
0 → 100644
... | ... | @@ -0,0 +1,149 @@ |
1 | +package br.com.centralit.esi.api.resource.model; | |
2 | + | |
3 | +import javax.persistence.AttributeOverride; | |
4 | +import javax.persistence.AttributeOverrides; | |
5 | +import javax.persistence.Column; | |
6 | +import javax.persistence.Embedded; | |
7 | +import javax.persistence.Entity; | |
8 | +import javax.persistence.FetchType; | |
9 | +import javax.persistence.GeneratedValue; | |
10 | +import javax.persistence.GenerationType; | |
11 | +import javax.persistence.Id; | |
12 | +import javax.persistence.ManyToOne; | |
13 | +import javax.persistence.Table; | |
14 | + | |
15 | +import br.com.centralit.esi.api.data.model.DataObject; | |
16 | +import br.com.centralit.esi.api.design.model.Flow; | |
17 | +import br.com.centralit.esi.api.domain.model.Domain; | |
18 | +import br.com.centralit.framework.json.Views; | |
19 | +import br.com.centralit.framework.model.arquitetura.PersistentObject; | |
20 | + | |
21 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
22 | +import com.fasterxml.jackson.annotation.JsonView; | |
23 | + | |
24 | +@Entity | |
25 | +@Table(name="RES_ReportParameter") | |
26 | +public class ReportParameter extends PersistentObject { | |
27 | + | |
28 | + /** | |
29 | + * | |
30 | + */ | |
31 | + private static final long serialVersionUID = -7632995826475698705L; | |
32 | + | |
33 | + @Id | |
34 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
35 | + @JsonView({Views.GenericView.class }) | |
36 | + protected Long id; | |
37 | + | |
38 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
39 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
40 | + private Domain type; | |
41 | + | |
42 | + @ManyToOne(fetch=FetchType.LAZY, optional=true) | |
43 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
44 | + protected DataObject dataObject; | |
45 | + | |
46 | + @ManyToOne(fetch=FetchType.LAZY, optional=true) | |
47 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
48 | + private Flow flow; | |
49 | + | |
50 | + @ManyToOne(fetch=FetchType.LAZY, optional=true) | |
51 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
52 | + private Resource image; | |
53 | + | |
54 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
55 | + @Embedded | |
56 | + @AttributeOverrides({ | |
57 | + @AttributeOverride(name="expressionType", column = @Column(name="expression_type")), | |
58 | + @AttributeOverride(name="constant", column = @Column(name="expression_constant")), | |
59 | + @AttributeOverride(name="scriptCode.script", column = @Column(name="expression_script")), | |
60 | + @AttributeOverride(name="scriptCode.engineType", column = @Column(name="expression_engineType")) | |
61 | + }) | |
62 | + private ReportExpression expression; | |
63 | + | |
64 | + @Column(nullable = true) | |
65 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
66 | + private String outputAttributeName; | |
67 | + | |
68 | + @ManyToOne(fetch=FetchType.LAZY, optional=false) | |
69 | + @JsonIgnore | |
70 | + protected ReportVersion report; | |
71 | + | |
72 | + @Column(nullable = false) | |
73 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
74 | + private String name; | |
75 | + | |
76 | + public ReportVersion getReport() { | |
77 | + return report; | |
78 | + } | |
79 | + | |
80 | + public void setReport(ReportVersion report) { | |
81 | + this.report = report; | |
82 | + } | |
83 | + | |
84 | + public String getName() { | |
85 | + return name; | |
86 | + } | |
87 | + | |
88 | + public void setName(String name) { | |
89 | + this.name = name; | |
90 | + } | |
91 | + | |
92 | + @Override | |
93 | + public Long getId() { | |
94 | + return this.id; | |
95 | + } | |
96 | + | |
97 | + public Domain getType() { | |
98 | + return type; | |
99 | + } | |
100 | + | |
101 | + public void setType(Domain type) { | |
102 | + this.type = type; | |
103 | + } | |
104 | + | |
105 | + public DataObject getDataObject() { | |
106 | + return dataObject; | |
107 | + } | |
108 | + | |
109 | + public void setDataObject(DataObject dataObject) { | |
110 | + this.dataObject = dataObject; | |
111 | + } | |
112 | + | |
113 | + public Flow getFlow() { | |
114 | + return flow; | |
115 | + } | |
116 | + | |
117 | + public void setFlow(Flow flow) { | |
118 | + this.flow = flow; | |
119 | + } | |
120 | + | |
121 | + public Resource getImage() { | |
122 | + return image; | |
123 | + } | |
124 | + | |
125 | + public void setImage(Resource image) { | |
126 | + this.image = image; | |
127 | + } | |
128 | + | |
129 | + public ReportExpression getExpression() { | |
130 | + return expression; | |
131 | + } | |
132 | + | |
133 | + public void setExpression(ReportExpression expression) { | |
134 | + this.expression = expression; | |
135 | + } | |
136 | + | |
137 | + public String getOutputAttributeName() { | |
138 | + return outputAttributeName; | |
139 | + } | |
140 | + | |
141 | + public void setOutputAttributeName(String outputAttributeName) { | |
142 | + this.outputAttributeName = outputAttributeName; | |
143 | + } | |
144 | + | |
145 | + public void setId(Long id) { | |
146 | + this.id = id; | |
147 | + } | |
148 | + | |
149 | +} | ... | ... |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportVersion.java
1 | 1 | package br.com.centralit.esi.api.resource.model; |
2 | 2 | |
3 | +import java.util.List; | |
4 | + | |
5 | +import javax.persistence.CascadeType; | |
6 | +import javax.persistence.Column; | |
3 | 7 | import javax.persistence.Entity; |
8 | +import javax.persistence.FetchType; | |
9 | +import javax.persistence.ManyToOne; | |
10 | +import javax.persistence.OneToMany; | |
4 | 11 | import javax.persistence.PrimaryKeyJoinColumn; |
5 | 12 | import javax.persistence.Table; |
6 | 13 | |
7 | 14 | import br.com.centralit.esi.api.enumerated.ResourceTypeEnum; |
15 | +import br.com.centralit.framework.json.Views; | |
16 | +import br.com.centralit.framework.model.Menu; | |
17 | + | |
18 | +import com.fasterxml.jackson.annotation.JsonView; | |
8 | 19 | |
9 | 20 | @Entity |
10 | 21 | @Table(name="RES_ReportVersion") |
... | ... | @@ -16,6 +27,22 @@ public class ReportVersion extends ResourceVersion { |
16 | 27 | * |
17 | 28 | */ |
18 | 29 | private static final long serialVersionUID = -1095473041588484440L; |
30 | + | |
31 | + @ManyToOne(fetch=FetchType.LAZY, optional=true) | |
32 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
33 | + private Menu menu; | |
34 | + | |
35 | + @Column(nullable = true, length=100) | |
36 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
37 | + private String menuName; | |
38 | + | |
39 | + @ManyToOne(fetch=FetchType.LAZY, optional=false) | |
40 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
41 | + protected ReportDataSource dataSource; | |
42 | + | |
43 | + @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "report", fetch = FetchType.LAZY) | |
44 | + @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | |
45 | + private List<ReportParameter> parameters; | |
19 | 46 | |
20 | 47 | public ReportVersion() { |
21 | 48 | super(); |
... | ... | @@ -24,5 +51,37 @@ public class ReportVersion extends ResourceVersion { |
24 | 51 | public ReportVersion(String name, String description, String path) { |
25 | 52 | super(ResourceTypeEnum.REPORT, name, description, path); |
26 | 53 | } |
54 | + | |
55 | + public ReportDataSource getDataSource() { | |
56 | + return dataSource; | |
57 | + } | |
58 | + | |
59 | + public void setDataSource(ReportDataSource dataSource) { | |
60 | + this.dataSource = dataSource; | |
61 | + } | |
62 | + | |
63 | + public List<ReportParameter> getParameters() { | |
64 | + return parameters; | |
65 | + } | |
66 | + | |
67 | + public void setParameters(List<ReportParameter> parameters) { | |
68 | + this.parameters = parameters; | |
69 | + } | |
70 | + | |
71 | + public Menu getMenu() { | |
72 | + return menu; | |
73 | + } | |
74 | + | |
75 | + public void setMenu(Menu menu) { | |
76 | + this.menu = menu; | |
77 | + } | |
78 | + | |
79 | + public String getMenuName() { | |
80 | + return menuName; | |
81 | + } | |
82 | + | |
83 | + public void setMenuName(String menuName) { | |
84 | + this.menuName = menuName; | |
85 | + } | |
27 | 86 | |
28 | 87 | } | ... | ... |
cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java
... | ... | @@ -277,6 +277,15 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
277 | 277 | list.add(new Dominio("dataObjectType", "Tabela", "TABLE", 1L)); |
278 | 278 | list.add(new Dominio("dataObjectType", "View", "VIEW", 2L)); |
279 | 279 | |
280 | + list.add(new Dominio("reportDataSourceType", "ESI.DOMINIO.OBJETO_DADOS", "DATAOBJECT", 1L)); | |
281 | + list.add(new Dominio("reportDataSourceType", "ESI.DOMINIO.FLUXO_ESI", "FLOW", 2L)); | |
282 | + list.add(new Dominio("reportParameterType", "ESI.DOMINIO.VARIAVEL", "VARIABLE", 3L)); | |
283 | + | |
284 | + list.add(new Dominio("reportParameterType", "ESI.DOMINIO.OBJETO_DADOS", "DATAOBJECT", 1L)); | |
285 | + list.add(new Dominio("reportParameterType", "ESI.DOMINIO.FLUXO_ESI", "FLOW", 2L)); | |
286 | + list.add(new Dominio("reportParameterType", "ESI.DOMINIO.VARIAVEL", "VARIABLE", 3L)); | |
287 | + list.add(new Dominio("reportParameterType", "ESI.DOMINIO.IMAGEM", "IMAGE", 4L)); | |
288 | + | |
280 | 289 | this.dominioService.saveListIfNotExist(list); |
281 | 290 | |
282 | 291 | Logger.getLogger(StartupListenerEsi.class).info("Domínios executados - StartupListenerESI!"); |
... | ... | @@ -2121,6 +2130,11 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen |
2121 | 2130 | internacionalizacaoList.add(new Internacionalizacao("ESI.TAREFA", "Tarefa", dominio, modulo)); |
2122 | 2131 | internacionalizacaoList.add(new Internacionalizacao("ESI.ATUALIZADO", "atualizado", dominio, modulo)); |
2123 | 2132 | |
2133 | + internacionalizacaoList.add(new Internacionalizacao("ESI.DOMINIO.OBJETO_DADOS", "Objeto de dados", dominio, modulo)); | |
2134 | + internacionalizacaoList.add(new Internacionalizacao("ESI.DOMINIO.FLUXO_ESI", "Fluxo ESI", dominio, modulo)); | |
2135 | + internacionalizacaoList.add(new Internacionalizacao("ESI.DOMINIO.VARIAVEL", "Variável", dominio, modulo)); | |
2136 | + internacionalizacaoList.add(new Internacionalizacao("ESI.DOMINIO.IMAGEM", "Imagem", dominio, modulo)); | |
2137 | + | |
2124 | 2138 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.TIPO_ENGINE_REGRA_DROOLS", "Drools", dominio, modulo)); |
2125 | 2139 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.TIPO_ESTIMATIVA_TEMPO", "Tempo", dominio, modulo)); |
2126 | 2140 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.TIPO_ENGINE_REGRA_FLUXO", "Fluxo", dominio, modulo)); | ... | ... |