本文整理匯總了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;
}