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


Java MxObjectEnumCaptions类代码示例

本文整理汇总了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;
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:73,代码来源:MetaObjectBuilder.java

示例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;
}
 
开发者ID:joelvdgraaf,项目名称:OQLMapper,代码行数:73,代码来源:MetaObjectBuilder.java


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