当前位置: 首页>>代码示例>>Java>>正文


Java Component.getMetaData方法代码示例

本文整理汇总了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);
	
	
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:23,代码来源:HibernateCaster.java

示例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);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:26,代码来源:ORMUtil.java

示例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;
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:27,代码来源:Mapping.java

示例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);
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:26,代码来源:ORMUtil.java

示例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;
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:20,代码来源:ORMUtil.java

示例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;
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:28,代码来源:Mapping.java

示例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;
		}
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:28,代码来源:GetComponentMetaData.java

示例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;
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:16,代码来源:HBMCreator.java

示例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();
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:12,代码来源:ORMUtil.java

示例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;
		}
	}
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:28,代码来源:GetComponentMetaData.java

示例11: getMetaData

import lucee.runtime.Component; //导入方法依赖的package包/类
public static Struct getMetaData(Component cfc, PageContext pc) throws PageException {
	return cfc.getMetaData(pc);
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:4,代码来源:GetMetaData.java


注:本文中的lucee.runtime.Component.getMetaData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。