- Timestamp:
- Jun 25, 2010, 11:55:00 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/groovy/dbnp/rest/CommunicationManager.groovy
r609 r615 147 147 148 148 149 150 151 /** 152 * Convenience method for constructing URLs for SAM that need parameters 153 * 154 * @params String resource The name of the resource, e.g. importer/pages 155 * @params Map params A Map of parmater names and values., e.g. ['externalAssayID':12] 156 * @return String url 157 */ 158 private URL getSAMURL( resource, params ) { 159 def url = ServerURL + '/' + resource 160 def first = true 161 params.each { name, value -> 162 if(first) { 163 first = false // this needs to be protected, otherwise might break url 164 url += '/nil?' + name + "='" + value.toString() + "'" 165 } 166 else { 167 url += '&' + name + "='" + value.toString() + "'" 168 } 169 } 170 return new URL( url ) 171 } 172 173 149 174 /** 150 175 * Get the URL for importing an assay from SAM. 151 176 * This is not a REST method! It only creates a rest resource and returns it's url. 152 177 * 153 * @params assay 178 * @params Study 179 * @params Assay 154 180 * @return URL 155 181 */ 156 public Object getAssayImportURL( assay ) { 157 return new URL( ServerURL + '/importer/pages/assay?externalAssayID=' + assay.externalAssayID ) 182 public URL getAssayImportURL( study, assay ) { 183 def params = ['externalAssayID':assay.externalAssayID, 'externalStudyID':study.code ] 184 return getSAMURL( 'importer/pages', params ) 158 185 } 159 186 … … 163 190 * This is not a REST method! It only creates a rest resource and returns it's url. 164 191 * 165 * @params assay192 * @params Assay 166 193 * @return URL 167 194 */ 168 public Object getAssayShowURL( assay ) { 169 return new URL( ServerURL + '/simpleAssay/show/assay?externalAssayID=' + assay.externalAssayID ) 195 public URL getAssayShowURL( assay ) { 196 def params = ['externalAssayID':assay.externalAssayID ] 197 return getSAMURL( 'simpleAssay/show', params ) 170 198 } 171 199 … … 175 203 * This is not a REST method! It only creates a rest resource and returns it's url. 176 204 * 177 * @params assay205 * @params Assay 178 206 * @return URL 179 207 */ 180 public Object getAssayEditURL( assay ) { 181 return new URL( ServerURL + '/simpleAssay/edit/assay?externalAssayID=' + assay.externalAssayID ) 208 public URL getAssayEditURL( assay ) { 209 def params = ['externalAssayID':assay.externalAssayID ] 210 return getSAMURL( 'simpleAssay/edit', params ) 182 211 } 183 212 … … 187 216 * This is not a REST method! It only creates a rest resource and returns it's url. 188 217 * 189 * @params URL 190 * @return list of ClinicalFloatData 191 */ 192 public Object getMeasurementTypesURL() { 193 return new URL( ServerURL + '/simpleAssayMeasurementType/list/nil?externalAssayID=' + assay.externalAssayID ) 218 * @params study 219 * @return list of ClinicalFloatData 220 */ 221 public URL getMeasurementTypesURL( study ) { 222 def params = ['externalStudyID':study.code] 223 return getSAMURL( 'simpleAssayMeasurementType/list', params ) 194 224 } 195 225
Note: See TracChangeset
for help on using the changeset viewer.