-
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
1 parent
f12ce57
commit ee22251
Showing
27 changed files
with
11,443 additions
and
144 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
46 changes: 0 additions & 46 deletions
46
src/main/java/com/mycompany/cassiopeia/cancerController.java
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/main/java/com/mycompany/cassiopeia/cancerRepository.java
This file was deleted.
Oops, something went wrong.
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
49 changes: 49 additions & 0 deletions
49
src/main/java/com/mycompany/cassiopeia/ejb/SymptomRepository.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,49 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package com.mycompany.cassiopeia.ejb; | ||
|
||
import com.mycompany.cassiopeia.entity.Symptom; | ||
import java.util.List; | ||
import javax.ejb.Stateless; | ||
import javax.persistence.EntityManager; | ||
import javax.persistence.PersistenceContext; | ||
import javax.persistence.TypedQuery; | ||
|
||
/** | ||
* | ||
* @author dancan | ||
*/ | ||
@Stateless | ||
public class SymptomRepository { | ||
|
||
@PersistenceContext(unitName="com.mycompany_cassiopeia_war_1.0-SNAPSHOTPU") | ||
protected EntityManager em; | ||
|
||
public EntityManager getEntityManager() { | ||
return em; | ||
} | ||
|
||
public Symptom createSymptom(Symptom symptom){ | ||
getEntityManager().persist(symptom); | ||
return symptom; | ||
} | ||
|
||
public List<Symptom> findAllSymptoms(){ | ||
TypedQuery<Symptom> query = getEntityManager().createQuery( | ||
"SELECT s FROM Symptom s", Symptom.class); | ||
return query.getResultList(); | ||
} | ||
|
||
public Symptom findSymptom(int id){ | ||
return getEntityManager().find(Symptom.class, id); | ||
} | ||
|
||
public List<Symptom> addAllSymptoms(List<Symptom> list){ | ||
for(Symptom symptom: list){createSymptom(symptom);} | ||
return list; | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
src/main/java/com/mycompany/cassiopeia/ejb/cancerRepository.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,66 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package com.mycompany.cassiopeia.ejb; | ||
|
||
import com.mycompany.cassiopeia.entity.Cancer; | ||
import java.util.HashMap; | ||
import javax.persistence.*; | ||
import java.util.List; | ||
import javax.ejb.Stateless; | ||
|
||
/** | ||
* | ||
* @author dancan | ||
*/ | ||
@Stateless | ||
public class cancerRepository { | ||
@PersistenceContext(unitName="com.mycompany_cassiopeia_war_1.0-SNAPSHOTPU") | ||
protected EntityManager em; | ||
|
||
public EntityManager getEntityManager() { | ||
return em; | ||
} | ||
|
||
|
||
public Cancer createCancerName(Cancer cancer) { | ||
// Cancer cancer = new Cancer(id); | ||
// cancer.setCancerName(cancerName); | ||
// cancer.setLethalDegree(lethalDegree); | ||
// cancer.setTreatmentType(treatmentType); | ||
getEntityManager().persist(cancer); | ||
return cancer; | ||
} | ||
|
||
public Cancer findCancerName(int id) { | ||
return getEntityManager().find(Cancer.class, id); | ||
} | ||
|
||
public List<Cancer> findAllCancerNames() { | ||
TypedQuery<Cancer> query = getEntityManager().createQuery( | ||
"SELECT c FROM Cancer c", Cancer.class); | ||
return query.getResultList(); | ||
} | ||
public boolean addListCancers(List<Cancer> list){ | ||
boolean dan = false; | ||
try{ | ||
for(Cancer c:list){ | ||
/*Cancer c = new Cancer(); | ||
c.setLethalDegree(c_hm.get("lethalDegree").toString()); | ||
c.setLethalDegree(c_hm.get("treatmentType").toString()); | ||
c.setLethalDegree(c_hm.get("cancerName").toString());*/ | ||
createCancerName(c); | ||
} | ||
dan = true; | ||
} | ||
catch(Exception e){ | ||
|
||
} | ||
finally{ | ||
return dan; | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.