<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ashish's Tech Blog &#187; MPXJ</title>
	<atom:link href="http://www.ashishpaliwal.com/blog/tag/mpxj/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ashishpaliwal.com/blog</link>
	<description>From Programmer, For Programmers</description>
	<lastBuildDate>Tue, 17 Aug 2010 12:04:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>[MPXJ Series] Writing MS Project File using MPXJ</title>
		<link>http://www.ashishpaliwal.com/blog/2009/01/mpxj-series-writing-ms-project-file-using-mpxj/</link>
		<comments>http://www.ashishpaliwal.com/blog/2009/01/mpxj-series-writing-ms-project-file-using-mpxj/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 09:14:42 +0000</pubDate>
		<dc:creator>ashish</dc:creator>
				<category><![CDATA[Application Programming]]></category>
		<category><![CDATA[MPXJ]]></category>

		<guid isPermaLink="false">http://www.ashishpaliwal.com/blog/?p=239</guid>
		<description><![CDATA[In the first part, we shall explore what are the different ways of writing a MS Project file using MPXJ. Pre-requisite The article assumes that you have downloaded MPXJ release and related dependencies. If not here are the links for download   MPXJ - http://sourceforge.net/project/showfiles.php?group_id=70649 Dependencies - http://mpxj.sourceforge.net/dependencies.html Now let’s get back to the original [...]]]></description>
			<content:encoded><![CDATA[<p>In the first part, we shall explore what are the different ways of writing a MS Project file using MPXJ.</p>
<p class="MsoNormal"><strong>Pre-requisite</strong></p>
<p class="MsoNormal">The article assumes that you have downloaded MPXJ release and related dependencies. If not here are the links for download</p>
<p class="MsoListParagraphCxSpFirst"> </p>
<ul>
<li>MPXJ - <a href="http://sourceforge.net/project/showfiles.php?group_id=70649">http://sourceforge.net/project/showfiles.php?group_id=70649</a></li>
<li>Dependencies - <a href="http://mpxj.sourceforge.net/dependencies.html">http://mpxj.sourceforge.net/dependencies.html</a></li>
</ul>
<p class="MsoNormal">Now let’s get back to the original intent of reading MPP files</p>
<p class="MsoNormal">Lets see the simplest form of reading an MPP file</p>
<pre class="java5"><span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
    ProjectWriter writer = ProjectWriterUtility.<span style="color: #006600;">getProjectWriter</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test.mpx&quot;</span><span style="color: #66cc66;">&#41;</span>;
    ProjectFile project = <span style="color: #000000; font-weight: bold;">new</span> ProjectFile<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Operations on Project File</span>
    writer.<span style="color: #006600;">write</span><span style="color: #66cc66;">&#40;</span>project, <span style="color: #ff0000;">&quot;test.mpx&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/InstantiationException.html"><span style="color: #aaaadd; font-weight: bold;">InstantiationException</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalAccessException.html"><span style="color: #aaaadd; font-weight: bold;">IllegalAccessException</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/IOException.html"><span style="color: #aaaadd; font-weight: bold;">IOException</span></a> ioEx<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    ioEx.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<div>
<p class="MsoNormal">ProjectWriterUtility.getProjectWriter(fileName), provides an appropriate Reader class, based on the version of MS Project file. This is the simplest way to create a writer for an Project file. ProjectFile is the class that contains details about the Schedule, we can iterate and extract information from it. We shall discuss the details on ProjectFile in subsequent posts. ProjectWriterUtility class checks for the file extension and returns an appropriate writer.</p>
<p class="MsoNormal"><strong>Alternative ways</strong></p>
<ul type="disc">
<li class="MsoNormal">For writing MPX file, you      can use net.sf.mpxj.mpx.MPXWriter</li>
<li class="MsoNormal">For writing XML Project file, use net.sf.mpxj.mspdi. MSPDIWriter</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ashishpaliwal.com/blog/2009/01/mpxj-series-writing-ms-project-file-using-mpxj/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Updating Google Calendar with MS Project Tasks</title>
		<link>http://www.ashishpaliwal.com/blog/2008/10/updating-google-calendar-with-ms-project-tasks/</link>
		<comments>http://www.ashishpaliwal.com/blog/2008/10/updating-google-calendar-with-ms-project-tasks/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 13:52:19 +0000</pubDate>
		<dc:creator>ashish</dc:creator>
				<category><![CDATA[Application Programming]]></category>
		<category><![CDATA[Apache POI]]></category>
		<category><![CDATA[GData API]]></category>
		<category><![CDATA[Google Calendar]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Microsoft Project]]></category>
		<category><![CDATA[MPXJ]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Task Tracking]]></category>

		<guid isPermaLink="false">http://www.ashishpaliwal.com/blog/?p=67</guid>
		<description><![CDATA[I am back, as promised. Please read my earlier post Processing Microsoft Project File in Java using MPXJ. In this post we shall take an mpp and update the Google Calendar with the task details. The question is why would anyone do that?  Lets cook the story. A small team is working and the poor Project [...]]]></description>
			<content:encoded><![CDATA[<p>I am back, as promised. Please read my earlier post <a rel="bookmark" href="http://www.ashishpaliwal.com/blog/?p=58" target="_blank">Processing Microsoft Project File in Java using MPXJ</a>.</p>
<p>In this post we shall take an mpp and update the Google Calendar with the task details. The question is why would anyone do that? </p>
<p>Lets cook the story. A small team is working and the poor Project Manager share the Schedule with the team. The team is so busy coding that they forget to look at the dates, and the tasks they must be starting on. The poor Project Manager himself loose track unless he keeps MS Project Open on his desktop :-( A pretty common situation <img src='http://www.ashishpaliwal.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Have faced this situation and decided to organize myself and this post is outcome of that. The driving force was "Out of sight, is out of mind". So my assumption was if the team has a visual of the task dates, the chances of task slippage shall reduce a lot. </p>
<p>In this post, have built upon the my previous post to create an MPP parsing function. Have tried to keep the code in simplest form, so that it can customized later to specific needs. Have created a sample Schedule for this activity and used it for the implementation. Here is how it looks.</p>
<p> </p>
<div id="attachment_68" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/mpp.png"><img class="size-medium wp-image-68" title="mpp" src="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/mpp-300x39.png" alt="Google Calendar updater Project Schedule" width="300" height="39" /></a><p class="wp-caption-text">Google Calendar updater Project Schedule</p></div>
<p>The schdule is simple, some date, and tasks with dependencies. The concept shall work for any number of tasks.</p>
<p>Following are the steps that we need to perform:</p>
<ol>
<li>Parse the mpp file</li>
<li>Create a Calendar Service (Lets assume that the Calendar is already there, though it is possible to <span><span>programmatically</span></span> create the same)</li>
<li>Get All tasks from MPP, and create Calendar Entries in Google Calendar</li>
</ol>
<div><strong>The Code</strong></div>
<div>
<div id="attachment_69" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalupdatecode.png"><img class="size-full wp-image-69" title="Google Calendar Entry Creation Code" src="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalupdatecode.png" alt="Google Calendar Entry Creation Code" width="500" height="480" /></a><p class="wp-caption-text">Google Calendar Entry Creation Code</p></div>
<p>The implementation is fairly simple. We have 3 functions:</p>
<ul>
<li>translateTaskToCalendarEventEntry() - Converts an Task into CalendarEventEntry, which can be added to Google Calendar</li>
<li>updateCalendar() - Takes input of all the Tasks from MPP, translates into CalendarEventEntry (using function translateTaskToCalendarEventEntry) and update the Calendar</li>
<li>updateGoogleCalendarWithMPP() - Parses the MPP using the util function from my previous post, and calls the API above to update the Calendar.</li>
</ul>
<p>Google Calendar API usage is described in details on Google's pages, hence won't discuss here.<br />
To use it for yourself, replace User Name and Password at line#70, with your User <span><span>Credentials</span></span>. Repace the URL at Line# 71 to point to your calendar.<br />
After running the program, this is how my Calendar looked like </p>
<dl id="attachment_72" class="wp-caption aligncenter" style="width: 510px;">
<dt class="wp-caption-dt"><a href="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalview.png"><img class="size-full wp-image-72" title="Google Calendar View" src="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalview.png" alt="Google Calendar View" width="500" height="232" /></a></dt>
<dd class="wp-caption-dd">Google Calendar View</dd>
</dl>
<p>A simple way to keep track of Tasks.<br />
 </p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ashishpaliwal.com/blog/2008/10/updating-google-calendar-with-ms-project-tasks/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Processing Microsoft Project File in Java using MPXJ</title>
		<link>http://www.ashishpaliwal.com/blog/2008/10/processing-microsoft-project-file-in-java-using-mpxj/</link>
		<comments>http://www.ashishpaliwal.com/blog/2008/10/processing-microsoft-project-file-in-java-using-mpxj/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 08:46:32 +0000</pubDate>
		<dc:creator>ashish</dc:creator>
				<category><![CDATA[Application Programming]]></category>
		<category><![CDATA[Apache POI]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MPXJ]]></category>

		<guid isPermaLink="false">http://www.ashishpaliwal.com/blog/?p=58</guid>
		<description><![CDATA[Many a time, I wished I had a utility that would read my projects mpp File and automatically alerted me about my tasks. Had created such a utilitly and this post desribes the process of reading MS Project Files in Java using MPXJ and Apache POI library. MPXJ - MPXJ is the java library used [...]]]></description>
			<content:encoded><![CDATA[<p>Many a time, I wished I had a utility that would read my projects mpp File and automatically alerted me about my tasks. Had created such a utilitly and this post desribes the process of reading MS Project Files in Java using MPXJ and Apache POI library.</p>
<p><strong><em>MPXJ</em></strong> - MPXJ is the java library used for parsing MS Project files. The lib depends upon Apache POI package for providing the functionality. MPXJ supports all the three formats for MS Project. The details can be found at the Home Page for MPXJ provided in references section</p>
<p>Let's start implementing. The code to read the File is fairly simple.</p>
<div id="attachment_60" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/codesnippets.png"><img class="size-medium wp-image-60" title="codesnippets" src="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/codesnippets-300x116.png" alt="Reading MS Project File in Java (Using MPXJ)" width="300" height="116" /></a><p class="wp-caption-text">Reading MS Project File in Java (Using MPXJ)</p></div>
<p> To read an MS Project file, we use projectReaderUtility class to get the instance of a ProjectReader, based on the extension. ProjectReader is the interface implemented by the classes that can read an MS Project file in mpxj library. Once we get the instance of ProjectReader, we need to invoke read API, passing the file name to be read. The API returns an instance of ProjectFile, containing all the details in the MS Project File. </p>
<p><strong><em>More about ProjectFile</em></strong> - ProjectFile is the class in mpxj, which contains all the information about an MS Project file. It has API's to access all Task details, as well other API's to extract and manipulate other metadata.</p>
<p>Is that it? The basic objective of reading is done. Now we can use the provided API to iterate and create applications to suite our needs. For example, to list all the tasks, use getAllTasks(), it returns a List of Tasks. Custom logic can be applied to manipulate this list as desired, like filtering the tasks based on resources or date.</p>
<p>What's next?</p>
<p>I am working on the prototype to read the MS Project File and update the Google Calendar with Task details, based on Start Date.</p>
<p>References</p>
<ul>
<li><a href="http://mpxj.sourceforge.net/index.html">http://mpxj.sourceforge.net/index.html</a></li>
<li><a href="http://poi.apache.org/index.html">http://poi.apache.org/index.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ashishpaliwal.com/blog/2008/10/processing-microsoft-project-file-in-java-using-mpxj/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
