Monday, April 7, 2008

Sprint #5

Its been quite a while since I last posted. I have been quite occupied working on an essay for my master's application. Its been taking my sleeping hours, but finally it was done last Friday.
As for the PRIMA project, the past week we have been busy working on separate tasks. Lisa was working on displaying data of an .xls (MS Excel) file, which is apparently our datasource for the "Hours: planned vs. actual" component. There was an access restriction that we could not get through from the database administrator for the actual (Artemis) database, therefore we were given an excel sheet that is updated daily, and posted on the sharepoint. However we have the following problems:
1. The Flex DataGrid component does not support excel file as data source.
2. Security (since we cannot automate the authentication&authorization process from sharepoint).
We had managed to solve the first point using a ColdFusion component developed by "www.bennadel.com" called the "POI to write and read Excel file" (http://www.bennadel.com/blog/474-ColdFusion-Component-Wrapper-For-POI-To-Read-And-Write-Excel-Files.htm)
The second problem has not been solved at the moment. We have tried to share a folder on the network for the responsible people to post in the excel file. However, it turned out that it, too, needs a login. It has been a few days since Lisa started working on that, so it is time to switch our focuses on to the next sprint goals (we are now in sprint #5 by the way). Lisa is now working on getting the nightly builds data.
I, on the other side, have been busy working on the "Control Panel", which will be the configuration point for the projects/components that will be shown on the screen. Since our metadata is written in 2 XML files, the idea was to create a GUI for the administrator, so when desiring a change, he/she would not have to go find the actual XML files and edit it, but instead changes will be done comfortably from the GUI.
In the beginning I had some difficulties trying to write the XML files from Flex. After being stuck with it for 2 days, I turned to look for other media to do the job. Turned out ColdFusion can do this EASILY.. I was quite embarrassed when I found out about this, because ColdFusion has been there as our data source connector since the beginning... anyways the following is a snippet of writing an XML file from flex application using ColdFusion class.
The XML file:

<?xml version="1.0" encoding="UTF-8"?>
<projects>
<project>PRIMA</project>
<project>Test1</project>
<project>Test2</project>
<project>Test3</project>
</projects>

in the ColdFusion file, I created a function something like the following:

<cffunction name="saveXML" output="false" access="remote">
<cfargument name="projectsXML" required="true" type="XML">
<cfset xmltext="TOSTRING(#projectsXML#)">
<cffile action="write" file="<yourXMLFileDirectory>\ds-testproject.xml"
output="XMLText">
</cffunction>

This function will basically take its parameter (an XML object) that I will pass from the .mxml file, and convert it to string, and then write that into your xml file.
And finally in your Flex .mxml file:

<!--create a remote object of the function you created in the ColdFusion file-->
<mx:RemoteObject
id="saveDataChange"
showBusyCursor="true"
destination="ColdFusion" source="TestProject.components.cfgenerated.TestPage">
<mx:method name="saveXML" fault="server_fault(event)">
</mx:RemoteObject>

<!--create an XML object-->
<mx:xml id="projectsXML" format="e4x" source="../src/ds-testproject.xml">

I also created an XMLListCollection and a DataGrid for displaying the data. A form for adding new projects (containing TextInput's for the attributes needed in the XML), and in an mx:Script block, I wrote the functions that are handling the events of buttons for removal and addition to the projects, and after I modify the XML object that I created with a new input or deletion, I send the modified XML object back to the saveXML() function. Here's how I implemented the action for delete button event:

private function deleteSelected():void{
delete projectsXML.project[myDataGrid.selectedIndex];
sendXMLChange(projectsXML);
myXMLListCol.refresh();

Thats it.. now I am expanding this for adding/removing components shown on the screen. We have talked about this, and we think we might need some changes on how the components are created before we can actually implement that feature (add/remove) for configuration. Since then, I will only start with displaying the information of the available components, and then I will move on to another sprint goal: implementing "Ronald's Magic Algorithm" for the project score ;).
Thats it for now, we'll keep you posted with our progress!

No comments: