diff options
author | kelvingoodson <kelvingoodson@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-01 16:56:53 +0000 |
---|---|---|
committer | kelvingoodson <kelvingoodson@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-01 16:56:53 +0000 |
commit | 667d3a02bc5867d349b548ac5eee5212026a2551 (patch) | |
tree | b8d197336a3c835f11fc93c12ba7df0e5da5ec0c /sandbox/kgoodson/jagg/src | |
parent | 666eea81f0ac8ea88c04da729bf98a4542453344 (diff) |
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
Diffstat (limited to 'sandbox/kgoodson/jagg/src')
5 files changed, 171 insertions, 106 deletions
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<Plan>) 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<RSS>) 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<JAXBElement<?>> 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<Milestone> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<jagg:plan xmlns:jagg="http://www.example.com/tracking" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/tracking JiraSideband.xsd "> - <issueBase>https://issues.apache.org/jira/browse/</issueBase> - - <milestone ID="V8 M5I14a"> - <dueDate>2001-01-01</dueDate> - <deliveredby>deliveredby</deliveredby> - <note>note</note> - - <workItem> - <title>support reference on other impl type than impl.widget</title> - <responsible>LR</responsible> - <dueDate>2001-01-01</dueDate> - <jira>TUSCANY-2850</jira> - <status>in progress</status> - <repository_vid>repository_vid</repository_vid> - <note>note</note> - </workItem> - <workItem> - <title>Enhance artefact processing performance by returning URI and location URL in one call</title> - <responsible>LR</responsible> - <dueDate>2001-01-01</dueDate> - <jira>TUSCANY-3395</jira> - <status>in progress</status> - <repository_vid>repository_vid</repository_vid> - <note>note</note> - </workItem> - <workItem> - <title>Add support for identifying the SCA Spec Version for contribution metadata</title> - <responsible>LR</responsible> - <dueDate>2001-01-01</dueDate> - <jira>TUSCANY-3397</jira> - <status>in progress</status> - <repository_vid>repository_vid</repository_vid> - <note>note</note> - </workItem> -</milestone> - <milestone ID="V8_M5I14b"> - <workItem> - <title>Itest copy from 1.x to 2.x</title> - <responsible>Ram</responsible> - <jira>TUSCANY-3433</jira> - </workItem> - <workItem> - <title>Non-simple property injection</title> - <responsible>Raymond</responsible> - <jira>TUSCANY-3409</jira> - </workItem> - <workItem> - <title>local/remote determination</title> - <responsible>Raymond</responsible> - <jira>TUSCANY-3441</jira> - </workItem> - <workItem> - <title>SPI version tracking</title> - <responsible>SL</responsible> - <jira>TUSCANY-3443</jira> - </workItem> - <workItem> - <title>Mechanism to retrieve revision number</title> - <responsible>AE</responsible> - </workItem> - <workItem> - <title>client API no honouring domain URI</title> - <responsible>AE</responsible> - </workItem></milestone> - -</jagg:plan> +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<ns2:plan xmlns:ns2="http://www.example.com/tracking"> + <issueBase>https://issues.apache.org/jira/browse/</issueBase> + <milestone ID="V8 M5I14a"> + <workItem> + <jira>TUSCANY-2850</jira> + <jiraData ID="TUSCANY-2850"> + <title> Support binding.json-rpc for implementation.java's reference</title> + <status>Open</status> + <assignedTo>Unassigned</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3395</jira> + <jiraData ID="TUSCANY-3395"> + <title> Tidying up Contribution Scanner API</title> + <status>Resolved</status> + <assignedTo>Luciano Resende</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3397</jira> + <jiraData ID="TUSCANY-3397"> + <title> Add support for identifying the SCA Spec Version for contribution metadata</title> + <status>Resolved</status> + <assignedTo>Luciano Resende</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-1111</jira> + <jiraData ID="TUSCANY-1111"> + <title> Interchangeability of Java and WSDL</title> + <status>Closed</status> + <assignedTo>Unassigned</assignedTo> + </jiraData> + </workItem> + </milestone> + <milestone ID="V8_M5I14b"> + <workItem> + <jira>TUSCANY-3433</jira> + <jiraData ID="TUSCANY-3433"> + <title> Import more of the basic itests from 1.x to 2.x </title> + <status>Open</status> + <assignedTo>Ramkumar Ramalingam</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3409</jira> + <jiraData ID="TUSCANY-3409"> + <title> Non-Simple Property Injected with XML Fails with NullPointerException</title> + <status>Resolved</status> + <assignedTo>Raymond Feng</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3441</jira> + <jiraData ID="TUSCANY-3441"> + <title> Improve mechanism for determining locality of endpoints to endpoint references</title> + <status>Open</status> + <assignedTo>Unassigned</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-2222</jira> + </workItem> + </milestone> +</ns2:plan> 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">
- <xsd:element name="plan" type="jagg:Plan"></xsd:element> - - <xsd:complexType name="Plan"> - <xsd:sequence> - <xsd:element name="issueBase" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element> - - - <xsd:element name="milestone" type="jagg:Milestone" maxOccurs="unbounded" minOccurs="0"></xsd:element> - </xsd:sequence> - </xsd:complexType>
+ <xsd:element name="plan"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="issueBase" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element> + + + <xsd:element name="milestone" type="jagg:Milestone" maxOccurs="unbounded" minOccurs="0"></xsd:element> + </xsd:sequence> + </xsd:complexType>
+ </xsd:element>
<xsd:complexType name="WorkItem">
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+='<option>'+ms[i].ID+'</option>'; var mswi = ms[i].workItem.list; mscontent +="<tr>"+ - - "<th>Work Item</th>"+ - "<th>Owner</th>"+ "<th>Jira</th>"+ "<th>Jira title</th>"+ "<th>Jira Assigned To</th>"+ "<th>Status</th>"+ - - "</tr>"; + "</tr>"; for (var j=0; j<mswi.length; j++) { - mscontent +="<tr>"+"<td>"+mswi[j].title+"</td>"+ - "<td>"+mswi[j].responsible+"</td>"; + mscontent +="<tr>"; if(mswi[j].jira) { mscontent += "<td><A HREF=\""+plan.issueBase+mswi[j].jira+"\">"+mswi[j].jira+"</A></td>"+ @@ -69,20 +64,25 @@ } } - mschoice += '<option>New Milestone..</option></select>'; + mscontent += "</table><P>"; + mschoice += '</select>'; + + document.getElementById('milestones').innerHTML='<h2>' + mscontent; - mscontent += "</table>"; + - mscontent += '<form name="newWorkItemForm">'+ - '<div id="addWorkItem">'+ - '<h4>New Work Item</h4>'+ + var newmscontent = + '<form name="newWorkItemForm">'+ + '<div id="addWorkItem">'+ 'JIRA: <input type="text" name="JIRA" value="TUSCANY-"><br/>'+ - 'MileStone: '+mschoice+ - '<input type="button" onClick="addWorkItem()" value="Add Work Item">'+ - '</div>'+ - '</form>'; - - document.getElementById('milestones').innerHTML='<h2>' + mscontent; + mschoice+ + '<br/>New Milestone'+ + '<input name="newmsname" type=text/></td></tr>'+ + '<input type="button" onClick="addWorkItem()" value="Add Work Item">'+ + '</div>'+ + '</form>'; + + 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 @@ <body onload="init()"> <h1>Plan</h1> - - <div id="milestones"></div> -</body> + + <table> + <tr><td><div id="milestones"></div></td></tr> + <tr><td><div id="addPlanData"></div></td></tr> + </table> + </body> </html>
\ No newline at end of file |