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


Java Core.commit方法代码示例

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


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

示例1: validateModule

import com.mendix.core.Core; //导入方法依赖的package包/类
protected Object validateModule(IContext context, String moduleName) throws CoreException {
	this.activeModule.add(moduleName);

	if (!this.moduleMap.containsKey(moduleName)) {
		this.moduleMap.put(moduleName, null);

		IMendixObject obj = Core.instantiate(context, Module.getType());
		obj.setValue(context, Module.MemberNames.ModuleName.toString(), moduleName);

		if (this.allNewModules) {
			this.moduleMap.put(moduleName, obj);
			obj.setValue(context, Module.MemberNames.SynchronizeObjectsWithinModule.toString(), true);
		}

		Core.commit(context, obj);

	}

	return this.moduleMap.get(moduleName);
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:21,代码来源:Builder.java

示例2: 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();
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:23,代码来源:Builder.java

示例3: translate

import com.mendix.core.Core; //导入方法依赖的package包/类
public static IMendixObject translate(IContext context, Translation translation, String username, String password) throws MendixException, CoreException {
	LOGGER.debug("Executing Translate Connector...");

	service.setUsernameAndPassword(username, password);

	final Language source = getLanguage(translation.getTranslation_SourceLanguage().getCode());
	final Language target = getLanguage(translation.getTranslation_TargetLanguage().getCode());

	TranslationResult result;
	try {

		result = service.translate(translation.getText(), source, target).execute();
	} catch (Exception e) {
		LOGGER.error("Watson Service connection - Failed translating from" + source + " to " + target + " the text " + StringUtils.abbreviate(translation.getText(), 20), e);
		throw new MendixException(e);
	}

	translation.setWordCount(Long.valueOf(result.getWordCount()));
	translation.setCharacterCount(Long.valueOf(result.getCharacterCount()));
	translation.setOutput(result.getFirstTranslation());
	Core.commit(context, translation.getMendixObject());

	return translation.getMendixObject();
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:25,代码来源:LanguageTranslationService.java

示例4: updateConversationContext

import com.mendix.core.Core; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static Map<String, Object> updateConversationContext(IContext context, ConversationContext conversationContext, MessageResponse response) throws CoreException {
	deleteCurrentDialogStack(conversationContext);

	conversationContext.setConversationId(context, response.getContext().get("conversation_id").toString());
	Map<String, Object> responseContext = response.getContext();
	Map<String, Object> resposeSystemContext = (Map<String, Object>) responseContext.get("system");
	conversationContext.setDialogTurnCounter(new BigDecimal(resposeSystemContext.get("dialog_turn_counter").toString()));
	conversationContext.setDialogRequestCounter(new BigDecimal(resposeSystemContext.get("dialog_request_counter").toString()));

	List<String> dialogStack = (List<String>) resposeSystemContext.get("dialog_stack");
	for(String dialogNode : dialogStack){
		final IMendixObject dialogNodeObject = Core.instantiate(context, DialogNode.entityName );
		dialogNodeObject.setValue(context, DialogNode.MemberNames.Name.toString(), dialogNode);
		final List<IMendixIdentifier> conversationContextList = new ArrayList<IMendixIdentifier>();
		conversationContextList.add(conversationContext.getMendixObject().getId());
		dialogNodeObject.setValue(context, DialogNode.MemberNames.Dialog_Stack.toString(), conversationContextList);

		Core.commit(context, dialogNodeObject);
	}

	conversationContext.commit();
	return resposeSystemContext;
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:25,代码来源:ConversationService.java

示例5: handleMxObject

import com.mendix.core.Core; //导入方法依赖的package包/类
private IMendixObject handleMxObject(IContext context, Map<String,IMendixObject> existingMetaObjects, IMetaObject metaObject) throws CoreException
{
	String completeName = metaObject.getName();
	IMendixObject object;
	if(!existingMetaObjects.containsKey(completeName) && !this.builder.allNewModules)
	{
		object = Core.instantiate(context, MxObjectType.getType());
		existingMetaObjects.put(completeName, object);

		object.setValue(context, MxObjectType.MemberNames.CompleteName.toString(), completeName);
		object.setValue(context, MxObjectType.MemberNames.Name.toString(), completeName.substring(completeName.indexOf(".")+1));
		object.setValue(context, MxObjectType.MemberNames.Module.toString(), completeName.substring(0,completeName.indexOf(".")));
	}
	else
		object = existingMetaObjects.get(completeName);

	if( object != null ) {
		List<IMendixIdentifier> superObjectIds = new ArrayList<IMendixIdentifier>();
		for(IMetaObject superObject : metaObject.getSuperObjects()) {
			IMendixObject superMxObject = this.handleMxObject(context, existingMetaObjects, superObject);
			if( superMxObject != null )
				superObjectIds.add(superMxObject.getId());
		}
		
		object.setValue(context, MxObjectType.MemberNames.MxObjectType_SubClassOf_MxObjectType.toString(), superObjectIds);
		object.setValue(context, MxObjectType.MemberNames.PersistenceType.toString(), (metaObject.isPersistable() ? PersistenceType.Persistable.toString() : PersistenceType.Non_persistent.toString())  );
		
		if( this.builder.moduleMap.get(metaObject.getModuleName()) != null ) {
			object.setValue(context, MxObjectType.MemberNames.MxObjectType_Module.toString(), this.builder.moduleMap.get(metaObject.getModuleName()).getId());
		}
		
		Core.commit(context, object);
	}
	
	return object;
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:37,代码来源:MetaObjectBuilder.java

示例6: createMessageResponse

import com.mendix.core.Core; //导入方法依赖的package包/类
private static IMendixObject createMessageResponse(IContext context, ConversationContext conversationContext, MessageResponse response) throws CoreException {
	updateConversationContext(context, conversationContext, response);

	final IMendixObject messageResponseObject = Core.instantiate(context, ConversationMessageResponse.entityName);
	messageResponseObject.setValue(context, ConversationMessageResponse.MemberNames.ConversationId.toString(), response.getContext().get("conversation_id"));
	messageResponseObject.setValue(context, ConversationMessageResponse.MemberNames.Input.toString(), response.getInputText());
	messageResponseObject.setValue(context, ConversationMessageResponse.MemberNames.Output.toString(), response.getTextConcatenated(","));

	Core.commit(context, messageResponseObject);

	

	for(Intent intent : response.getIntents()){
		final IMendixObject intentObject = Core.instantiate(context, ConversationIntent.entityName);
		intentObject.setValue(context, ConversationIntent.MemberNames.Name.toString(), intent.getIntent());
		intentObject.setValue(context, ConversationIntent.MemberNames.Confidence.toString(), intent.getConfidence().toString());
		intentObject.setValue(context, ConversationIntent.MemberNames.ConversationIntent_ConversationResponse.toString(), messageResponseObject.getId());

		Core.commit(context, intentObject);
	}
	
	for(Entity entity : response.getEntities()){
		final IMendixObject entityObject = Core.instantiate(context, ConversationEntity.entityName);
		entityObject.setValue(context, ConversationEntity.MemberNames.Name.toString(), entity.getEntity());
		entityObject.setValue(context, ConversationEntity.MemberNames.Value.toString(), entity.getValue());
		entityObject.setValue(context, ConversationEntity.MemberNames.ConversationEntity_ConversationResponse.toString(), messageResponseObject.getId());

		Core.commit(context, entityObject);
	}

	return messageResponseObject;
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:33,代码来源:ConversationService.java

示例7: executeAction

import com.mendix.core.Core; //导入方法依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
	// BEGIN USER CODE
	ISession session = getContext().getSession();
	IContext newContext = session.createContext();
	Core.commit(newContext, mxObject);
	newContext.endTransaction();
	return true;
	// END USER CODE
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:12,代码来源:commitInSeparateDatabaseTransaction.java

示例8: 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);
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:40,代码来源:MetaObjectBuilder.java

示例9: executeAction

import com.mendix.core.Core; //导入方法依赖的package包/类
@Override
public Boolean executeAction() throws Exception
{
	// BEGIN USER CODE
	ISession session = getContext().getSession();
	IContext newContext = session.createContext();
	Core.commit(newContext, mxObject);
	newContext.endTransaction();
	return true;
	// END USER CODE
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:12,代码来源:commitInSeparateDatabaseTransaction.java

示例10: constructInstance

import com.mendix.core.Core; //导入方法依赖的package包/类
/**
 * Creates one instance of the type of this XPath query, and initializes the provided attributes to the provided values. 
 * @param keysAndValues AttributeName, AttributeValue, AttributeName2, AttributeValue2... list. 
 * @return
 * @throws CoreException
 */
public T constructInstance(boolean autoCommit, Object... keysAndValues) throws CoreException
{
	assertEven(keysAndValues);
	IMendixObject newObj = Core.instantiate(context, this.entity);
	
	for(int i = 0; i < keysAndValues.length; i+= 2)
		newObj.setValue(context, String.valueOf(keysAndValues[i]), toMemberValue(keysAndValues[i + 1]));
	
	if (autoCommit)
		Core.commit(context, newObj);
	
	return createProxy(context, proxyClass, newObj);
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:20,代码来源:XPath.java

示例11: commitSilent

import com.mendix.core.Core; //导入方法依赖的package包/类
public static void commitSilent(IContext c, IMendixObject mendixObject)
{
	try
	{
		Core.commit(c, mendixObject);
	}
	catch (CoreException e)
	{
		throw new RuntimeException(e);
	}
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:12,代码来源:ORM.java

示例12: handleEnumMember

import com.mendix.core.Core; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private IMendixObject handleEnumMember(IContext context, IMendixObject enumObject, IMetaPrimitive enumPrimitive, IMendixObject curObject) throws CoreException
{
	if(enumObject == null)
		enumObject = Core.instantiate(context, MxObjectEnum.getType());

	Map<String,IMendixObject> curEnumValues = new HashMap<String, IMendixObject>();
	List<IMendixIdentifier> enumValueIds = (List<IMendixIdentifier>) enumObject.getValue(context, MxObjectEnum.MemberNames.Values.toString());
	if(enumValueIds != null)
		for(IMendixObject enumValueObject : Core.retrieveIdList(context, enumValueIds))
			curEnumValues.put((String)enumValueObject.getValue(context, MxObjectEnumValue.MemberNames.Name.toString()), enumValueObject);

	List<IMendixIdentifier> valueIds = new ArrayList<IMendixIdentifier>();
	List<IMendixObject> valueObjs = new ArrayList<IMendixObject>();
	

	List<IMendixIdentifier> captionIds = new ArrayList<IMendixIdentifier>();
	List<IMendixObject> captionObjs = new ArrayList<IMendixObject>();
	for(IMetaEnumValue metaEnumValue : enumPrimitive.getEnumValues())
	{
		IMendixObject enumValue = null;
		if(curEnumValues.containsKey(metaEnumValue.getIdentifier()))
			enumValue = curEnumValues.get(metaEnumValue.getIdentifier());
		else
			enumValue = Core.instantiate(context, MxObjectEnumValue.getType());

		Map<String,IMendixObject> curEnumCaptions = new HashMap<String, IMendixObject>();
		List<IMendixIdentifier> enumCaptionIds = (List<IMendixIdentifier>) enumValue.getValue(context, MxObjectEnumValue.MemberNames.Captions.toString());
		if(enumCaptionIds != null )
			for(IMendixObject enumCaptionObject : Core.retrieveIdList(context, enumCaptionIds))
				curEnumCaptions.put((String)enumCaptionObject.getValue(context, MxObjectEnumCaptions.MemberNames.LanguageCode.toString()), enumCaptionObject);

		IMendixObject enumCaption;
		for(String languageCode : this.languageCodes)
		{
			if(curEnumCaptions.containsKey(languageCode))
				enumCaption = curEnumCaptions.get(languageCode);
			else
				enumCaption = Core.instantiate(context, MxObjectEnumCaptions.getType());

			enumCaption.setValue(context, MxObjectEnumCaptions.MemberNames.Caption.toString(), Core.getInternationalizedString(languageCode, metaEnumValue.getI18NCaptionKey()));
			enumCaption.setValue(context, MxObjectEnumCaptions.MemberNames.LanguageCode.toString(), languageCode);
			captionObjs.add(enumCaption);
			captionIds.add(enumCaption.getId());
		}

		enumValue.setValue(context, MxObjectEnumValue.MemberNames.Name.toString(), metaEnumValue.getIdentifier());
		enumValue.setValue(context, MxObjectEnumValue.MemberNames.Captions.toString(), captionIds);
		Core.commit(context, captionObjs);
		captionObjs.clear();
		captionIds.clear();
		valueIds.add(enumValue.getId());
		valueObjs.add(enumValue);
	}
	
	enumObject.setValue(context, MxObjectEnum.MemberNames.Values.toString(), valueIds);
	enumObject.setValue(context, MxObjectMember.MemberNames.AttributeName.toString(), enumPrimitive.getName());
	enumObject.setValue(context, MxObjectMember.MemberNames.AttributeType.toString(), enumPrimitive.getType().toString());
	enumObject.setValue(context, MxObjectMember.MemberNames.AttributeTypeEnum.toString(), PrimitiveTypes.EnumType.toString());
	enumObject.setValue(context, MxObjectMember.MemberNames.MxObjectMember_MxObjectType.toString(), curObject.getId());
	enumObject.setValue(context, MxObjectMember.MemberNames.MxObjectMember_Type.toString(), this.builder.getTypeId(context,
			Core.createDataType(enumPrimitive.getParent().getName(), enumPrimitive.getName())
	));
	
	
	Core.commit(context, valueObjs);
	valueObjs.clear();
	valueIds.clear();
	
	
	return enumObject;
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:73,代码来源:MetaObjectBuilder.java


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