本文整理汇总了Java中mxmodelreflection.proxies.MxObjectEnumCaptions类的典型用法代码示例。如果您正苦于以下问题:Java MxObjectEnumCaptions类的具体用法?Java MxObjectEnumCaptions怎么用?Java MxObjectEnumCaptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MxObjectEnumCaptions类属于mxmodelreflection.proxies包,在下文中一共展示了MxObjectEnumCaptions类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEnumMember
import mxmodelreflection.proxies.MxObjectEnumCaptions; //导入依赖的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;
}
示例2: handleEnumMember
import mxmodelreflection.proxies.MxObjectEnumCaptions; //导入依赖的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;
}