You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2010/02/01 11:19:48 UTC

svn commit: r905237 - in /tuscany/sandbox/kgoodson/jagg/src/main: java/services/PlanViewImpl.java resources/uiservices/plan.html

Author: kelvingoodson
Date: Mon Feb  1 10:19:48 2010
New Revision: 905237

URL: http://svn.apache.org/viewvc?rev=905237&view=rev
Log:
begin to support adding data from website

Modified:
    tuscany/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java
    tuscany/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html

Modified: tuscany/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java?rev=905237&r1=905236&r2=905237&view=diff
==============================================================================
--- tuscany/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java (original)
+++ tuscany/sandbox/kgoodson/jagg/src/main/java/services/PlanViewImpl.java Mon Feb  1 10:19:48 2010
@@ -89,53 +89,54 @@
 		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 {
-
 				}
 				
-				
 			}	
 		}
 	}

Modified: tuscany/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html
URL: http://svn.apache.org/viewvc/tuscany/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html?rev=905237&r1=905236&r2=905237&view=diff
==============================================================================
--- tuscany/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html (original)
+++ tuscany/sandbox/kgoodson/jagg/src/main/resources/uiservices/plan.html Mon Feb  1 10:19:48 2010
@@ -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 @@
 
 <body onload="init()">
 <h1>Plan</h1>
+
+ 
   <div id="milestones"></div>
 </body>
 </html>
\ No newline at end of file