SiebelAdapter--具体干事的类,

本文介绍了SiebelAdapter在适配器模式中的具体使用,它实现了Adapter接口,并且在AbstractBase类中通过内部获取Adapter并调用相关方法。OrderEntryServiceImpl作为服务层接口的实现,继承了AbstractBase。此外,内容提到了SiebelAdapter.java的详细实现,以及与ExceptionWithCode和JDBFactory的联动。
摘要由CSDN通过智能技术生成

继承关系
OrderEntryServiceImpl extends AbstractBase implements OrderEntryService
AbstractBase implements AdapterConfig :内部获取Aapter,调用各种方法。
interface Adapter
SiebelAdapter implements Adapter
具体请看:
SiebelAdapter.java —适配器实现类
联动 ExceptionWithCode, JDBFactory

public  class SiebelAdapter<Z extends BaseModel> implements Adapter<Z>{
	public static final Logger logger = LoggerFactory.getLogger(SiebelAdapter.class);
	
	protected AdapterConfig<Z> config;
	public AdapterConfig<Z> getConfig(){
		return config;
	}
	public void setConfig( AdapterConfig<Z> config){
		this.config = config;
	}
	//1;获取适配器配置
	public Z getConfigByModel(Z model){
		return fillProperties(getConfig(),model);
	}
	public Z fillProperties(AdapterConfig<Z> adapter, Z model){
		if(StringUtils.isBlank(model.getBusinessComponeseName())){ model.setBusinessComponeseName(adapter.getBCName())}
		//BC,BO,IC,IO,PBC一样,我就不写了.基本就是在各个实现类中 重写AdapterConfig接口的方法.
		return model;
	}

	//2:getMapping
	final private Map<String ,String> getMapping(){
		Map<String ,String>  mapping = new LinkedHashMap<>();
			if(mapping.isEmpty() ){
				Map<String ,String> map =  getConfig().getRawMapping();
					if( map != null ){
						map.put("Id","rowId");
						map.put("Created","createTime");
						map.put("Created By","creatorId");
						mapping.putAll(map);
					}
			}
		return mapping;
	}
	//3,4 getExpress/getOrExpress 条件拼接。
	public final String getExpress (List<String> exprList){
		StringBuffer expr = new String Buffer();
		for(String  e : exprList){
			if( expr.length() > 0 ) expr.append(" and ");
			expr.append(e);
		}
		return  expr.toString();
	}
	public final String getOrExpress (List<String> exprList){
		StringBuffer expr = new String Buffer();
		for(String  e : exprList){
			if( expr.length() > 0 ) expr.append(" or");
			expr.append(e);
		}
		return  expr.toString();
	}
	//5通过查询 取得数据的列表
	public List<Z> getList(Z model) throws Exception{
		return getList(  model, getConfig().getListExpress(model) );
	}
	public List<Z> getListByBs(Z model) throws Exception{
		return getListByBs(  model,getConfig().getListExpress(model) );
	}
	//--通过查询 取得数据的列表
	public List<Z> getList(Z model,String expr) throws Exception{
		Z modelconfig = getConfigByModel(model);//得到具体有Bo,BC,IC,IO配置的模型
		if(StringUtils.isBlank(modelconfig.getBOName())){ throw new ExceptionWithCode("0010");} --BO未指定
		if(StringUtils.isBlank(modelconfig.getBCName())){ throw new ExceptionWithCode("0011");}--BC未指定
		/从这里可以看出来,在具体的实现类中必须  重写BO,BC方法,指明其名字,否则将报错。
	List<Z> retlist = new LinkedList<Z>();
	//获取siebel--数据对象
	SiebelDataBean sdb = JDBFactory.getSiebelDataBean();
try{	getConfigInfo(sdb);
	//获取siebel--BO对象
	SiebelBusObject busObject = sdb.getBusObject(modelconfig.getBusinessObjectNameI());
	//获取siebel--BC对象,及其父BC对象
try{ SiebelBusComp busComp = busObject.getBusComp(modelconfig.getBusinessComponeseName());	
try{ SiebelBusComp pc 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值