本文整理汇总了Java中com.mendix.core.Core类的典型用法代码示例。如果您正苦于以下问题:Java Core类的具体用法?Java Core怎么用?Java Core使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Core类属于com.mendix.core包,在下文中一共展示了Core类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: messageArrived
import com.mendix.core.Core; //导入依赖的package包/类
@Override
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
try {
logger.info(String.format("messageArrived: %s, %s, %s", topic, new String(mqttMessage.getPayload()), client.getClientId()));
IContext ctx = Core.createSystemContext();
ISession session = ctx.getSession();
MqttSubscription subscription = getSubscriptionForTopic(topic);
if (subscription != null) {
String microflow = subscription.getOnMessageMicroflow();
logger.info(String.format("Calling onMessage microflow: %s, %s", microflow, client.getClientId()));
final ImmutableMap map = ImmutableMap.of("Topic", topic, "Payload", new String(mqttMessage.getPayload()));
logger.info("Parameter map: " + map);
//Core.execute(ctx, microflow, true, map);
Core.executeAsync(ctx, microflow, true, map);
} else {
logger.error(String.format("Cannot find microflow for message received on topic %s", topic));
}
} catch (Exception e) {
logger.error(e);
}
}
开发者ID:ako,项目名称:MqttClient,代码行数:22,代码来源:MxMqttCallback.java
示例3: getFileSize
import com.mendix.core.Core; //导入依赖的package包/类
public static Long getFileSize(IContext context, IMendixObject document)
{
final int BUFFER_SIZE = 4096;
long size = 0;
if (context != null) {
InputStream inputStream = null;
byte[] buffer = new byte[BUFFER_SIZE];
try {
inputStream = Core.getFileDocumentContent(context, document);
int i;
while ((i = inputStream.read(buffer)) != -1)
size += i;
} catch (IOException e) {
Core.getLogger("FileUtil").error(
"Couldn't determine filesize of FileDocument '" + document.getId());
} finally {
IOUtils.closeQuietly(inputStream);
}
}
return size;
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:25,代码来源:Misc.java
示例4: getUserProfile
import com.mendix.core.Core; //导入依赖的package包/类
public static profileservice.proxies.UserProfile getUserProfile(IContext context, java.lang.String _openID, java.lang.String _environmentUUID, java.lang.String _environmentPassword)
{
try
{
Map<java.lang.String, Object> params = new HashMap<java.lang.String, Object>();
params.put("OpenID", _openID);
params.put("EnvironmentUUID", _environmentUUID);
params.put("EnvironmentPassword", _environmentPassword);
IMendixObject result = (IMendixObject)Core.execute(context, "ProfileService.GetUserProfile", params);
return result == null ? null : profileservice.proxies.UserProfile.initialize(context, result);
}
catch (CoreException e)
{
throw new MendixRuntimeException(e);
}
}
开发者ID:ako,项目名称:MqttClient,代码行数:17,代码来源:Microflows.java
示例5: findOrCreateSynchronized
import com.mendix.core.Core; //导入依赖的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:mendix,项目名称:database-connector,代码行数:23,代码来源:XPath.java
示例6: 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
示例7: getRolesForOpenID
import com.mendix.core.Core; //导入依赖的package包/类
public static java.util.List<permissionsapi.proxies.AppRole> getRolesForOpenID(IContext context, java.lang.String _openID, java.lang.String _environmentID, java.lang.String _environmentPassword)
{
try
{
Map<java.lang.String, Object> params = new HashMap<java.lang.String, Object>();
params.put("OpenID", _openID);
params.put("EnvironmentID", _environmentID);
params.put("EnvironmentPassword", _environmentPassword);
java.util.List<IMendixObject> objs = Core.execute(context, "PermissionsAPI.GetRolesForOpenID", params);
java.util.List<permissionsapi.proxies.AppRole> result = null;
if (objs != null)
{
result = new java.util.ArrayList<permissionsapi.proxies.AppRole>();
for (IMendixObject obj : objs)
result.add(permissionsapi.proxies.AppRole.initialize(context, obj));
}
return result;
}
catch (CoreException e)
{
throw new MendixRuntimeException(e);
}
}
开发者ID:ako,项目名称:MqttClient,代码行数:24,代码来源:Microflows.java
示例8: removeInactiveModules
import com.mendix.core.Core; //导入依赖的package包/类
public void removeInactiveModules(IContext context) throws CoreException {
for (Entry<String, IMendixObject> entry : this.moduleMap.entrySet()) {
if (!this.activeModule.contains(entry.getKey())) {
if (entry.getValue() != null)
Core.delete(context, entry.getValue());
else
Core.delete(context, Core.retrieveXPathQuery(context, "//" + Module.getType() + "[" + Module.MemberNames.ModuleName + "='" + entry.getKey() + "']").get(0));
}
}
this.moduleMap.clear();
this.activeModule.clear();
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:14,代码来源:Builder.java
示例9: findMicroflowUnitTests
import com.mendix.core.Core; //导入依赖的package包/类
public List<String> findMicroflowUnitTests(TestSuite testRun)
{
List<String> mfnames = new ArrayList<String>();
String basename1 = (testRun.getModule() + "." + TEST_MICROFLOW_PREFIX_1).toLowerCase();
String basename2 = (testRun.getModule() + "." + TEST_MICROFLOW_PREFIX_2).toLowerCase();
//Find microflownames
for (String mf : Core.getMicroflowNames())
if (mf.toLowerCase().startsWith(basename1) || mf.toLowerCase().startsWith(basename2))
mfnames.add(mf);
//Sort microflow names
Collections.sort(mfnames);
return mfnames;
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:17,代码来源:TestManager.java
示例10: findAllTests
import com.mendix.core.Core; //导入依赖的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
示例11: executeAction
import com.mendix.core.Core; //导入依赖的package包/类
@Override
public Boolean executeAction() throws Exception
{
this.testRun = __testRun == null ? null : unittesting.proxies.TestSuite.initialize(getContext(), __testRun);
// BEGIN USER CODE
try {
//Run tests in a new context without transaction!
TestManager.instance().runTestSuite(Core.createSystemContext(), testRun);
}
catch(Exception e) {
TestManager.LOG.error("An error occurred while trying to run the unit tests: " + ExceptionUtils.getRootCauseMessage(e), e);
return false;
}
return true;
// END USER CODE
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:18,代码来源:RunAllUnitTestsWrapper.java
示例12: getCloneOfObject
import com.mendix.core.Core; //导入依赖的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:mendix,项目名称:database-connector,代码行数:22,代码来源:ORM.java
示例13: runMicroflowAsyncInQueue
import com.mendix.core.Core; //导入依赖的package包/类
public static Boolean runMicroflowAsyncInQueue(final String microflowName)
{
MFSerialExecutor.instance().execute(new Runnable() {
@Override
public void run()
{
try
{
Future<Object> future = Core.executeAsync(Core.createSystemContext(), microflowName, true, new HashMap<String,Object>()); //MWE: somehow, it only works with system context... well thats OK for now.
future.get();
}
catch (Exception e)
{
throw new RuntimeException("Failed to run Async: "+ microflowName + ": " + e.getMessage(), e);
}
}
});
return true;
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:20,代码来源:Misc.java
示例14: executeAction
import com.mendix.core.Core; //导入依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
this.testRun = __testRun == null ? null : unittesting.proxies.TestSuite.initialize(getContext(), __testRun);
// BEGIN USER CODE
try {
//Run tests in a new context without transaction!
TestManager.instance().runTestSuite(Core.createSystemContext(), testRun);
}
catch(Exception e) {
TestManager.LOG.error("An error occurred while trying to run the unit tests: " + ExceptionUtils.getRootCauseMessage(e), e);
return false;
}
return true;
// END USER CODE
}
开发者ID:ako,项目名称:MqttClient,代码行数:18,代码来源:RunAllUnitTestsWrapper.java
示例15: findOrCreateSynchronized
import com.mendix.core.Core; //导入依赖的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().getSudoContext();
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:appronto,项目名称:RedisConnector,代码行数:23,代码来源:XPath.java
示例16: findMicroflowUnitTests
import com.mendix.core.Core; //导入依赖的package包/类
public List<String> findMicroflowUnitTests(TestSuite testRun)
{
List<String> mfnames = new ArrayList<String>();
if(testRun.getPrefix1() == null) {
testRun.setPrefix1("Test_");
}
if(testRun.getPrefix2() == null) {
testRun.setPrefix2("UT_");
}
String basename1 = (testRun.getModule() + "." + testRun.getPrefix1()).toLowerCase();
String basename2 = (testRun.getModule() + "." + testRun.getPrefix2()).toLowerCase();
//Find microflownames
for (String mf : Core.getMicroflowNames())
if (mf.toLowerCase().startsWith(basename1) || mf.toLowerCase().startsWith(basename2))
mfnames.add(mf);
//Sort microflow names
Collections.sort(mfnames);
return mfnames;
}
开发者ID:mendix,项目名称:database-connector,代码行数:25,代码来源:TestManager.java
示例17: log
import com.mendix.core.Core; //导入依赖的package包/类
public static void log(String lognode, LogLevel loglevel, String message, Throwable e) {
ILogNode logger = Core.getLogger(lognode);
switch (loglevel) {
case Critical:
logger.critical(message,e);
break;
case Warning:
logger.warn(message,e);
break;
case Debug:
logger.debug(message);
break;
case Error:
logger.error(message,e);
break;
case Info:
logger.info(message);
break;
case Trace:
logger.trace(message);
break;
}
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:24,代码来源:Logging.java
示例18: substituteTemplate
import com.mendix.core.Core; //导入依赖的package包/类
public static String substituteTemplate(final IContext context, String template,
final IMendixObject substitute, final boolean HTMLEncode, final String datetimeformat) {
return regexReplaceAll(template, "\\{(@)?([\\w./]+)\\}", new Function<MatchResult, String>() {
@Override
public String apply(MatchResult match)
{
String value;
String path = match.group(2);
if (match.group(1) != null)
value = String.valueOf(Core.getConfiguration().getConstantValue(path));
else {
try
{
value = ORM.getValueOfPath(context, substitute, path, datetimeformat);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
return HTMLEncode ? HTMLEncode(value) : value;
}
});
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:27,代码来源:StringUtils.java
示例19: test_SubscribeTwoMosquittoImportTopics
import com.mendix.core.Core; //导入依赖的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
示例20: Synthesize
import com.mendix.core.Core; //导入依赖的package包/类
public static IMendixObject Synthesize(IContext context, String text, VoiceEnum voiceEnumParameter, String username, String password) throws MendixException {
LOGGER.debug("Executing Synthetize Connector...");
service.setUsernameAndPassword(username, password);
final Voice voice = getVoice(voiceEnumParameter);
InputStream stream;
try {
stream = service.synthesize(text, voice, AudioFormat.OGG).execute();
} catch (Exception e) {
LOGGER.error("Watson Service Connection - Failed text to speech: " + StringUtils.abbreviate(text, 20), e);
throw new MendixException(e);
}
final IMendixObject speechObject = Core.instantiate(context, Speech.entityName);
Core.storeFileDocumentContent(context, speechObject, stream);
return speechObject;
}
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:21,代码来源:TextToSpeechService.java
注:本文中的com.mendix.core.Core类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论