forked from I-TECH-UW/OpenELIS-Global-2
-
Notifications
You must be signed in to change notification settings - Fork 0
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
178 additions
and
20 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
2 changes: 1 addition & 1 deletion
2
...o/rest/CalculatedValueRestController.java → ...r/rest/CalculatedValueRestController.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
8 changes: 8 additions & 0 deletions
8
src/main/java/org/openelisglobal/testcalculated/dao/TestCalculationDAO.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,8 @@ | ||
package org.openelisglobal.testcalculated.dao; | ||
|
||
import org.openelisglobal.common.dao.BaseDAO; | ||
import org.openelisglobal.testcalculated.valueholder.Calculation; | ||
|
||
public interface TestCalculationDAO extends BaseDAO<Calculation, Integer> { | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/org/openelisglobal/testcalculated/daoimpl/TestCalculationDAOImpl.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,18 @@ | ||
package org.openelisglobal.testcalculated.daoimpl; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
import org.openelisglobal.common.daoimpl.BaseDAOImpl; | ||
import org.openelisglobal.testcalculated.dao.TestCalculationDAO; | ||
import org.openelisglobal.testcalculated.valueholder.Calculation; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Transactional | ||
public class TestCalculationDAOImpl extends BaseDAOImpl<Calculation, Integer> implements TestCalculationDAO{ | ||
|
||
public TestCalculationDAOImpl() { | ||
super(Calculation.class); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/openelisglobal/testcalculated/service/TestCalculationService.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,9 @@ | ||
package org.openelisglobal.testcalculated.service; | ||
|
||
import org.openelisglobal.common.service.BaseObjectService; | ||
import org.openelisglobal.testcalculated.valueholder.Calculation; | ||
|
||
|
||
public interface TestCalculationService extends BaseObjectService<Calculation , Integer>{ | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/openelisglobal/testcalculated/service/TestCalculationServiceImpl.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,23 @@ | ||
package org.openelisglobal.testcalculated.service; | ||
|
||
import org.openelisglobal.common.service.BaseObjectServiceImpl; | ||
import org.openelisglobal.testcalculated.dao.TestCalculationDAO; | ||
import org.openelisglobal.testcalculated.valueholder.Calculation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class TestCalculationServiceImpl extends BaseObjectServiceImpl<Calculation, Integer> implements TestCalculationService { | ||
@Autowired | ||
TestCalculationDAO testCalculationDAOdao; | ||
|
||
public TestCalculationServiceImpl() { | ||
super(Calculation.class); | ||
} | ||
|
||
@Override | ||
protected TestCalculationDAO getBaseObjectDAO() { | ||
return testCalculationDAOdao; | ||
} | ||
|
||
} |
49 changes: 31 additions & 18 deletions
49
src/main/java/org/openelisglobal/testcalculated/valueholder/Calculation.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 |
---|---|---|
@@ -1,71 +1,84 @@ | ||
package org.openelisglobal.testcalculated.valueholder; | ||
|
||
import java.util.Set; | ||
|
||
import javax.persistence.CascadeType; | ||
import javax.persistence.Column; | ||
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.OneToMany; | ||
import javax.persistence.SequenceGenerator; | ||
import javax.persistence.Table; | ||
|
||
import org.openelisglobal.common.valueholder.BaseObject; | ||
|
||
@Entity | ||
@Table(name = "calculation") | ||
public class Calculation extends BaseObject<Integer>{ | ||
|
||
public class Calculation extends BaseObject<Integer> { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "calculation_generator") | ||
@SequenceGenerator(name = "calculation_generator", sequenceName = "calculation_seq", allocationSize = 1) | ||
@Column(name = "id") | ||
private Integer id; | ||
|
||
@Column(name = "name") | ||
private String name; | ||
|
||
private Integer sampleId ; | ||
|
||
private Integer testId ; | ||
|
||
@Column(name = "sample_id") | ||
private Integer sampleId; | ||
|
||
@Column(name = "test_id") | ||
private Integer testId; | ||
|
||
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) | ||
@JoinColumn(name = "calculation_id", referencedColumnName = "id") | ||
private Set<Operation> operations; | ||
|
||
@Override | ||
public Integer getId() { | ||
// TODO Auto-generated method stub | ||
throw new UnsupportedOperationException("Unimplemented method 'getId'"); | ||
return id; | ||
} | ||
|
||
@Override | ||
public void setId(Integer id) { | ||
// TODO Auto-generated method stub | ||
throw new UnsupportedOperationException("Unimplemented method 'setId'"); | ||
this.id = id ; | ||
} | ||
|
||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
|
||
public Integer getSampleId() { | ||
return sampleId; | ||
} | ||
|
||
|
||
public void setSampleId(Integer sampleId) { | ||
this.sampleId = sampleId; | ||
} | ||
|
||
|
||
public Integer getTestId() { | ||
return testId; | ||
} | ||
|
||
|
||
public void setTestId(Integer testId) { | ||
this.testId = testId; | ||
} | ||
|
||
public Set<Operation> getOperations() { | ||
return operations; | ||
} | ||
|
||
public void setOperations(Set<Operation> operations) { | ||
this.operations = operations; | ||
} | ||
|
||
} |
83 changes: 83 additions & 0 deletions
83
src/main/java/org/openelisglobal/testcalculated/valueholder/Operation.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 |
---|---|---|
@@ -1,5 +1,88 @@ | ||
package org.openelisglobal.testcalculated.valueholder; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.SequenceGenerator; | ||
import javax.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "calculation_opearation") | ||
public class Operation { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "calculation_opearation_generator") | ||
@SequenceGenerator(name = "calculation_opeartion_generator", sequenceName = "calculation_opearation_seq", allocationSize = 1) | ||
@Column(name = "id") | ||
private Integer id; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "type") | ||
private OperationType type; | ||
|
||
@Column(name = "value") | ||
private String value;; | ||
|
||
@Column(name = "sampleId") | ||
private Integer sampleId; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public OperationType getType() { | ||
return type; | ||
} | ||
|
||
public void setType(OperationType type) { | ||
this.type = type; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
|
||
public Integer getSampleId() { | ||
return sampleId; | ||
} | ||
|
||
public void setSampleId(Integer sampleId) { | ||
this.sampleId = sampleId; | ||
} | ||
|
||
public enum OperationType { | ||
|
||
TEST_RESULT("Test Result"), | ||
MATH_FUNCTION("Math Function"), | ||
INTEGER("Integer"), | ||
PATIENT_ATTRIBUTE("Patient Attribute"); | ||
|
||
private String displayName; | ||
|
||
private OperationType(String displayName) { | ||
this.displayName = displayName; | ||
} | ||
|
||
public String getDisplayName() { | ||
return this.displayName; | ||
} | ||
|
||
public static Stream<OperationType> stream() { | ||
return Stream.of(OperationType.values()); | ||
} | ||
} | ||
} |