<commit_before>package com.cabolabs.ehrserver.api

import grails.converters.*
import java.text.SimpleDateFormat
import com.cabolabs.ehrserver.openehr.demographic.Person
import com.cabolabs.ehrserver.query.Query
import com.cabolabs.ehrserver.query.DataGet
import com.cabolabs.ehrserver.query.DataCriteria
import com.cabolabs.ehrserver.ehr.clinical_documents.CompositionIndex
import com.cabolabs.ehrserver.ehr.clinical_documents.data.DataValueIndex
import com.cabolabs.ehrserver.openehr.common.generic.DoctorProxy
import com.cabolabs.ehrserver.openehr.common.generic.AuditDetails
import com.cabolabs.ehrserver.openehr.common.generic.PatientProxy
import com.cabolabs.ehrserver.openehr.common.change_control.Contribution
import com.cabolabs.ehrserver.openehr.common.change_control.VersionedComposition
import com.cabolabs.ehrserver.openehr.common.change_control.Version
import com.cabolabs.ehrserver.openehr.ehr.Ehr
import com.cabolabs.security.Organization

import grails.util.Holders
import groovy.util.slurpersupport.GPathResult
import java.lang.reflect.UndeclaredThrowableException
import javax.xml.bind.ValidationException

import net.kaleidos.grails.plugin.security.stateless.annotation.SecuredStateless
import org.springframework.security.core.Authentication
import org.springframework.security.core.AuthenticationException
import org.springframework.security.core.userdetails.UsernameNotFoundException
import org.springframework.security.authentication.LockedException
import org.springframework.security.authentication.DisabledException
import org.springframework.security.authentication.AccountExpiredException
import org.springframework.security.authentication.BadCredentialsException
import org.springframework.security.authentication.AuthenticationProvider
import com.cabolabs.security.UserPassOrgAuthToken
import com.cabolabs.security.User
import grails.plugin.springsecurity.authentication.encoding.BCryptPasswordEncoder // passwordEncoder
import com.cabolabs.ehrserver.openehr.composition.CompositionService
import com.cabolabs.util.DateParser

import grails.transaction.Transactional

/**
 * @author <NAME> <<EMAIL>>
 */
class RestController {

   static allowedMethods = [commit: "POST", createPerson: "POST", contributions: "GET"]
   
   def messageSource
   
   def xmlService // Utilizado por commit
   def jsonService // Query composition with format = json
   def compositionService

   // Para acceder a las opciones de localizacion 
   def config = Holders.config.app
   
   
   // TODO: un index con la lista de servicios y parametros de cada uno (para testing)
   
   def formatter = new SimpleDateFormat( config.l10n.datetime_format )
   def formatterDate = new SimpleDateFormat( config.l10n.date_format )
   
   
   // test stateless security
   def statelessTokenProvider
   def userService
   def passwordEncoder = Holders.grailsApplication.mainContext.getBean('passwordEncoder')<commit_msg>fix for #359<commit_after>package com.cabolabs.ehrserver.api

import grails.converters.*
import java.text.SimpleDateFormat
import com.cabolabs.ehrserver.openehr.demographic.Person
import com.cabolabs.ehrserver.query.Query
import com.cabolabs.ehrserver.query.DataGet
import com.cabolabs.ehrserver.query.DataCriteria
import com.cabolabs.ehrserver.ehr.clinical_documents.CompositionIndex
import com.cabolabs.ehrserver.ehr.clinical_documents.data.DataValueIndex
import com.cabolabs.ehrserver.openehr.common.generic.DoctorProxy
import com.cabolabs.ehrserver.openehr.common.generic.AuditDetails
import com.cabolabs.ehrserver.openehr.common.generic.PatientProxy
import com.cabolabs.ehrserver.openehr.common.change_control.Contribution
import com.cabolabs.ehrserver.openehr.common.change_control.VersionedComposition
import com.cabolabs.ehrserver.openehr.common.change_control.Version
import com.cabolabs.ehrserver.openehr.ehr.Ehr
import com.cabolabs.security.Organization

import grails.util.Holders
import groovy.util.slurpersupport.GPathResult
import java.lang.reflect.UndeclaredThrowableException
import javax.xml.bind.ValidationException

import net.kaleidos.grails.plugin.security.stateless.annotation.SecuredStateless
import org.springframework.security.core.Authentication
import org.springframework.security.core.AuthenticationException
import org.springframework.security.core.userdetails.UsernameNotFoundException
import org.springframework.security.authentication.LockedException
import org.springframework.security.authentication.DisabledException
import org.springframework.security.authentication.AccountExpiredException
import org.springframework.security.authentication.BadCredentialsException
import org.springframework.security.authentication.AuthenticationProvider
import com.cabolabs.security.UserPassOrgAuthToken
import com.cabolabs.security.User
import grails.plugin.springsecurity.authentication.encoding.BCryptPasswordEncoder // passwordEncoder
import com.cabolabs.ehrserver.openehr.composition.CompositionService
import com.cabolabs.util.DateParser

import grails.transaction.Transactional

/**
 * @author <NAME> <<EMAIL>>
 */
class RestController {

   static allowedMethods = [login: "POST", commit: "POST", createPerson: "POST", contributions: "GET"]
   
   def messageSource
   
   def xmlService // Utilizado por commit
   def jsonService // Query composition with format = json
   def compositionService

   // Para acceder a las opciones de localizacion 
   def config = Holders.config.app
   
   
   // TODO: un index con la lista de servicios y parametros de cada uno (para testing)
   
   def formatter = new SimpleDateFormat( config.l10n.datetime_format )
   def formatterDate = new SimpleDateFormat( config.l10n.date_format )
   
   
   // test stateless security
   def statelessTokenProvider
   def userService
   def passwordEncoder = Holders.grailsApplication.mainContext.getBean('passwordEncoder')
{'fraction_non_alphanumeric': 0.07606837606837606, 'fraction_numerical': 0.0018803418803418803, 'mean_word_length': 5.957193816884661, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '830792', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1658, 'n_words': 297}