/** Type level (history of all resources of a given type) */ @History(type=Patient.class) Bundle getHistoryPatientType();
private static Class<? extends IBaseResource> toReturnType(Method theMethod, Object theProvider) { History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (type != IBaseResource.class && type != IResource.class) { return type; } return null; }
@History public List<T> historyType() { return myTypeHistory; }
private static Class<? extends IBaseResource> toReturnType(Method theMethod, Object theProvider) { if (theProvider instanceof IResourceProvider) { return ((IResourceProvider) theProvider).getResourceType(); } History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (type != IBaseResource.class && type != IResource.class) { return type; } return null; }
/** Server level (history of ALL resources) */ @History Bundle getHistoryServer();
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (Modifier.isInterface(type.getModifiers())) { myResourceOperationType = RestOperationTypeEnum.HISTORY_SYSTEM; } else { if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } if (type != IBaseResource.class && type != IResource.class) { myResourceName = theContext.getResourceDefinition(type).getName(); } else { myResourceName = null; } }
/** Instance level (history of a specific resource instance by type and ID) */ @History(type=Patient.class) Bundle getHistoryPatientInstance(@IdParam IdType theId);
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (Modifier.isInterface(type.getModifiers())) { if (theProvider instanceof IResourceProvider) { type = ((IResourceProvider) theProvider).getResourceType(); if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_SYSTEM; } } else { if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } if (type != IBaseResource.class && type != IResource.class) { myResourceName = theContext.getResourceDefinition(type).getName(); } else { myResourceName = null; } }
/** * Either (or both) of the "since" and "count" paramaters can * also be included in any of the methods above. */ @History Bundle getHistoryServerWithCriteria(@Since Date theDate, @Count Integer theCount);
returnTypeFromAnnotation = search.type(); } else if (history != null) { returnTypeFromAnnotation = history.type(); } else if (delete != null) { returnTypeFromAnnotation = delete.type();
@History public List<T> historyInstance(@IdParam IIdType theId) { LinkedList<T> retVal = myIdToHistory.get(theId.getIdPart()); if (retVal == null) { throw new ResourceNotFoundException(theId); } return retVal; }
returnTypeFromAnnotation = search.type(); } else if (history != null) { returnTypeFromAnnotation = history.type(); } else if (delete != null) { returnTypeFromAnnotation = delete.type();
@History() public List<Patient> getPatientHistory( @IdParam IdType theId, @Since InstantType theSince, @At DateRangeParam theAt ) { List<Patient> retVal = new ArrayList<Patient>(); Patient patient = new Patient(); patient.addName().setFamily("Smith"); // Set the ID and version patient.setId(theId.withVersion("1")); // ...populate the rest... return retVal; } //END SNIPPET: history
private static Class<? extends IBaseResource> toReturnType(Method theMethod, Object theProvider) { History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (type != IBaseResource.class && type != IResource.class) { return type; } return null; }
@History public IBundleProvider historyServer(HttpServletRequest theRequest, @Since Date theDate, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam range = super.processSinceOrAt(theDate, theAt); return myDao.history(range.getLowerBoundAsInstant(), range.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
private static Class<? extends IBaseResource> toReturnType(Method theMethod, Object theProvider) { if (theProvider instanceof IResourceProvider) { return ((IResourceProvider) theProvider).getResourceType(); } History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (type != IBaseResource.class && type != IResource.class) { return type; } return null; }
@History public IBundleProvider getHistoryForResourceType( HttpServletRequest theRequest, @Since Date theSince, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt); return myDao.history(sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (Modifier.isInterface(type.getModifiers())) { myResourceOperationType = RestOperationTypeEnum.HISTORY_SYSTEM; } else { if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } if (type != IBaseResource.class && type != IResource.class) { myResourceName = theContext.getResourceDefinition(type).getName(); } else { myResourceName = null; } }
@History public List<T> historyType() { return myTypeHistory; }
public HistoryMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) { super(toReturnType(theMethod, theProvider), theMethod, theContext, theProvider); myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod, getContext()); History historyAnnotation = theMethod.getAnnotation(History.class); Class<? extends IBaseResource> type = historyAnnotation.type(); if (Modifier.isInterface(type.getModifiers())) { if (theProvider instanceof IResourceProvider) { type = ((IResourceProvider) theProvider).getResourceType(); if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_SYSTEM; } } else { if (myIdParamIndex != null) { myResourceOperationType = RestOperationTypeEnum.HISTORY_INSTANCE; } else { myResourceOperationType = RestOperationTypeEnum.HISTORY_TYPE; } } if (type != IBaseResource.class && type != IResource.class) { myResourceName = theContext.getResourceDefinition(type).getName(); } else { myResourceName = null; } }