2 * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 * not use this file except in compliance with the License. You may obtain
6 * a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 * implied. See the License for the specific language governing
14 * permissions and limitations under the License.
16 package org.akraino.validation.ui.entity;
18 import java.io.IOException;
19 import java.io.Serializable;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.FetchType;
25 import javax.persistence.GeneratedValue;
26 import javax.persistence.GenerationType;
27 import javax.persistence.Id;
28 import javax.persistence.JoinColumn;
29 import javax.persistence.ManyToOne;
30 import javax.persistence.OneToMany;
31 import javax.persistence.OneToOne;
32 import javax.persistence.Table;
34 import com.fasterxml.jackson.core.JsonGenerator;
35 import com.fasterxml.jackson.databind.SerializerProvider;
36 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
37 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
40 @Table(name = "validation_test_result")
41 public class ValidationDbTestResult implements Serializable {
46 private static final long serialVersionUID = 1L;
49 @GeneratedValue(strategy = GenerationType.IDENTITY)
54 @JoinColumn(name = "blueprint_instance_id")
55 private BlueprintInstance blueprintInstance;
58 @JoinColumn(name = "lab_id")
61 @Column(name = "timestamp")
62 private String timestamp;
64 @Column(name = "all_layers")
65 private Boolean allLayers;
67 @Column(name = "optional")
68 private Boolean optional;
70 @Column(name = "result")
71 private Boolean result;
73 @Column(name = "date_of_storage")
74 private String dateStorage;
77 @JoinColumn(name = "submission_id")
78 @JsonSerialize(using = SubmissionSerializer.class)
79 private Submission submission;
81 @OneToMany(mappedBy = "validationDbTestResult", targetEntity = WRobotDbTestResult.class, fetch = FetchType.EAGER)
82 private Set<WRobotDbTestResult> wRobotDbTestResults;
84 public int getResultId() {
88 public void setResultId(int resultId) {
89 this.resultId = resultId;
92 public BlueprintInstance getBlueprintInstance() {
93 return blueprintInstance;
96 public void setBlueprintInstance(BlueprintInstance blueprintInstance) {
97 this.blueprintInstance = blueprintInstance;
100 public Boolean getAllLayers() {
104 public void setAllLayers(Boolean allLayers) {
105 this.allLayers = allLayers;
108 public Boolean getOptional() {
112 public void setOptional(Boolean optional) {
113 this.optional = optional;
116 public LabInfo getLab() {
120 public void setLab(LabInfo lab) {
124 public String getTimestamp() {
128 public void setTimestamp(String timestamp) {
129 this.timestamp = timestamp;
132 public Boolean getResult() {
136 public void setResult(Boolean result) {
137 this.result = result;
140 public String getDateStorage() {
144 public void setDateStorage(String dateStorage) {
145 this.dateStorage = dateStorage;
148 public Submission getSubmission() {
149 return this.submission;
152 public void setSubmission(Submission submission) {
153 this.submission = submission;
156 public Set<WRobotDbTestResult> getWRobotDbTestResults() {
157 return this.wRobotDbTestResults;
160 public void setWRobotDbTestResults(Set<WRobotDbTestResult> wRobotDbTestResults) {
161 this.wRobotDbTestResults = wRobotDbTestResults;
164 static class SubmissionSerializer extends StdSerializer<Submission> {
166 public SubmissionSerializer() {
170 public SubmissionSerializer(Class<Submission> t) {
175 public void serialize(Submission submission, JsonGenerator gen, SerializerProvider provider)
177 Submission result = new Submission();
178 result.setSubmissionId(submission.getSubmissionId());
179 result.setSubmissionStatus(submission.getSubmissionStatus());
180 result.setTimeslot(submission.getTimeslot());
181 gen.writeObject(result);