本文整理汇总了Java中com.mendix.core.Core.retrieveXPathQuery方法的典型用法代码示例。如果您正苦于以下问题:Java Core.retrieveXPathQuery方法的具体用法?Java Core.retrieveXPathQuery怎么用?Java Core.retrieveXPathQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mendix.core.Core
的用法示例。
在下文中一共展示了Core.retrieveXPathQuery方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTypeId
import com.mendix.core.Core; //导入方法依赖的package包/类
protected IMendixIdentifier getTypeId(IContext context, IDataType dataType) throws CoreException {
String valueTypeName = dataType.getDSLType();
if (dataType.getType() == DataTypeEnum.Enumeration)
valueTypeName = "Enum";
else if (dataType.isList())
valueTypeName = "List of type: " + dataType.getObjectType();
else if (dataType.isMendixObject())
valueTypeName = "Object of type: " + dataType.getObjectType();
List<IMendixObject> result = Core.retrieveXPathQuery(context, "//" + ValueType.getType() + "[" + ValueType.MemberNames.Name + "='" + valueTypeName + "']");
if (result.size() > 0)
return result.get(0).getId();
IMendixObject memberTypeObject = Core.instantiate(context, ValueType.getType());
memberTypeObject.setValue(context, ValueType.MemberNames.Name.toString(), valueTypeName);
memberTypeObject.setValue(context, ValueType.MemberNames.ValueType_MxObjectType.toString(), this.getObjectTypeId(context, dataType));
PrimitiveTypes type = getPrimitiveTypesFromDatatype(dataType);
memberTypeObject.setValue(context, ValueType.MemberNames.TypeEnum.toString(), (type == null ? null : type.toString()));
Core.commit(context, memberTypeObject);
return memberTypeObject.getId();
}
示例2: firstWhere
import com.mendix.core.Core; //导入方法依赖的package包/类
public static IMendixObject firstWhere(IContext c, String entityName,
Object member, String value) throws CoreException
{
List<IMendixObject> items = Core.retrieveXPathQuery(c, String.format("//%s[%s = '%s']", entityName, member, value), 1, 0, new HashMap<String, String>());
if (items == null || items.size() == 0)
return null;
return items.get(0);
}
示例3: findUser
import com.mendix.core.Core; //导入方法依赖的package包/类
private static IUser findUser(IContext c, String openID) throws CoreException {
List<IMendixObject> userList = Core.retrieveXPathQuery(c, String.format("//%s[%s='%s']", USER_ENTITY, USER_ENTITY_NAME, openID));
if (userList.size() > 0) {
IMendixObject userObject = userList.get(0);
String username = userObject.getValue(c, DEFAULT_MENDIX_USERNAME_ATTRIBUTE);
if (LOG.isTraceEnabled())
LOG.trace("Getting System.User using username: '" + username + "'");
return Core.getUser(c, username);
} else {
return null;
}
}
示例4: handleMembers
import com.mendix.core.Core; //导入方法依赖的package包/类
private void handleMembers(IContext context, IMetaObject metaObject, IMendixObject curObject) throws CoreException
{
Map<String,IMendixObject> membersByName = new HashMap<String, IMendixObject>();
List<IMendixObject> existingMembers = Core.retrieveXPathQuery(context, "//" + MxObjectMember.getType() + "[" + MxObjectMember.MemberNames.MxObjectMember_MxObjectType + "='" + curObject.getId().toLong() + "']");
for(IMendixObject obj : existingMembers)
membersByName.put((String)obj.getValue(context, MxObjectMember.MemberNames.AttributeName.toString()), obj);
List<IMendixObject> memberList = new ArrayList<IMendixObject>();
for(IMetaPrimitive metaPrimitive : metaObject.getMetaPrimitives())
{
String name = metaPrimitive.getName();
if(metaPrimitive.getType() == PrimitiveType.Enum)
{
if(membersByName.containsKey(name))
{
IMendixObject curMember = membersByName.get(name);
if(MxObjectEnum.getType().equals(curMember.getType()))
{
memberList.add(this.handleEnumMember(context, curMember, metaPrimitive, curObject));
membersByName.remove(name);
}
else
{
Core.delete(context, curMember);
memberList.add(this.handleEnumMember(context, null, metaPrimitive, curObject));
}
}
else
memberList.add(this.handleEnumMember(context, null, metaPrimitive, curObject));
}
else
{
processMember(context, curObject, membersByName, memberList, metaPrimitive, name);
}
}
Core.commit(context, memberList);
this.builder.removeDeletedObjects(context, membersByName);
}
示例5: handleMicroflowParams
import com.mendix.core.Core; //导入方法依赖的package包/类
private List<IMendixObject> handleMicroflowParams(IContext context, String microflowName, IMendixObject obj) throws CoreException
{
Map<String, IMendixObject> existingParams = new HashMap<String, IMendixObject>();
List<IMendixObject> params = Core.retrieveXPathQuery(context, "//" + Parameter.getType() + "[" + Microflows.MemberNames.Microflows_InputParameter + "='" + obj.getId().toLong() + "']");
for(IMendixObject param : params)
existingParams.put((String)param.getValue(context, Parameter.MemberNames.Name.toString()), param);
List<IMendixIdentifier> inputParameterIds = new ArrayList<IMendixIdentifier>();
List<IMendixObject> inputParameterObjs = new ArrayList<IMendixObject>();
for(Entry<String,IDataType> entry : Core.getInputParameters(microflowName).entrySet())
{
String inputParameterName = entry.getKey();
IDataType inputParameterType = entry.getValue();
IMendixObject parameter;
if(existingParams.containsKey(inputParameterName))
{
parameter = existingParams.get(inputParameterName);
existingParams.remove(inputParameterName);
}
else
parameter = Core.instantiate(context, Parameter.getType());
parameter.setValue(context, Parameter.MemberNames.Name.toString(), inputParameterName);
parameter.setValue(context, Parameter.MemberNames.Parameter_ValueType.toString(), this.builder.getTypeId(context, inputParameterType));
parameter.setValue(context, Parameter.MemberNames.Parameter_MxObjectType.toString(), this.builder.getObjectTypeId(context, inputParameterType));
inputParameterObjs.add( parameter );
inputParameterIds.add(parameter.getId());
}
obj.setValue(context, Microflows.MemberNames.Microflows_Output_Type.toString(), this.builder.getTypeId(context, Core.getReturnType(microflowName)));
obj.setValue(context, Microflows.MemberNames.Microflows_InputParameter.toString(), inputParameterIds);
this.builder.removeDeletedObjects(context, existingParams);
return inputParameterObjs;
}
示例6: cacheModules
import com.mendix.core.Core; //导入方法依赖的package包/类
public void cacheModules(IContext context) throws CoreException {
List<IMendixObject> result = Core.retrieveXPathQuery(context, "//" + Module.getType());
if (result.size() == 0)
this.allNewModules = true;
else {
for (IMendixObject object : result) {
boolean syncModule = (Boolean) object.getValue(context, Module.MemberNames.SynchronizeObjectsWithinModule.toString());
String moduleName = (String) object.getValue(context, Module.MemberNames.ModuleName.toString());
if (syncModule)
this.moduleMap.put(moduleName, object);
else
this.moduleMap.put(moduleName, null);
}
}
}
示例7: firstMendixObject
import com.mendix.core.Core; //导入方法依赖的package包/类
public IMendixObject firstMendixObject() throws CoreException {
assertEmptyStack();
List<IMendixObject> result = Core.retrieveXPathQuery(context, getXPath(), 1, offset, sorting);
if (result.isEmpty())
return null;
return result.get(0);
}
示例8: allMendixObjects
import com.mendix.core.Core; //导入方法依赖的package包/类
public List<IMendixObject> allMendixObjects() throws CoreException {
assertEmptyStack();
return Core.retrieveXPathQuery(context, getXPath(), limit, offset, sorting);
}
示例9: cacheLanguageCodes
import com.mendix.core.Core; //导入方法依赖的package包/类
private void cacheLanguageCodes(IContext context) throws CoreException
{
for(IMendixObject language : Core.retrieveXPathQuery(context, "//" + Language.entityName))
this.languageCodes.add(Language.initialize(context, language).getCode());
}