List of usage examples for org.springframework.beans BeanUtils copyProperties
public static void copyProperties(Object source, Object target) throws BeansException
From source file:org.okj.im.SimpleWebQQClient.java
/** * @see org.okj.im.WebQQClient#loadFriendLevel(java.lang.String) *//*from w w w . jav a2 s. co m*/ @Override public Member loadFriendLevel(String account) { ActionContext context = new ActionContext(BizCode.QQ_LOAD_FRIEND_LEVEL); Member sample = new Member(); sample.getAccount().setAccount(account); context.addAttribute(ActionContextKeys.MEMBER_KEY, sample); boolean success = executeActions(context); if (success) { Member friend = (Member) context.getAttribute(ActionContextKeys.FRIEND_KEY); //ActionContext,?bean? Member nFriend = new Member(); BeanUtils.copyProperties(friend, nFriend); return nFriend; } return null; }
From source file:org.openehealth.ipf.commons.ihe.xds.core.metadata.PatientInfo.java
/** * @param name/* w ww . j a va2 s .c om*/ * the name (PID-5). */ public void setName(Name name) { if (name != null) { this.name = new XpnName(); BeanUtils.copyProperties(name, this.name); } else { this.name = null; } }
From source file:org.openehealth.ipf.commons.ihe.xds.core.metadata.Person.java
/** * @param name/*www. jav a 2 s .c o m*/ * the name of the person (XCN.2.1, XCN.3, XCN.4, XCN.5, XCN.6, XCN.7). */ public void setName(Name name) { if (name != null) { BeanUtils.copyProperties(name, new XcnName(getHapiObject())); } else { XCN xcn = getHapiObject(); xcn.getXcn2_FamilyName().clear(); xcn.getXcn3_GivenName().clear(); xcn.getXcn4_SecondAndFurtherGivenNamesOrInitialsThereof().clear(); xcn.getXcn5_SuffixEgJRorIII().clear(); xcn.getXcn6_PrefixEgDR().clear(); xcn.getXcn7_DegreeEgMD().clear(); } }
From source file:org.oscarehr.PMmodule.caisi_integrator.CaisiIntegratorUpdateTask.java
private void pushFacility(Date lastDataUpdated) throws MalformedURLException { Facility facility = LoggedInInfo.loggedInInfo.get().currentFacility; if (facility.getLastUpdated().after(lastDataUpdated)) { logger.debug("pushing facility record"); CachedFacility cachedFacility = new CachedFacility(); BeanUtils.copyProperties(facility, cachedFacility); FacilityWs service = CaisiIntegratorManager.getFacilityWs(); service.setMyFacility(cachedFacility); } else {/*from ww w . j a v a 2 s . c om*/ logger.debug("skipping facility record, not updated since last push"); } }
From source file:org.oscarehr.PMmodule.caisi_integrator.CaisiIntegratorUpdateTask.java
private void pushPrograms(Date lastDataUpdated, Facility facility) throws MalformedURLException, ShutdownException { // all are always sent so program deletions have be proliferated. List<Program> programs = programDao.getProgramsByFacilityId(facility.getId()); ArrayList<CachedProgram> cachedPrograms = new ArrayList<CachedProgram>(); for (Program program : programs) { logger.debug("pushing program : " + program.getId() + ':' + program.getName()); MiscUtils.checkShutdownSignaled(); CachedProgram cachedProgram = new CachedProgram(); BeanUtils.copyProperties(program, cachedProgram); FacilityIdIntegerCompositePk pk = new FacilityIdIntegerCompositePk(); pk.setCaisiItemId(program.getId()); cachedProgram.setFacilityIdIntegerCompositePk(pk); try {// w w w.j av a2 s . c o m cachedProgram.setGender(Gender.valueOf(program.getManOrWoman().toUpperCase())); } catch (Exception e) { // do nothing, we can't assume anything is right or wrong with genders // until the whole mess is sorted out, for now it's a what you get is // what you get } if (program.isTransgender()) cachedProgram.setGender(Gender.T); cachedProgram.setMaxAge(program.getAgeMax()); cachedProgram.setMinAge(program.getAgeMin()); cachedProgram.setStatus(program.getProgramStatus()); cachedPrograms.add(cachedProgram); } ProgramWs service = CaisiIntegratorManager.getProgramWs(facility); service.setCachedPrograms(cachedPrograms); }
From source file:org.oscarehr.PMmodule.caisi_integrator.CaisiIntegratorUpdateTask.java
private void pushProviders(Date lastDataUpdated, Facility facility) throws MalformedURLException, ShutdownException { List<String> providerIds = ProviderDao.getProviderIds(facility.getId()); ProviderWs service = CaisiIntegratorManager.getProviderWs(facility); for (String providerId : providerIds) { logger.debug("Adding provider " + providerId + " for " + facility.getName()); // copy provider basic data over Provider provider = providerDao.getProvider(providerId); if (provider == null) continue; ProviderTransfer providerTransfer = new ProviderTransfer(); CachedProvider cachedProvider = new CachedProvider(); BeanUtils.copyProperties(provider, cachedProvider); FacilityIdStringCompositePk pk = new FacilityIdStringCompositePk(); pk.setCaisiItemId(provider.getProviderNo()); cachedProvider.setFacilityIdStringCompositePk(pk); providerTransfer.setCachedProvider(cachedProvider); // copy roles over List<SecUserRole> roles = secUserRoleDao.getUserRoles(providerId); for (SecUserRole role : roles) { Role integratorRole = IntegratorRoleUtils.getIntegratorRole(role.getRoleName()); if (integratorRole != null) providerTransfer.getRoles().add(integratorRole); }/*ww w . ja v a 2s . c om*/ ArrayList<ProviderTransfer> providerTransfers = new ArrayList<ProviderTransfer>(); providerTransfers.add(providerTransfer); service.setCachedProviders(providerTransfers); throttleAndChecks(); } }
From source file:org.oscarehr.PMmodule.caisi_integrator.CaisiIntegratorUpdateTask.java
private void pushDemographicIssues(Date lastDataUpdated, Facility facility, List<Program> programsInFacility, DemographicWs service, Integer demographicId) throws ShutdownException { logger.debug(// w ww . j a v a2 s . c om "pushing demographicIssues facilityId:" + facility.getId() + ", demographicId:" + demographicId); List<CaseManagementIssue> caseManagementIssues = caseManagementIssueDAO .getIssuesByDemographic(demographicId.toString()); StringBuilder sentIds = new StringBuilder(); if (caseManagementIssues.size() == 0) return; for (CaseManagementIssue caseManagementIssue : caseManagementIssues) { // don't send issue if it is not in our facility. logger.debug("Facility:" + facility.getName() + " - caseManagementIssue = " + caseManagementIssue.toString()); if (caseManagementIssue.getProgram_id() == null || !isProgramIdInProgramList(programsInFacility, caseManagementIssue.getProgram_id())) continue; long issueId = caseManagementIssue.getIssue_id(); Issue issue = issueDao.getIssue(issueId); CachedDemographicIssue cachedDemographicIssue = new CachedDemographicIssue(); FacilityIdDemographicIssueCompositePk facilityDemographicIssuePrimaryKey = new FacilityIdDemographicIssueCompositePk(); facilityDemographicIssuePrimaryKey .setCaisiDemographicId(Integer.parseInt(caseManagementIssue.getDemographic_no())); facilityDemographicIssuePrimaryKey.setCodeType(CodeType.ICD_10); // temporary hard code hack till we sort this out facilityDemographicIssuePrimaryKey.setIssueCode(issue.getCode()); cachedDemographicIssue.setFacilityDemographicIssuePk(facilityDemographicIssuePrimaryKey); BeanUtils.copyProperties(caseManagementIssue, cachedDemographicIssue); cachedDemographicIssue.setIssueDescription(issue.getDescription()); cachedDemographicIssue.setIssueRole(IntegratorRoleUtils.getIntegratorRole(issue.getRole())); ArrayList<CachedDemographicIssue> issues = new ArrayList<CachedDemographicIssue>(); issues.add(cachedDemographicIssue); service.setCachedDemographicIssues(issues); throttleAndChecks(); sentIds.append("," + caseManagementIssue.getId()); } conformanceTestLog(facility, "CaseManagementIssue", sentIds.toString()); }
From source file:org.oscarehr.ws.rest.ProductDispensingService.java
@GET @Path("/drugProduct/{drugProductId}") @Produces("application/json") public DrugProductResponse getDrugProduct(@PathParam("drugProductId") Integer drugProductId) { DrugProduct result = drugProductManager.getDrugProduct(getLoggedInInfo(), drugProductId); DrugProductResponse response = new DrugProductResponse(); DrugProductTo1 to = new DrugProductTo1(); BeanUtils.copyProperties(result, to); response.getContent().add(to);/*w w w . j a va 2s . co m*/ return response; }
From source file:org.oscarehr.ws.rest.ProductDispensingService.java
@GET @Path("/drugProducts") @Produces("application/json") public DrugProductResponse getAllDrugProducts(@QueryParam("offset") Integer offset, @QueryParam("limit") Integer limit, @QueryParam("limitByName") String limitByName, @QueryParam("limitByLot") String limitByLot, @QueryParam("limitByLocation") String limitByLocation, @QueryParam("availableOnly") boolean availableOnly) { List<DrugProduct> results = null; int count = drugProductManager.getAllDrugProductsByNameAndLotCount(getLoggedInInfo(), limitByName, limitByLot,//from ww w . j a v a 2 s.c o m (limitByLocation != null && limitByLocation.length() > 0) ? Integer.valueOf(limitByLocation) : null, availableOnly); results = drugProductManager.getAllDrugProductsByNameAndLot(getLoggedInInfo(), offset, limit, limitByName, limitByLot, (limitByLocation != null && limitByLocation.length() > 0) ? Integer.valueOf(limitByLocation) : null, availableOnly); DrugProductResponse response = new DrugProductResponse(); for (DrugProduct result : results) { DrugProductTo1 to = new DrugProductTo1(); BeanUtils.copyProperties(result, to); response.getContent().add(to); } response.setTotal(count); return response; }
From source file:org.oscarehr.ws.rest.ProductDispensingService.java
@GET @Path("/drugProducts/byCode") @Produces("application/json") public DrugProductResponse getAllDrugProductsGroupedByCode(@QueryParam("offset") Integer offset, @QueryParam("limit") Integer limit) { List<DrugProduct> results = drugProductManager.getAllDrugProductsGroupedByCode(getLoggedInInfo(), offset, limit);/* w w w. ja va 2 s .co m*/ DrugProductResponse response = new DrugProductResponse(); for (DrugProduct result : results) { DrugProductTo1 to = new DrugProductTo1(); BeanUtils.copyProperties(result, to); response.getContent().add(to); } return response; }