Ejemplo n.º 1
0
 private void verifyStudySiteExists() throws ResourceException {
   if (study == null) {
     throw new ResourceException(
         Status.CLIENT_ERROR_NOT_FOUND,
         "No study matching " + STUDY_IDENTIFIER.extractFrom(getRequest()));
   } else if (site == null) {
     throw new ResourceException(
         Status.CLIENT_ERROR_NOT_FOUND,
         "No site matching " + SITE_IDENTIFIER.extractFrom(getRequest()));
   } else if (studySite == null) {
     throw new ResourceException(
         Status.CLIENT_ERROR_NOT_FOUND,
         "Site "
             + SITE_IDENTIFIER.extractFrom(getRequest())
             + " is not participating in "
             + STUDY_IDENTIFIER.extractFrom(getRequest()));
   }
 }
Ejemplo n.º 2
0
  @Override
  public void doInit() {
    super.doInit();

    study = studyDao.getByAssignedIdentifier(STUDY_IDENTIFIER.extractFrom(getRequest()));
    log.debug("Resolved study from {} as {}", STUDY_IDENTIFIER.extractFrom(getRequest()), study);
    site = siteDao.getByAssignedIdentifier(SITE_IDENTIFIER.extractFrom(getRequest()));
    log.debug("Resolved site from {} as {}", SITE_IDENTIFIER.extractFrom(getRequest()), site);

    if (study != null && site != null) {
      studySite = study.getStudySite(site);
    }
    setExisting(studySite != null);
    log.debug("Site {} participating in study", isExisting() ? "is" : "is not");

    getVariants().add(new Variant(MediaType.TEXT_XML));
    getAllowedMethods().add(Method.GET);
    getAllowedMethods().add(Method.POST);
  }