From 667d3a02bc5867d349b548ac5eee5212026a2551 Mon Sep 17 00:00:00 2001 From: kelvingoodson Date: Mon, 1 Feb 2010 16:56:53 +0000 Subject: adding work items to existing milestone working - new milstone missing some logic, i/f needs tidying, backup of old plan not yet good enough git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@905337 13f79535-47bb-0310-9956-ffa450edef68 --- .../jagg/src/main/java/services/PlanView.java | 1 + .../jagg/src/main/java/services/PlanViewImpl.java | 67 ++++++++-- .../jagg/src/main/resources/JiraSideband.xml | 135 ++++++++++----------- .../jagg/src/main/resources/JiraSideband.xsd | 20 +-- .../jagg/src/main/resources/uiservices/plan.html | 54 +++++---- 5 files changed, 171 insertions(+), 106 deletions(-) (limited to 'sandbox/kgoodson') diff --git a/sandbox/kgoodson/jagg/src/main/java/services/PlanView.java b/sandbox/kgoodson/jagg/src/main/java/services/PlanView.java index e3d9080246..101e1d1e01 100644 --- a/sandbox/kgoodson/jagg/src/main/java/services/PlanView.java +++ b/sandbox/kgoodson/jagg/src/main/java/services/PlanView.java @@ -31,5 +31,6 @@ import com.example.ipo.jaxb.Plan; public interface PlanView { Plan get(); + void post(String newMSName,String msChoice, String jira); } \ No newline at end of file diff --git a/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java b/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java index 5c4f115a6c..79d835ecb2 100644 --- a/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java +++ b/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java @@ -20,6 +20,7 @@ package services; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; @@ -29,6 +30,7 @@ import java.util.List; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.Unmarshaller; +import javax.xml.bind.Marshaller; import org.oasisopen.sca.annotation.Init; import org.xml.sax.InputSource; @@ -55,7 +57,6 @@ public class PlanViewImpl implements PlanView { @Init public void init() { - } private Plan getPlan() { @@ -70,7 +71,7 @@ public class PlanViewImpl implements PlanView { // Reader r = new XMLReader() // InputSource s = new InputSource(r); - _p = ((JAXBElement) m.unmarshal(inputFile)).getValue(); + _p = (Plan)m.unmarshal(inputFile); augment_plan(_p); } catch (Exception e) { e.printStackTrace(); @@ -99,11 +100,6 @@ public class PlanViewImpl implements PlanView { JAXBContext jaxbContext = JAXBContext .newInstance("com.example.ipo.jaxb"); Unmarshaller m2 = jaxbContext.createUnmarshaller(); - - // File inputFile = new File("src/main/resources/exampleJira.xml") - // .getAbsoluteFile(); - // - // RSS j = ((JAXBElement) m2.unmarshal(inputFile)).getValue(); InputStream is = null; RSS j; try{ @@ -118,6 +114,7 @@ public class PlanViewImpl implements PlanView { Item i = j.getChannel().getItem(); System.out.println(i.toString()); List> c = i.getContent(); + // TODO see if there's a better way to get this data out for (JAXBElement element : c) { if("title".equals(element.getName().getLocalPart())) { String jtitle = (String)element.getValue(); @@ -148,4 +145,60 @@ public class PlanViewImpl implements PlanView { return modelplan; } + private Milestone getMS(String id) { + + Milestone m = null; + Plan p = getPlan(); + for(Milestone mi : p.getMilestone()) { + if(id.equals(mi.getID())) { + m = mi; + break; + } + } + return m; + } + + public void post(String newMSName,String msChoice, String jira) { + + String msName = msChoice; + Plan p = getPlan(); + if(!"".equals(newMSName)) { + List mis = p.getMilestone(); + Milestone newm = new Milestone(); + newm.setID(newMSName); + mis.add(new Milestone()); + msName = newMSName; + } + + Milestone m = getMS(msName); + WorkItem wi = new WorkItem(); + wi.setJira(jira); + m.getWorkItem().add(wi); + + writePlan(); + } + + private void writePlan() + { + try { + JAXBContext jaxbContext = JAXBContext + .newInstance("com.example.ipo.jaxb"); + Marshaller m = jaxbContext.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + File oldInputFile = new File("src/main/resources/jiraSideBand.xml").getAbsoluteFile(); + String oldPath = oldInputFile.getAbsolutePath(); + oldInputFile.renameTo(new File(oldPath+".old")); + File outputFile = new File("src/main/resources/jiraSideBand.xml").getAbsoluteFile(); + FileOutputStream fos = new FileOutputStream(outputFile); + + + m.marshal(getPlan(), fos); + } catch (Exception e) { + e.printStackTrace(); + } finally { + + } + } + + } \ No newline at end of file diff --git a/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xml b/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xml index 0af97d7a9d..afe66a5c32 100644 --- a/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xml +++ b/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xml @@ -1,68 +1,67 @@ - - - https://issues.apache.org/jira/browse/ - - - 2001-01-01 - deliveredby - note - - - support reference on other impl type than impl.widget - LR - 2001-01-01 - TUSCANY-2850 - in progress - repository_vid - note - - - Enhance artefact processing performance by returning URI and location URL in one call - LR - 2001-01-01 - TUSCANY-3395 - in progress - repository_vid - note - - - Add support for identifying the SCA Spec Version for contribution metadata - LR - 2001-01-01 - TUSCANY-3397 - in progress - repository_vid - note - - - - - Itest copy from 1.x to 2.x - Ram - TUSCANY-3433 - - - Non-simple property injection - Raymond - TUSCANY-3409 - - - local/remote determination - Raymond - TUSCANY-3441 - - - SPI version tracking - SL - TUSCANY-3443 - - - Mechanism to retrieve revision number - AE - - - client API no honouring domain URI - AE - - - + + + https://issues.apache.org/jira/browse/ + + + TUSCANY-2850 + + Support binding.json-rpc for implementation.java's reference + Open + Unassigned + + + + TUSCANY-3395 + + Tidying up Contribution Scanner API + Resolved + Luciano Resende + + + + TUSCANY-3397 + + Add support for identifying the SCA Spec Version for contribution metadata + Resolved + Luciano Resende + + + + TUSCANY-1111 + + Interchangeability of Java and WSDL + Closed + Unassigned + + + + + + TUSCANY-3433 + + Import more of the basic itests from 1.x to 2.x + Open + Ramkumar Ramalingam + + + + TUSCANY-3409 + + Non-Simple Property Injected with XML Fails with NullPointerException + Resolved + Raymond Feng + + + + TUSCANY-3441 + + Improve mechanism for determining locality of endpoints to endpoint references + Open + Unassigned + + + + TUSCANY-2222 + + + diff --git a/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xsd b/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xsd index e868645dce..ad3f7f8daf 100644 --- a/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xsd +++ b/sandbox/kgoodson/jagg/src/main/resources/JiraSideband.xsd @@ -21,16 +21,16 @@ xmlns:jagg="http://www.example.com/tracking" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - - - - - - - - - + + + + + + + + + + diff --git a/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html b/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html index ddb018ed74..a914dbe14e 100644 --- a/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html +++ b/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html @@ -42,18 +42,13 @@ mschoice+=''; var mswi = ms[i].workItem.list; mscontent +=""+ - - "Work Item"+ - "Owner"+ "Jira"+ "Jira title"+ "Jira Assigned To"+ "Status"+ - - ""; + ""; for (var j=0; j"+mswi[j].title+""+ - ""+mswi[j].responsible+""; + mscontent +=""; if(mswi[j].jira) { mscontent += ""+mswi[j].jira+""+ @@ -69,20 +64,25 @@ } } - mschoice += ''; + mscontent += "

"; + mschoice += ''; + + document.getElementById('milestones').innerHTML='

' + mscontent; - mscontent += ""; + - mscontent += '
'+ - '
'+ - '

New Work Item

'+ + var newmscontent = + ''+ + '
'+ 'JIRA:
'+ - 'MileStone: '+mschoice+ - ''+ - '
'+ - ''; - - document.getElementById('milestones').innerHTML='

' + mscontent; + mschoice+ + '
New Milestone'+ + ''+ + ''+ + '

'+ + ''; + + document.getElementById('addPlanData').innerHTML=newmscontent; return; } @@ -94,6 +94,15 @@ } function addWorkItem() { + + planView.post(document.newWorkItemForm.newmsname.value, + document.newWorkItemForm.mschoice.value, + document.newWorkItemForm.JIRA.value) + .addCallback(plan_postNewItem_response); + } + + function plan_postNewItem_response() + { } @@ -104,7 +113,10 @@

Plan

- -
- + + + + +
+ \ No newline at end of file -- cgit v1.2.3