@Search public List<Organization> getAllOrganizations() { List<Organization> retVal=new ArrayList<Organization>(); // populate this return retVal; } //END SNIPPET: searchAll
public SearchMethodBinding(Class<? extends IBaseResource> theReturnResourceType, Class<? extends IBaseResource> theResourceProviderResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theReturnResourceType, theMethod, theContext, theProvider); Search search = theMethod.getAnnotation(Search.class); this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null); this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null); this.myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); this.myAllowUnknownParams = search.allowUnknownParams(); Description desc = theMethod.getAnnotation(Description.class); if (desc != null) { if (isNotBlank(desc.formalDefinition())) { myDescription = StringUtils.defaultIfBlank(desc.formalDefinition(), null); } else { myDescription = StringUtils.defaultIfBlank(desc.shortDefinition(), null); } } /* * Only compartment searching methods may have an ID parameter */ if (isBlank(myCompartmentName) && myIdParamIndex != null) { String msg = theContext.getLocalizer().getMessage(getClass().getName() + ".idWithoutCompartment", theMethod.getName(), theMethod.getDeclaringClass()); throw new ConfigurationException(msg); } if (theResourceProviderResourceType != null) { this.myResourceProviderResourceName = theContext.getResourceDefinition(theResourceProviderResourceType).getName(); } else { this.myResourceProviderResourceName = null; } }
public SearchMethodBinding(Class<? extends IBaseResource> theReturnResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theReturnResourceType, theMethod, theContext, theProvider); Search search = theMethod.getAnnotation(Search.class); this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null); this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null); this.myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
/** * Get the key for the baseMethodBinding. This is: * <ul> * <li>the compartName for SearchMethodBindings * <li>the methodName for OperationMethodBindings * <li> {@link #DEFAULT_METHOD_KEY} for all other MethodBindings * </ul> * @param theBinding the methodbinding * @return the key for the methodbinding. */ private String getBindingKey(final BaseMethodBinding<?> theBinding) { if (theBinding instanceof OperationMethodBinding) { return ((OperationMethodBinding) theBinding).getName(); } else if (theBinding instanceof SearchMethodBinding) { Search search = theBinding.getMethod().getAnnotation(Search.class); return search.compartmentName(); } else { return DEFAULT_METHOD_KEY; } }
returnTypeFromAnnotation = read.type(); } else if (search != null) { returnTypeFromAnnotation = search.type(); } else if (history != null) { returnTypeFromAnnotation = history.type();
public SearchMethodBinding(Class<? extends IBaseResource> theReturnResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theReturnResourceType, theMethod, theContext, theProvider); Search search = theMethod.getAnnotation(Search.class); this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null); this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null); this.myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext());
returnTypeFromAnnotation = read.type(); } else if (search != null) { returnTypeFromAnnotation = search.type(); } else if (history != null) { returnTypeFromAnnotation = history.type();
@Search(compartmentName="Condition") public List<IBaseResource> searchCompartment(@IdParam IdType thePatientId) { List<IBaseResource> retVal=new ArrayList<IBaseResource>(); // populate this with resources of any type that are a part of the // "Condition" compartment for the Patient with ID "thePatientId" return retVal; }
public SearchMethodBinding(Class<? extends IBaseResource> theReturnResourceType, Class<? extends IBaseResource> theResourceProviderResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theReturnResourceType, theMethod, theContext, theProvider); Search search = theMethod.getAnnotation(Search.class); this.myQueryName = StringUtils.defaultIfBlank(search.queryName(), null); this.myCompartmentName = StringUtils.defaultIfBlank(search.compartmentName(), null); this.myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); this.myAllowUnknownParams = search.allowUnknownParams(); Description desc = theMethod.getAnnotation(Description.class); if (desc != null) { if (isNotBlank(desc.formalDefinition())) { myDescription = StringUtils.defaultIfBlank(desc.formalDefinition(), null); } else { myDescription = StringUtils.defaultIfBlank(desc.shortDefinition(), null); } } /* * Only compartment searching methods may have an ID parameter */ if (isBlank(myCompartmentName) && myIdParamIndex != null) { String msg = theContext.getLocalizer().getMessage(getClass().getName() + ".idWithoutCompartment", theMethod.getName(), theMethod.getDeclaringClass()); throw new ConfigurationException(msg); } if (theResourceProviderResourceType != null) { this.myResourceProviderResourceName = theContext.getResourceDefinition(theResourceProviderResourceType).getName(); } else { this.myResourceProviderResourceName = null; } }
returnTypeFromAnnotation = read.type(); } else if (search != null) { returnTypeFromAnnotation = search.type(); } else if (history != null) { returnTypeFromAnnotation = history.type();
@Search(queryName="namedQuery1") public List<Patient> searchByNamedQuery(@RequiredParam(name="someparam") StringParam theSomeParam) { List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: searchNamedQuery
returnTypeFromAnnotation = read.type(); } else if (search != null) { returnTypeFromAnnotation = search.type(); } else if (history != null) { returnTypeFromAnnotation = history.type();
@Search public List<Patient> search( SummaryEnum theSummary, // will receive the summary (no annotation required) @Elements Set<String> theElements // (requires the @Elements annotation) ) { return null; // todo: populate } //END SNIPPET: summaryAndElements
@Search public List<IBaseResource> searchAll() { List<IBaseResource> retVal = new ArrayList<>(); for (TreeMap<Long, T> next : myIdToVersionToResourceMap.values()) { if (next.isEmpty() == false) { T nextResource = next.lastEntry().getValue(); retVal.add(nextResource); } } mySearchCount.incrementAndGet(); return retVal; }
@Search public List<Patient> findPatients( @RequiredParam(name="foo") StringParam theParameter, HttpServletRequest theRequest, HttpServletResponse theResponse) { List<Patient> retVal=new ArrayList<Patient>(); // populate this return retVal; } //END SNIPPET: underlyingReq
@Search() public List<Practitioner> findPractitionersByName( @RequiredParam(name = Practitioner.SP_NAME) final StringDt theName) { // throw new UnprocessableEntityException( // "Please provide more than 4 characters for the name"); return Lists.newArrayList(); }
/** * This is translated into a URL similar to the following: * http://fhir.healthintersections.com.au/open/Patient?identifier=urn:oid:1.2.36.146.595.217.0.1%7C12345 */ @Search List<Patient> findPatientsForMrn(@RequiredParam(name = Patient.SP_IDENTIFIER) IdentifierDt theIdentifier);
/** A FHIR search */ @Search public List<Patient> findPatientsByIdentifier(@RequiredParam(name="identifier") IdentifierDt theIdentifier);
@Search List<Patient> getPatientByDob(@RequiredParam(name=Patient.SP_BIRTHDATE) DateParam theParam);
/** * The "@Search" annotation indicates that this method supports the * search operation. You may have many different method annotated with * this annotation, to support many different search criteria. This * example searches by family name. * * @param theIdentifier * This operation takes one parameter which is the search criteria. It is * annotated with the "@Required" annotation. This annotation takes one argument, * a string containing the name of the search criteria. The datatype here * is StringDt, but there are other possible parameter types depending on the * specific search criteria. * @return * This method returns a list of Patients. This list may contain multiple * matching resources, or it may also be empty. */ @Search() public List<Patient> getPatient(@RequiredParam(name = Patient.SP_FAMILY) StringDt theFamilyName);