Commits

Robert MacGregor  committed 1b6e8bd

Added import of Project Participants. Added import of Project.Company.

  • Participants
  • Parent commits 0a8ea43

Comments (0)

Files changed (3)

File grails-app/domain/com/koyanainc/bc/Project.groovy

     String status = "active"
     Date lastChangedOn = new Date()
 
-    //Client company
+    ResponsibleParty company
 
     String announcement = ""
     Boolean showAnnouncement = false

File grails-app/services/ImportClientService.groovy

 
         def p = new Person(personMap)
         p.id = personMap.id
-log.info "Saving person under id ${p.id} using personMap id ${personMap.id}"
         p.save(flush:true)
         c.addToPeople(p)
       }

File grails-app/services/ImportProjectService.groovy

         projectMap.remove(it)
       }
 
+      def crp = ResponsibleParty.findById(project.company.id.text())
+      if(null == crp ) log.warn "\n\n\t Company id:${project.company.id.text()} cannot be found in db"
+      projectMap.company = crp
+
       def p  = new Project(projectMap)
       p.id = projectMap.id
       p.save(flush:true)
 
         def rp = ResponsibleParty.findById(milestoneMap.responsiblePartyId)
         def cr = ResponsibleParty.findById(milestoneMap.creatorId)
-        log.info "\n\n\t Rp is $rp, completer is $co, creator is $cr"
+
         milestoneMap['responsibleParty'] = rp
         milestoneMap['creator'] = cr
         milestoneMap['project'] = p
 
-        log.warn "\n\n\t Milestone is ${milestoneMap}"
+        //Insert company info
+        def cId = milestone.company.id
 
         def m = new Milestone(milestoneMap)
         m.id = milestoneMap.id
         m.save()
 
-        log.warn "Milestone creation errors ${m.errors}"
+      }
+
+      //Insert project participants into project
+      project.participants.person.each{personId->
+        def rp = ResponsibleParty.findById(personId.text())
+        p.addToParticipants(rp)
       }
 
     }