begin to support adding data from website
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@905237 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
15b1561375
commit
d53d1514cc
2 changed files with 64 additions and 47 deletions
|
|
@ -89,53 +89,54 @@ public class PlanViewImpl implements PlanView {
|
|||
for(Milestone m : plan.getMilestone()) {
|
||||
for (WorkItem wi: m.getWorkItem()) {
|
||||
String jira = wi.getJira();
|
||||
String feed = rssPrefix += jira + "/" + jira + ".xml";
|
||||
JiraData jd = new JiraData();
|
||||
wi.setJiraData(jd);
|
||||
jd.setID(jira);
|
||||
|
||||
try {
|
||||
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{
|
||||
URL url = new URL("http://issues.apache.org/jira/si/jira.issueviews:issue-xml/"+jira+"/"+jira+".xml");
|
||||
is = url.openStream();
|
||||
j = ((JAXBElement<RSS>) m2.unmarshal(is)).getValue();
|
||||
}
|
||||
finally {
|
||||
if(is != null) is.close();
|
||||
}
|
||||
if(jira != null) {
|
||||
String feed = rssPrefix += jira + "/" + jira + ".xml";
|
||||
JiraData jd = new JiraData();
|
||||
wi.setJiraData(jd);
|
||||
jd.setID(jira);
|
||||
|
||||
Item i = j.getChannel().getItem();
|
||||
System.out.println(i.toString());
|
||||
List<JAXBElement<?>> c = i.getContent();
|
||||
for (JAXBElement<?> element : c) {
|
||||
if("title".equals(element.getName().getLocalPart())) {
|
||||
String jtitle = (String)element.getValue();
|
||||
jd.setTitle(jtitle.substring(jtitle.indexOf(']')+1, jtitle.length()));
|
||||
try {
|
||||
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{
|
||||
URL url = new URL("http://issues.apache.org/jira/si/jira.issueviews:issue-xml/"+jira+"/"+jira+".xml");
|
||||
is = url.openStream();
|
||||
j = ((JAXBElement<RSS>) m2.unmarshal(is)).getValue();
|
||||
}
|
||||
else if("status".equals(element.getName().getLocalPart())){
|
||||
jd.setStatus((String)element.getValue());
|
||||
finally {
|
||||
if(is != null) is.close();
|
||||
}
|
||||
else if("assignee".equals(element.getName().getLocalPart())) {
|
||||
jd.setAssignedTo((String)element.getValue());
|
||||
}
|
||||
|
||||
Item i = j.getChannel().getItem();
|
||||
System.out.println(i.toString());
|
||||
List<JAXBElement<?>> c = i.getContent();
|
||||
for (JAXBElement<?> element : c) {
|
||||
if("title".equals(element.getName().getLocalPart())) {
|
||||
String jtitle = (String)element.getValue();
|
||||
jd.setTitle(jtitle.substring(jtitle.indexOf(']')+1, jtitle.length()));
|
||||
}
|
||||
else if("status".equals(element.getName().getLocalPart())){
|
||||
jd.setStatus((String)element.getValue());
|
||||
}
|
||||
else if("assignee".equals(element.getName().getLocalPart())) {
|
||||
jd.setAssignedTo((String)element.getValue());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<script language="JavaScript">
|
||||
|
||||
//@Reference
|
||||
var plan = new tuscany.sca.Reference("plan");
|
||||
var planView = new tuscany.sca.Reference("plan");
|
||||
var ms;
|
||||
|
||||
function plan_getResponse(plan,exception) {
|
||||
|
|
@ -36,8 +36,10 @@
|
|||
}
|
||||
ms = plan.milestone.list;
|
||||
var mscontent = "<table border=\"1\" align=\"left\">";
|
||||
var mschoice = '<select name="mschoice">';
|
||||
for(var i=0; i<ms.length; i++) {
|
||||
mscontent += "<tr><th colspan=\"6\" align=\"left\">Milestone " + ms[i].ID + "</th></tr>";
|
||||
mschoice+='<option>'+ms[i].ID+'</option>';
|
||||
var mswi = ms[i].workItem.list;
|
||||
mscontent +="<tr>"+
|
||||
|
||||
|
|
@ -67,9 +69,18 @@
|
|||
}
|
||||
|
||||
}
|
||||
mschoice += '<option>New Milestone..</option></select>';
|
||||
|
||||
mscontent += "</table>";
|
||||
|
||||
mscontent += "</table>";
|
||||
mscontent += '<form name="newWorkItemForm">'+
|
||||
'<div id="addWorkItem">'+
|
||||
'<h4>New Work Item</h4>'+
|
||||
'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;
|
||||
return;
|
||||
|
|
@ -77,10 +88,13 @@
|
|||
}
|
||||
|
||||
|
||||
function init()
|
||||
{
|
||||
plan.get().addCallback(plan_getResponse);
|
||||
}
|
||||
function init()
|
||||
{
|
||||
planView.get().addCallback(plan_getResponse);
|
||||
}
|
||||
|
||||
function addWorkItem() {
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
@ -89,6 +103,8 @@ function init()
|
|||
|
||||
<body onload="init()">
|
||||
<h1>Plan</h1>
|
||||
|
||||
|
||||
<div id="milestones"></div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue