use of com.iggroup.oss.sample.domain.SampleReference in project RESTdoclet by IG-Group.
the class SampleController method getSampleByReference.
/**
* Find sample by unique lookup reference
*
* @param reference the sample reference, a 5 digit text field
* @return the sample object corresponding to the lookup reference
*/
@RequestMapping(value = "/samples/{reference}", method = { RequestMethod.GET })
@ResponseBody
public Sample getSampleByReference(/*
* @Valid @Pattern(regexp=
* "[0-9][0-9][0-9][0-9][0-9]")
*/
@PathVariable String reference) {
LOGGER.info("getSampleByReference " + reference);
// since @Valid doesn't work properly until Spring 3.1
// Note: could use SampleReference as a RequestParam but then the
// interface is a little clunky
validate(new SampleReference(reference));
return service.getSampleByReference(reference);
}
use of com.iggroup.oss.sample.domain.SampleReference in project RESTdoclet by IG-Group.
the class AbstractSampleServiceTest method getAvailableRef.
/**
* Find an available reference by adding 1 to the largest existing reference
* number
*
* @return unique reference
*/
private String getAvailableRef() {
Long availRef = new Long(0);
List<Sample> samples = service.findAllSamples();
for (Sample s : samples) {
Long ref = Long.valueOf(s.getReference());
if (ref >= availRef) {
availRef = ref + 1;
}
}
return new SampleReference(availRef).toString();
}
use of com.iggroup.oss.sample.domain.SampleReference in project RESTdoclet by IG-Group.
the class SampleController method deleteSample.
/**
* Delete the sample indicated by the reference
*
* @param reference the sample's reference, a 5 digit text field
*/
@RequestMapping(value = "/samples/{reference}", method = { RequestMethod.DELETE })
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void deleteSample(@PathVariable String reference) {
LOGGER.info("deleteSample " + reference);
validate(new SampleReference(reference));
service.deleteSample(reference);
}
Aggregations