本文整理汇总了Java中lucee.runtime.Component.getMetaData方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getMetaData方法的具体用法?Java Component.getMetaData怎么用?Java Component.getMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucee.runtime.Component
的用法示例。
在下文中一共展示了Component.getMetaData方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntityName
import lucee.runtime.Component; //导入方法依赖的package包/类
public static String getEntityName(Component cfc) {
String name=null;
try {
name=CommonUtil.toString(HibernateUtil.getMetaStructItem(cfc,CommonUtil.ENTITY_NAME),null);
}
catch (Throwable t) {
lucee.commons.lang.ExceptionUtil.rethrowIfNecessary(t);
try {
Struct md = cfc.getMetaData(CommonUtil.pc());
name = CommonUtil.toString(md.get(CommonUtil.ENTITY_NAME),null);
}catch (PageException e) {}
}
if(!Util.isEmpty(name)) {
return name;
}
return getName(cfc);
}
示例2: getDataSource
import lucee.runtime.Component; //导入方法依赖的package包/类
/**
* if the given component has defined a datasource in the meta data, lucee is returning this datasource,
* otherwise the default orm datasource is returned
* @param pc
* @param cfc
* @return
* @throws PageException
*/
public static DataSource getDataSource(PageContext pc, Component cfc, DataSource defaultValue) {
pc=ThreadLocalPageContext.get(pc);
// datasource defined with cfc
try{
Struct meta = cfc.getMetaData(pc);
String datasourceName = Caster.toString(meta.get(KeyConstants._datasource,null),null);
if(!StringUtil.isEmpty(datasourceName,true)) {
DataSource ds = ((PageContextImpl)pc).getDataSource(datasourceName,null);
if(ds!=null) return ds;
}
}
catch(Throwable t){
lucee.commons.lang.ExceptionUtil.rethrowIfNecessary(t);
}
return getDefaultDataSource(pc, defaultValue);
}
示例3: _init
import lucee.runtime.Component; //导入方法依赖的package包/类
private static ArrayList<Source> _init(PageContext pc, Mapping mapping, Resource dir) throws PageException{
Resource[] children = dir.listResources(FILTER);
RestSettings settings = pc.getApplicationContext().getRestSettings();
ArrayList<Source> sources = new ArrayList<Source>();
PageSource ps;
Component cfc;
Struct meta;
String path;
for(int i=0;i<children.length;i++){
try{
ps = pc.toPageSource(children[i],null);
cfc = ComponentLoader.loadComponent(pc, ps, children[i].getName(), true,true);
meta = cfc.getMetaData(pc);
if(Caster.toBooleanValue(meta.get(KeyConstants._rest,null),false)){
path = Caster.toString(meta.get(KeyConstants._restPath,null),null);
sources.add(new Source(mapping, cfc.getPageSource(), path));
}
}
catch(Throwable t){
ExceptionUtil.rethrowIfNecessary(t);
if(!settings.getSkipCFCWithError()) throw Caster.toPageException(t);
}
}
return sources;
}
示例4: getDataSource
import lucee.runtime.Component; //导入方法依赖的package包/类
/**
* if the given component has defined a datasource in the meta data, lucee is returning this datasource,
* otherwise the default orm datasource is returned
* @param pc
* @param cfc
* @return
* @throws PageException
*/
public static DataSource getDataSource(PageContext pc, Component cfc, DataSource defaultValue) {
pc=ThreadLocalPageContext.get(pc);
// datasource defined with cfc
try{
Struct meta = cfc.getMetaData(pc);
String datasourceName = Caster.toString(meta.get(KeyConstants._datasource,null),null);
if(!StringUtil.isEmpty(datasourceName,true)) {
DataSource ds = pc.getDataSource(datasourceName,null);
if(ds!=null) return ds;
}
}
catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}
return getDefaultDataSource(pc, defaultValue);
}
示例5: getDataSourceName
import lucee.runtime.Component; //导入方法依赖的package包/类
public static String getDataSourceName(PageContext pc, Component cfc, String defaultValue) {
pc=ThreadLocalPageContext.get(pc);
// datasource defined with cfc
Struct meta=null;
try {
meta = cfc.getMetaData(pc);
String datasourceName = Caster.toString(meta.get(KeyConstants._datasource,null),null);
if(!StringUtil.isEmpty(datasourceName,true)) {
return datasourceName.trim();
}
}
catch (PageException e) {}
DataSource ds = getDefaultDataSource(pc,null);
if(ds!=null)return ds.getName();
return defaultValue;
}
示例6: _init
import lucee.runtime.Component; //导入方法依赖的package包/类
private static ArrayList<Source> _init(PageContext pc, Mapping mapping, Resource dir) throws PageException{
Resource[] children = dir.listResources(FILTER);
RestSettings settings = pc.getApplicationContext().getRestSettings();
ArrayList<Source> sources = new ArrayList<Source>();
PageSource ps;
Component cfc;
Struct meta;
String path;
for(int i=0;i<children.length;i++){
try{
ps = pc.toPageSource(children[i],null);
cfc = ComponentLoader.loadComponent(pc, null, ps, children[i].getName(), true,true);
meta = cfc.getMetaData(pc);
if(Caster.toBooleanValue(meta.get(KeyConstants._rest,null),false)){
path = Caster.toString(meta.get(KeyConstants._restPath,null),null);
sources.add(new Source(mapping, cfc.getPageSource(), path));
}
}
catch(Throwable t){
ExceptionUtil.rethrowIfNecessary(t);
if(!settings.getSkipCFCWithError()) throw Caster.toPageException(t);
}
}
return sources;
}
示例7: call
import lucee.runtime.Component; //导入方法依赖的package包/类
public static Struct call(PageContext pc , Object obj) throws PageException {
if(obj instanceof Component){
return ((Component)obj).getMetaData(pc);
}
// load existing meta without loading the cfc
/*try{
Page page = ComponentLoader.loadPage(pc,((PageContextImpl)pc).getCurrentPageSource(null), Caster.toString(obj), null,null);
if(page.metaData!=null && page.metaData.get()!=null) return page.metaData.get();
}catch(Throwable t){
ExceptionUtil.rethrowIfNecessary(t);}*/
// load the cfc when metadata was not defined before
try{
Component cfc = CreateObject.doComponent(pc, Caster.toString(obj));
return cfc.getMetaData(pc);
}
// TODO better solution
catch(ApplicationException ae){
try{
InterfaceImpl inter = ComponentLoader.loadInterface(pc,((PageContextImpl)pc).getCurrentPageSource(null), Caster.toString(obj), new HashMap());
return inter.getMetaData(pc);
}
catch(PageException pe){
throw ae;
}
}
}
示例8: getProperties
import lucee.runtime.Component; //导入方法依赖的package包/类
private static Property[] getProperties(PageContext pc, Component cfc, DatasourceConnection dc, Struct meta, boolean isClass, boolean recursivePersistentMappedSuperclass,SessionFactoryData data) throws PageException, PageException {
Property[] _props;
if (recursivePersistentMappedSuperclass) {
_props = CommonUtil.getProperties(cfc,true, true, true, true);
}
else {
_props = cfc.getProperties(true);
}
if(isClass && _props.length==0 && data.getORMConfiguration().useDBForMapping()){
if(meta==null)meta = cfc.getMetaData(pc);
_props=HibernateUtil.createPropertiesFromTable(dc,getTableName(pc, meta, cfc, data));
}
return _props;
}
示例9: getDataSourceName
import lucee.runtime.Component; //导入方法依赖的package包/类
public static String getDataSourceName(PageContext pc, Component cfc) throws PageException {
pc=ThreadLocalPageContext.get(pc);
// datasource defined with cfc
Struct meta = cfc.getMetaData(pc);
String datasourceName = Caster.toString(meta.get(KeyConstants._datasource,null),null);
if(!StringUtil.isEmpty(datasourceName,true)) {
return datasourceName.trim();
}
return getDefaultDataSource(pc).getName();
}
示例10: call
import lucee.runtime.Component; //导入方法依赖的package包/类
public static Struct call(PageContext pc , Object obj) throws PageException {
if(obj instanceof Component){
return ((Component)obj).getMetaData(pc);
}
// load existing meta without loading the cfc
/*try{
Page page = ComponentLoader.loadPage(pc,((PageContextImpl)pc).getCurrentPageSource(null), Caster.toString(obj), null,null);
if(page.metaData!=null && page.metaData.get()!=null) return page.metaData.get();
}catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}*/
// load the cfc when metadata was not defined before
try{
//Component cfc = CreateObject.doComponent(pc, Caster.toString(obj));
Component cfc = ComponentLoader.searchComponent(pc,null,Caster.toString(obj),null,null,true,true/* MUST false does not produce properties */);
return cfc.getMetaData(pc);
}
// TODO better solution
catch(ApplicationException ae){
try{
InterfaceImpl inter = ComponentLoader.searchInterface(pc,((PageContextImpl)pc).getCurrentPageSource(null), Caster.toString(obj));
return inter.getMetaData(pc);
}
catch(PageException pe){
throw ae;
}
}
}
示例11: getMetaData
import lucee.runtime.Component; //导入方法依赖的package包/类
public static Struct getMetaData(Component cfc, PageContext pc) throws PageException {
return cfc.getMetaData(pc);
}