- Timestamp:
- Feb 16, 2011, 2:24:56 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/nl/tno/metagenomics/integration/GscfService.groovy
r13 r14 24 24 */ 25 25 public String urlAuthRemote( def params, def token ) { 26 def redirectURL = "${config.gscf.baseURL}/login/auth_remote?moduleURL=${this.moduleURL()}&consumer=${this.consumerID()}&token=${token}&returnUrl=${config.grails.serverURL}" 27 26 def redirectURL = "${config.gscf.baseURL}/login/auth_remote?moduleURL=${this.moduleURL()}&consumer=${this.consumerID()}&token=${token}&" 27 28 def returnUrl = config.grails.serverURL 28 29 if (params.controller != null){ 29 re directURL+= "/${params.controller}"30 returnUrl += "/${params.controller}" 30 31 if (params.action != null){ 31 re directURL+= "/${params.action}"32 returnUrl += "/${params.action}" 32 33 if (params.id != null){ 33 re directURL+= "/${params.id}"34 returnUrl += "/${params.id}" 34 35 } 35 36 } 36 37 } 37 38 38 return redirectURL 39 // Append other parameters 40 returnUrl += "?" + params.collect { 41 if( it.key != "controller" && it.key != "action" && it.key != "id" ) 42 return it.key.toString().encodeAsURL() + "=" + it.value.toString().encodeAsURL(); 43 else 44 return "" 45 }.findAll { it }.join( "&" ); 46 47 return redirectURL + "returnUrl=" + returnUrl.encodeAsURL(); 39 48 } 40 49 … … 65 74 * @return Map 66 75 */ 67 public Map getUser(String sessionToken) {76 public Map getUser(String sessionToken) throws Exception { 68 77 def user = [:] 69 this.callGSCF(sessionToken, "getUser").each { 70 user[ it.key ] = it.value; 71 } 72 return user 78 try { 79 this.callGSCF(sessionToken, "getUser").each { 80 user[ it.key ] = it.value; 81 } 82 return user 83 } catch( Exception e ) { 84 throw new Exception( "Retrieving user details from GSCF failed", e ); 85 } 73 86 } 74 87 … … 80 93 * @return ArrayList 81 94 */ 82 public ArrayList getStudies(String sessionToken) {95 public ArrayList getStudies(String sessionToken) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 83 96 return this.callGSCF(sessionToken, "getStudies") 84 97 } … … 92 105 * @return ArrayList 93 106 */ 94 public ArrayList getStudies(String sessionToken, ArrayList studyTokens ) {107 public ArrayList getStudies(String sessionToken, ArrayList studyTokens ) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 95 108 return this.callGSCF(sessionToken, "getStudies", [ "studyToken": studyTokens ] ); 96 109 } … … 104 117 * @return ArrayList 105 118 */ 106 public def getStudy(String sessionToken, String studyToken) throws NotAuthorizedException, ResourceNotFoundException{119 public def getStudy(String sessionToken, String studyToken) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 107 120 def list 108 121 … … 131 144 * @return ArrayList 132 145 */ 133 public ArrayList getAssays(String sessionToken, String studyToken) throws NotAuthorizedException, ResourceNotFoundException{146 public ArrayList getAssays(String sessionToken, String studyToken) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 134 147 try { 135 148 return this.callGSCF(sessionToken, "getAssays", ["studyToken": studyToken]) … … 150 163 * @return ArrayList 151 164 */ 152 public def getAssay(String sessionToken, String studyToken, String assayToken ) throws NotAuthorizedException, ResourceNotFoundException{165 public def getAssay(String sessionToken, String studyToken, String assayToken )throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 153 166 def list 154 167 try { … … 178 191 * @return ArrayList 179 192 */ 180 public def getSample(String sessionToken, String assayToken, String sampleToken) throws NotAuthorizedException, ResourceNotFoundException{193 public def getSample(String sessionToken, String assayToken, String sampleToken) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 181 194 def list 182 195 … … 205 218 * @return ArrayList 206 219 */ 207 public ArrayList getSamples(String sessionToken, String assayToken) throws NotAuthorizedException, ResourceNotFoundException{220 public ArrayList getSamples(String sessionToken, String assayToken) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 208 221 // Samples of a Study limited to a single Assay 209 222 try { … … 225 238 * @return ArrayList 226 239 */ 227 public def getSamples(String sessionToken, List sampleTokens) throws NotAuthorizedException, ResourceNotFoundException{240 public def getSamples(String sessionToken, List sampleTokens) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 228 241 def list 229 242 … … 249 262 * @return ArrayList 250 263 */ 251 public HashMap getAuthorizationLevel(String sessionToken, String studyToken) throws ResourceNotFoundException{264 public HashMap getAuthorizationLevel(String sessionToken, String studyToken) throws BadRequestException, NotAuthenticatedException, NotAuthorizedException, ResourceNotFoundException, Exception { 252 265 ArrayList list 253 266
Note: See TracChangeset
for help on using the changeset viewer.