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


Java CoreException类代码示例

本文整理汇总了Java中com.mendix.core.CoreException的典型用法代码示例。如果您正苦于以下问题:Java CoreException类的具体用法?Java CoreException怎么用?Java CoreException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: validateTokens

import com.mendix.core.CoreException; //导入依赖的package包/类
public static List<IMendixObject> validateTokens(IContext context, String text, List<IMendixObject> tokenList) throws CoreException
{
	if (tokenList == null)
	{
		throw new CoreException("The given token list is empty.");
	}
	if (text == null)
	{
		throw new CoreException("The source text is empty.");
	}
	
	List<IMendixObject> missingTokens = new ArrayList<IMendixObject>();
	for (IMendixObject token : tokenList)
	{
		if( !isTokenPresent(context, text, token) )
			missingTokens.add(token);
	}

	return missingTokens;
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:21,代码来源:TokenReplacer.java

示例2: getCloneOfObject

import com.mendix.core.CoreException; //导入依赖的package包/类
private static IMendixIdentifier getCloneOfObject(IContext ctx, IMendixObject src,
           List<String> toskip, List<String> tokeep, List<String> revAssoc,
           List<String> skipEntities, List<String> skipModules,
           Map<IMendixIdentifier, IMendixIdentifier> mappedObjects) throws CoreException
{
    String objType = src.getMetaObject().getName();
    String modName = src.getMetaObject().getModuleName();
    
    // if object is already being cloned, return ref to clone
    if (mappedObjects.containsKey(src.getId())) {
           return mappedObjects.get(src.getId());
       // if object should be skipped based on module or entity, return source object
       } else if (skipEntities.contains(objType) || skipModules.contains(modName)) {
           return src.getId();            
        // if not already being cloned, create clone
       } else { 
           IMendixObject clone = Core.instantiate(ctx, src.getType());
           duplicate(ctx, src, clone, toskip, tokeep, revAssoc, skipEntities, skipModules, mappedObjects);
           return clone.getId();               
       }
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:22,代码来源:ORM.java

示例3: translate

import com.mendix.core.CoreException; //导入依赖的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.CoreException; //导入依赖的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: findUser

import com.mendix.core.CoreException; //导入依赖的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;
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:15,代码来源:SessionInitializer.java

示例6: sendInvite

import com.mendix.core.CoreException; //导入依赖的package包/类
public static void sendInvite(IContext context, java.lang.String _environmentUUID, java.lang.String _environmentPassword, java.lang.String _roleUUID, java.lang.String _inviteeEmailAddress, java.lang.String _inviterEmailAddress)
{
	try
	{
		Map<java.lang.String, Object> params = new HashMap<java.lang.String, Object>();
		params.put("EnvironmentUUID", _environmentUUID);
		params.put("EnvironmentPassword", _environmentPassword);
		params.put("RoleUUID", _roleUUID);
		params.put("InviteeEmailAddress", _inviteeEmailAddress);
		params.put("InviterEmailAddress", _inviterEmailAddress);
		Core.execute(context, "InviteAPI.SendInvite", params);
	}
	catch (CoreException e)
	{
		throw new MendixRuntimeException(e);
	}
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:18,代码来源:Microflows.java

示例7: invokeOnNonFirstLoginAppCloudUser

import com.mendix.core.CoreException; //导入依赖的package包/类
public static void invokeOnNonFirstLoginAppCloudUser(IContext context, system.proxies.User _user)
{
	try
	{
		Map<java.lang.String, Object> params = new HashMap<java.lang.String, Object>();
		params.put("User", _user == null ? null : _user.getMendixObject());
		Core.execute(context, "AppCloudServices.InvokeOnNonFirstLoginAppCloudUser", params);
	}
	catch (CoreException e)
	{
		throw new MendixRuntimeException(e);
	}
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:14,代码来源:Microflows.java

示例8: findAllTests

import com.mendix.core.CoreException; //导入依赖的package包/类
public synchronized void findAllTests(IContext context) throws CoreException {
	/*
	 * Find modules
	 */
	Set<String> modules = new HashSet<String>();
	for(String name : Core.getMicroflowNames())
		modules.add(name.split("\\.")[0]);
	
	/*
	 * Update modules
	 */
	for(String module : modules) {
		TestSuite testSuite = XPath.create(context, TestSuite.class).findOrCreate(TestSuite.MemberNames.Module, module);
		updateUnitTestList(context, testSuite);
	}
	
	/*
	 * Remove all modules without tests
	 */
	XPath.create(context, TestSuite.class).not().hasReference(UnitTest.MemberNames.UnitTest_TestSuite, UnitTest.entityName).close().deleteAll();
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:22,代码来源:TestManager.java

示例9: createMessageResponse

import com.mendix.core.CoreException; //导入依赖的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

示例10: findOrCreateSynchronized

import com.mendix.core.CoreException; //导入依赖的package包/类
public T findOrCreateSynchronized(Object... keysAndValues) throws CoreException, InterruptedException {
	T res = findFirst(keysAndValues);
	
	if (res != null) {
		return res;
	} else {
		synchronized (Core.getMetaObject(entity)) {
			IContext synchronizedContext = context.getSession().createContext().createSudoClone();
			try {
				synchronizedContext.startTransaction();
				res = createProxy(synchronizedContext, proxyClass, XPath.create(synchronizedContext, entity).findOrCreate(keysAndValues));
				synchronizedContext.endTransaction();
				return res;
			} catch (CoreException e) {
				if (synchronizedContext.isInTransaction()) {
					synchronizedContext.rollbackTransAction();
				}
				throw e;
			}
		}
	}
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:23,代码来源:XPath.java

示例11: test_SubscribeTwoMosquittoImportTopics

import com.mendix.core.CoreException; //导入依赖的package包/类
public static void test_SubscribeTwoMosquittoImportTopics(IContext context)
{
	try
	{
		Map<java.lang.String, Object> params = new HashMap<java.lang.String, Object>();
		Core.execute(context, "TestMqttClient.Test_SubscribeTwoMosquittoImportTopics", params);
	}
	catch (CoreException e)
	{
		throw new MendixRuntimeException(e);
	}
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:13,代码来源:Microflows.java

示例12: handleMembers

import com.mendix.core.CoreException; //导入依赖的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

示例13: processMember

import com.mendix.core.CoreException; //导入依赖的package包/类
public void processMember(IContext context, IMendixObject curObject, Map<String, IMendixObject> membersByName, List<IMendixObject> memberList, IMetaPrimitive metaPrimitive, String name) throws CoreException {
	IMendixObject curMember;
	IDataType memberType = Core.createDataType(metaPrimitive.getType().toString());
	if( !membersByName.containsKey(name) )
	{
		curMember = Core.instantiate(context, MxObjectMember.getType());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeName.toString(), name);
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeType.toString(), metaPrimitive.getType().toString());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeTypeEnum.toString(), 
				this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()) != null ? this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()).toString() : null);
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_MxObjectType.toString(), curObject.getId());
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_Type.toString(), this.builder.getTypeId(context, memberType));
		curMember.setValue(context, MxObjectMember.MemberNames.FieldLength.toString(), metaPrimitive.getLength());
		curMember.setValue(context, MxObjectMember.MemberNames.IsVirtual.toString(), metaPrimitive.isVirtual());
		
		memberList.add(curMember);
	}
	else
	{
		curMember = membersByName.get(name);
		if(MxObjectEnum.getType().equals(curMember.getType()))
		{
			Core.delete(context, curMember);
			curMember = Core.instantiate(context, MxObjectMember.getType());
			curMember.setValue(context, MxObjectMember.MemberNames.AttributeName.toString(), name);
			curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_MxObjectType.toString(), curObject.getId());
		}
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_Type.toString(), this.builder.getTypeId(context, memberType));
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeType.toString(), metaPrimitive.getType().toString());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeTypeEnum.toString(), 
				this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()) != null ? this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()).toString() : null);
		curMember.setValue(context, MxObjectMember.MemberNames.FieldLength.toString(), metaPrimitive.getLength());
		curMember.setValue(context, MxObjectMember.MemberNames.IsVirtual.toString(), metaPrimitive.isVirtual());
		
		memberList.add(curMember);
		
		membersByName.remove(name);
	}
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:40,代码来源:MetaObjectBuilder.java

