Robert MacGregor avatar Robert MacGregor committed e0a6cf7

Removed Client, Firm and Person. Using ResponsibleParty only.

Comments (0)

Files changed (18)

application.properties

 #utf-8
-#Mon Sep 21 07:56:32 EDT 2009
+#Tue Sep 22 19:24:15 EDT 2009
 app.version=0.1
 app.servlet.version=2.4
 app.grails.version=1.1

grails-app/controllers/ImportController.groovy

 import grails.converters.XML
 import java.io.FileInputStream
+
+
 class ImportController {
 
     def importFirmService
 			def importFile = "/Users/rob/Dropbox/Projects/basecamp/db/xml/rapportinc-20090721001012.xml"
       //def importFile = "/Users/rob/Dropbox/Projects/basecamp/db/xml/koyanainc-20090716141017.xml"
 
-       //importXMLService.importFromFile("/Users/rmacgreg/Dropbox/Projects/basecamp/db/xml/koyanainc-20090716141017.xml")
+       //def importFile = "/Users/rmacgreg/Dropbox/Projects/basecamp/db/xml/koyanainc-20090716141017.xml"
        //importXMLService.importFromFile("/Users/rmacgreg/Dropbox/Projects/basecamp/db/xml/rapportinc-20090721001012.xml")
 
 

grails-app/domain/com/koyanainc/bc/Account.groovy

 
 class Account {
 
-    Person accountHolder
+    ResponsibleParty accountHolder
     Date createdOn = new Date()
     String name = "Sherpa Account"
 
     Date updatedAt = new Date()
 
     static hasMany = [defaultAttachmentCategories:Category, defaultPostCategories:Category,
-                        clients:Client, projects:Project]
+                        clients:ResponsibleParty, projects:Project]
 
-    Firm firm
+    ResponsibleParty firm
     
     String toString()
     {

grails-app/domain/com/koyanainc/bc/Client.groovy

-package com.koyanainc.bc
-
-class Client extends ResponsibleParty {
-
-	//Initializer
-	{
-		rpType = "com.koyanainc.bc.Client"
-	}
-
-    String name
-    String addressOne = ""
-    String addressTwo = ""
-
-    String city = ""
-    String state = ""
-    String zip = ""
-
-    String country = ""
-    String webAddress = ""
-    String phoneNumberOffice = ""
-
-    String phoneNumberFax = ""
-    String timeZoneId = ""
-
-    Boolean canSeePrivate = false
-
-    String uuid = ""
-
-    //clientOf
-    //static belongsTo = [account:Account]
-
-    static hasMany = [people:Person]
-
-    static constraints = {
-        name(nullable:false)
-    }
-
-
-    static mapping = {
-        id generator: 'assigned'
-
-    }
-}

grails-app/domain/com/koyanainc/bc/Comment.groovy

 class Comment {
 
     Integer attachementCount = 0
-    Person author
+    ResponsibleParty author
     String body = "No comment!"
 
     Date createdAt
     String commentableType
     
     static constraints = {
-        author(nullable:false)
+        author(nullable:true)
         commentableType()
     }
 

grails-app/domain/com/koyanainc/bc/Firm.groovy

-package com.koyanainc.bc
-
-class Firm extends ResponsibleParty {
-
-	//Initializer
-	{
-		rpType = "com.koyanainc.bc.Firm"
-	}
-
-    String name
-    String addressOne = ""
-    String addressTwo = ""
-
-    String city = ""
-    String state = ""
-    String zip = ""
-
-    String country = ""
-    String webAddress = ""
-    String phoneNumberOffice = ""
-
-    String phoneNumberFax = ""
-    String timeZoneId = ""
-    Boolean canSeePrivate = false
-
-    String uuid = ""
-
-    String urlName = ""
-
-    static hasMany = [people:Person]
-
-    //static belongsTo = [account:Account]
-
-    String toString(){
-        name
-    }
-
-    static mapping = {
-        id generator: 'assigned'
-
-    }
-
-}

grails-app/domain/com/koyanainc/bc/Milestone.groovy

   Date deadline
   Date createdOn
 
-  Person completer
-  Person creator
+  ResponsibleParty completer
+  ResponsibleParty creator
   ResponsibleParty responsibleParty
-
+	
   //Project project
 
   Boolean wantsNotification = false

grails-app/domain/com/koyanainc/bc/Person.groovy

-package com.koyanainc.bc
-
-class Person extends ResponsibleParty{
-
-	//Initializer
-	{
-		rpType = "com.koyanainc.bc.Person";
-	}
-
-    String firstName = ""
-    String lastName = ""
-    String title = ""
-
-    String emailAddress = ""
-    String imHandle = ""
-    String imService = ""
-
-    String phoneNumberOffice = ""
-    String phoneNumberOfficeExt = ""
-
-    String phoneNumberMobile = ""
-    String phoneNumberHome = ""
-    String phoneNumberFax = ""
-
-    Date lastLogin = new Date()
-    String identityUrl = ""
-
-    //String clientBcNum
-    String userName = ""     //If user is an admin
-
-    //If user is self
-    String password = ""
-    String token = ""
-
-    //If user is an admin
-    Boolean administrator = false
-    Boolean deleted = false
-    Boolean hasAccessToNewProjects = false
-    
-    //static belongsTo = [client:Client]
-
-    String uuid = ""
-
-    static mapping = {
-        id generator: 'assigned'
-
-    }
-
-    static constraints = {
-    firstName(nullable:true)
-    lastName(nullable:true)
-    title(nullable:true)
-
-    emailAddress(nullable:true)
-    imHandle(nullable:true)
-    imService(nullable:true)
-
-    phoneNumberOffice(nullable:true)
-    phoneNumberOfficeExt(nullable:true)
-
-    phoneNumberMobile(nullable:true)
-    phoneNumberHome(nullable:true)
-    phoneNumberFax(nullable:true)
-
-    userName(blank:true)     //If user is an admin
-
-    //If user is self
-    password(blank:true)
-
-    //If user is an admin
-    hasAccessToNewProjects(nullable:true)
-
-    }
-
-
-
-    String toString()
-    {
-        firstName
-    }
-    
-}

grails-app/domain/com/koyanainc/bc/Post.groovy

 class Post {
 
     Integer attachmentCount = 0
-    Person author
+    ResponsibleParty author
     String body = ""
 
     //Category category

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

     String startPage = "www.default-start-page.com"
     Boolean showWriteboards = false
 
-    static hasMany = [participants:Person, todoLists:TodoList, posts: Post]
+    static hasMany = [participants:ResponsibleParty, todoLists:TodoList, posts: Post]
 
 
     static constraints = {

grails-app/domain/com/koyanainc/bc/ResponsibleParty.groovy

 
 class ResponsibleParty {
 
-   String rpType
+   String type  //One of: Firm, Client or Person
+   
+   //From Firm and Client
+   String name
+   String addressOne = ""
+   String addressTwo = ""
+
+   String city = ""
+   String state = ""
+   String zip = ""
+
+   String country = ""
+   String webAddress = ""
+   String phoneNumberOffice = ""
+
+   String phoneNumberFax = ""
+   String timeZoneId = ""
+   Boolean canSeePrivate = false
+
+   String uuid = ""
+
+   //Applies for Firm only
+   String urlName = ""
+
+   static hasMany = [people:ResponsibleParty]
+   
+   //From Person
+   String firstName = ""
+   String lastName = ""
+   String title = ""
+
+   String emailAddress = ""
+   String imHandle = ""
+   String imService = ""
+
+   //String phoneNumberOffice = ""
+   String phoneNumberOfficeExt = ""
+
+   String phoneNumberMobile = ""
+   String phoneNumberHome = ""
+   //String phoneNumberFax = ""
+
+   Date lastLogin = new Date()
+   String identityUrl = ""
+
+   //String clientBcNum
+   String userName = ""     //If user is an admin
+
+   //If user is self
+   String password = ""
+   String token = ""
+
+   //If user is an admin
+   Boolean administrator = false
+   Boolean deleted = false
+   Boolean hasAccessToNewProjects = false
+   
+   static belongsTo = [client:ResponsibleParty]
+   
+   static constraints = {
+   
+   name(nullable:true)
+   firstName(nullable:true)
+   lastName(nullable:true)
+   title(nullable:true)
+
+   emailAddress(nullable:true)
+   imHandle(nullable:true)
+   imService(nullable:true)
+
+   phoneNumberOffice(nullable:true)
+   phoneNumberOfficeExt(nullable:true)
+
+   phoneNumberMobile(nullable:true)
+   phoneNumberHome(nullable:true)
+   phoneNumberFax(nullable:true)
+
+   userName(blank:true)     //If user is an admin
+
+   //If user is self
+   password(blank:true)
+
+   //If user is an admin
+   hasAccessToNewProjects(nullable:true)
+
+   }
 
     static mapping = {
         id generator: 'assigned'
         //tablePerHierarchy false
     }
 
+
 }

grails-app/domain/com/koyanainc/bc/TimeEntry.groovy

    String description
    Float hours
    
-   Person person
+   ResponsibleParty person
    Project project
    TodoItem todoItem
    

grails-app/domain/com/koyanainc/bc/TodoItem.groovy

     Date completedOn
 
     //Integer creator
-    Person creator
-    Person completer
+    ResponsibleParty creator
+    ResponsibleParty completer
     ResponsibleParty responsibleParty
 
     Boolean completed = false

grails-app/services/ImportClientService.groovy

-import com.koyanainc.bc.Client
-import com.koyanainc.bc.Person
+import com.koyanainc.bc.ResponsibleParty
+
 
 
 class ImportClientService {
       def clientMap = XMLUtil.xmlToGorm(client.children())
       clientMap.remove('people')    //We have to remove the 'people' key and it's associated data - not digestible by GORM
 
-      clientMap['responsiblePartyType'] = 'Company'
-      def c  = new Client(clientMap)
-      if(!c.validate()) println "Cannot create Client using map $clientMap"
+      clientMap.type = 'Client'
+      def c  = new ResponsibleParty(clientMap)
+      if(!c.validate())
+			{
+				println "Cannot create Client using map $clientMap"
+				c.errors.allErrors.each{e-> println "Client creation errors: $e"}
+			}
       c.id = clientMap.id
       c.save()
       //println "client errors ${c.errors}"
 
       client.people.person.each{person->
         def personMap = XMLUtil.xmlToGorm(person.children())
-
-        def p = new Person(personMap)
+        
+        personMap.type = "Person"
+        def p = new ResponsibleParty(personMap)
         p.id = personMap.id
         p.save()
         c.addToPeople(p)

grails-app/services/ImportFirmService.groovy

-import com.koyanainc.bc.Firm
-import com.koyanainc.bc.Person
+import com.koyanainc.bc.ResponsibleParty
+
 
 class ImportFirmService {
 
 
     def leafMap = XMLUtil.xmlToGorm(firmLeafs)
 
-    def f = new Firm(leafMap)
+    leafMap.type = "Firm"
+    def f = new ResponsibleParty(leafMap)
     f.id = leafMap.id
     f.save()
 
     peopleList.each{
       def pm = XMLUtil.xmlToGorm(it.children())
 
-      def p = new Person(pm)
+      pm.type = "Person"
+      def p = new ResponsibleParty(pm)
       p.id = pm.id
       p.save()
       f.addToPeople(p)

grails-app/services/ImportProjectService.groovy

 
       //Insert project participants into project
       project.participants.person.each{personId->
-        def rp = ResponsibleParty.findById(personId.text())
-        p.addToParticipants(rp)
+        def per = ResponsibleParty.findById(personId.text())
+        p.addToParticipants(per)
       }
 
       //Insert project posts and comments into db

grails-app/services/ImportTimeEntryService.groovy

           def timeEntryMap = XMLUtil.xmlToGorm(timeEntryXml.children())
       
           //Person
-          def pe = Person.findById(timeEntryMap['personId'])
+          def pe = ResponsibleParty.findById(timeEntryMap['personId'])
           if( null == pe )
           {
             log.warn "\n\tFailed to locate person with id ${timeEntryMap['personId']}"

grails-app/utils/XMLUtil.groovy

 					println "\n\n** Null author for ${commentMap}"
 					println "\nGenerating Person with id:${commentMap.authorId}"
 					String name  = ""+ commentMap.authorId.toString()
-					commentAuth = new com.koyanainc.bc.Person(firstName:name)
+					commentAuth = new com.koyanainc.bc.ResponsibleParty(firstName:name)
 					commentAuth.id = commentMap.authorId.toInteger()
 					commentAuth.save()
 				}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.