Texa / grails-app / services / ImportTimeEntryService.groovy

import com.koyanainc.bc.*

class ImportTimeEntryService {

  boolean transactional = true

  def importXML(projects) {


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

          def pr = Project.findById(timeEntryMap['projectId'])
          if( null == pr )
            log.warn "\n\tFailed to locate project with id ${timeEntryMap['projectId']}"
          timeEntryMap['project'] = pr
          def tdi = 'Undefined TimeEntry'
          if( null == timeEntryMap['todoItemId'] )
            tdi = null
            tdi = TodoItem.findById(timeEntryMap['todoItemId'])
            if( null == tdi )
              log.warn "\n\tFailed to locate TodoItem with id ${timeEntryMap['todoItemId']}"
          timeEntryMap['todoItem'] = tdi
          def te = new TimeEntry(timeEntryMap)
          if( ! )
            log.warn "\n\tFailed to create TimeEntry using map: ${timeEntryMap}.\nGot errors: ${te.errors}"
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
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.