package com.vci.server.bof.delegate;
|
|
import com.vci.server.base.persistence.dao.HibernateSessionFactory;
|
import com.vci.server.cache.OMCacheProvider;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.omd.atm.AttribItem;
|
import com.vci.corba.omd.data.AttributeValue;
|
import com.vci.corba.omd.data.LinkObject;
|
import com.vci.omd.utils.ObjectTool;
|
import com.vci.common.objects.UserEntity;
|
import com.vci.common.utility.ObjectUtility;
|
|
public class LOFacotryServerLODelegate extends LOFacotryBaseDelegate {
|
|
private static LOFacotryServerLODelegate instance = null;
|
public static UserEntity userEntity = null;
|
public LOFacotryServerLODelegate() {
|
userEntity = new UserEntity();
|
}
|
|
public static synchronized LOFacotryServerLODelegate getInstance() {
|
if (instance == null) {
|
instance = new LOFacotryServerLODelegate();
|
}
|
|
return instance;
|
}
|
|
public LinkObject initLinkObject(String loName) throws VCIError {
|
LinkObject lo = new LinkObject();
|
lo.oid = ObjectUtility.getNewObjectID36();
|
lo.creator = HibernateSessionFactory.getVciSessionInfo().userName;
|
lo.createTime = System.currentTimeMillis();
|
lo.modifier = HibernateSessionFactory.getVciSessionInfo().userName;
|
lo.modifyTime = System.currentTimeMillis();
|
lo.fromOid = "";
|
lo.fromRevOid = "";
|
lo.fromNameOid = "";
|
lo.fromBTName = "";
|
lo.toOid = "";
|
lo.toRevOid = "";
|
lo.toNameOid = "";
|
lo.toBTName = "";
|
lo.ltName = loName;
|
lo.newAttrValList = new AttributeValue[0];
|
lo.hisAttrValList = new AttributeValue[0];
|
lo.ts = System.currentTimeMillis();
|
//属性初始值设置
|
initLinkTypeAttributeValue(lo, loName);
|
return lo;
|
}
|
|
private void initLinkTypeAttributeValue(LinkObject lo, String loName) throws VCIError {
|
try {
|
//LinkType lt = ServerServiceProvider.getOMDService().getLinkTypeService().getLinkType(loName);
|
//LinkType lt = OMProvider.getLinkType(loName);
|
//AttribItem[] attrs = ServerServiceProvider.getOMDService().getAttributeService().getAttribItemsByNames(lt.attributes);
|
AttribItem[] attrs = OMCacheProvider.getAttribItemsByLinkType(loName);
|
|
for (AttribItem item : attrs) {
|
ObjectTool.setLOAttributeValue(lo, item.name, item.defValue);
|
}
|
} catch (Throwable e) {
|
e.printStackTrace();
|
throw this.getLocalString("P0010SOF-10008", e);
|
}
|
}
|
}
|