@@ -104,7 +104,8 @@
@@ -206,6 +207,10 @@
+
+
+
+
diff --git a/jacq-input/src/test/java/org/jacq/input/EditTest.java b/jacq-input/src/test/java/org/jacq/input/EditTest.java
index de1d956..1297344 100644
--- a/jacq-input/src/test/java/org/jacq/input/EditTest.java
+++ b/jacq-input/src/test/java/org/jacq/input/EditTest.java
@@ -20,6 +20,7 @@
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
/**
*
@@ -57,6 +58,11 @@ public void createLiving() {
List
scientificNameRows = scientificNamePanel.findElements(By.tagName("tr"));
Assert.assertTrue(scientificNameRows.size() > 0);
scientificNameRows.get(0).click();
+
+ // check index seminum type for "WS" as default value
+ WebElement indexSeminumTypeSelect = driver.findElement(By.id("jacq_form:tabView:index_seminum_type_input"));
+ Assert.assertNotNull(indexSeminumTypeSelect);
+ Assert.assertEquals("WS", (new Select(indexSeminumTypeSelect)).getFirstSelectedOption().getText());
}
@Test
diff --git a/jacq-names/pom.xml b/jacq-names/pom.xml
index b53fddc..3003625 100644
--- a/jacq-names/pom.xml
+++ b/jacq-names/pom.xml
@@ -4,7 +4,7 @@
org.jacq
jacq
- 0.8.0
+ 0.9.0
../jacq/pom.xml
diff --git a/jacq-names/src/main/resources/META-INF/persistence.xml b/jacq-names/src/main/resources/META-INF/persistence.xml
index b775270..a47b1f7 100644
--- a/jacq-names/src/main/resources/META-INF/persistence.xml
+++ b/jacq-names/src/main/resources/META-INF/persistence.xml
@@ -4,7 +4,7 @@
java:/openupDS
org.hibernate.ejb.HibernatePersistence
- ../WEB-INF/lib/jacq-common-0.8.0.jar
+ ../WEB-INF/lib/jacq-common-0.9.0.jar
false
@@ -22,7 +22,7 @@
java:/jacqDS
org.hibernate.ejb.HibernatePersistence
- ../WEB-INF/lib/jacq-common-0.8.0.jar
+ ../WEB-INF/lib/jacq-common-0.9.0.jar
false
diff --git a/jacq-output/pom.xml b/jacq-output/pom.xml
index e969b28..520b655 100644
--- a/jacq-output/pom.xml
+++ b/jacq-output/pom.xml
@@ -4,7 +4,7 @@
org.jacq
jacq
- 0.8.0
+ 0.9.0
../jacq/pom.xml
diff --git a/jacq-service-output/pom.xml b/jacq-service-output/pom.xml
index c65b6b8..dc08084 100644
--- a/jacq-service-output/pom.xml
+++ b/jacq-service-output/pom.xml
@@ -4,7 +4,7 @@
org.jacq
jacq
- 0.8.0
+ 0.9.0
../jacq/pom.xml
diff --git a/jacq-service-output/src/main/resources/META-INF/persistence.xml b/jacq-service-output/src/main/resources/META-INF/persistence.xml
index 271f1e6..9141107 100644
--- a/jacq-service-output/src/main/resources/META-INF/persistence.xml
+++ b/jacq-service-output/src/main/resources/META-INF/persistence.xml
@@ -4,7 +4,7 @@
java:/jacqDS
org.hibernate.ejb.HibernatePersistence
- ../WEB-INF/lib/jacq-common-0.8.0.jar
+ ../WEB-INF/lib/jacq-common-0.9.0.jar
false
diff --git a/jacq-service-report/pom.xml b/jacq-service-report/pom.xml
index 81598ac..6a0a5b0 100644
--- a/jacq-service-report/pom.xml
+++ b/jacq-service-report/pom.xml
@@ -4,7 +4,7 @@
org.jacq
jacq
- 0.8.0
+ 0.9.0
../jacq/pom.xml
diff --git a/jacq-service-report/src/main/resources/META-INF/persistence.xml b/jacq-service-report/src/main/resources/META-INF/persistence.xml
index 960b7e8..e0122c0 100644
--- a/jacq-service-report/src/main/resources/META-INF/persistence.xml
+++ b/jacq-service-report/src/main/resources/META-INF/persistence.xml
@@ -4,7 +4,7 @@
java:/jacqDS
org.hibernate.ejb.HibernatePersistence
- ../WEB-INF/lib/jacq-common-0.8.0.jar
+ ../WEB-INF/lib/jacq-common-0.9.0.jar
false
diff --git a/jacq-service/pom.xml b/jacq-service/pom.xml
index a41c175..1e0885e 100644
--- a/jacq-service/pom.xml
+++ b/jacq-service/pom.xml
@@ -3,7 +3,7 @@
org.jacq
jacq
- 0.8.0
+ 0.9.0
../jacq/pom.xml
diff --git a/jacq-service/src/main/java/org/jacq/service/manager/SeedExchangeManager.java b/jacq-service/src/main/java/org/jacq/service/manager/SeedExchangeManager.java
index 4bbfb90..328b439 100644
--- a/jacq-service/src/main/java/org/jacq/service/manager/SeedExchangeManager.java
+++ b/jacq-service/src/main/java/org/jacq/service/manager/SeedExchangeManager.java
@@ -18,6 +18,7 @@
import org.jacq.common.model.jpa.TblDerivative;
import org.jacq.common.model.jpa.TblOrganisation;
import org.jacq.common.model.jpa.TblSeedOrder;
+import org.jacq.common.model.jpa.TblSeedOrderDerivative;
import org.jacq.common.model.jpa.custom.BotanicalObjectDerivative;
import org.jacq.common.model.rest.SeedOrderResult;
import org.jacq.common.rest.SeedExchangeService;
@@ -45,7 +46,7 @@ public class SeedExchangeManager {
public SeedOrderResult find(Long seedOrderId) {
TblSeedOrder tblSeedOrder = em.find(TblSeedOrder.class, seedOrderId);
- return new SeedOrderResult(tblSeedOrder, this.fromTblDerivativeList(tblSeedOrder.getTblDerivativeList()));
+ return new SeedOrderResult(tblSeedOrder, this.fromTblDerivativeList(tblSeedOrder.getTblSeedOrderDerivativeList()));
}
/**
@@ -60,7 +61,7 @@ public List findAll() {
List tblSeedOrderList = tblSeedOrderQuery.getResultList();
for (TblSeedOrder tblSeedOrder : tblSeedOrderList) {
- seedOrderResults.add(new SeedOrderResult(tblSeedOrder, this.fromTblDerivativeList(tblSeedOrder.getTblDerivativeList())));
+ seedOrderResults.add(new SeedOrderResult(tblSeedOrder, this.fromTblDerivativeList(tblSeedOrder.getTblSeedOrderDerivativeList())));
}
return seedOrderResults;
@@ -90,10 +91,13 @@ public SeedOrderResult save(SeedOrderResult seedOrderResult) {
tblSeedOrder.setSenderOrganisationId(frmwrkUser.getOrganisationId());
tblSeedOrder.setSenderUserId(frmwrkUser);
+ // save & refresh seed order
+ em.persist(tblSeedOrder);
+
// add list of derivatives
- List tblDerivatives = tblSeedOrder.getTblDerivativeList();
- if (tblDerivatives == null) {
- tblDerivatives = new ArrayList<>();
+ List tblSeedOrderDerivatives = tblSeedOrder.getTblSeedOrderDerivativeList();
+ if (tblSeedOrderDerivatives == null) {
+ tblSeedOrderDerivatives = new ArrayList<>();
}
for (BotanicalObjectDerivative botanicalObjectDerivative : seedOrderResult.getDerivativeList()) {
TblDerivative tblDerivative = em.find(TblDerivative.class, botanicalObjectDerivative.getDerivativeId());
@@ -110,29 +114,34 @@ public SeedOrderResult save(SeedOrderResult seedOrderResult) {
em.persist(tblDerivative);
}
- tblDerivatives.add(tblDerivative);
+ TblSeedOrderDerivative tblSeedOrderDerivative = new TblSeedOrderDerivative();
+ tblSeedOrderDerivative.setDerivativeId(tblDerivative);
+ tblSeedOrderDerivative.setSeedOrderId(tblSeedOrder);
+
+ // persist derivative association and save it
+ em.persist(tblSeedOrderDerivative);
+ em.flush();
+ em.refresh(tblSeedOrderDerivative);
}
- tblSeedOrder.setTblDerivativeList(tblDerivatives);
- // save & refresh seed order
- em.persist(tblSeedOrder);
+ // refresh seed order
em.flush();
em.refresh(tblSeedOrder);
- return new SeedOrderResult(tblSeedOrder, this.fromTblDerivativeList(tblSeedOrder.getTblDerivativeList()));
+ return new SeedOrderResult(tblSeedOrder, this.fromTblDerivativeList(tblSeedOrder.getTblSeedOrderDerivativeList()));
}
/**
* Helper function for converting a list of tblderivatives to
* botanicalobject derivatives
*
- * @param tblDerivatives
+ * @param tblSeedOrderDerivatives
* @return
*/
- protected List fromTblDerivativeList(List tblDerivatives) {
+ protected List fromTblDerivativeList(List tblSeedOrderDerivatives) {
List botanicalObjectDerivatives = new ArrayList<>();
- for (TblDerivative tblDerivative : tblDerivatives) {
- List botanicalObjectDerivativeResults = derivativeManager.find(null, tblDerivative.getDerivativeId(), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
+ for (TblSeedOrderDerivative tblSeedOrderDerivative : tblSeedOrderDerivatives) {
+ List botanicalObjectDerivativeResults = derivativeManager.find(null, tblSeedOrderDerivative.getDerivativeId().getDerivativeId(), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
if (botanicalObjectDerivativeResults != null && botanicalObjectDerivativeResults.size() > 0) {
botanicalObjectDerivatives.add(botanicalObjectDerivativeResults.get(0));
}
diff --git a/jacq-service/src/main/resources/META-INF/persistence.xml b/jacq-service/src/main/resources/META-INF/persistence.xml
index 6993385..b1325b7 100644
--- a/jacq-service/src/main/resources/META-INF/persistence.xml
+++ b/jacq-service/src/main/resources/META-INF/persistence.xml
@@ -4,7 +4,7 @@
java:/jacqDS
org.hibernate.ejb.HibernatePersistence
- ../WEB-INF/lib/jacq-common-0.8.0.jar
+ ../WEB-INF/lib/jacq-common-0.9.0.jar
false
diff --git a/jacq/jacq.mwb b/jacq/jacq.mwb
index 607bea3..c0e9e39 100644
Binary files a/jacq/jacq.mwb and b/jacq/jacq.mwb differ
diff --git a/jacq/pom.xml b/jacq/pom.xml
index b1c28dd..13034e5 100644
--- a/jacq/pom.xml
+++ b/jacq/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.jacq
jacq
- 0.8.0
+ 0.9.0
jacq
pom