/** * Unmarshals the given map source into a bean. * @param source the source * @return the organization */ public static OrganizationBean unmarshallOrganization(Map<String, Object> source) { if (source == null) { return null; } OrganizationBean bean = new OrganizationBean(); bean.setId(asString(source.get("id"))); bean.setName(asString(source.get("name"))); bean.setDescription(asString(source.get("description"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setModifiedOn(asDate(source.get("modifiedOn"))); bean.setModifiedBy(asString(source.get("modifiedBy"))); postMarshall(bean); return bean; }
/** * Unmarshals the given map source into a bean. * @param source the source * @return the organization */ public static OrganizationBean unmarshallOrganization(Map<String, Object> source) { if (source == null) { return null; } OrganizationBean bean = new OrganizationBean(); bean.setId(asString(source.get("id"))); bean.setName(asString(source.get("name"))); bean.setDescription(asString(source.get("description"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setModifiedOn(asDate(source.get("modifiedOn"))); bean.setModifiedBy(asString(source.get("modifiedBy"))); postMarshall(bean); return bean; }
@Override public ContractBean unmarshal(Map<String, Object> source) { ContractBean contract = EsMarshalling.unmarshallContract(source); String apiOrgId = (String) source.get("apiOrganizationId"); String apiId = (String) source.get("apiId"); String apiVersion = (String) source.get("apiVersion"); String planId = (String) source.get("planId"); String planVersion = (String) source.get("planVersion"); ApiVersionBean svb = new ApiVersionBean(); svb.setVersion(apiVersion); svb.setApi(new ApiBean()); svb.getApi().setOrganization(new OrganizationBean()); svb.getApi().setId(apiId); svb.getApi().getOrganization().setId(apiOrgId); PlanVersionBean pvb = new PlanVersionBean(); pvb.setVersion(planVersion); pvb.setPlan(new PlanBean()); pvb.getPlan().setOrganization(new OrganizationBean()); pvb.getPlan().setId(planId); pvb.getPlan().getOrganization().setId(apiOrgId); contract.setPlan(pvb); contract.setApi(svb); return contract; } }, query);
@Override public ContractBean unmarshal(Map<String, Object> source) { ContractBean contract = EsMarshalling.unmarshallContract(source); String apiOrgId = (String) source.get("apiOrganizationId"); String apiId = (String) source.get("apiId"); String apiVersion = (String) source.get("apiVersion"); String planId = (String) source.get("planId"); String planVersion = (String) source.get("planVersion"); ApiVersionBean svb = new ApiVersionBean(); svb.setVersion(apiVersion); svb.setApi(new ApiBean()); svb.getApi().setOrganization(new OrganizationBean()); svb.getApi().setId(apiId); svb.getApi().getOrganization().setId(apiOrgId); PlanVersionBean pvb = new PlanVersionBean(); pvb.setVersion(planVersion); pvb.setPlan(new PlanBean()); pvb.getPlan().setOrganization(new OrganizationBean()); pvb.getPlan().setId(planId); pvb.getPlan().getOrganization().setId(apiOrgId); contract.setPlan(pvb); contract.setApi(svb); return contract; } }, query);
/** * @see io.apiman.manager.api.exportimport.read.IImportReaderDispatcher#clientContract(io.apiman.manager.api.beans.contracts.ContractBean) */ @Override public void clientContract(ContractBean contract) { ClientVersionBean avb = new ClientVersionBean(); avb.setClient(new ClientBean()); avb.getClient().setOrganization(new OrganizationBean()); avb.getClient().setId(currentClient.getId()); avb.getClient().getOrganization().setId(currentOrg.getId()); avb.setVersion(currentClientVersion.getVersion()); contract.setClient(avb); contracts.add(contract); }
/** * @param api */ private ApiVersionBean minifyApi(ApiVersionBean api) { ApiVersionBean rval = new ApiVersionBean(); rval.setVersion(api.getVersion()); rval.setApi(new ApiBean()); rval.getApi().setId(api.getApi().getId()); rval.getApi().setOrganization(new OrganizationBean()); rval.getApi().getOrganization().setId(api.getApi().getOrganization().getId()); return rval; }
/** * @param plan */ private PlanVersionBean minifyPlan(PlanVersionBean plan) { PlanVersionBean rval = new PlanVersionBean(); rval.setVersion(plan.getVersion()); rval.setPlan(new PlanBean()); rval.getPlan().setId(plan.getPlan().getId()); rval.getPlan().setOrganization(new OrganizationBean()); rval.getPlan().getOrganization().setId(plan.getPlan().getOrganization().getId()); return rval; }
orgBean.setName(bean.getName()); orgBean.setDescription(bean.getDescription()); orgBean.setId(BeanUtils.idFromName(bean.getName())); orgBean.setCreatedOn(new Date()); orgBean.setCreatedBy(securityContext.getCurrentUser());
orgBean.setName(bean.getName()); orgBean.setDescription(bean.getDescription()); orgBean.setId(BeanUtils.idFromName(bean.getName())); orgBean.setCreatedOn(new Date()); orgBean.setCreatedBy(securityContext.getCurrentUser());