本文整理汇总了Java中com.mendix.systemwideinterfaces.core.IMendixObject类的典型用法代码示例。如果您正苦于以下问题:Java IMendixObject类的具体用法?Java IMendixObject怎么用?Java IMendixObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMendixObject类属于com.mendix.systemwideinterfaces.core包,在下文中一共展示了IMendixObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateModule
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的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);
}
示例2: getTypeId
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的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();
}
示例3: cloneObject
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
public static Boolean cloneObject(IContext c, IMendixObject source,
IMendixObject target, Boolean withAssociations)
{
Map<String, ? extends IMendixObjectMember<?>> members = source.getMembers(c);
for(String key : members.keySet()) {
IMendixObjectMember<?> m = members.get(key);
if (m.isVirtual())
continue;
if (m instanceof MendixAutoNumber)
continue;
if (withAssociations || ((!(m instanceof MendixObjectReference) && !(m instanceof MendixObjectReferenceSet)&& !(m instanceof MendixAutoNumber))))
target.setValue(c, key, m.getValue(c));
}
return true;
}
示例4: getCloneOfObject
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的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();
}
}
示例5: copyAttributes
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
public static void copyAttributes(IContext context, IMendixObject source, IMendixObject target)
{
if (source == null)
throw new IllegalStateException("source is null");
if (target == null)
throw new IllegalStateException("target is null");
for(IMetaPrimitive e : target.getMetaObject().getMetaPrimitives()) {
if (!source.hasMember(e.getName()))
continue;
if (e.isVirtual() || e.getType() == PrimitiveType.AutoNumber)
continue;
target.setValue(context, e.getName(), source.getValue(context, e.getName()));
}
}
示例6: handleMxObject
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的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;
}
示例7: ReplaceToken
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
public ReplaceToken(IContext context, IMendixObject TokenObject, IMendixObject ValueObject, String TextToReplace)
{
super(context);
this.__TokenObject = TokenObject;
this.ValueObject = ValueObject;
this.TextToReplace = TextToReplace;
}
示例8: substituteTemplate
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的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;
}
});
}
示例9: deepClone
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
public static void deepClone(IContext c, IMendixObject source, IMendixObject target, String membersToSkip, String membersToKeep, String reverseAssociations, String excludeEntities, String excludeModules) throws CoreException
{
List<String> toskip = Arrays.asList((membersToSkip + ",createdDate,changedDate").split(","));
List<String> tokeep = Arrays.asList((membersToKeep + ",System.owner,System.changedBy").split(","));
List<String> revAssoc = Arrays.asList(reverseAssociations.split(","));
List<String> skipEntities = Arrays.asList(excludeEntities.split(","));
List<String> skipModules = Arrays.asList(excludeModules.split(","));
Map<IMendixIdentifier, IMendixIdentifier> mappedIDs = new HashMap<IMendixIdentifier, IMendixIdentifier>();
duplicate(c, source, target, toskip, tokeep, revAssoc, skipEntities, skipModules, mappedIDs);
}
示例10: memberHasChanged
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
/**
* checks whether a certain member of an object has changed. If the objects itself is still new, we consider to be changes as well.
* @param item
* @param member
* @param context
* @return
*/
public static boolean memberHasChanged(IContext context, IMendixObject item, String member)
{
if (item == null)
throw new IllegalArgumentException("The provided object is empty");
if (!item.hasMember(member))
throw new IllegalArgumentException("Unknown member: " + member);
return item.getMember(context, member).getState() == MemberState.CHANGED || item.getState() != ObjectState.NORMAL;
}
示例11: testObjectInstantiatorException
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
@Test public void testObjectInstantiatorException() throws SQLException {
Exception testException = new IllegalArgumentException("Test Exception Text");
when(connectionManager.getConnection(anyString(), anyString(), anyString())).thenReturn(connection);
when(connection.prepareStatement(anyString())).thenReturn(preparedStatement);
when(preparedStatement.executeQuery()).thenReturn(resultSet);
when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
when(resultSet.next()).thenReturn(true, false);
when(objectInstantiator.instantiate(anyObject(), anyString())).thenThrow(testException);
Stream<IMendixObject> result = jdbcConnector.executeQuery(jdbcUrl, userName, password, mockIMetaObject(), sqlQuery, context);
try {
result.count();
fail("An exception should occur!");
} catch(IllegalArgumentException iae) {}
verify(objectInstantiator).instantiate(context, entityName);
verify(connection).close();
verify(preparedStatement).close();
verify(resultSet).close();
}
示例12: executeAction
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
@Override
public java.util.List<IMendixObject> executeAction() throws Exception
{
// BEGIN USER CODE
List<IMendixObject> objectList = new ArrayList<IMendixObject>();
objectList.add(this.inputObject);
return objectList;
// END USER CODE
}
示例13: executeAction
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
@Override
public java.util.List<IMendixObject> executeAction() throws Exception
{
this.TokenList = new java.util.ArrayList<mxmodelreflection.proxies.Token>();
if (__TokenList != null)
for (IMendixObject __TokenListElement : __TokenList)
this.TokenList.add(mxmodelreflection.proxies.Token.initialize(getContext(), __TokenListElement));
// BEGIN USER CODE
return TokenReplacer.validateTokens(this.getContext(), this.Text, __TokenList);
// END USER CODE
}
示例14: XPath
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
private XPath(IContext c, Class<T> proxyClass) {
try
{
if (proxyClass != IMendixObject.class)
this.entity = (String) proxyClass.getMethod("getType").invoke(null);
}
catch (Exception e)
{
throw new IllegalArgumentException("Failed to determine entity type of proxy class. Did you provide a valid proxy class? '" + proxyClass.getName() + "'");
}
this.proxyClass = proxyClass;
this.context = c;
}
示例15: executeAction
import com.mendix.systemwideinterfaces.core.IMendixObject; //导入依赖的package包/类
@Override
public IMendixObject executeAction() throws Exception
{
this.translation = __translation == null ? null : watsonservices.proxies.Translation.initialize(getContext(), __translation);
// BEGIN USER CODE
return LanguageTranslationService.translate(getContext(), translation, username, password);
// END USER CODE
}