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


Java Core.retrieveXPathQueryEscaped方法代码示例

本文整理汇总了Java中com.mendix.core.Core.retrieveXPathQueryEscaped方法的典型用法代码示例。如果您正苦于以下问题:Java Core.retrieveXPathQueryEscaped方法的具体用法?Java Core.retrieveXPathQueryEscaped怎么用?Java Core.retrieveXPathQueryEscaped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mendix.core.Core的用法示例。


在下文中一共展示了Core.retrieveXPathQueryEscaped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: duplicateReverseAssociations

import com.mendix.core.Core; //导入方法依赖的package包/类
private static void duplicateReverseAssociations(IContext ctx, IMendixObject src, IMendixObject tar, 
        List<String> toskip, List<String> tokeep, List<String> revAssocs, 
        List<String> skipEntities, List<String> skipModules,
        Map<IMendixIdentifier, IMendixIdentifier> mappedObjects) throws CoreException
{
	for(String fullAssocName : revAssocs) {
		String[] parts = fullAssocName.split("/"); 
		
		if (parts.length != 1 && parts.length != 3) //specifying entity has no meaning anymore, but remain backward compatible. 
			throw new IllegalArgumentException("Reverse association is not defined correctly, please mention the relation name only: '" + fullAssocName + "'");

		String assocname = parts.length == 3 ? parts[1] : parts[0]; //support length 3 for backward compatibility
		
		IMetaAssociation massoc = src.getMetaObject().getDeclaredMetaAssociationChild(assocname);

		if (massoc != null) {
			IMetaObject relationParent = massoc.getParent();
		    // if the parent is in the exclude list, we can't clone the parent, and setting the 
			// references to the newly cloned target object will screw up the source data.
			if (skipEntities.contains(relationParent.getName()) || skipModules.contains(relationParent.getModuleName())){
		        throw new IllegalArgumentException("A reverse reference has been specified that starts at an entity in the exclude list, this is not possible to clone: '" + fullAssocName + "'");
		    }
		    
		    //MWE: what to do with reverse reference sets? -> to avoid spam creating objects on 
		    //reverse references, do not support referenceset (todo: we could keep a map of converted guids and reuse that!)
			if (massoc.getType() == AssociationType.REFERENCESET) {
				throw new IllegalArgumentException("It is not possible to clone reverse referencesets: '" + fullAssocName + "'");
			}
			
			List<IMendixObject> objs = Core.retrieveXPathQueryEscaped(ctx, "//%s[%s='%s']", 
			        relationParent.getName(), assocname, String.valueOf(src.getId().toLong()));
			
			for(IMendixObject obj : objs) {
			    @SuppressWarnings("unused") // object is unused on purpose
                   IMendixIdentifier refObj = getCloneOfObject(ctx, obj, toskip, tokeep, revAssocs, skipEntities, skipModules, mappedObjects);
                   // setting reference explicitly is not necessary, this has been done in the 
                   // duplicate() call.
			}
		}
	}
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:42,代码来源:ORM.java

示例2: getClassifierEntity

import com.mendix.core.Core; //导入方法依赖的package包/类
private static IMendixObject getClassifierEntity(IContext context,  String classifierName) throws MendixException{

		final List<IMendixObject> classifierObjectList = Core.retrieveXPathQueryEscaped(context, "//%s[%s ='%s']", CLASSIFIER_ENTITY_NAME, CLASSIFIER_ENTITY_PROPERTY, classifierName);

		if(classifierObjectList.isEmpty()){
			throw new MendixException("Not found a classifier object with id: " + classifierName);
		}

		return classifierObjectList.get(0);
	}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:11,代码来源:VisualRecognitionService.java


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