Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
395 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
* | ||
*/ | ||
public class TestCaseCommand { | ||
|
||
protected Long testCaseId; | ||
|
||
public Long getTestCaseId() { | ||
|
168 changes: 168 additions & 0 deletions
168
hit-core-domain/src/main/java/gov/nist/hit/core/domain/log/ValidationLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
package gov.nist.hit.core.domain.log; | ||
|
||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import javax.persistence.CollectionTable; | ||
import javax.persistence.Column; | ||
import javax.persistence.ElementCollection; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.MapKeyColumn; | ||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* This software was developed at the National Institute of Standards and Technology by employees of | ||
* the Federal Government in the course of their official duties. Pursuant to title 17 Section 105 | ||
* of the United States Code this software is not subject to copyright protection and is in the | ||
* public domain. This is an experimental system. NIST assumes no responsibility whatsoever for its | ||
* use by other parties, and makes no guarantees, expressed or implied, about its quality, | ||
* reliability, or any other characteristic. We would appreciate acknowledgement if the software is | ||
* used. This software can be redistributed and/or modified freely provided that any derivative | ||
* works bear some notice that they are derived from it, and any modified versions bear some notice | ||
* that they have been modified. | ||
* | ||
* Created by mcl1 on 10/21/16. | ||
* | ||
* The ValidationLogReport is a minimalist version of the EnhancedReport that contains only the | ||
* information we need to display the validation logs. | ||
* | ||
*/ | ||
@Entity | ||
public class ValidationLog { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
protected Long id; | ||
|
||
|
||
@NotNull | ||
@Column(nullable = false) | ||
private Long userId; | ||
|
||
@NotNull | ||
@Column(nullable = false) | ||
private Long testStepId; | ||
private String messageId; | ||
private String format; | ||
private String testingStage; | ||
private int errorCount = 0; | ||
private int warningCount = 0; | ||
|
||
@NotNull | ||
@Column(nullable = false) | ||
private Date date; | ||
|
||
@ElementCollection(fetch = FetchType.EAGER) | ||
@CollectionTable(name = "ErrorCountInSegment", | ||
joinColumns = @JoinColumn(name = "validation_log_id")) | ||
@MapKeyColumn(name = "segment_name") | ||
@Column(name = "number_errors") | ||
private Map<String, Integer> errorCountInSegment = new HashMap<String, Integer>(); | ||
|
||
private boolean validationResult = true; | ||
|
||
|
||
public ValidationLog() { | ||
|
||
} | ||
|
||
public String getMessageId() { | ||
return messageId; | ||
} | ||
|
||
public void setMessageId(String messageId) { | ||
this.messageId = messageId; | ||
} | ||
|
||
public String getFormat() { | ||
return format; | ||
} | ||
|
||
public void setFormat(String format) { | ||
this.format = format; | ||
} | ||
|
||
public int getErrorCount() { | ||
return errorCount; | ||
} | ||
|
||
public void setErrorCount(int errorCount) { | ||
this.errorCount = errorCount; | ||
} | ||
|
||
public int getWarningCount() { | ||
return warningCount; | ||
} | ||
|
||
public void setWarningCount(int warningCount) { | ||
this.warningCount = warningCount; | ||
} | ||
|
||
public String getDate(String format) { | ||
// Format the date as specified | ||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); | ||
if (this.date == null) { | ||
this.date = new Date(); | ||
} | ||
return simpleDateFormat.format(this.date); | ||
} | ||
|
||
public void setDate(Date date) { | ||
this.date = date; | ||
} | ||
|
||
public Map<String, Integer> getErrorCountInSegment() { | ||
return errorCountInSegment; | ||
} | ||
|
||
public void setErrorCountInSegment(Map<String, Integer> errorCountInSegment) { | ||
this.errorCountInSegment = errorCountInSegment; | ||
} | ||
|
||
public boolean isValidationResult() { | ||
return validationResult; | ||
} | ||
|
||
public void setValidationResult(boolean validationResult) { | ||
this.validationResult = validationResult; | ||
} | ||
|
||
public String getTestingStage() { | ||
return testingStage; | ||
} | ||
|
||
public void setTestingStage(String testingStage) { | ||
this.testingStage = testingStage; | ||
} | ||
|
||
public Long getTestStepId() { | ||
return testStepId; | ||
} | ||
|
||
public void setTestStepId(Long testStepId) { | ||
this.testStepId = testStepId; | ||
} | ||
|
||
public Long getUserId() { | ||
return userId; | ||
} | ||
|
||
public void setUserId(Long userId) { | ||
this.userId = userId; | ||
} | ||
|
||
public Date getDate() { | ||
return date; | ||
} | ||
|
||
|
||
|
||
} |
38 changes: 38 additions & 0 deletions
38
hit-core-repo/src/main/java/gov/nist/hit/core/repo/ValidationLogRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* This software was developed at the National Institute of Standards and Technology by employees of | ||
* the Federal Government in the course of their official duties. Pursuant to title 17 Section 105 | ||
* of the United States Code this software is not subject to copyright protection and is in the | ||
* public domain. This is an experimental system. NIST assumes no responsibility whatsoever for its | ||
* use by other parties, and makes no guarantees, expressed or implied, about its quality, | ||
* reliability, or any other characteristic. We would appreciate acknowledgement if the software is | ||
* used. This software can be redistributed and/or modified freely provided that any derivative | ||
* works bear some notice that they are derived from it, and any modified versions bear some notice | ||
* that they have been modified. | ||
*/ | ||
|
||
package gov.nist.hit.core.repo; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import gov.nist.hit.core.domain.TestArtifact; | ||
import gov.nist.hit.core.domain.log.ValidationLog; | ||
|
||
public interface ValidationLogRepository extends JpaRepository<ValidationLog, Long> { | ||
|
||
|
||
@Query("select testStep.testStory from TestStep testStep where testStep.id = :id") | ||
public TestArtifact testStory(@Param("id") Long id); | ||
|
||
|
||
@Query("select log from ValidationLog log where log.userId = :userId") | ||
public List<ValidationLog> findByUserId(@Param("userId") Long userId); | ||
|
||
@Query("select log from ValidationLog log where log.testStepId = :testStepId") | ||
public List<ValidationLog> findByTestStepId(@Param("testStepId") Long testStepId); | ||
|
||
|
||
} |
22 changes: 22 additions & 0 deletions
22
hit-core-service/src/main/java/gov/nist/hit/core/service/ValidationLogService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package gov.nist.hit.core.service; | ||
|
||
import java.util.List; | ||
|
||
import gov.nist.healthcare.unified.model.EnhancedReport; | ||
import gov.nist.hit.core.domain.TestContext; | ||
import gov.nist.hit.core.domain.log.ValidationLog; | ||
|
||
public interface ValidationLogService { | ||
|
||
public ValidationLog findOne(Long id); | ||
|
||
public ValidationLog save(ValidationLog log); | ||
|
||
public List<ValidationLog> findByUserId(Long userId); | ||
|
||
public List<ValidationLog> findByTestStepId(Long testStepId); | ||
|
||
public ValidationLog generateAndSave(Long userId, TestContext testContext, EnhancedReport report); | ||
|
||
|
||
} |
Oops, something went wrong.