Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

mrprjContent.cc

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001 Karsten Reincke <karsten.reincke@karubik.de>
00003  *  
00004  * This file is part of of the software-project MRPROJEXT.
00005  * 
00006  * MRPROJEXT is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  * 
00011  * MRPROJEXT is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software 
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  *  
00020  * file <mrprjContent.h> version <#1.3.1#> of project <MrProjext>
00021  */   
00022 
00029 #include <iostream.h>
00030 #include "mrprjContent.h"
00031 
00032 /* &&& (1) local preprocessor-defines &&&&&&&&&&&&&&&&&&&&&&& */
00033 
00034 /* &&& (2) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00035 /* &&&     methods for class DateStringConverter */
00036 
00037 /*
00038  *  \brief constructor for the class DateStringConverter
00039  *
00040  *  needs nothing, does nothing
00041  */
00042 mrprj::DateStringConverter::DateStringConverter()
00043 {
00044 }
00045 
00046 /*
00047  *  \brief destructor for the class DateStringConverter
00048  *
00049  *  does nothing
00050  */
00051 mrprj::DateStringConverter::~DateStringConverter()
00052 {
00053 }
00054 
00063 string mrprj::DateStringConverter::formYankDateString
00064 (
00065   const string& pMrprojectDateString
00066 ) const
00067 {
00068   string year="2000";
00069   string month="01";
00070   string day="01";
00071   string hours="00";
00072   string minutes="00";
00073   string seconds="00";
00074   
00075   if (pMrprojectDateString.size()>=4)
00076     year=pMrprojectDateString.substr(0,4);
00077 
00078   if (pMrprojectDateString.size()>=6)
00079     month=pMrprojectDateString.substr(4,2);
00080 
00081   if (pMrprojectDateString.size()>=8)
00082     day=pMrprojectDateString.substr(6,2);
00083 
00084   if (pMrprojectDateString.size()>=11)
00085     hours=pMrprojectDateString.substr(9,2);
00086 
00087   if (pMrprojectDateString.size()>=13)
00088     minutes=pMrprojectDateString.substr(11,2);
00089 
00090   if (pMrprojectDateString.size()>=15)
00091     seconds=pMrprojectDateString.substr(13,2);
00092     
00093   return (year + "-" + month + "-" + day + " " 
00094           + hours + ":" + minutes + ":" + seconds);
00095 }
00096 
00105 string mrprj::DateStringConverter::formGermanDateString
00106 (
00107   const string& pMrprojectDateString
00108 ) const
00109 {
00110   string year="2000";
00111   string month="01";
00112   string day="01";
00113   string hours="00";
00114   string minutes="00";
00115   string seconds="00";
00116   
00117   if (pMrprojectDateString.size()>=4)
00118     year=pMrprojectDateString.substr(0,4);
00119 
00120   if (pMrprojectDateString.size()>=6)
00121     month=pMrprojectDateString.substr(4,2);
00122 
00123   if (pMrprojectDateString.size()>=8)
00124     day=pMrprojectDateString.substr(6,2);
00125 
00126   if (pMrprojectDateString.size()>=11)
00127     hours=pMrprojectDateString.substr(9,2);
00128 
00129   if (pMrprojectDateString.size()>=13)
00130     minutes=pMrprojectDateString.substr(11,2);
00131 
00132   if (pMrprojectDateString.size()>=15)
00133     seconds=pMrprojectDateString.substr(13,2);
00134     
00135   return (day + "." + month + "."  + year + " "+ hours + "." + minutes);
00136 }
00137 
00138 /* &&& (3) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00139 /* &&&     methods for class XmlNodeReader */
00140 
00146 mrprj::XmlNodeReader::XmlNodeReader()                       
00147 {
00148 }
00149 
00155 mrprj::XmlNodeReader::~XmlNodeReader()
00156 {
00157 }
00158 
00174 bool mrprj::XmlNodeReader::getStringProperty
00175 ( 
00176   const xmlDocPtr xmlDoc,
00177   const xmlNodePtr pPropertyNode, 
00178   const string& pPropertySigner,
00179   string& pPropertyValue
00180 )
00181 {
00182   char *propertyCstr;
00183   
00184   propertyCstr=(char *)
00185     xmlGetProp(pPropertyNode, (xmlChar *)pPropertySigner.c_str());
00186   if (!(propertyCstr))
00187     return false;
00188     
00189   char* propertyEncodeCstr
00190     =(char *)xmlEncodeEntitiesReentrant(xmlDoc, (xmlChar *)propertyCstr);
00191   free(propertyCstr);  
00192   string propertyStr=propertyEncodeCstr;  
00193   free(propertyEncodeCstr);  
00194   pPropertyValue=xmlConverter.decode(propertyStr);
00195   
00196   return true;
00197 }
00198 
00199 
00200 /* &&& (4) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00201 /* --- (4) public constructors, inits & operators :-:-:-:-: */
00212 mrprj::Property::Property
00213 ( 
00214   krmuo::LoggingUnit& pLoggingUnit,
00215   const string& pName,
00216   const string& pType,
00217   const string& pOwner,
00218   const string& pLabel,
00219   const string& pDescription
00220 )                       
00221 : 
00222   mLoggingUnit(pLoggingUnit),
00223   mName(pName),
00224   mType(pType),
00225   mOwner(pOwner),
00226   mLabel(pLabel),
00227   mDescription(pDescription)
00228 {
00229   string propDescr=("property<" + mName +">:<"+ mLabel+">");
00230   mLoggingUnit.makeEntry("creating property",propDescr,HM);
00231 }
00232 
00238 mrprj::Property::~Property()
00239 {
00240   string propDescr=("property<" + mName +">:<"+ mLabel+">");
00241   mLoggingUnit.makeEntry("deleting property",propDescr,HM);
00242 } 
00243 
00244 
00245 /* &&& (5) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00246 /* --- (5) public constructors, inits & operators :-:-:-:-: */
00253 mrprj::Phase::Phase
00254 ( 
00255   krmuo::LoggingUnit& pLoggingUnit,
00256   const string& pName
00257 )                       
00258 : 
00259   mLoggingUnit(pLoggingUnit),
00260   mName(pName)
00261 {
00262   string phaseDescr=("phase<" + mName +">");
00263   mLoggingUnit.makeEntry("creating phase",phaseDescr,HM);
00264 }
00265 
00271 mrprj::Phase::~Phase()
00272 {
00273   string phaseDescr=("phase<" + mName +">");
00274   mLoggingUnit.makeEntry("deleting phase",phaseDescr,HM);
00275 } 
00276 
00277 
00278 /* &&& (6) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00279 /* --- (6) public constructors, inits & operators :-:-:-:-: */
00288 mrprj::DayType::DayType
00289 ( 
00290   krmuo::LoggingUnit& pLoggingUnit,
00291   const string& pId,
00292   const string& pName,
00293   const string& pDescription
00294 )                       
00295 : 
00296   mLoggingUnit(pLoggingUnit),
00297   mId(pId),
00298   mName(pName),
00299   mDescription(pDescription)
00300 {
00301   string dayTypeDescr=("dayType<" + mId +"><" + mName +">");
00302   mLoggingUnit.makeEntry("creating",dayTypeDescr,HM);
00303 }
00304 
00310 mrprj::DayType::~DayType()
00311 {
00312   string dayTypeDescr=("dayType<" + mId +"><" + mName +">");
00313   mLoggingUnit.makeEntry("deleting",dayTypeDescr,HM);
00314 } 
00315 
00321 mrprj::DayType::DayType(const mrprj::DayType& co)
00322 : mLoggingUnit(co.mLoggingUnit),
00323   mId(co.mId),
00324   mName(co.mName),
00325   mDescription(co.mDescription)
00326 {
00327 
00328   string dayTypeDescr=("dayType<" + mId +"><" + mName +">");
00329   mLoggingUnit.makeEntry("copying",dayTypeDescr,HM);
00330 
00331 }
00332 
00333 /* &&& (7) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00334 /* --- (7) public constructors, inits & operators :-:-:-:-: */
00342 mrprj::Interval::Interval
00343 ( 
00344   krmuo::LoggingUnit& pLoggingUnit,
00345   const string& pStart,
00346   const string& pEnd
00347 )                       
00348 : 
00349   mLoggingUnit(pLoggingUnit),
00350   mStart(pStart),
00351   mEnd(pEnd)
00352 {
00353   string intervalDescr=("interval<" + mStart +"><" + mEnd +">");
00354   mLoggingUnit.makeEntry("creating",intervalDescr,HM);
00355 }
00356 
00362 mrprj::Interval::~Interval()
00363 {
00364   string intervalDescr=("interval<" + mStart +"><" + mEnd +">");
00365   mLoggingUnit.makeEntry("deleting",intervalDescr,HM);
00366 } 
00367 
00373 mrprj::Interval::Interval(const mrprj::Interval& co)  
00374 : mLoggingUnit(co.mLoggingUnit),
00375   mStart(co.mStart),
00376   mEnd(co.mEnd)
00377 {
00378   string intervalDescr=("interval<" + mStart +"><" + mEnd +">");
00379   mLoggingUnit.makeEntry("copying",intervalDescr,HM);
00380 }
00381 
00382 
00383 /* &&& (8) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00384 /* --- (8) public constructors, inits & operators :-:-:-:-: */
00391 mrprj::OverriddenDayType::OverriddenDayType
00392 ( 
00393   krmuo::LoggingUnit& pLoggingUnit,
00394   const string& pId
00395 )                       
00396 : 
00397   mLoggingUnit(pLoggingUnit),
00398   mId(pId)
00399 {
00400   string overriddenDayTypeDescr=("overriddenDayType<" + mId +">");
00401   mIntervalList.clear();
00402   mLoggingUnit.makeEntry("creating",overriddenDayTypeDescr,HM);
00403 }
00404 
00410 mrprj::OverriddenDayType::~OverriddenDayType()
00411 {
00412   string overriddenDayTypeDescr=("overriddenDayType<" + mId +">");
00413   mLoggingUnit.makeEntry("deleting",overriddenDayTypeDescr,HM);
00414   mIntervalList.clear();
00415 } 
00416 
00422 mrprj::OverriddenDayType::OverriddenDayType(const OverriddenDayType& co)
00423 : mIntervalList(co.mIntervalList),
00424   mLoggingUnit(co.mLoggingUnit),
00425   mId(co.mId)
00426 {
00427 
00428 } 
00429 
00430 /* &&& (9) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00431 /* --- (9) public constructors, inits & operators :-:-:-:-: */
00439 mrprj::Day::Day
00440 ( 
00441   krmuo::LoggingUnit& pLoggingUnit,
00442   const string& pDate,
00443   const string& pType,
00444   const string& pId
00445 )                       
00446 : mLoggingUnit(pLoggingUnit),
00447   mDate(pDate),
00448   mType(pType),
00449   mId(pId)
00450 {
00451   string dayDescr=("day<" + mId +"><" + mDate +">");
00452   mLoggingUnit.makeEntry("creating",dayDescr,HM);
00453 }
00454 
00460 mrprj::Day::~Day()
00461 {
00462   string dayDescr=("day<" + mId +"><" + mDate +">");
00463   mLoggingUnit.makeEntry("deleting",dayDescr,HM);
00464 } 
00465 
00466 mrprj::Day::Day(const mrprj::Day& co)    
00467 : mLoggingUnit(co.mLoggingUnit),
00468   mDate(co.mDate),
00469   mType(co.mType),
00470   mId(co.mId)
00471 {
00472   string dayDescr=("day<" + mId +"><" + mDate +">");
00473   mLoggingUnit.makeEntry("copying",dayDescr,HM);
00474 
00475 }
00476 
00477 
00478 /* &&& (10) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00479 /* --- (10) public constructors, inits & operators :-:-:-:-: */
00487 mrprj::Calendar::Calendar
00488 ( 
00489   krmuo::LoggingUnit& pLoggingUnit,
00490   const string& pId,
00491   const string& pName
00492 )                       
00493 : mMon(""),
00494   mTue(""),
00495   mWed(""),
00496   mThu(""),
00497   mFri(""),
00498   mSat(""),
00499   mSun(""),
00500   mLoggingUnit(pLoggingUnit),
00501   mId(pId),
00502   mName(pName)
00503 {
00504   string CalendarDescr=("Calendar<" + mId +"><" + mName +">");
00505   mOverriddenDayTypeList.clear();
00506   mDayList.clear();
00507   mLoggingUnit.makeEntry("creating",CalendarDescr,HM);
00508 }
00509 
00515 mrprj::Calendar::~Calendar()
00516 {
00517   string CalendarDescr=("Calendar<" + mId +"><" + mName +">");
00518   mOverriddenDayTypeList.clear();
00519   mDayList.clear();
00520   mLoggingUnit.makeEntry("deleting",CalendarDescr,HM);
00521 } 
00522 
00523 
00524 
00525 /* &&& (11) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00526 /* &&&     methods for class Task Predecessor &&& */
00527 
00539 mrprj::Predecessor::Predecessor
00540 ( 
00541   const string& pEntryId,
00542   const string& pPredecessorTaskId,
00543   const string& pType  
00544 )                       
00545 : mEntryId(pEntryId),
00546   mPredecessorTaskId(pPredecessorTaskId),
00547   mType(pType)
00548 {
00549 }
00550 
00551 
00557 mrprj::Predecessor::~Predecessor()
00558 {
00559 }
00560 
00561 
00562 /* &&& (12) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00563 /* :-: (12.A) public constructors, inits & operators -:-:-:-: */
00564 
00576 mrprj::Task::Task
00577 ( 
00578   krmuo::LoggingUnit& pLoggingUnit,
00579   const string& pTaskId,
00580   const string& pTaskTitle,
00581   const string& pTaskDescription,
00582   const string& pTaskStartDate,
00583   const string& pTaskEndDate,
00584   const int pFullFilledPercent,
00585   const bool pIsEmptyTopTask
00586 )                       
00587 : mTaskId(pTaskId),
00588   mTaskTitle(pTaskTitle),
00589   mTaskDescription(pTaskDescription),
00590   mTaskStartDate(pTaskStartDate),
00591   mTaskEndDate(pTaskEndDate),
00592   mFullFilledPercent(pFullFilledPercent),
00593   mIsEmptyTopTask(pIsEmptyTopTask),
00594   mSubTaskMap(),
00595   mSubTaskOrderList(),
00596   mPredecessorMap(),
00597   mLoggingUnit(pLoggingUnit),
00598   mIsActive(true),
00599   mIsAllocated(false),
00600   mAnyDaughterIsActive(false),
00601   mXrowspan(0),
00602   mXrowTacker(0),
00603   mNodeEmbeddedLevel(0),
00604   mXdoPrint(true)
00605 {
00606   mLoggingUnit.makeEntry("creating task",mTaskTitle,HM);
00607 }
00608 
00609 
00615 mrprj::Task::~Task()
00616 {
00617   // (a) at first we delete all allocated subtasks
00618   map<string, Task*>::iterator subTaskMapIterator=mSubTaskMap.begin();
00619   while(subTaskMapIterator!=mSubTaskMap.end())
00620   {
00621     delete subTaskMapIterator->second;
00622     subTaskMapIterator++;
00623   }
00624   // (b) sometimes we are paranoic: we explicitely delete the map-content itself ...  
00625   mSubTaskMap.clear();
00626   // (c) .. and the order-list too
00627   mSubTaskOrderList.clear();
00628   // (d) then we delete all allocated predecessor-objects
00629   map<string,Predecessor*>::iterator predecessorMapIterator=mPredecessorMap.begin();
00630   while(predecessorMapIterator!=mPredecessorMap.end())
00631   {
00632     delete predecessorMapIterator->second;
00633     predecessorMapIterator++;
00634   }  
00635   // (e) at last we are paranoic again 
00636   mPredecessorMap.clear();
00637   mLoggingUnit.makeEntry("deleting task",mTaskTitle,HM);
00638 }
00639 
00640 /* :-: (12.B) public others -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00641 
00651 void mrprj::Task::setPassiveIfAllDaughtersPassive()
00652 {
00653   
00654   if (mSubTaskMap.size()!=0)
00655   {
00656     map<string, Task*>::const_iterator
00657       mSubTaskMapIterator=mSubTaskMap.begin();
00658     bool allDaughtersArePassive=true;
00659     while(mSubTaskMapIterator!=mSubTaskMap.end())
00660     {
00661       mSubTaskMapIterator->second->setPassiveIfAllDaughtersPassive();
00662       
00663       if (mSubTaskMapIterator->second->isActive())
00664         allDaughtersArePassive=false;
00665       mSubTaskMapIterator++;
00666     }
00667    
00668     if (allDaughtersArePassive)
00669       setPassive();
00670     else
00671       setAnyDaughterIsActive();    
00672   }
00673   else
00674   {
00675     if (mIsActive)
00676       setAnyDaughterIsActive();
00677   }
00678 }
00679 
00693 bool mrprj::Task::fillTaskSubStructureByMrPrjXmlTaskNodes
00694 (
00695   xmlDocPtr xmlDoc, 
00696   const xmlNodePtr pFirstTaskSubnode,
00697   map<string,Task*>& pGlobalTaskMap
00698 )
00699 { 
00700   string taskId;
00701   string taskTitle;
00702   string taskDescr;
00703   string taskStart;
00704   string taskEnd;
00705   int fullFilledPerCent;
00706   XmlNodeReader xmlNodeReader;
00707 
00708   if (!(pFirstTaskSubnode))
00709     return false;
00710   mrprj::Task* newSubTask;
00711   
00712   xmlNodePtr xmlTaskTreeListRunner=pFirstTaskSubnode;
00713   while(xmlTaskTreeListRunner)
00714   {
00715     if (strcmp((char *)xmlTaskTreeListRunner->name,"predecessors")==0)
00716     {
00717       fillTaskPredecessorByMrPrjXmlPredecessorNodes(xmlDoc,xmlTaskTreeListRunner->xmlChildrenNode);
00718     }
00719     if (strcmp((char *)xmlTaskTreeListRunner->name,"task")==0)
00720     {
00721       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlTaskTreeListRunner,"id",taskId));
00722       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTaskTreeListRunner,"name",taskTitle)))
00723         taskTitle="???";
00724       
00725       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTaskTreeListRunner,"note",taskDescr)))
00726         taskDescr="???";
00727 
00728       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlTaskTreeListRunner,"start",taskStart));
00729       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlTaskTreeListRunner,"end",taskEnd));
00730 
00731       if (!(xmlNodeReader.getIntProperty(xmlDoc,xmlTaskTreeListRunner,"percent-complete",fullFilledPerCent)))
00732         fullFilledPerCent=0;
00733         
00734       newSubTask
00735         =insertSubTask
00736           ( taskId,taskTitle,taskDescr,taskStart,taskEnd,fullFilledPerCent);
00737       pGlobalTaskMap.insert(pair<string,Task*>(newSubTask->mTaskId,newSubTask));
00738       newSubTask->fillTaskSubStructureByMrPrjXmlTaskNodes
00739         (xmlDoc,xmlTaskTreeListRunner->xmlChildrenNode,pGlobalTaskMap);
00740     }
00741     xmlTaskTreeListRunner=xmlTaskTreeListRunner->next;
00742   }
00743   return true;
00744 }
00745 
00755 bool  mrprj::Task::limitToTimeSlot
00756 (
00757   const string& pTimeSlotStart,
00758   const string& pTimeSlotEnd
00759 )
00760 {
00761   if (!(isEmptyTopTask()))
00762   {    
00763     if (  (getEndDate()<pTimeSlotStart)
00764        || (getStartDate()>pTimeSlotEnd)
00765        )
00766     {
00767       setPassive();
00768     }
00769     else
00770     {
00771       if (getStartDate()<pTimeSlotStart)
00772         setStartDate(pTimeSlotStart);
00773       if (getEndDate()>pTimeSlotEnd)
00774         setEndDate(pTimeSlotEnd);
00775     }
00776   }
00777  
00778   list<string>::iterator 
00779     mSubTaskOrderListIterator
00780       =mSubTaskOrderList.begin();
00781   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
00782   {
00783     mSubTaskMap[*mSubTaskOrderListIterator]->limitToTimeSlot(pTimeSlotStart,pTimeSlotEnd);
00784     mSubTaskOrderListIterator++;
00785   }
00786   return true;
00787 }
00788 
00795 bool  mrprj::Task::limitToOpenTasks()
00796 {
00797   if (!(isEmptyTopTask()))
00798   {
00799     if (getFullFilledPercent()==100)
00800       setPassive();
00801   }
00802  
00803   list<string>::iterator 
00804     mSubTaskOrderListIterator
00805       =mSubTaskOrderList.begin();
00806   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
00807   {
00808     mSubTaskMap[*mSubTaskOrderListIterator]->limitToOpenTasks();
00809     mSubTaskOrderListIterator++;
00810   }
00811   return true;
00812 }
00813 
00814 
00825 int mrprj::Task::insertXYposition
00826 ( 
00827   const int pEmbeddedLevel,
00828   int& pMaxEmbeddedLevel
00829 )
00830 {
00831    
00832   mNodeEmbeddedLevel=pEmbeddedLevel; 
00833   if (isLeafNode())
00834   {
00835     mXrowspan=1;
00836     mXrowTacker=1;
00837     /*
00838     printf("%d,%s:%s (x(%d),y(%d),r(%d),c(%d))\n",
00839     pEmbeddedLevel,
00840     getTaskId().c_str(),
00841     getTaskTitle().c_str(),
00842     mXposition,
00843     mYposition,
00844     mXrowspan,
00845     mYcolspan
00846     );
00847     */
00848     if (pEmbeddedLevel>pMaxEmbeddedLevel)
00849       pMaxEmbeddedLevel=pEmbeddedLevel;
00850     return 1;
00851   }
00852   
00853   
00854   list<string>::iterator 
00855     mSubTaskOrderListIterator
00856       =mSubTaskOrderList.begin();
00857   mXrowspan=0;
00858   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
00859   {
00860     mXrowspan=
00861       ( mSubTaskMap[*mSubTaskOrderListIterator]
00862           ->insertXYposition
00863             ( (pEmbeddedLevel+1),
00864               pMaxEmbeddedLevel
00865             )
00866       + mXrowspan);
00867     mSubTaskOrderListIterator++;
00868   }
00869   /*
00870   printf("%d,%s:%s (x(%d),y(%d),r(%d),c(%d))\n",
00871     pEmbeddedLevel,
00872     getTaskId().c_str(),
00873     getTaskTitle().c_str(),
00874     mXposition,
00875     mYposition,
00876     mXrowspan,
00877     mYcolspan
00878     );
00879   */
00880   mXrowTacker=mXrowspan;
00881   return mXrowspan;
00882 }
00883 
00893 bool mrprj::Task::printTaskAsMrPrjXmlFileMember(int pBlankIndents)const
00894 {
00895   krmuo::XmlConverter xmlConverter;
00896   
00897   string pBlankPrefix="";
00898   for(int i=0;i<pBlankIndents;i++)
00899   {
00900      pBlankPrefix+=" ";
00901   }
00902   
00903     // (0) if it's the virtual main task we are writing the opening task-list-tag
00904   if (isEmptyTopTask())
00905     printf("%s<tasks>\n",pBlankPrefix.c_str());
00906   else
00907   {
00908     if ((mIsActive)||(mAnyDaughterIsActive))
00909     {
00910       // (1) the we are writing the task itself (if it's not the virtual main task)
00911       printf("%s<task id=\"%s\" name=\"%s\" "
00912              "start=\"%s\" end=\"%s\" "
00913              "percent-complete=\"%d\" "
00914              "note=\"%s\" "
00915              " >\n",
00916               pBlankPrefix.c_str(),
00917               xmlConverter.encode(getTaskId()).c_str(),
00918               xmlConverter.encode(getTaskTitle()).c_str(),
00919               xmlConverter.encode(getStartDate()).c_str(),
00920               xmlConverter.encode(getEndDate()).c_str(),
00921               getFullFilledPercent(),
00922         xmlConverter.encode(getTaskDescription()).c_str()
00923             );
00924       // (2) followed by the list of all denoted predecessors
00925       if (mPredecessorMap.size()==0)
00926       {
00927         printf("%s  <predecessors />\n",pBlankPrefix.c_str());
00928       }
00929       else
00930       {
00931         printf("%s  <predecessors>\n",pBlankPrefix.c_str());
00932         map<string,Predecessor*>::const_iterator mPredecessorMapIterator=mPredecessorMap.begin();
00933         while(mPredecessorMapIterator!=mPredecessorMap.end())
00934         {
00935           printf("%s    <predecessor id=\"%s\" predecessor-id=\"%s\" type=\"%s\" />\n",
00936                   pBlankPrefix.c_str(),
00937                   mPredecessorMapIterator->second->getEntryId().c_str(),
00938                   mPredecessorMapIterator->second->getPredecessorTaskId().c_str(),
00939                   mPredecessorMapIterator->second->getType().c_str()
00940                 );
00941           mPredecessorMapIterator++;
00942         }
00943         printf("%s  </predecessors>\n",pBlankPrefix.c_str());
00944       }
00945     }
00946   }
00947  
00948     // (3) at last we are writing all subtasks by respecting the order of the original mrproject-xml-file 
00949    list<string>::const_iterator 
00950     mSubTaskOrderListIterator
00951       =mSubTaskOrderList.begin();
00952   map<string, Task*>::const_iterator mSubTaskMapIterator;
00953   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
00954   {
00955     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
00956     mSubTaskMapIterator->second->printTaskAsMrPrjXmlFileMember((pBlankIndents+2));
00957     mSubTaskOrderListIterator++;
00958   }
00959   
00960   
00961   if (isEmptyTopTask())
00962     printf("%s</tasks>\n",pBlankPrefix.c_str());
00963   else
00964   {
00965     if ((mIsActive)||(mAnyDaughterIsActive))
00966       printf("%s</task>\n",pBlankPrefix.c_str());
00967   }
00968   return true;
00969 }
00970 
00986 bool mrprj::Task::printTaskAsLeafMemoListMember
00987 ( const string& pTaskPrefix,
00988   const string& pLevelOrderString,
00989   const map<string,Resource*>& pResourceMap,
00990   const list<Allocation*>& pAllocationList,
00991   const bool pIso8601
00992 )const
00993 {
00994 
00995   string actualPrefix=(pTaskPrefix+ "/");
00996  
00997   if(mSubTaskOrderList.size()>0)
00998   {
00999     string actualLevelOrderString=(pLevelOrderString + ".");
01000 
01001     if (!(isEmptyTopTask()))
01002     {
01003       actualPrefix=(actualPrefix + getTaskTitle());  
01004     }
01005     else
01006     {
01007       actualLevelOrderString="";
01008       actualPrefix="";
01009     }
01010     
01011     list<string>::const_iterator 
01012       mSubTaskOrderListIterator
01013         =mSubTaskOrderList.begin();
01014     int levelSorter=1;
01015     char buffer[120];
01016     string nextOrderString="";
01017     map<string, Task*>::const_iterator mSubTaskMapIterator;
01018 
01019     while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01020     {
01021       sprintf(buffer,"%d",levelSorter);
01022       nextOrderString=(actualLevelOrderString+buffer);
01023       
01024       mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01025       mSubTaskMapIterator->second->printTaskAsLeafMemoListMember
01026           ( actualPrefix,
01027             nextOrderString,
01028             pResourceMap,
01029             pAllocationList,
01030             pIso8601
01031           );
01032       mSubTaskOrderListIterator++;
01033       levelSorter++;
01034     }
01035     return true;
01036   }
01037   
01038   if (mIsActive)
01039   {
01040     string resourceId;
01041     string resourceName;
01042     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01043     {
01044       resourceId=-1;
01045       resourceName="?";
01046     }
01047     string startDate="";
01048     string endDate="";
01049     if (pIso8601)
01050     {
01051       startDate=getStartDate();
01052       endDate=getEndDate();
01053     }
01054     else
01055     {
01056       DateStringConverter dateStringConverter;
01057       startDate=dateStringConverter.formGermanDateString(getStartDate());
01058       endDate=dateStringConverter.formGermanDateString(getEndDate());
01059     }
01060     printf("<%s> %s (%s):\n  %s\n    [%s - %s]\n      (%s):\n        %s\n",
01061             resourceName.c_str(),
01062             pLevelOrderString.c_str(),
01063             getDoneDescription().c_str(),           
01064             getTaskTitle().c_str(),
01065             startDate.c_str(),
01066             endDate.c_str(),
01067             actualPrefix.c_str(),
01068             getTaskDescriptionAsFormattedString("",64).c_str()
01069            );
01070   }
01071   return true;
01072 }
01073 
01088 bool mrprj::Task::printTaskAsTreeMemoMember
01089 ( const string& pLevelOrderString,
01090   int pTreeDepth,
01091   const map<string,Resource*>& pResourceMap,
01092   const list<Allocation*>& pAllocationList,
01093   const bool pIso8601 
01094 )const
01095 {
01096   string pBlankPrefix="";
01097   for(int i=0;i<pTreeDepth;i++)
01098   {
01099      pBlankPrefix+="  ";
01100   }
01101 
01102   if (((mIsActive)||(mAnyDaughterIsActive))&&(!(mIsEmptyTopTask)))
01103   {
01104     string resourceId;
01105     string resourceName;
01106     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01107     {
01108       resourceId=-1;
01109       resourceName="?";
01110     }
01111     string startDate="";
01112     string endDate="";
01113     if (pIso8601)
01114     {
01115       startDate=getStartDate();
01116       endDate=getEndDate();
01117     }
01118     else
01119     {
01120       DateStringConverter dateStringConverter;
01121       startDate=dateStringConverter.formGermanDateString(getStartDate());
01122       endDate=dateStringConverter.formGermanDateString(getEndDate());
01123     }
01124 
01125     printf("%s%s [%s - %s] %s(%s,%s):\n%s  %s\n",
01126             pBlankPrefix.c_str(),
01127             getTaskTitle().c_str(),
01128             startDate.c_str(),
01129             endDate.c_str(),
01130             getDoneDescription().c_str(),
01131             resourceName.c_str(),
01132             pLevelOrderString.c_str(),
01133             pBlankPrefix.c_str(),
01134             (getTaskDescriptionAsFormattedString((pBlankPrefix+" "),64) + "\n").c_str()
01135            );
01136   }
01137   
01138   string actualLevelOrderString="";
01139   if (!(mIsEmptyTopTask))
01140   {
01141     actualLevelOrderString=(pLevelOrderString+".");
01142   }
01143     
01144   list<string>::const_iterator 
01145     mSubTaskOrderListIterator
01146       =mSubTaskOrderList.begin();
01147   int levelSorter=1;
01148   char buffer[120];
01149   string nextOrderString="";
01150   map<string, Task*>::const_iterator mSubTaskMapIterator;
01151   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01152   {
01153     sprintf(buffer,"%d",levelSorter);
01154     nextOrderString=(actualLevelOrderString+buffer);
01155     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01156     mSubTaskMapIterator->second->printTaskAsTreeMemoMember
01157         ( nextOrderString,
01158           pTreeDepth+1,
01159           pResourceMap,
01160           pAllocationList,
01161           pIso8601
01162         );
01163     mSubTaskOrderListIterator++;
01164     levelSorter++;
01165   }
01166   
01167   return true;
01168 }
01169 
01181 bool mrprj::Task::printTaskAsLeafVTodoMember
01182 ( const map<string,Resource*>& pResourceMap,
01183   const list<Allocation*>& pAllocationList,
01184   const string& pConnectedProjectName
01185 )const
01186 {
01187   if (mIsEmptyTopTask)
01188     printf("BEGIN:VCALENDAR\n");
01189     
01190   if (  ((mIsActive)||(mAnyDaughterIsActive))
01191      && (!(mIsEmptyTopTask))
01192      && (mSubTaskOrderList.size()==0)
01193      )
01194   {
01195     string resourceId;
01196     string resourceName;
01197     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01198     {
01199       resourceId=-1;
01200       resourceName="?";
01201     }
01202         
01203     printf("BEGIN:VTODO\n");
01204     printf("UID:mrproject-%s-%s\n",pConnectedProjectName.c_str(),getTaskId().c_str());
01205     printf("SEQUENCE:-1\n");
01206     printf("DTSTART:%s\n",getStartDate().c_str());
01207     printf("DUE:%s\n",getEndDate().c_str());
01208     printf("DCREATED:%s\n",getStartDate().c_str());
01209     printf("DESCRIPTION:%s for/by %s: %s\n",
01210       getDoneDescription().c_str(),resourceName.c_str(),getTaskDescriptionAsOneLine().c_str());
01211        
01212     printf("SUMMARY:%s\n",getTaskTitle().c_str());
01213     if (isOpenTask())
01214       printf("STATUS:NEEDS ACTION\n");
01215     printf("CLASS:PUBLIC\n");
01216     printf("PRIORITY:5\n");
01217     printf("TRANSP:0\n");
01218     printf("X-PILOTID:0\n");
01219     printf("X-PILOTSTAT:1\n");
01220     printf("X-PILOT-NOTIME:0\n");
01221     printf("END:VTODO\n\n");
01222   }
01223       
01224   list<string>::const_iterator 
01225     mSubTaskOrderListIterator
01226       =mSubTaskOrderList.begin();
01227   map<string, Task*>::const_iterator mSubTaskMapIterator;
01228   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01229   {
01230     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01231     mSubTaskMapIterator->second->printTaskAsLeafVTodoMember
01232         ( pResourceMap,
01233           pAllocationList,
01234           pConnectedProjectName
01235         );
01236     mSubTaskOrderListIterator++;
01237   }
01238   if (mIsEmptyTopTask)
01239     printf("END:VCALENDAR\n");
01240 
01241   return true;
01242 }
01243 
01255 bool mrprj::Task::printTaskAsTreeVTodoMember
01256 ( const map<string,Resource*>& pResourceMap,
01257   const list<Allocation*>& pAllocationList,
01258   const string& pConnectedProjectName
01259 )const
01260 {
01261   if (mIsEmptyTopTask)
01262     printf("BEGIN:VCALENDAR\n");
01263     
01264   if (  ((mIsActive)||(mAnyDaughterIsActive))
01265      && (!(mIsEmptyTopTask))
01266      )
01267   {
01268     string resourceId;
01269     string resourceName;
01270     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01271     {
01272       resourceId=-1;
01273       resourceName="?";
01274     }
01275         
01276     printf("BEGIN:VTODO\n");
01277     printf("UID:mrproject-%s-%s\n",pConnectedProjectName.c_str(),getTaskId().c_str());
01278     printf("SEQUENCE:-1\n");
01279     printf("DTSTART:%s\n",getStartDate().c_str());
01280     printf("DUE:%s\n",getEndDate().c_str());
01281     printf("DCREATED:%s\n",getStartDate().c_str());
01282     printf("DESCRIPTION:%s for/by %s: %s\n",
01283       getDoneDescription().c_str(),resourceName.c_str(),getTaskDescriptionAsOneLine().c_str());
01284        
01285     printf("SUMMARY:%s\n",getTaskTitle().c_str());
01286     if (isOpenTask())
01287       printf("STATUS:NEEDS ACTION\n");
01288     printf("CLASS:PUBLIC\n");
01289     printf("PRIORITY:5\n");
01290     printf("TRANSP:0\n");
01291     printf("X-PILOTID:0\n");
01292     printf("X-PILOTSTAT:1\n");
01293     printf("X-PILOT-NOTIME:0\n");
01294     printf("END:VTODO\n\n");
01295   }
01296       
01297   list<string>::const_iterator 
01298     mSubTaskOrderListIterator
01299       =mSubTaskOrderList.begin();
01300   map<string, Task*>::const_iterator mSubTaskMapIterator;
01301   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01302   {
01303     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01304     mSubTaskMapIterator->second->printTaskAsTreeVTodoMember
01305         ( pResourceMap,
01306           pAllocationList,
01307           pConnectedProjectName
01308         );
01309     mSubTaskOrderListIterator++;
01310   }
01311   
01312   if (mIsEmptyTopTask)
01313     printf("END:VCALENDAR\n");
01314 
01315   return true;
01316 }
01317 
01330 bool mrprj::Task::printTaskAsPilotTreeTodoMember
01331 ( const string& pLevelOrderString,
01332   const map<string,Resource*>& pResourceMap,
01333   const list<Allocation*>& pAllocationList
01334 )const
01335 {
01336   if (((mIsActive)||(mAnyDaughterIsActive))&&(!(mIsEmptyTopTask)))
01337   {
01338     string resourceId;
01339     string resourceName;
01340     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01341     {
01342       resourceId=-1;
01343       resourceName="?";
01344     }
01345 
01346     printf("%s [%s - %s] <%s(%s,%s)>\n",
01347             getTaskTitle().c_str(),
01348             getStartDate().c_str(),
01349             getEndDate().c_str(),
01350             getDoneDescription().c_str(),
01351             resourceName.c_str(),
01352             pLevelOrderString.c_str()
01353            );
01354   }
01355   
01356   string actualLevelOrderString="";
01357   if (!(mIsEmptyTopTask))
01358   {
01359     actualLevelOrderString=(pLevelOrderString+".");
01360   }
01361     
01362   list<string>::const_iterator 
01363     mSubTaskOrderListIterator
01364       =mSubTaskOrderList.begin();
01365   int levelSorter=1;
01366   char buffer[120];
01367   string nextOrderString="";
01368   map<string, Task*>::const_iterator mSubTaskMapIterator;
01369   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01370   {
01371     sprintf(buffer,"%d",levelSorter);
01372     nextOrderString=(actualLevelOrderString+buffer);
01373     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01374     mSubTaskMapIterator->second->printTaskAsPilotTreeTodoMember
01375         ( nextOrderString,
01376           pResourceMap,
01377           pAllocationList
01378         );
01379     mSubTaskOrderListIterator++;
01380     levelSorter++;
01381   }
01382   
01383   return true;
01384 }
01385 
01398 bool mrprj::Task::printTaskAsPilotLeafTodoMember
01399 ( const string& pLevelOrderString,
01400   const map<string,Resource*>& pResourceMap,
01401   const list<Allocation*>& pAllocationList
01402 )const
01403 {
01404   if (((mIsActive)||(mAnyDaughterIsActive))&&(!(mIsEmptyTopTask))&&(mSubTaskOrderList.size()==0))
01405   {
01406     string resourceId;
01407     string resourceName;
01408     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01409     {
01410       resourceId=-1;
01411       resourceName="?";
01412     }
01413 
01414     printf("%s [%s - %s] <%s(%s,%s)>\n",
01415             getTaskTitle().c_str(),
01416             getStartDate().c_str(),
01417             getEndDate().c_str(),
01418             getDoneDescription().c_str(),
01419             resourceName.c_str(),
01420             pLevelOrderString.c_str()
01421            );
01422   }
01423   
01424   string actualLevelOrderString="";
01425   if (!(mIsEmptyTopTask))
01426   {
01427     actualLevelOrderString=(pLevelOrderString+".");
01428   }
01429     
01430   list<string>::const_iterator 
01431     mSubTaskOrderListIterator
01432       =mSubTaskOrderList.begin();
01433   int levelSorter=1;
01434   char buffer[120];
01435   string nextOrderString="";
01436   map<string, Task*>::const_iterator mSubTaskMapIterator;
01437   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01438   {
01439     sprintf(buffer,"%d",levelSorter);
01440     nextOrderString=(actualLevelOrderString+buffer);
01441     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01442     mSubTaskMapIterator->second->printTaskAsPilotTreeTodoMember
01443         ( nextOrderString,
01444           pResourceMap,
01445           pAllocationList
01446         );
01447     mSubTaskOrderListIterator++;
01448     levelSorter++;
01449   }
01450   
01451   return true;
01452 }
01453 
01465 bool mrprj::Task::printTaskAsLeafYankTodoMember
01466 ( const map<string,Resource*>& pResourceMap,
01467   const list<Allocation*>& pAllocationList
01468 )const
01469 {
01470   krmuo::XmlConverter xmlConverter; 
01471   mrprj::DateStringConverter dateStringConverter;
01472   
01473   if (  ((mIsActive)||(mAnyDaughterIsActive))
01474      && (!(mIsEmptyTopTask))
01475      && (mSubTaskOrderList.size()==0)
01476      )
01477   {
01478     string resourceId;
01479     string resourceName;
01480     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01481     {
01482       resourceId=-1;
01483       resourceName="?";
01484     }
01485     printf("  <Node Type=\"TodoNote\" ");
01486     printf("User=\"%s\" ",(xmlConverter.encode(resourceName)).c_str() );
01487     printf("Priority=\"3\" ");
01488     printf("Deadline=\"%s\" ",dateStringConverter.formYankDateString(getEndDate()).c_str());
01489     printf("Complete=\"%f\" ",(float)getFullFilledPercent());
01490     if (getFullFilledPercent()==100)
01491       printf("Todo=\"1\" ");
01492     else
01493       printf("Todo=\"0\" ");
01494               
01495     printf(">\n");
01496     printf("    <ID>%s</ID>\n",getTaskId().c_str());
01497     printf("    <Title>%s</Title>\n",(xmlConverter.encode(getTaskTitle())).c_str());
01498     printf("    <Text>\n%s for/by %s:\n%s\n    </Text>\n",
01499                       getDoneDescription().c_str(),
01500                       (xmlConverter.encode(resourceName)).c_str(),
01501                       (xmlConverter.encode(getTaskDescriptionAsFormattedString("",60))).c_str());
01502     printf("  </Node>\n");
01503   }
01504 
01505   list<string>::const_iterator 
01506     mSubTaskOrderListIterator
01507       =mSubTaskOrderList.begin();
01508   map<string, Task*>::const_iterator mSubTaskMapIterator;
01509   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01510   {
01511     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01512     mSubTaskMapIterator->second->printTaskAsLeafYankTodoMember
01513         ( pResourceMap,
01514           pAllocationList
01515         );
01516     mSubTaskOrderListIterator++;
01517   }
01518 
01519   return true;
01520 }
01521 
01534 bool mrprj::Task::printTaskAsTreeYankTodoMember
01535 ( const map<string,Resource*>& pResourceMap,
01536   const list<Allocation*>& pAllocationList,
01537   const int pBlankIndents
01538 )const
01539 {
01540   krmuo::XmlConverter xmlConverter; 
01541   mrprj::DateStringConverter dateStringConverter;
01542 
01543   string pBlankPrefix="";
01544   for(int i=0;i<pBlankIndents;i++)
01545   {
01546      pBlankPrefix+=" ";
01547   }
01548 
01549   if (  ((mIsActive)||(mAnyDaughterIsActive))
01550      && (!(mIsEmptyTopTask))
01551      )
01552   {
01553     string resourceId;
01554     string resourceName;
01555     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01556     {
01557       resourceId=-1;
01558       resourceName="?";
01559     }
01560     printf("%s<Node Type=\"TodoNote\" ",pBlankPrefix.c_str());
01561     printf("User=\"%s\" ",(xmlConverter.encode(resourceName)).c_str() );
01562     printf("Priority=\"3\" ");
01563     printf("Deadline=\"%s\" ",dateStringConverter.formYankDateString(getEndDate()).c_str());
01564     printf("Complete=\"%f\" ",(float)getFullFilledPercent());
01565     if (getFullFilledPercent()==100)
01566       printf("Todo=\"1\" ");
01567     else
01568       printf("Todo=\"0\" ");
01569     printf(">\n");
01570     printf("%s  <ID>%s</ID>\n",pBlankPrefix.c_str(),getTaskId().c_str());
01571     printf("%s  <Title>%s</Title>\n",pBlankPrefix.c_str(),(xmlConverter.encode(getTaskTitle())).c_str());
01572     printf("%s  <Text>\n%s for/by %s:\n%s\n%s</Text>\n",
01573                       pBlankPrefix.c_str(),
01574                       getDoneDescription().c_str(),
01575                       (xmlConverter.encode(resourceName)).c_str(),
01576                       (xmlConverter.encode(getTaskDescriptionAsFormattedString("",60))).c_str(),
01577                       pBlankPrefix.c_str());
01578   }
01579       
01580   list<string>::const_iterator 
01581     mSubTaskOrderListIterator
01582       =mSubTaskOrderList.begin();
01583   map<string, Task*>::const_iterator mSubTaskMapIterator;
01584   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01585   {
01586     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01587     mSubTaskMapIterator->second->printTaskAsTreeYankTodoMember
01588         ( pResourceMap,
01589           pAllocationList,
01590           (pBlankIndents +2)
01591         );
01592     mSubTaskOrderListIterator++;
01593   }
01594   
01595   if (  ((mIsActive)||(mAnyDaughterIsActive))
01596      && (!(mIsEmptyTopTask))
01597      )
01598     printf("%s</Node>\n",pBlankPrefix.c_str());
01599 
01600   return true;
01601 }
01602 
01614 bool mrprj::Task::printTaskAsLeafCslTodoMember
01615 ( const string& pLevelOrderString,
01616   const map<string,Resource*>& pResourceMap,
01617   const list<Allocation*>& pAllocationList
01618 )const
01619 {
01620   mrprj::DateStringConverter dateStringConverter;
01621   
01622   if (  ((mIsActive)||(mAnyDaughterIsActive))
01623      && (!(mIsEmptyTopTask))
01624      && (mSubTaskOrderList.size()==0)
01625      )
01626   {
01627     string resourceId;
01628     string resourceName;
01629     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01630     {
01631       resourceId=-1;
01632       resourceName="?";
01633     }
01634     
01635     printf("\"%s:\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"\n",
01636             pLevelOrderString.c_str(),
01637             getTaskTitle().c_str(),
01638             getClearTaskDescriptionAsOneLine().c_str(),
01639             resourceName.c_str(),
01640             dateStringConverter.formGermanDateString(getStartDate()).c_str(),
01641             dateStringConverter.formGermanDateString(getEndDate()).c_str(),
01642             getDoneDescription().c_str(),
01643             getPredecessorString().c_str()
01644           );
01645   }
01646 
01647   string actualLevelOrderString="";
01648   if (!(mIsEmptyTopTask))
01649   {
01650     actualLevelOrderString=(pLevelOrderString+".");
01651   }
01652   list<string>::const_iterator 
01653     mSubTaskOrderListIterator
01654       =mSubTaskOrderList.begin();
01655   int levelSorter=1;
01656   char buffer[120];
01657   string nextOrderString="";
01658   map<string, Task*>::const_iterator mSubTaskMapIterator;
01659   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01660   {
01661     sprintf(buffer,"%d",levelSorter);
01662     nextOrderString=(actualLevelOrderString+buffer);
01663     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01664     mSubTaskMapIterator->second->printTaskAsLeafCslTodoMember
01665         ( nextOrderString,
01666           pResourceMap,
01667           pAllocationList
01668         );
01669     mSubTaskOrderListIterator++;
01670     levelSorter++;
01671   }
01672 
01673   return true;
01674 }
01675 
01687 bool mrprj::Task::printTaskAsTreeCslTodoMember
01688 ( const string& pLevelOrderString,
01689   const map<string,Resource*>& pResourceMap,
01690   const list<Allocation*>& pAllocationList
01691 )const
01692 {
01693   krmuo::XmlConverter xmlConverter; 
01694   mrprj::DateStringConverter dateStringConverter;
01695 
01696   if (  ((mIsActive)||(mAnyDaughterIsActive))
01697      && (!(mIsEmptyTopTask))
01698      )
01699   {
01700     string resourceId;
01701     string resourceName;
01702     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01703     {
01704       resourceId=-1;
01705       resourceName="?";
01706     }
01707     printf("\"%s:\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"\n",
01708             pLevelOrderString.c_str(),
01709             getTaskTitle().c_str(),
01710             getClearTaskDescriptionAsOneLine().c_str(),
01711             resourceName.c_str(),
01712             dateStringConverter.formGermanDateString(getStartDate()).c_str(),
01713             dateStringConverter.formGermanDateString(getEndDate()).c_str(),
01714             getDoneDescription().c_str(),
01715             getPredecessorString().c_str()
01716           );
01717   }
01718       
01719   string actualLevelOrderString="";
01720   if (!(mIsEmptyTopTask))
01721   {
01722     actualLevelOrderString=(pLevelOrderString+".");
01723   }
01724   list<string>::const_iterator 
01725     mSubTaskOrderListIterator
01726       =mSubTaskOrderList.begin();
01727   int levelSorter=1;
01728   char buffer[120];
01729   string nextOrderString="";
01730   map<string, Task*>::const_iterator mSubTaskMapIterator;
01731   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01732   {
01733     sprintf(buffer,"%d",levelSorter);
01734     nextOrderString=(actualLevelOrderString+buffer);
01735     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01736     mSubTaskMapIterator->second->printTaskAsTreeCslTodoMember
01737         ( nextOrderString,
01738           pResourceMap,
01739           pAllocationList
01740         );
01741     mSubTaskOrderListIterator++;
01742     levelSorter++;
01743   }
01744   
01745   return true;
01746 }
01747 
01748 
01761 bool mrprj::Task::printTaskAsHtmlSurveyMember
01762 ( const map<string,Resource*>& pResourceMap,
01763   const list<Allocation*>& pAllocationList,
01764   const int maxPathLength,
01765   const string& pSurveyReferenceDayString
01766 )
01767 {
01768   krmuo::HtmlConverter htmlConverter; 
01769   mrprj::DateStringConverter dateStringConverter;
01770 
01771   if (mIsEmptyTopTask)
01772   {
01773 
01774     list<string>::const_iterator 
01775       mSubTaskOrderListIterator
01776         =mSubTaskOrderList.begin();
01777     map<string, Task*>::const_iterator mSubTaskMapIterator;
01778     while(mSubTaskOrderListIterator!=mSubTaskOrderList.end())
01779     {
01780 
01781       mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01782  
01783       while(mSubTaskMapIterator->second->mXrowTacker>0)
01784       {
01785         printf("  <tr>\n");
01786       
01787         mSubTaskMapIterator->second->printTaskAsHtmlSurveyMember
01788           ( pResourceMap,
01789             pAllocationList,
01790             maxPathLength,
01791             pSurveyReferenceDayString
01792           );
01793         printf("  </tr>\n");
01794       }
01795       mSubTaskOrderListIterator++;
01796     }
01797   
01798     return true;
01799   }
01800   
01801   //printf("%s->%d\n",getTaskId().c_str(),mXrowTacker);
01802 
01803   if (mXrowTacker==0)
01804     return false;
01805     
01806   if (mXdoPrint)
01807   {
01808     int colspanValue=1;
01809     if (mSubTaskOrderList.size()==0)
01810     {
01811       colspanValue=(maxPathLength-mNodeEmbeddedLevel)+1;    
01812     }
01813     
01814     string startDate=getStartDate();
01815     string endDate=getEndDate();
01816     string fullFillDegree="fullFilledTask";
01817     if (mFullFilledPercent<100)
01818     {
01819       if (pSurveyReferenceDayString>endDate)
01820         fullFillDegree="tolateTask";
01821       else if (pSurveyReferenceDayString<startDate)
01822         fullFillDegree="openLaterTask";
01823       else
01824         fullFillDegree="openNowTask";
01825     }
01826 
01827     printf("    <td rowspan=\"%d\" colspan=\"%d\" class=\"%s\">\n",
01828       mXrowspan,colspanValue,fullFillDegree.c_str());
01829     printf("      <span id=\"taskTitle\">\n");
01830     printf("        %s [%s]:\n",
01831       htmlConverter.encode(getTaskTitle()).c_str(),
01832       getTaskId().c_str()
01833       );
01834     printf("      </span>\n");
01835     printf("      <span id=\"taskDescription\">\n");
01836     printf("        %s\n",htmlConverter.encode(getClearTaskDescriptionAsOneLine()).c_str());
01837     printf("      </span>\n");
01838     printf("      <br />\n");
01839     printf("      <span id=\"taskTimeslot\">\n");
01840     printf("        %s - %s\n",
01841       htmlConverter.encode(dateStringConverter.formGermanDateString(getStartDate())).c_str(),
01842       htmlConverter.encode(dateStringConverter.formGermanDateString(getEndDate())).c_str()
01843       );
01844     printf("      </span>\n");
01845     
01846     printf("      <span id=\"taskState\">\n");
01847     printf("        [%s]\n",
01848        htmlConverter.encode(getDoneDescription()).c_str()
01849       );
01850     printf("      </span>\n");
01851     
01852     printf("      <br />\n");
01853     printf("      <span id=\"taskResource\">\n");
01854     string resourceId;
01855     string resourceName;
01856     if(!(getResourceInfos(pResourceMap,pAllocationList,resourceId,resourceName)))
01857     {
01858       resourceId=-1;
01859       resourceName="?";
01860     }
01861     printf("        %s\n",htmlConverter.encode(resourceName).c_str());    
01862     printf("      </span>\n");
01863     printf("      <br />\n");
01864     
01865     printf("    </td>\n");
01866     
01867     mXdoPrint=false;
01868   }
01869   
01870   mXrowTacker-=1;
01871 
01872       
01873   list<string>::const_iterator 
01874     mSubTaskOrderListIterator
01875       =mSubTaskOrderList.begin();
01876   map<string, Task*>::const_iterator mSubTaskMapIterator;
01877   bool nextFieldHasBeenPrinted=false;
01878   while(mSubTaskOrderListIterator!=mSubTaskOrderList.end()&&(!(nextFieldHasBeenPrinted)))
01879   {
01880     mSubTaskMapIterator=mSubTaskMap.find(*mSubTaskOrderListIterator);
01881     nextFieldHasBeenPrinted=
01882       mSubTaskMapIterator->second->printTaskAsHtmlSurveyMember
01883         ( pResourceMap,
01884           pAllocationList,
01885           maxPathLength,
01886           pSurveyReferenceDayString
01887         );
01888     mSubTaskOrderListIterator++;
01889   }
01890   
01891   return true;
01892 }
01893 
01894 
01895 /* :-: (5.B.4) private others :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
01909 mrprj::Task* mrprj::Task::insertSubTask
01910 ( 
01911   const string& pSubTaskId,
01912   const string& pSubTaskTitle,
01913   const string& pSubTaskDescription,
01914   const string& pSubTaskStartDate,
01915   const string& pSubTaskEndDate,
01916   const int pFullFilledPercent
01917 )
01918 {
01919   if (mSubTaskMap.find(pSubTaskId)!=mSubTaskMap.end())
01920     return NULL;
01921   
01922   Task* 
01923     newSubTask
01924       =new  Task
01925             ( mLoggingUnit,
01926               pSubTaskId,
01927               pSubTaskTitle,
01928               pSubTaskDescription,
01929               pSubTaskStartDate,
01930               pSubTaskEndDate,
01931               pFullFilledPercent
01932             );
01933   assert(newSubTask);
01934   
01935   mLoggingUnit.makeEntry("inserting task", pSubTaskTitle,HM);
01936   mSubTaskMap.insert(pair<string,Task*>(pSubTaskId,newSubTask));
01937   mSubTaskOrderList.push_back(pSubTaskId);
01938   return newSubTask;
01939 }
01940 
01950 bool mrprj::Task::fillTaskPredecessorByMrPrjXmlPredecessorNodes
01951 ( 
01952    xmlDocPtr xmlDoc,
01953   const xmlNodePtr pFirstPredecessor
01954 )
01955 {
01956   XmlNodeReader xmlNodeReader;
01957   if (!(pFirstPredecessor))
01958     return false;
01959 
01960   xmlNodePtr xmlPredecessorListRunner=pFirstPredecessor;
01961   while(xmlPredecessorListRunner)
01962   {
01963     if (strcmp((char *)xmlPredecessorListRunner->name,"predecessor")==0)
01964     {
01965       
01966       string entryId,predTaskId;
01967       string predRelationType;
01968       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlPredecessorListRunner,"id",entryId));
01969       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlPredecessorListRunner,"predecessor-id",predTaskId));
01970       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlPredecessorListRunner,"type",predRelationType));
01971       
01972       Predecessor* newPredecessor
01973         =new Predecessor(entryId,predTaskId,predRelationType);
01974       assert(newPredecessor);
01975       mPredecessorMap.insert(pair<string,Predecessor*>(entryId,newPredecessor));
01976 
01977     }
01978     xmlPredecessorListRunner=xmlPredecessorListRunner->next;
01979   }
01980   
01981   return true;
01982 }
01983 
01995 bool mrprj::Task::getResourceInfos
01996 (
01997   const map<string,Resource*>& pResourceMap,
01998   const list<Allocation*>& pAllocationList,
01999   string& pResourceId,
02000   string& pResourceTitle
02001 )const
02002 {
02003 
02004   pResourceId="-1";
02005   pResourceTitle="?";
02006   list<Allocation*>
02007     ::const_iterator 
02008       pAllocationListIterator
02009         =pAllocationList.begin();
02010   while( pAllocationListIterator!=pAllocationList.end()
02011          && pResourceId=="-1"
02012          )
02013   {
02014     if ((*pAllocationListIterator)->getTaskId()==mTaskId)
02015         pResourceId=(*pAllocationListIterator)->getResourceId();
02016     pAllocationListIterator++;
02017   }
02018   if (pResourceId=="-1")
02019     return false;
02020  
02021   const map<string,Resource*>
02022     ::const_iterator 
02023       pResourceMapIterator
02024         = pResourceMap.find(pResourceId);
02025   if (pResourceMapIterator==pResourceMap.end())
02026     return false;
02027   
02028   pResourceTitle=pResourceMapIterator->second->getResourceTitle();
02029   return true;
02030 }
02031 
02035 const string  mrprj::Task::getTaskDescriptionAsOneLine() const
02036 {
02037   string taskDescriptionAsOneLine="";
02038   string::const_iterator mTaskDescriptionIterator=mTaskDescription.begin();
02039   while(mTaskDescriptionIterator!=mTaskDescription.end())
02040   {
02041     if ((*mTaskDescriptionIterator<' ')&&(*mTaskDescriptionIterator>0))
02042       taskDescriptionAsOneLine+=' ';
02043     else
02044       taskDescriptionAsOneLine+=*mTaskDescriptionIterator;
02045     mTaskDescriptionIterator++;
02046   }
02047   return taskDescriptionAsOneLine;
02048 }
02049 
02056 const string  mrprj::Task::getTaskDescriptionAsFormattedString
02057 ( const string& pIndent,
02058   const int pLineLength
02059 ) const
02060 {
02061   const string taskDescriptionAsOneLine=getTaskDescriptionAsOneLine();
02062   string taskDescriptionAsFormattedString="";
02063   string::const_iterator mTaskDescriptionIterator=taskDescriptionAsOneLine.begin();
02064   int signs=pIndent.length();
02065   bool split=false;
02066   while(mTaskDescriptionIterator!=taskDescriptionAsOneLine.end())
02067   {
02068     if (signs==pLineLength)
02069       split=true;
02070     if (split && (*mTaskDescriptionIterator==' '))
02071     {
02072       split=false;
02073       signs=0;
02074       taskDescriptionAsFormattedString+=("\n" + pIndent);
02075      
02076     }
02077     signs+=1;
02078     taskDescriptionAsFormattedString+=*mTaskDescriptionIterator;
02079     mTaskDescriptionIterator++;
02080   }
02081   return taskDescriptionAsFormattedString;
02082 }
02083 
02087 const string  mrprj::Task::getClearTaskDescriptionAsOneLine
02088 () const
02089 {
02090   string description=getTaskDescriptionAsOneLine();
02091   string::iterator c=description.begin();
02092   
02093   while(c!=description.end())
02094   {
02095     if (*c == '"')
02096       *c='\'';
02097     if (*c == ',')
02098       *c=';';
02099       
02100     c++;
02101   }
02102   return description;
02103 }
02104 
02108 const string  mrprj::Task::getPredecessorString()
02109 const
02110 {
02111   string thePredecessors="";
02112   
02113   thePredecessors=(getTaskId() + "<-[");
02114     
02115   map<string,Predecessor*>::const_iterator 
02116     mPredecessorMapIterator
02117       =mPredecessorMap.begin();
02118 
02119   while(mPredecessorMapIterator!=mPredecessorMap.end())
02120   {
02121     if (mPredecessorMapIterator==mPredecessorMap.begin())
02122     {
02123       thePredecessors=
02124         (thePredecessors + mPredecessorMapIterator->second->getPredecessorTaskId());
02125     }
02126     else
02127     {
02128       thePredecessors= 
02129         ( thePredecessors + "+" +mPredecessorMapIterator->second->getPredecessorTaskId());
02130     }
02131     mPredecessorMapIterator++;
02132   }
02133   
02134   thePredecessors=(thePredecessors+"]");
02135   return thePredecessors;
02136 }
02137 
02138 /* &&& (6) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
02139 /* --- (6.A) public constructors, inits & operators :-:-:-:-: */
02151 mrprj::ResourceGroup::ResourceGroup
02152 ( 
02153   krmuo::LoggingUnit& pLoggingUnit,
02154   const string& pGroupId,
02155   const string& pGroupTitle,
02156   const string& pGroupDescription,
02157   const string& pGroupAdminName,
02158   const string& pGroupAdminPhone,
02159   const string& pGroupAdminEmail
02160 )                       
02161 : 
02162   mGroupId(pGroupId),
02163   mGroupTitle(pGroupTitle),
02164   mGroupDescription(pGroupDescription),
02165   mGroupAdminName(pGroupAdminName),
02166   mGroupAdminPhone(pGroupAdminPhone),
02167   mGroupAdminEmail(pGroupAdminEmail),
02168   mLoggingUnit(pLoggingUnit)
02169 
02170 {
02171   mLoggingUnit.makeEntry("creating ResourceGroup",mGroupTitle,HM);
02172 }
02173 
02179 mrprj::ResourceGroup::~ResourceGroup()
02180 {
02181   mLoggingUnit.makeEntry("deleting ResourceGroup",mGroupTitle,HM);
02182 } 
02183 
02184 
02185 
02186 /* &&& (7) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
02187 /* --- (7) public constructors, inits & operators :-:-:-:-: */
02202 mrprj::Resource::Resource
02203 ( 
02204   krmuo::LoggingUnit& pLoggingUnit,
02205   const string& pResourceId,
02206   const string& pResourceGroupId,      
02207   const string& pResourceTitle,
02208   const string& pResourceDescription,
02209   const int pResourceType,
02210   const long pResourceUnits,
02211   const string& pRecourceEmail,
02212   float pRecourceStdRate,
02213   float pRecourceOvtRate
02214 )                       
02215 : 
02216   mResourceId(pResourceId),
02217   mResourceGroupId(pResourceGroupId),      
02218   mResourceTitle(pResourceTitle),
02219   mResourceDescription(pResourceDescription),
02220   mResourceType(pResourceType),
02221   mResourceUnits(pResourceUnits),
02222   mRecourceEmail(pRecourceEmail),
02223   mRecourceStdRate(pRecourceStdRate),
02224   mRecourceOvtRate(pRecourceOvtRate),
02225   mLoggingUnit(pLoggingUnit) 
02226 {
02227   mLoggingUnit.makeEntry("creating resource",mResourceTitle,HM);
02228 }
02229 
02235 mrprj::Resource::~Resource()
02236 {
02237   mLoggingUnit.makeEntry("deleting resource",mResourceTitle,HM);
02238 } 
02239 
02240 /* &&& (8) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
02241 /* --- (8) public constructors, inits & operators :-:-:-:-: */
02249 mrprj::Allocation::Allocation
02250 ( 
02251   krmuo::LoggingUnit& pLoggingUnit,
02252   const string& pTaskId,
02253   const string& pResourceId      
02254 )                       
02255 : 
02256   mTaskId(pTaskId),
02257   mResourceId(pResourceId),
02258   mLoggingUnit(pLoggingUnit) 
02259 {
02260   string alloDescr=("task<" + mTaskId +">:<"+ mResourceId+">");
02261   mLoggingUnit.makeEntry("creating allocation",alloDescr,HM);
02262 }
02263 
02269 mrprj::Allocation::~Allocation()
02270 {
02271   string alloDescr=("task<" + mTaskId +">:<"+ mResourceId+">");
02272   mLoggingUnit.makeEntry("deleting allocation",alloDescr,HM);
02273 } 
02274 
02275 
02276 
02277 
02278 
02279 /* &&& (9) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
02280 /* &&&     methods for class TaskField &&& */
02281 
02282 /* --- (9.A) - public ----------------------------------------- */
02283 /* :-: (9.A.1) public constructors, inits & operators :-:-:-:-: */
02289 mrprj::TaskField::TaskField(krmuo::LoggingUnit& pLoggingUnit)                       
02290 : 
02291   mMainTask(pLoggingUnit,"-1","topTask","container for all real tasks","-","-",0,true),
02292   mResourceGroupMap(),
02293   mDefaultResourceGroup("-1"),
02294   mResourceMap(),
02295   mAllocationList(),
02296   mPropertyList(),
02297   mPhaseList(),
02298   mDayTypeList(),
02299   mCalendarList(),
02300   mLoggingUnit(pLoggingUnit),
02301   mProjectName(""),
02302   mProjectCompany(""),
02303   mProjectManager(""),
02304   mProjectPhase(""),
02305   mProjectStart(""),
02306   mProjectMrpVersion(""),
02307   mProjectCalendar(""),
02308   mRealTimeslotStart(""),
02309   mRealTimeslotEnd("")
02310 {
02311   mLoggingUnit.makeEntry("creating the mainTask",DM);
02312 }
02313 
02324 mrprj::TaskField::~TaskField()
02325 {
02326   mLoggingUnit.makeEntry("deleting taskField",DM);
02327   map<string,ResourceGroup*>::iterator 
02328     resourceGroupMapIterator
02329       =mResourceGroupMap.begin();
02330   while(resourceGroupMapIterator!=mResourceGroupMap.end())
02331   {
02332     delete(resourceGroupMapIterator->second);
02333     resourceGroupMapIterator++;
02334   }
02335 
02336   map<string,Resource*>::iterator 
02337     resourceMapIterator
02338       =mResourceMap.begin();
02339   while(resourceMapIterator!=mResourceMap.end())
02340   {
02341     delete(resourceMapIterator->second);
02342     resourceMapIterator++;
02343   }
02344   
02345   list<Allocation*>::iterator 
02346     mAllocationListIterator
02347       =mAllocationList.begin();
02348   while(mAllocationListIterator!=mAllocationList.end())
02349   {
02350     delete(*mAllocationListIterator);
02351     mAllocationListIterator++;
02352   }
02353   list<Property*>::iterator 
02354     mPropertyListIterator
02355       =mPropertyList.begin();
02356   while(mPropertyListIterator!=mPropertyList.end())
02357   {
02358     delete(*mPropertyListIterator);
02359     mPropertyListIterator++;
02360   }
02361 
02362   list<Phase*>::iterator 
02363     mPhaseListIterator
02364       =mPhaseList.begin();
02365   while(mPhaseListIterator!=mPhaseList.end())
02366   {
02367     delete(*mPhaseListIterator);
02368     mPhaseListIterator++;
02369   }
02370 
02371   list<DayType*>::iterator 
02372     mDayTypeListIterator
02373       =mDayTypeList.begin();
02374   while(mDayTypeListIterator!=mDayTypeList.end())
02375   {
02376     delete(*mDayTypeListIterator);
02377     mDayTypeListIterator++;
02378   }
02379 
02380   list<Calendar*>::iterator 
02381     mCalendarListIterator
02382       =mCalendarList.begin();
02383   while(mCalendarListIterator!=mCalendarList.end())
02384   {
02385     delete(*mCalendarListIterator);
02386     mCalendarListIterator++;
02387   }
02388   
02389   
02390   mGlobalTaskMap.clear();
02391 } 
02392 
02393 /* :-: (9.A.4) public others -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
02394 
02404 bool mrprj::TaskField::fillTaskFieldByMrPrjXmlFileContent
02405 ( 
02406   krmuo::LoggingUnit& pLoggingUnit,
02407   const string& mrprjBaseFileContent
02408 )
02409 {
02410   XmlNodeReader xmlNodeReader;
02411 
02412   xmlDocPtr xmlDoc=xmlParseMemory(mrprjBaseFileContent.c_str(),mrprjBaseFileContent.size());
02413   if (!(xmlDoc))
02414   {
02415     pLoggingUnit.makeEntry("can't parse the the content of  the mrprj-xml-master-file",SM);
02416     return false;
02417   } 
02418   
02419   // (2) take the correct root-xml-node
02420   xmlNodePtr xmlTopNode=xmlDocGetRootElement(xmlDoc);
02421   if (!(xmlTopNode))
02422   {
02423     pLoggingUnit.makeEntry("no topnode found",SM);
02424     return false;
02425   }
02426   
02427   if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTopNode,"name",mProjectName)))
02428     mProjectName="";
02429   if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTopNode,"company",mProjectCompany)))
02430     mProjectCompany="";
02431   if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTopNode,"manager",mProjectManager)))
02432     mProjectManager="";
02433   if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTopNode,"phase",mProjectPhase)))
02434     mProjectPhase="";
02435   if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTopNode,"project-start",mProjectStart)))
02436     mProjectStart="";
02437   if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTopNode,"mrproject-version",mProjectMrpVersion)))
02438     mProjectMrpVersion="";
02439   if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlTopNode,"calendar",mProjectCalendar)))
02440     mProjectCalendar="";
02441   
02442   
02443   
02444   // (3) for all childs of the root-xml-node do
02445   xmlNodePtr xmlListNode=xmlTopNode->xmlChildrenNode;
02446   while(xmlListNode)
02447   {
02448     // (3.A) read the task-list
02449     if (strcmp((char *)xmlListNode->name,(char *)"tasks")==0)
02450     {
02451       mMainTask.fillTaskSubStructureByMrPrjXmlTaskNodes
02452         (xmlDoc,xmlListNode->xmlChildrenNode,mGlobalTaskMap);
02453     }
02454     
02455     // (3.B) read the resource-group-list
02456     if (strcmp((char *)xmlListNode->name,(char *)"resource-groups")==0)
02457     {
02458       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlListNode,"default_group",mDefaultResourceGroup)))
02459         mDefaultResourceGroup="-1";
02460       fillResourceGroupMapByMrPrjXmlEntries
02461         (pLoggingUnit,xmlDoc,xmlListNode->xmlChildrenNode);
02462     }
02463     // (3.C) read the resource-list
02464     if (strcmp((char *)xmlListNode->name,(char *)"resources")==0)
02465     {
02466       fillResourceMapByMrPrjXmlEntries
02467         (pLoggingUnit,xmlDoc,xmlListNode->xmlChildrenNode);
02468     }
02469     // (3.D) read the allocation-list
02470     if (strcmp((char *)xmlListNode->name,(char *)"allocations")==0)
02471     {
02472       fillAllocationListByMrPrjXmlEntries
02473         (pLoggingUnit,xmlDoc,xmlListNode->xmlChildrenNode);
02474     }
02475     
02476     // (3.E) read the property-list
02477     if (strcmp((char *)xmlListNode->name,(char *)"properties")==0)
02478     {
02479       fillPropertyListByMrPrjXmlEntries
02480         (pLoggingUnit,xmlDoc,xmlListNode->xmlChildrenNode);
02481     }
02482     
02483     // (3.F) read the property-list
02484     if (strcmp((char *)xmlListNode->name,(char *)"phases")==0)
02485     {
02486       fillPhaseListByMrPrjXmlEntries
02487         (pLoggingUnit,xmlDoc,xmlListNode->xmlChildrenNode);
02488     }
02489     
02490     if (strcmp((char *)xmlListNode->name,(char *)"calendars")==0)
02491     {
02492       fillCalendarListByMrPrjXmlEntries
02493         (pLoggingUnit,xmlDoc,xmlListNode->xmlChildrenNode);
02494     }
02495 
02496 
02497     xmlListNode=xmlListNode->next;
02498     
02499     
02500   }
02501   //(4) don't become a memory leak
02502   xmlFreeDoc(xmlDoc);
02503 
02504   return true;
02505 }
02506 
02507 
02516 bool mrprj::TaskField::limitToResource(const string& pResourceTitel)
02517 {
02518 
02519   map<string,Resource*>::const_iterator 
02520     mResourceMapIterator
02521       =mResourceMap.begin();
02522   string allowedResourceId="-1";
02523   while(mResourceMapIterator!=mResourceMap.end())
02524   {
02525     if (  mResourceMapIterator->second->getResourceTitle()
02526        == pResourceTitel
02527        )
02528       allowedResourceId=mResourceMapIterator->second->getResourceId();
02529     mResourceMapIterator++;
02530   }
02531 
02532   if (allowedResourceId=="-1")
02533     return false;
02534     
02535   list<Allocation*>::const_iterator
02536     mAllocationListIterator
02537      =mAllocationList.begin();
02538   while(mAllocationListIterator!=mAllocationList.end())
02539   {
02540     if (  (*mAllocationListIterator)->getResourceId()
02541         !=
02542           allowedResourceId
02543         )
02544       mGlobalTaskMap[(*mAllocationListIterator)->getTaskId()]->setPassive();
02545     mAllocationListIterator++;
02546   }
02547 
02548   map<string,Task*>::const_iterator 
02549     mGlobalTaskMapIterator
02550       = mGlobalTaskMap.begin();
02551   while (mGlobalTaskMapIterator != mGlobalTaskMap.end())
02552   {
02553     if (  (mGlobalTaskMapIterator->second->numberOfDaughters()==0)
02554        && (!(mGlobalTaskMapIterator->second->isAllocated()))
02555        )
02556       mGlobalTaskMapIterator->second->setPassive();
02557       mGlobalTaskMapIterator++;
02558   }
02559   return true;
02560 }
02561 
02570 bool mrprj::TaskField::limitToResourceGroup(const string& pResourceGroupTitel)
02571 {
02572 
02573   map<string,ResourceGroup*>::const_iterator 
02574     mResourceGroupMapIterator
02575       =mResourceGroupMap.begin();
02576   string allowedResourceGroupId="-1";
02577   while(mResourceGroupMapIterator!=mResourceGroupMap.end())
02578   {
02579     if (  mResourceGroupMapIterator->second->getGroupTitle()
02580        == pResourceGroupTitel
02581        )
02582       allowedResourceGroupId=mResourceGroupMapIterator->second->getGroupId();
02583     mResourceGroupMapIterator++;
02584   }
02585 
02586   if (allowedResourceGroupId=="-1")
02587     return false;
02588 
02589   list<Allocation*>::const_iterator
02590     mAllocationListIterator
02591      =mAllocationList.begin();
02592   string realRecourceId;
02593   string realTaskId;
02594   while(mAllocationListIterator!=mAllocationList.end())
02595   {
02596     // for each member of the allocation list do
02597     // set passive if their recource-group doesn't match
02598     realRecourceId=(*mAllocationListIterator)->getResourceId();
02599     realTaskId=(*mAllocationListIterator)->getTaskId();
02600    
02601     map<string,Resource*>::const_iterator
02602       mResourceMapIterator=mResourceMap.find(realRecourceId);
02603       
02604     if (mResourceMapIterator!=mResourceMap.end())
02605     {
02606       if (allowedResourceGroupId!=mResourceMapIterator->second->getResourceGroupId())
02607       {
02608         mGlobalTaskMap[realTaskId]->setPassive();
02609       }
02610     }
02611     
02612     
02613     mAllocationListIterator++;
02614   }
02615 
02616   // for all existing tasks do
02617   map<string,Task*>::const_iterator 
02618     mGlobalTaskMapIterator
02619       = mGlobalTaskMap.begin();
02620   while (mGlobalTaskMapIterator != mGlobalTaskMap.end())
02621   {
02622     if (  (mGlobalTaskMapIterator->second->numberOfDaughters()==0)
02623        && (!(mGlobalTaskMapIterator->second->isAllocated()))
02624        )
02625       mGlobalTaskMapIterator->second->setPassive();
02626       mGlobalTaskMapIterator++;
02627   }
02628   
02629   return true;
02630 }
02631 
02637 bool mrprj::TaskField::printTaskFieldAsMrPrjXmlFile()const
02638 {
02639   krmuo::XmlConverter xmlConverter;
02640   // (1) write the headers
02641   printf("<?xml version=\"1.0\"?>\n");
02642   printf("<project xmlns=\"http://mrproject.codefactory.se/format/project/1\" "
02643           "name=\"%s\" company=\"%s\" manager=\"%s\" "
02644           "phase=\"%s\" project-start=\"%s\" mrproject-version=\"%s\" calendar=\"%s\">\n",
02645           mProjectName.c_str(), 
02646           mProjectCompany.c_str(),
02647           mProjectManager.c_str(),
02648           mProjectPhase.c_str(),
02649           mProjectStart.c_str(),
02650           mProjectMrpVersion.c_str(),
02651           mProjectCalendar.c_str()         
02652         );
02653   
02654   
02655   // (2) write the property-list    
02656   printf("  <properties>\n");
02657   list<Property*>::const_iterator
02658     mPropertyListIterator
02659       =mPropertyList.begin();
02660   
02661   while(mPropertyListIterator!=mPropertyList.end())
02662   {
02663     printf(
02664       "    <property name=\"%s\" type =\"%s\" owner=\"%s\" label=\"%s\" description=\"%s\"/>\n",
02665       ((*mPropertyListIterator)->getName()).c_str(),
02666       ((*mPropertyListIterator)->getType()).c_str(),
02667       ((*mPropertyListIterator)->getOwner()).c_str(),
02668       ((*mPropertyListIterator)->getLabel()).c_str(),
02669       ((*mPropertyListIterator)->getDescription()).c_str()
02670     );
02671     
02672     mPropertyListIterator++; 
02673   }
02674   printf("  </properties>\n");
02675   
02676   // (3) write the phase-list    
02677   printf("  <phases>\n");
02678   list<Phase*>::const_iterator
02679     mPhaseListIterator
02680       =mPhaseList.begin();
02681   
02682   while(mPhaseListIterator!=mPhaseList.end())
02683   {
02684     printf("    <phase name=\"%s\" />\n",((*mPhaseListIterator)->getName()).c_str());    
02685     mPhaseListIterator++; 
02686   }
02687   printf("  </phases>\n");
02688   
02689 
02690   // (4) write the phase-list    
02691   printf("  <calendars>\n");
02692   
02693   printf("    <day-types>\n");
02694   list<DayType*>::const_iterator
02695     mDayTypeListIterator
02696       =mDayTypeList.begin();
02697   
02698   while(mDayTypeListIterator!=mDayTypeList.end())
02699   {
02700     printf("      <day-type id=\"%s\" name=\"%s\" description=\"%s\"/>\n",
02701               ((*mDayTypeListIterator)->getId()).c_str(),
02702               ((*mDayTypeListIterator)->getName()).c_str(),
02703               ((*mDayTypeListIterator)->getDescription()).c_str()
02704     );    
02705     mDayTypeListIterator++; 
02706   }
02707   printf("    </day-types>\n");
02708   
02709   
02710   list<Calendar*>::const_iterator
02711     mCalendarListIterator
02712       =mCalendarList.begin();
02713   
02714   while(mCalendarListIterator!=mCalendarList.end())
02715   {
02716     printf("    <calendar id=\"%s\"  name=\"%s\" >\n",
02717       ((*mCalendarListIterator)->getId()).c_str(),
02718       ((*mCalendarListIterator)->getName()).c_str()
02719       );
02720     
02721     printf("      <default-week mon=\"%s\" tue=\"%s\" wed=\"%s\" thu=\"%s\" fri=\"%s\" sat=\"%s\" sun=\"%s\"/>\n",
02722         ((*mCalendarListIterator)->mMon).c_str(),
02723         ((*mCalendarListIterator)->mTue).c_str(),
02724         ((*mCalendarListIterator)->mWed).c_str(),
02725         ((*mCalendarListIterator)->mThu).c_str(),
02726         ((*mCalendarListIterator)->mFri).c_str(),
02727         ((*mCalendarListIterator)->mSat).c_str(),
02728         ((*mCalendarListIterator)->mSun).c_str() 
02729         );
02730     
02731     printf("      <overridden-day-types>\n");
02732     list<OverriddenDayType>::const_iterator
02733       mOverriddenDayTypeListIterator
02734         =((*mCalendarListIterator)->mOverriddenDayTypeList).begin();
02735     while(mOverriddenDayTypeListIterator!=((*mCalendarListIterator)->mOverriddenDayTypeList).end())
02736     {
02737       printf("        <overridden-day-type id=\"%s\">\n",(mOverriddenDayTypeListIterator->getId().c_str()));
02738       list<Interval>::const_iterator
02739       intervalListIterator
02740         =(mOverriddenDayTypeListIterator->mIntervalList).begin();
02741       while(intervalListIterator!=(mOverriddenDayTypeListIterator->mIntervalList).end())
02742       {
02743         printf("          <interval start=\"%s\" end=\"%s\" />\n",
02744           (intervalListIterator->getStart()).c_str(),
02745           (intervalListIterator->getEnd()).c_str() 
02746         );
02747         
02748         intervalListIterator++;
02749       }
02750       printf("        </overridden-day-type>\n");    
02751       mOverriddenDayTypeListIterator++; 
02752     } 
02753     printf("      </overridden-day-types>\n");
02754 
02755     printf("      <days>\n");
02756     list<Day>::const_iterator
02757       mDayListIterator
02758         =((*mCalendarListIterator)->mDayList).begin();
02759     while(mDayListIterator!=((*mCalendarListIterator)->mDayList).end())
02760     {
02761       printf("        <day date=\"%s\" type=\"%s\" id=\"%s\" />\n",
02762         (mDayListIterator->getDate()).c_str(),
02763         (mDayListIterator->getType()).c_str(),
02764         (mDayListIterator->getId()).c_str()
02765         
02766         );
02767       mDayListIterator++; 
02768     } 
02769     printf("      </days>\n");
02770     printf("    </calendar>\n");
02771     
02772     mCalendarListIterator++; 
02773   }
02774   printf("  </calendars>\n");
02775   
02776   
02777   // (2) write the task-list  
02778   mMainTask.printTaskAsMrPrjXmlFileMember(2);
02779     
02780   // (3) write the resource-group-list 
02781   if ((mDefaultResourceGroup=="")||(mDefaultResourceGroup=="-1"))
02782     printf("  <resource-groups>\n");
02783   else
02784     printf("  <resource-groups default_group=\"%s\" >\n",mDefaultResourceGroup.c_str());
02785     
02786   map<string,ResourceGroup*>::const_iterator
02787     resourceGroupMapIterator=
02788       mResourceGroupMap.begin();
02789   while(resourceGroupMapIterator!=mResourceGroupMap.end())
02790   {
02791     printf( "    <group id=\"%s\" name=\"%s\" "
02792            "admin-name=\"%s\" admin-phone=\"%s\" admin-email=\"%s\" />\n",
02793             xmlConverter.encode(resourceGroupMapIterator->second->getGroupId()).c_str(),
02794             xmlConverter.encode(resourceGroupMapIterator->second->getGroupTitle()).c_str(),
02795             xmlConverter.encode(resourceGroupMapIterator->second->getGroupAdminName()).c_str(),
02796             xmlConverter.encode(resourceGroupMapIterator->second->getGroupAdminPhone()).c_str(),
02797             xmlConverter.encode(resourceGroupMapIterator->second->getGroupAdminEmail()).c_str());
02798     resourceGroupMapIterator++;
02799   }
02800   printf("  </resource-groups>\n");
02801   
02802   // (4) write the resource-list    
02803   printf("  <resources>\n");
02804   map<string,Resource*>::const_iterator 
02805     resourceMapIterator=
02806       mResourceMap.begin();
02807   while(resourceMapIterator!=mResourceMap.end())
02808   {
02809      printf( "    <resource id=\"%s\" name=\"%s\" group=\"%s\" "
02810              "type=\"%d\" units=\"%ld\" email=\"%s\" "
02811              "std-rate=\"%f\" ovt-rate=\"%f\" />\n",
02812              xmlConverter.encode(resourceMapIterator->second->getResourceId()).c_str(),
02813              xmlConverter.encode(resourceMapIterator->second->getResourceTitle()).c_str(),
02814              xmlConverter.encode(resourceMapIterator->second->getResourceGroupId()).c_str(),
02815              resourceMapIterator->second->getResourceType(),
02816              resourceMapIterator->second->getResourceUnits(),
02817              resourceMapIterator->second->getRecourceEmail().c_str(),
02818              resourceMapIterator->second->getRecourceStdRate(),
02819              resourceMapIterator->second->getRecourceOvtRate());
02820     resourceMapIterator++;
02821   }
02822   
02823   printf("  </resources>\n");
02824   
02825   // (5) write the allocation-list    
02826   printf("  <allocations>\n");
02827   list<Allocation*>::const_iterator
02828     mAllocationListIterator
02829       =mAllocationList.begin();
02830   string taskId,resourceId;
02831   map<string,Task*>::const_iterator mGlobalTaskMapIterator;
02832   
02833   while(mAllocationListIterator!=mAllocationList.end())
02834   {
02835     taskId=(*mAllocationListIterator)->getTaskId();
02836     resourceId=(*mAllocationListIterator)->getResourceId();
02837     mGlobalTaskMapIterator=mGlobalTaskMap.find(taskId);
02838     if (mGlobalTaskMapIterator->second->isActive())
02839     {
02840       printf("    <allocation task-id=\"%s\" resource-id=\"%s\" />\n",taskId.c_str(),resourceId.c_str());
02841     }
02842     mAllocationListIterator++; 
02843   }
02844   printf("  </allocations>\n");
02845   printf("</project>\n");
02846 
02847   return true;
02848 }
02856 bool mrprj::TaskField::printTaskFieldAsLeafListMemo(bool pIso8601)
02857 {
02858   // (1) write the headers
02859   storeRealTimeSlot();
02860   printf("tasks between %s and %s\n\n",
02861           mRealTimeslotStart.c_str(),
02862           mRealTimeslotEnd.c_str()
02863         );
02864   
02865   // (2) write the task-list  
02866   mMainTask.printTaskAsLeafMemoListMember("","",mResourceMap,mAllocationList,pIso8601);
02867   
02868   return true;
02869 }
02877 bool mrprj::TaskField:: printTaskFieldAsTreeMemo(bool pIso8601)
02878 {
02879   // (1) write the headers
02880   storeRealTimeSlot();
02881   printf("tasks between %s and %s\n\n",
02882           mRealTimeslotStart.c_str(),
02883           mRealTimeslotEnd.c_str()
02884         );
02885   
02886   // (2) write the task-list  
02887   mMainTask.printTaskAsTreeMemoMember("",-1,mResourceMap,mAllocationList,pIso8601);
02888   
02889   return true;
02890 }
02891 
02895 void mrprj::TaskField::printTaskFieldAsLeafYankTodo()
02896 {
02897   printf("<?xml version=\"1.0\"?>\n");
02898   printf("<yank>\n");
02899   mMainTask.printTaskAsLeafYankTodoMember(mResourceMap,mAllocationList);
02900   printf("</yank>\n");
02901 
02902 }
02903 
02907 void mrprj::TaskField:: printTaskFieldAsTreeYankTodo()
02908 {
02909   printf("<?xml version=\"1.0\"?>\n");
02910   printf("<yank>\n");
02911   mMainTask.printTaskAsTreeYankTodoMember(mResourceMap,mAllocationList,2);
02912   printf("</yank>\n");
02913 
02914 }
02915 
02919 void mrprj::TaskField::printTaskFieldAsLeafCslTodo()
02920 {
02921    printf("\"Nr.\",\"Task\",\"Description\","
02922         "\"Actor\",\"Begin\",\"End\","
02923         "\"State\",\"Conditions\"\n");
02924   mMainTask.printTaskAsLeafCslTodoMember("",mResourceMap,mAllocationList);
02925 }
02926 
02930 void mrprj::TaskField:: printTaskFieldAsTreeCslTodo()
02931 {
02932   printf("\"Nr.\",\"Task\",\"Description\","
02933         "\"Actor\",\"Begin\",\"End\","
02934         "\"State\",\"Conditions\"\n");
02935   mMainTask.printTaskAsTreeCslTodoMember("",mResourceMap,mAllocationList);
02936 }
02937 
02938 
02944 void mrprj::TaskField::printTaskHtmlSurvey(const string& pSurveyReferenceDayString)
02945 {
02946    
02947    printf("<html>\n");
02948    printf("<head>\n");
02949    printf("<title>%s: fullfilled taskstructure with respect to %s</title>\n",
02950     mProjectName.c_str(),pSurveyReferenceDayString.c_str());
02951    printf("</title>\n");
02952    printf("<style type=\"text/css\">\n<!--\n");
02953    printf("body.default {\n"
02954           "  background-color: #ffffff;\n"     
02955           "  color: #000000;\n"
02956           "  font-size: 12pt;\n"
02957           "  font-style: normal;\n"
02958           "  font-weight: normal;\n"
02959           "  font-family: century schoolbook,Times,Serif;\n"
02960           "}\n");
02961           
02962    printf("td.fullFilledTask {\n"
02963           "  background-color: #00ff00;\n"
02964           "}\n");
02965    
02966    printf("td.tolateTask {\n"
02967           "  background-color: #ff0000;\n"
02968           "}\n");
02969 
02970    printf("td.openLaterTask {\n"
02971           "  background-color: #bbbbbb;\n"
02972           "}\n");
02973 
02974    printf("td.openNowTask {\n"
02975           "  background-color: #ffbb00;\n"
02976           "}\n");
02977     
02978    printf("#taskTitle {\n"
02979           "  font-family: Helvetica,Arial,Sans-Serif;\n"
02980           "  font-weight: bold;\n"
02981           "  font-size: 12pt;\n"
02982           "  font-style: normal;\n"
02983           "}\n");
02984     
02985    printf("#taskDescription {\n"
02986           "  font-family: Times,Serif;\n"
02987           "  font-weight: normal;\n"
02988           "  font-size: 12pt;\n"
02989           "  font-style: oblique;\n"
02990           "}\n");
02991 
02992    printf("#taskResource {\n"
02993           "  font-family: Helvetica,Arial,Sans-Serif;\n"
02994           "  font-weight: bold;\n"
02995           "  font-size: 12pt;\n"
02996           "  font-style: oblique;\n"
02997           "}\n");
02998 
02999    printf("#taskTimeslot {\n"
03000           "  font-family: Helvetica,Arial,Sans-Serif;\n"
03001           "  font-weight: normal;\n"
03002           "  font-size: 12pt;\n"
03003           "  color: blue;\n"
03004           "  font-style: normal;\n"
03005           "}\n");
03006 
03007    printf("#taskState {\n"
03008           "  font-family: Helvetica,Arial,Sans-Serif;\n"
03009           "  font-weight: bold;\n"
03010           "  font-size: 12pt;\n"
03011           "  color: black;\n"
03012           "  font-style: normal;\n"
03013           "}\n");
03014 
03015     
03016    printf("-->\n</style>\n");
03017    printf("</head>\n");
03018    printf("<body class=\"default\">\n");
03019    int maxPathLength=0;  
03020    mMainTask.insertXYposition(0,maxPathLength);
03021    printf("<table border=\"1\">\n");   
03022    mMainTask.printTaskAsHtmlSurveyMember
03023     (mResourceMap,mAllocationList,maxPathLength,pSurveyReferenceDayString);
03024    printf("</table>\n");
03025    printf("</body>\n");
03026    printf("</html>\n");
03027 };
03028 
03029 /* :-: (9.B.1) private getters :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
03030 string mrprj::TaskField::getConnectProjectName()const
03031 {
03032   string connectedProjectName=mProjectName;
03033   string::iterator connectedProjectNameInterator=connectedProjectName.begin();
03034   while(connectedProjectNameInterator != connectedProjectName.end())
03035   {
03036     if ( *connectedProjectNameInterator <= ' ')
03037       *connectedProjectNameInterator='-';
03038     connectedProjectNameInterator++;
03039   }
03040   return connectedProjectName;
03041 }
03042 /* :-: (9.B.4) private others :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
03043 
03053 bool mrprj::TaskField::fillResourceGroupMapByMrPrjXmlEntries
03054 (
03055   krmuo::LoggingUnit& pLoggingUnit,
03056   xmlDocPtr xmlDoc, 
03057   const xmlNodePtr pFirstResourceGroup
03058 )
03059 {
03060   if (!(pFirstResourceGroup))
03061     return false;
03062   
03063   string lResourceGroupId;
03064   string lResourceGroupName;
03065   string lResourceGroupAdminName;
03066   string lResourceGroupAdminPhone;
03067   string lResourceGroupAdminEmail;
03068   XmlNodeReader xmlNodeReader;
03069   
03070   xmlNodePtr xmlResourceGroupListRunner=pFirstResourceGroup;
03071   while(xmlResourceGroupListRunner)
03072   {
03073     if (strcmp((char *)xmlResourceGroupListRunner->name,"group")==0)
03074     {
03075       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceGroupListRunner,"id",lResourceGroupId));
03076       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceGroupListRunner,"name",lResourceGroupName)))
03077         lResourceGroupName="???";
03078       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceGroupListRunner,"admin-name",lResourceGroupAdminName)))
03079         lResourceGroupAdminName="???";
03080       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceGroupListRunner,"admin-phone",lResourceGroupAdminPhone)))
03081         lResourceGroupAdminPhone="???";
03082       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceGroupListRunner,"admin-email",lResourceGroupAdminEmail)))
03083         lResourceGroupAdminEmail="???";
03084         
03085       ResourceGroup* newResourceGroup
03086         =new ResourceGroup(pLoggingUnit,
03087                            lResourceGroupId,
03088                            lResourceGroupName,
03089                            "---",
03090                            lResourceGroupAdminName,
03091                            lResourceGroupAdminPhone,
03092                            lResourceGroupAdminEmail
03093                           );
03094       assert(newResourceGroup);
03095       mResourceGroupMap.insert(pair<string,ResourceGroup*>(lResourceGroupId,newResourceGroup));
03096     }
03097     xmlResourceGroupListRunner=xmlResourceGroupListRunner->next;
03098   }
03099   return true;
03100 }
03101 
03112 bool mrprj::TaskField::fillResourceMapByMrPrjXmlEntries
03113 ( 
03114   krmuo::LoggingUnit& pLoggingUnit,
03115   xmlDocPtr xmlDoc, 
03116   const xmlNodePtr pFirstResource 
03117 )
03118 {
03119   if (!(pFirstResource))
03120     return false;
03121   
03122   string resourceId,resourceGroupId;
03123   long resourceUnits;
03124   string resourceTitle,resourceEmail;
03125   int resourceType;
03126   float resourceStdRate,resourceOvtRate;
03127   XmlNodeReader xmlNodeReader;
03128   
03129   xmlNodePtr xmlResourceListRunner=pFirstResource;
03130   while(xmlResourceListRunner)
03131   {
03132     if (strcmp((char *)xmlResourceListRunner->name,"resource")==0)
03133     {
03134       assert(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceListRunner,"id",resourceId));
03135       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceListRunner,"group",resourceGroupId)))
03136         resourceGroupId=-1;
03137       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceListRunner,"name",resourceTitle)))
03138         resourceTitle="???";
03139       if (!(xmlNodeReader.getStringProperty(xmlDoc,xmlResourceListRunner,"email",resourceEmail)))
03140         resourceEmail="???";
03141       if (!(xmlNodeReader.getIntProperty(xmlDoc,xmlResourceListRunner,"type",resourceType)))
03142         resourceType=-1;
03143       if (!(xmlNodeReader.getLongProperty(xmlDoc,xmlResourceListRunner,"units",resourceUnits)))
03144         resourceUnits=100;
03145       if (!(xmlNodeReader.getFloatProperty(xmlDoc,xmlResourceListRunner,"std-rate",resourceStdRate)))
03146         resourceStdRate=0.0;
03147       if (!(xmlNodeReader.getFloatProperty(xmlDoc,xmlResourceListRunner,"ovt-rate",resourceOvtRate)))
03148         resourceOvtRate=0.0;
03149  
03150       Resource* newResource
03151         =new Resource(pLoggingUnit,
03152                       resourceId,
03153                       resourceGroupId,
03154                       resourceTitle,
03155                       "---",
03156                       resourceType,
03157                       resourceUnits,
03158                       resourceEmail,
03159                       resourceStdRate,
03160                       resourceOvtRate
03161                      );
03162  
03163       assert(newResource);
03164       mResourceMap.insert(pair<string,Resource*>(resourceId,newResource));
03165     }
03166     xmlResourceListRunner=xmlResourceListRunner->next;
03167   }  
03168   return true;
03169 }
03170 
03181 bool mrprj::TaskField::fillAllocationListByMrPrjXmlEntries
03182 ( 
03183   krmuo::LoggingUnit& pLoggingUnit,
03184   xmlDocPtr xmlDoc, 
03185   const xmlNodePtr pFirstAllocation
03186 )
03187 {
03188   XmlNodeReader xmlNodeReader;
03189   if (!(pFirstAllocation))
03190     return false;
03191   string taskId,resourceId;
03192 
03193   xmlNodePtr xmlAllocationListRunner=pFirstAllocation;
03194   while(xmlAllocationListRunner)
03195   {
03196     if (strcmp((char *)xmlAllocationListRunner->name,"allocation")==0)
03197     {
03198       if (  xmlNodeReader.getStringProperty(xmlDoc,xmlAllocationListRunner,"task-id",taskId)
03199          &&
03200             xmlNodeReader.getStringProperty(xmlDoc,xmlAllocationListRunner,"resource-id",resourceId)
03201           )
03202       {
03203         Allocation* newAllocation
03204           =new Allocation(pLoggingUnit,
03205                           taskId,
03206                           resourceId
03207                           );
03208         assert(newAllocation);
03209         mAllocationList.push_back(newAllocation);
03210         mGlobalTaskMap[taskId]->setAllocated();
03211       }
03212     }
03213     xmlAllocationListRunner=xmlAllocationListRunner->next;
03214   }
03215   return true;
03216 }
03217 
03228 bool mrprj::TaskField::fillPropertyListByMrPrjXmlEntries
03229 ( 
03230   krmuo::LoggingUnit& pLoggingUnit,
03231   xmlDocPtr xmlDoc, 
03232   const xmlNodePtr pFirstProperty
03233 )
03234 {
03235   XmlNodeReader xmlNodeReader;
03236   if (!(pFirstProperty))
03237     return false;
03238   string name,type,owner,label,description;
03239 
03240   xmlNodePtr xmlPropertyListRunner=pFirstProperty;
03241   while(xmlPropertyListRunner)
03242   {
03243     if (strcmp((char *)xmlPropertyListRunner->name,"property")==0)
03244     {
03245       if (  xmlNodeReader.getStringProperty(xmlDoc,xmlPropertyListRunner,"name",name)
03246           &&
03247             xmlNodeReader.getStringProperty(xmlDoc,xmlPropertyListRunner,"type",type)
03248           &&
03249             xmlNodeReader.getStringProperty(xmlDoc,xmlPropertyListRunner,"owner",owner)
03250           &&
03251             xmlNodeReader.getStringProperty(xmlDoc,xmlPropertyListRunner,"label",label)
03252           &&
03253             xmlNodeReader.getStringProperty(xmlDoc,xmlPropertyListRunner,"description",description)
03254             
03255           )
03256         
03257       {
03258         Property* newProperty
03259           =new Property(pLoggingUnit,name,type,owner,label,description);
03260         assert(newProperty);
03261         mPropertyList.push_back(newProperty);
03262       }
03263     }
03264     xmlPropertyListRunner=xmlPropertyListRunner->next;
03265   }
03266   return true;
03267 }
03268 
03279 bool mrprj::TaskField::fillPhaseListByMrPrjXmlEntries
03280 ( 
03281   krmuo::LoggingUnit& pLoggingUnit,
03282   xmlDocPtr xmlDoc, 
03283   const xmlNodePtr pFirstPhase
03284 )
03285 {
03286   XmlNodeReader xmlNodeReader;
03287   if (!(pFirstPhase))
03288     return false;
03289   string name;
03290 
03291   xmlNodePtr xmlPhaseListRunner=pFirstPhase;
03292   while(xmlPhaseListRunner)
03293   {
03294     if (strcmp((char *)xmlPhaseListRunner->name,"phase")==0)
03295     {
03296       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlPhaseListRunner,"name",name))
03297         
03298       {
03299         Phase* newPhase
03300           =new Phase(pLoggingUnit,name);
03301         assert(newPhase);
03302         mPhaseList.push_back(newPhase);
03303       }
03304     }
03305     xmlPhaseListRunner=xmlPhaseListRunner->next;
03306   }
03307   return true;
03308 }
03309 
03310 bool mrprj::TaskField::fillDayTypeListByMrPrjXmlEntries
03311 ( 
03312   krmuo::LoggingUnit& pLoggingUnit,
03313   xmlDocPtr xmlDoc, 
03314   const xmlNodePtr pFirstDayType
03315 )
03316 {
03317   XmlNodeReader xmlNodeReader;
03318   if (!(pFirstDayType))
03319     return false;
03320   string id;
03321   string name;
03322   string description;
03323 
03324   xmlNodePtr xmlDayTypeListRunner=pFirstDayType;
03325   while(xmlDayTypeListRunner)
03326   {
03327     if (strcmp((char *)xmlDayTypeListRunner->name,"day-type")==0)
03328     {
03329       if (( ( xmlNodeReader.getStringProperty(xmlDoc,xmlDayTypeListRunner,"name",name))
03330           && ( xmlNodeReader.getStringProperty(xmlDoc,xmlDayTypeListRunner,"id",id))
03331           )
03332           &&
03333           ( xmlNodeReader.getStringProperty(xmlDoc,xmlDayTypeListRunner,"description",description))
03334         )
03335         
03336       {
03337         DayType* newDayType
03338           =new DayType(pLoggingUnit,id,name,description);
03339         assert(newDayType);
03340         mDayTypeList.push_back(newDayType);
03341       }
03342     }
03343     xmlDayTypeListRunner=xmlDayTypeListRunner->next;
03344   }
03345   return true;
03346 }
03347 
03348 bool mrprj::TaskField::fillIntervalListByMrPrjXmlEntries
03349 ( 
03350   krmuo::LoggingUnit& pLoggingUnit,
03351   xmlDocPtr xmlDoc, 
03352   const xmlNodePtr pFirstInterval,
03353   list<Interval>& pIntervalList
03354 )
03355 {
03356   XmlNodeReader xmlNodeReader;
03357   if (!(pFirstInterval))
03358     return false;
03359 
03360   string startTime,endTime;
03361   
03362   xmlNodePtr xmlIntervalListRunner=pFirstInterval;
03363   while(xmlIntervalListRunner)
03364   {
03365     if (strcmp((char *)xmlIntervalListRunner->name,"interval")==0)
03366     {
03367       if (  ( xmlNodeReader.getStringProperty(xmlDoc,xmlIntervalListRunner,"start",startTime))
03368          && ( xmlNodeReader.getStringProperty(xmlDoc,xmlIntervalListRunner,"end",endTime))
03369          )
03370       {               
03371         Interval newInterval(pLoggingUnit,startTime,endTime);
03372         pIntervalList.push_back(newInterval);
03373       }
03374     }
03375     xmlIntervalListRunner=xmlIntervalListRunner->next;
03376   }
03377   return true;
03378 }
03379 
03380 
03381 bool mrprj::TaskField::fillOverriddenDayTypeListByMrPrjXmlEntries
03382 ( 
03383   krmuo::LoggingUnit& pLoggingUnit,
03384   xmlDocPtr xmlDoc, 
03385   const xmlNodePtr pFirstOverriddenDayType,
03386   list<OverriddenDayType>& pOverriddenDayTypeList
03387 )
03388 {
03389   XmlNodeReader xmlNodeReader;
03390   if (!(pFirstOverriddenDayType))
03391     return false;
03392 
03393   string id;
03394   
03395   xmlNodePtr xmlOverriddenDayTypeListRunner=pFirstOverriddenDayType;
03396   while(xmlOverriddenDayTypeListRunner)
03397   {
03398     if (strcmp((char *)xmlOverriddenDayTypeListRunner->name,"overridden-day-type")==0)
03399     {
03400       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlOverriddenDayTypeListRunner,"id",id))
03401       {               
03402         OverriddenDayType newOverriddenDayType(pLoggingUnit,id);
03403         fillIntervalListByMrPrjXmlEntries
03404         (pLoggingUnit,xmlDoc,xmlOverriddenDayTypeListRunner->xmlChildrenNode,newOverriddenDayType.mIntervalList);
03405         pOverriddenDayTypeList.push_back(newOverriddenDayType);
03406       }
03407       
03408     }
03409     xmlOverriddenDayTypeListRunner=xmlOverriddenDayTypeListRunner->next;
03410   }
03411   return true;
03412 }
03413 
03414 bool mrprj::TaskField::fillDayListByMrPrjXmlEntries
03415 ( 
03416   krmuo::LoggingUnit& pLoggingUnit,
03417   xmlDocPtr xmlDoc, 
03418   const xmlNodePtr pFirstDay,
03419   list<Day>& pDayList
03420 )
03421 {
03422   XmlNodeReader xmlNodeReader;
03423   if (!(pFirstDay))
03424     return false;
03425   string date;
03426   string type;
03427   string id;
03428   
03429   xmlNodePtr xmlDayListRunner=pFirstDay;
03430   while(xmlDayListRunner)
03431   {
03432     if (strcmp((char *)xmlDayListRunner->name,"day")==0)
03433     {
03434       if (  ( ( xmlNodeReader.getStringProperty(xmlDoc,xmlDayListRunner,"date",date))
03435             && ( xmlNodeReader.getStringProperty(xmlDoc,xmlDayListRunner,"type",type))
03436             )
03437           && xmlNodeReader.getStringProperty(xmlDoc,xmlDayListRunner,"id",id)
03438         )
03439        {
03440                
03441         Day newDay(pLoggingUnit,date,type,id);
03442         pDayList.push_back(newDay);
03443       }
03444     }
03445     xmlDayListRunner=xmlDayListRunner->next;
03446   }
03447   return true;
03448 }
03449 
03450 bool mrprj::TaskField::fillCalSubPartByMrPrjXmlEntries
03451 ( 
03452   krmuo::LoggingUnit& pLoggingUnit,
03453   xmlDocPtr xmlDoc, 
03454   const xmlNodePtr pFirstCalSubPart,
03455   Calendar* pCalendar
03456 )
03457 {
03458   XmlNodeReader xmlNodeReader;
03459   if (!(pFirstCalSubPart))
03460     return false;
03461   string dayx;
03462 
03463   xmlNodePtr xmlCalSubPartListRunner=pFirstCalSubPart;
03464   while(xmlCalSubPartListRunner)
03465   {
03466     if (strcmp((char *)xmlCalSubPartListRunner->name,"overridden-day-types")==0)
03467     {
03468       fillOverriddenDayTypeListByMrPrjXmlEntries
03469       ( pLoggingUnit,xmlDoc,xmlCalSubPartListRunner->xmlChildrenNode,pCalendar->mOverriddenDayTypeList);
03470       
03471     }
03472     
03473     if (strcmp((char *)xmlCalSubPartListRunner->name,"days")==0)
03474        fillDayListByMrPrjXmlEntries(pLoggingUnit,xmlDoc,xmlCalSubPartListRunner->xmlChildrenNode,pCalendar->mDayList);
03475     
03476     
03477     if (strcmp((char *)xmlCalSubPartListRunner->name,"default-week")==0)
03478     {
03479     
03480       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalSubPartListRunner,"mon",dayx))
03481         pCalendar->mMon=dayx;
03482       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalSubPartListRunner,"tue",dayx))
03483         pCalendar->mTue=dayx;
03484       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalSubPartListRunner,"wed",dayx))
03485         pCalendar->mWed=dayx;
03486       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalSubPartListRunner,"thu",dayx))
03487         pCalendar->mThu=dayx;
03488       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalSubPartListRunner,"fri",dayx))
03489         pCalendar->mFri=dayx;
03490       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalSubPartListRunner,"sat",dayx))
03491         pCalendar->mSat=dayx;
03492       if ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalSubPartListRunner,"sun",dayx))
03493         pCalendar->mSun=dayx;
03494 
03495     }
03496     
03497     
03498     
03499     xmlCalSubPartListRunner=xmlCalSubPartListRunner->next;
03500   }
03501   return true;
03502 }
03503 
03504 bool mrprj::TaskField::fillCalendarListByMrPrjXmlEntries
03505 ( 
03506   krmuo::LoggingUnit& pLoggingUnit,
03507   xmlDocPtr xmlDoc, 
03508   const xmlNodePtr pFirstCalendar
03509 )
03510 {
03511   XmlNodeReader xmlNodeReader;
03512   if (!(pFirstCalendar))
03513     return false;
03514   string id;
03515   string name;
03516   string description;
03517 
03518   xmlNodePtr xmlCalendarListRunner=pFirstCalendar;
03519   while(xmlCalendarListRunner)
03520   {
03521     if (strcmp((char *)xmlCalendarListRunner->name,"day-types")==0)
03522     {
03523       fillDayTypeListByMrPrjXmlEntries
03524         (pLoggingUnit,xmlDoc,xmlCalendarListRunner->xmlChildrenNode);
03525       
03526     }
03527     if (strcmp((char *)xmlCalendarListRunner->name,"calendar")==0)
03528     {
03529       if (  ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalendarListRunner,"name",name))
03530           && ( xmlNodeReader.getStringProperty(xmlDoc,xmlCalendarListRunner,"id",id))
03531           )
03532       {
03533         Calendar* newCalendar
03534           =new Calendar(pLoggingUnit,id,name);
03535         assert(newCalendar);
03536         mCalendarList.push_back(newCalendar);
03537         fillCalSubPartByMrPrjXmlEntries(pLoggingUnit,xmlDoc,xmlCalendarListRunner->xmlChildrenNode,newCalendar);
03538         
03539       }
03540       
03541     }
03542     
03543     xmlCalendarListRunner=xmlCalendarListRunner->next;
03544   }
03545   return true;
03546 }
03547 
03548 
03552 void mrprj::TaskField::storeRealTimeSlot()
03553 {
03554   mRealTimeslotStart="99991231T240000";
03555   mRealTimeslotEnd="00000101T000000";
03556   
03557   map<string,Task*>::const_iterator 
03558     mGlobalTaskMapIterator
03559       =mGlobalTaskMap.begin();
03560   while(mGlobalTaskMapIterator!=mGlobalTaskMap.end())
03561   {
03562     if ( mGlobalTaskMapIterator->second->getStartDate() < mRealTimeslotStart)
03563       mRealTimeslotStart=mGlobalTaskMapIterator->second->getStartDate();
03564       
03565     if ( mGlobalTaskMapIterator->second->getEndDate() > mRealTimeslotEnd)
03566       mRealTimeslotEnd=mGlobalTaskMapIterator->second->getEndDate();
03567       
03568     mGlobalTaskMapIterator++;
03569   }
03570 }

Generated on Sun Mar 16 10:58:36 2003 for MRPROJEXT by doxygen1.2.17