From d53d1514cca9d215f98a9991f7c4c5e6dd9b5053 Mon Sep 17 00:00:00 2001 From: kelvingoodson Date: Mon, 1 Feb 2010 10:19:48 +0000 Subject: begin to support adding data from website git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@905237 13f79535-47bb-0310-9956-ffa450edef68 --- .../jagg/src/main/java/services/PlanViewImpl.java | 83 +++++++++++----------- .../jagg/src/main/resources/uiservices/plan.html | 28 ++++++-- 2 files changed, 64 insertions(+), 47 deletions(-) (limited to 'sandbox/kgoodson') diff --git a/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java b/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java index 4bef994b3f..5c4f115a6c 100644 --- a/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java +++ b/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java @@ -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) 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) 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> 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) 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) 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> 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 { - } - } } } diff --git a/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html b/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html index 90e34be917..ddb018ed74 100644 --- a/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html +++ b/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html @@ -26,7 +26,7 @@ @@ -89,6 +103,8 @@ function init()

Plan

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