public boolean hasAccessToPatient(AccessToken token, String patientId) throws FhirServerException { String projectId = token.getI2b2Project(); ProjectPatientMap p = getProjectPatientMap( token.getResourceUserId(), token.getI2b2Token(), token.getI2b2Url(), token.getI2b2Domain(), token.getI2b2Project()); // logger.info("is patientId:"+patientId+" present in list"+ p.getPatientIdList()); // if(p.getPatientIdList().length()<2) { // logger.warn("list seems empty for the project"); // return false;} List<String> list = Arrays.asList(p.getPatientIdList().replaceAll("[\\[\\]\\s]", "").split(",")); logger.trace("list>:" + list); return (list.contains(patientId)) ? true : false; }
public Bundle getProjectPatientBundle(AccessToken token) throws FhirServerException { ProjectPatientMap p = getProjectPatientMap( token.getResourceUserId(), token.getI2b2Token(), token.getI2b2Url(), token.getI2b2Domain(), token.getI2b2Project()); String bundleXml = p.getPatientBundle(); Bundle b = null; try { b = JAXBUtil.fromXml(bundleXml, Bundle.class); } catch (JAXBException e) { logger.error(e.getMessage(), e); } return b; }