示例14: serveRunStart

import com.mendix.core.CoreException; //导入依赖的package包/类
private synchronized void serveRunStart(HttpServletRequest request,
		HttpServletResponse response, String path) throws IOException, CoreException, InvalidCredentialsException {
	JSONObject input = parseInput(request);
	verifyPassword(input);

	IContext context = Core.createSystemContext();
	if (!detectedUnitTests) {
		TestManager.instance().findAllTests(context);
		detectedUnitTests = true;
	}
	
	if (testSuiteRunner != null && !testSuiteRunner.isFinished()) {
		throw new IllegalArgumentException("Cannot start a test run while another test run is still running");
	}
	
	LOG.info("[remote api] starting new test run");
	testSuiteRunner = new TestSuiteRunner();
	
	Thread t = new Thread() {
		@Override
		public void run() {
			testSuiteRunner.run();
		}
	};
	
	t.start();
	response.setStatus(HttpServletResponse.SC_NO_CONTENT);		
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:29,代码来源:RemoteApiServlet.java

示例15: onCompleteAnonymousLogin

import com.mendix.core.CoreException; //导入依赖的package包/类
public void onCompleteAnonymousLogin(String continuation, IMxRuntimeRequest req, IMxRuntimeResponse resp)
		throws CoreException, IllegalStateException, IOException
{
	try {
		/** Setting up guest sessions is not the responsibility of this module, but otherwise:
			if (Core.getConfiguration().getEnableGuestLogin()) {
				ISession session = Core.initializeGuestSession();
				SessionInitializer.writeSessionCookies(resp, session);
			}
		*/
		SessionInitializer.redirectToIndex(resp, continuation);
	} catch (Exception e) {
		OpenIDHandler.error(resp, ResponseType.INTERNAL_SERVER_ERROR, "Failed to initialize session", e);
	}
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:16,代码来源:DefaultLoginHandler.java


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