`
我改名了
  • 浏览: 87801 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

ofbiz 之服务 实体api 积累

 
阅读更多

1:根据delegator 获取 LocalDispatcher

LocalDispatcher thisDispatcher = GenericDispatcher.getLocalDispatcher(delegator.getDelegatorName(), delegator);

 

2:根据dispatcher 获取 DispatcherContext

DispatchContext dctx =
dispatcher.getDispatchContext();

 

3:获取一个GenericValue对象的所有字段

GenericDelegator delegator = DelegatorFactory.getDelegator("default");
GenericValue tmp = delegator.makeValue("UserLogin");
String entityName = tmp.getEntityName();
ModelEntity entity = delegator.getModelEntity(entityName);
List fieldNameList = entity.getAllFieldNames();

 

4:----

ServiceDispatcher sd = ServiceDispatcher.getInstance(dispatcherName, delegator);

LocalDispatcher dispatcher = sd.getLocalDispatcher(dispatcherName);

dispatcher = new GenericDispatcher(dispatcherName, delegator, readerURLs, loader, sd);

DispatchContext dc = new DispatchContext(name, readerURLs, loader, null);

5:ofbiz URL

URL formFileUrl = FlexibleLocation.resolveLocation(resourceName);

resourceName:component://common/widget/LookupForms.xml

formFileUrl:file:/E:/workspace/cpsp20110819/framework/common/widget/LookupForms.xml

 

 

for (File screenFile: screenFiles) {
String screenFilePath = screenFile.getAbsolutePath();
screenFilePath = screenFilePath.replace('\\', '/');
String screenFileRelativePath = screenFilePath.substring(rootComponentPath.length());
String screenLocation = "component://" + componentName + "/" + screenFileRelativePath;

 

 

Set<String> groupNames = getModelGroupReader().getGroupNames(delegatorBaseName);
for (String groupName: groupNames) {
GenericHelperInfo helperInfo = this.getGroupHelperInfo(groupName);
String helperBaseName = helperInfo.getHelperBaseName();

if (Debug.infoOn()) Debug.logInfo("Delegator \"" + delegatorFullName + "\" initializing helper \"" +
helperBaseName + "\" for entity group \"" + groupName + "\".", module);
if (UtilValidate.isNotEmpty(helperInfo.getHelperFullName())) {
// pre-load field type defs, the return value is ignored
ModelFieldTypeReader.getModelFieldTypeReader(helperBaseName);
// get the helper and if configured, do the datasource check
GenericHelper helper = GenericHelperFactory.getHelper(helperInfo);

DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperBaseName);
if (datasourceInfo.checkOnStart) {
if (Debug.infoOn()) Debug.logInfo("Doing database check as requested in entityengine.xml with addMissing=" + datasourceInfo.addMissingOnStart, module);
try {
helper.checkDataSource(this.getModelEntityMapByGroup(groupName), null, datasourceInfo.addMissingOnStart);
} catch (GenericEntityException e) {
Debug.logWarning(e, e.getMessage(), module);
}
}
}
}

6: 获取所有实体名称

Set<String> entitys = delegator.getModelReader().getEntityNames();
entityArr = delegator.getModelReader().getEntityNames().toArray(new String[entitys.size()]);

7:清除实体缓存

Cache entityCache = delegator.getCache();

entityCache.remove(entityName);

 

8 : xml 中取${}值

FlexibleStringExpander fse = FlexibleStringExpander.getInstance(expression);
return fse.expandString(context, timeZone, locale);

 

9: xml 获取多个 不同节点

Set<String> nameSet = UtilMisc.toSet("set", "action","log");
for (Element actionOrSetElementOrLog : UtilXml.childElementList(eca, nameSet)) {

 

10 : String 类型xml 与 Map 互相转换

XmlSerializer.deserialize

XmlSerializer.serialize

11:类型转化类的加载

Iterator<ConverterLoader> converterLoaders = ServiceLoader.load(ConverterLoader.class, loader).iterator();

 

 

Collections.unmodifiableList

getStrElems

 

 

12: private void initEngines(final ClassLoader loader) {
Iterator itr = null;
try {
if (loader != null) {
itr = Service.providers(ScriptEngineFactory.class, loader);
} else {
itr = Service.installedProviders(ScriptEngineFactory.class);
}
}

 

13: Map<String, ConditionalFactory<?>> factories = new HashMap<String, ConditionalFactory<?>>();
Iterator<ConditionalFactory<?>> it = UtilGenerics.cast(ServiceLoader.load(ConditionalFactory.class, ConditionalFactory.class.getClassLoader()).iterator());
while (it.hasNext()) {
ConditionalFactory<?> factory = it.next();
factories.put(factory.getName(), factory);
}
conditionalFactories = Collections.unmodifiableMap(factories);

分享到:
评论

相关推荐

    ofbiz api开发文档

    还在为找不到ofbiz开发文档而烦恼吗?

    OFBiz API中文版.chw

    OFBiz API中文版.chw

    OFBiz-API-Docs

    OFBiz API 文档,英文html版。使用官方资源中的ant命令自动生成,无任何修改。有兴趣的朋友可以自己生成,ant命令是:docs-all,该命令生成帮助文档时会获取操作系统语言设置,要生成英文文档请先将操作系统语言改为...

    ofbiz API,学习ofbiz的朋友一定不能少

    ofbiz API,学习ofbiz的朋友一定不能少

    ofbiz_服务引擎

    ofbiz_服务引擎,ofbiz中最为称道的部分

    ofbiz 入门+增删改查+实体

    ofbiz入门图文讲解,包括入门helloworld 和使用ofbiz 新建实体 操作数据库对实体增删改查

    ofbiz API文档

    ofbiz API——ofbiz 开发必备

    OFbiz实体引擎指南

    OFBiz是一个非常著名的电子商务平台,是一个非常著名的开源项目,提供了创建基于最新J2EE/XML规范和技术标准,构建大中型企业级、跨平台、跨数据库、跨...包括实体引擎, 服务引擎, 消息引擎, 工作流引擎, 规则引擎等。

    ofbiz 服务

    ofbiz服务,通过给controller增加事件来调用服务,也可以在方法内调用服务

    ofbiz开发教程

    适合ofbiz新手入门学习,ofbiz的环境搭建,api的查阅...开发中的参考

    ofbiz git 服务搭建

    不多说了, 就是搭建

    OFBIZ快速入门OFBIZ快速入门

    OFBIZ快速入门OFBIZ快速入门OFBIZ快速入门OFBIZ快速入门OFBIZ快速入门OFBIZ快速入门

    ofbiz资料大全

    OFBiz API中文版.rar Apache OFBiz Cookbook Sep 2010.rar Opentaps widget使用说明.rar OFBiz.Development.2008.rar Groovy中文教程.rar freemarker中文手册.rar ofbiz10.04表结构.rar OFBiz开发指南.rar ...

    Ofbiz之LOOKUP字段使用方法

    Ofbiz的Lookup字段,讲解ofbiz辅助输入,包括文本,选择框,日期,时间,主从文本框。后面还介绍一下自定义修改的Lookup

    ofbiz_springservice.zip

    基于spring封装的ofbiz所有服务,使用spring security进行安全验证,可以方便的发布为微服务,同时实现了一套直接使用ofbiz实体引擎操作ofbiz所有数据库表的spring应用框架设计

    Ofbiz16.11.05运行及开发环境搭建等

    gradle ofbiz 16 开发环境搭建 2 Ofbiz中增加百度地图 8 使用entity-auto服务实现增加、修改、删除提示国际化 9 ...ofbiz实体引擎(九) 多租户 31 菜单权限配置 34 ofbiz权限判断语法整理 42 ofbiz 权限设计详解 43

    原创 Ofbiz 入门教程

    Ofbiz(http://www.ofbiz.org) 是 Open Source 的商务软件系统,充分利用了各优秀的的Open Source 项目, 像 Tomcat, Ant, BeanShell, Jboss 等,构建了一个...Ofbiz 宣称的优点之一是用 很少的 Code 完成复杂的处理。

    ofbiz综合技术文档

    1、ofbiz 将其他的webservice 封装成服务,这时ofbiz的应用系统可以直接调用该服务,以访问其他的Webservice: 92 2、其他的soap客户端可以通过soap访问ofbiz,这时ofbiz相当于Webservice服务器 92 二、Soap应用例子...

    OFBIZ.txt(同表不同字段计算)

    OFBIZ的同一个表的不同字段之间的加减乘除等的计算公式

Global site tag (gtag.js) - Google Analytics