• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IMetaPrimitive类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive的典型用法代码示例。如果您正苦于以下问题:Java IMetaPrimitive类的具体用法?Java IMetaPrimitive怎么用?Java IMetaPrimitive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMetaPrimitive类属于com.mendix.systemwideinterfaces.core.meta包,在下文中一共展示了IMetaPrimitive类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: copyAttributes

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的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()));
	}
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:17,代码来源:ORM.java


示例2: executeAction

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
@Override
public Boolean executeAction() throws Exception
{
	// BEGIN USER CODE
	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 (e.isVirtual() || e.getType() == PrimitiveType.AutoNumber)
			continue;
		if (!Source.hasMember(e.getName()))
			throw new TestManager.AssertionException("Attribute of "+e.getName() + " is not present in Source: " + Source.getMetaObject().getName());
		if ( !Source.getValue(getContext(), e.getName()).equals(Target.getValue(getContext(), e.getName())))
		{
			throw new TestManager.AssertionException("Value of "+ Source.getMetaObject().getName() + " / " + e.getName() + " is not equal; was \""+ Target.getValue(getContext(), e.getName()) +"\" expected \"" + Source.getValue(getContext(), e.getName())+"\"" );
		}
	}
	return true;
	// END USER CODE
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:23,代码来源:AssertAttributesAndValues.java


示例3: mockIMetaObject

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private IMetaObject mockIMetaObject(SimpleEntry<String, IMetaPrimitive.PrimitiveType>... entries) {
  IMetaObject metaObject = mock(IMetaObject.class);
  when(metaObject.getName()).thenReturn(entityName);

  final Collection<IMetaPrimitive> primitives = new ArrayList<>();

  Arrays.asList(entries).forEach(entry -> {
    IMetaPrimitive metaPrimitive = mock(IMetaPrimitive.class);
    when(metaPrimitive.getName()).thenReturn(entry.getKey());
    when(metaPrimitive.getType()).thenReturn(entry.getValue());
    when(metaObject.getMetaPrimitive(entry.getKey())).thenReturn(metaPrimitive);
    primitives.add(metaPrimitive);
  });

  Mockito.<Collection<? extends IMetaPrimitive>>when(metaObject.getMetaPrimitives()).thenReturn(primitives);
  return metaObject;
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:18,代码来源:JdbcConnectorTest.java


示例4: mockMetaObjectWithAllPrimitives

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private IMetaObject mockMetaObjectWithAllPrimitives() {
  final IMetaObject metaObject = mock(IMetaObject.class);
  final Collection<? extends IMetaPrimitive> allPrimitives = Arrays.asList(
      integerPrimitive,
      autoNumberPrimitive,
      longPrimitive,
      booleanPrimitive,
      decimalPrimitive,
      floatPrimitive,
      currencyPrimitive,
      hashStringPrimitive,
      enumPrimitive,
      stringPrimitive,
      binaryPrimitive,
      dateTimePrimitive
  );
  Mockito.<Collection<? extends IMetaPrimitive>>when(metaObject.getMetaPrimitives()).thenReturn(allPrimitives);
  return metaObject;
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:20,代码来源:ResultSetReaderTest.java


示例5: getColumnInfo

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private ColumnInfo getColumnInfo(final int index) {
  final String columnName;

  try {
    columnName = resultSet.getMetaData().getColumnName(index);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  final Predicate<IMetaPrimitive> caseInsensitiveName = (IMetaPrimitive mp) -> mp.getName().equalsIgnoreCase(columnName);
  final Optional<? extends IMetaPrimitive> primitive = metaObject.getMetaPrimitives().stream().filter(caseInsensitiveName).findFirst();

  final IMetaPrimitive.PrimitiveType type = primitive.<RuntimeException>orElseThrow(() -> {
    final String msg = "The entity type '%s' does not contain the primitive '%s' as specified in the query.";
    throw new RuntimeException(String.format(msg, metaObject.getName(), columnName));
  }).getType();

  return new ColumnInfo(index, columnName, type);
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:20,代码来源:ResultSetIterator.java


示例6: handleMembers

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private void handleMembers(IContext context, IMetaObject metaObject, IMendixObject curObject) throws CoreException
{
	Map<String,IMendixObject> membersByName = new HashMap<String, IMendixObject>();
	List<IMendixObject> existingMembers = Core.retrieveXPathQuery(context, "//" + MxObjectMember.getType() + "[" + MxObjectMember.MemberNames.MxObjectMember_MxObjectType + "='" + curObject.getId().toLong() + "']");
	for(IMendixObject obj : existingMembers)
		membersByName.put((String)obj.getValue(context, MxObjectMember.MemberNames.AttributeName.toString()), obj);

	List<IMendixObject> memberList = new ArrayList<IMendixObject>();
	for(IMetaPrimitive metaPrimitive : metaObject.getMetaPrimitives())
	{
		String name = metaPrimitive.getName();
		if(metaPrimitive.getType() == PrimitiveType.Enum)
		{
			if(membersByName.containsKey(name))
			{
				IMendixObject curMember = membersByName.get(name);
				if(MxObjectEnum.getType().equals(curMember.getType()))
				{
					memberList.add(this.handleEnumMember(context, curMember, metaPrimitive, curObject));
					membersByName.remove(name);
				}
				else
				{
					Core.delete(context, curMember);
					memberList.add(this.handleEnumMember(context, null, metaPrimitive, curObject));
				}
			}
			else
				memberList.add(this.handleEnumMember(context, null, metaPrimitive, curObject));
		}
		else
		{
			processMember(context, curObject, membersByName, memberList, metaPrimitive, name);
		}
	}		
	Core.commit(context, memberList);

	this.builder.removeDeletedObjects(context, membersByName);
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:40,代码来源:MetaObjectBuilder.java


示例7: processMember

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
public void processMember(IContext context, IMendixObject curObject, Map<String, IMendixObject> membersByName, List<IMendixObject> memberList, IMetaPrimitive metaPrimitive, String name) throws CoreException {
	IMendixObject curMember;
	IDataType memberType = Core.createDataType(metaPrimitive.getType().toString());
	if( !membersByName.containsKey(name) )
	{
		curMember = Core.instantiate(context, MxObjectMember.getType());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeName.toString(), name);
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeType.toString(), metaPrimitive.getType().toString());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeTypeEnum.toString(), 
				this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()) != null ? this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()).toString() : null);
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_MxObjectType.toString(), curObject.getId());
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_Type.toString(), this.builder.getTypeId(context, memberType));
		curMember.setValue(context, MxObjectMember.MemberNames.FieldLength.toString(), metaPrimitive.getLength());
		curMember.setValue(context, MxObjectMember.MemberNames.IsVirtual.toString(), metaPrimitive.isVirtual());
		
		memberList.add(curMember);
	}
	else
	{
		curMember = membersByName.get(name);
		if(MxObjectEnum.getType().equals(curMember.getType()))
		{
			Core.delete(context, curMember);
			curMember = Core.instantiate(context, MxObjectMember.getType());
			curMember.setValue(context, MxObjectMember.MemberNames.AttributeName.toString(), name);
			curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_MxObjectType.toString(), curObject.getId());
		}
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_Type.toString(), this.builder.getTypeId(context, memberType));
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeType.toString(), metaPrimitive.getType().toString());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeTypeEnum.toString(), 
				this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()) != null ? this.builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()).toString() : null);
		curMember.setValue(context, MxObjectMember.MemberNames.FieldLength.toString(), metaPrimitive.getLength());
		curMember.setValue(context, MxObjectMember.MemberNames.IsVirtual.toString(), metaPrimitive.isVirtual());
		
		memberList.add(curMember);
		
		membersByName.remove(name);
	}
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:40,代码来源:MetaObjectBuilder.java


示例8: mockMetaObject

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private IMetaObject mockMetaObject() {
  final IMetaObject metaObject = mock(IMetaObject.class);
  final Collection<? extends IMetaPrimitive> stringPrimitives = Arrays.asList(
      mockMetaPrimitive("a", PrimitiveType.String),
      mockMetaPrimitive("b", PrimitiveType.String),
      mockMetaPrimitive("c", PrimitiveType.String)
  );
  Mockito.<Collection<? extends IMetaPrimitive>>when(metaObject.getMetaPrimitives()).thenReturn(stringPrimitives);
  return metaObject;
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:11,代码来源:ResultSetIteratorTest.java


示例9: mockMetaObjectWithThreePrimitives

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private IMetaObject mockMetaObjectWithThreePrimitives() {
  final IMetaObject metaObject = mock(IMetaObject.class);
  final Collection<? extends IMetaPrimitive> allPrimitives = Arrays.asList(
      integerPrimitive,
      booleanPrimitive,
      stringPrimitive
  );
  Mockito.<Collection<? extends IMetaPrimitive>>when(metaObject.getMetaPrimitives()).thenReturn(allPrimitives);
  return metaObject;
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:11,代码来源:ResultSetReaderTest.java


示例10: processMember

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
public void processMember(IContext context, IMendixObject curObject, Map<String, IMendixObject> membersByName, List<IMendixObject> memberList, IMetaPrimitive metaPrimitive, String name) throws CoreException {
	IMendixObject curMember;
	IDataType memberType = Core.createDataType(metaPrimitive.getType().toString());
	if( !membersByName.containsKey(name) )
	{
		curMember = Core.instantiate(context, MxObjectMember.getType());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeName.toString(), name);
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeType.toString(), metaPrimitive.getType().toString());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeTypeEnum.toString(), 
				builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()) != null ? builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()).toString() : null);
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_MxObjectType.toString(), curObject.getId());
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_Type.toString(), this.builder.getTypeId(context, memberType));
		curMember.setValue(context, MxObjectMember.MemberNames.FieldLength.toString(), metaPrimitive.getLength());
		memberList.add(curMember);
	}
	else
	{
		curMember = membersByName.get(name);
		if(MxObjectEnum.getType().equals(curMember.getType()))
		{
			Core.delete(context, curMember);
			curMember = Core.instantiate(context, MxObjectMember.getType());
			curMember.setValue(context, MxObjectMember.MemberNames.AttributeName.toString(), name);
			curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_MxObjectType.toString(), curObject.getId());
		}
		curMember.setValue(context, MxObjectMember.MemberNames.MxObjectMember_Type.toString(), this.builder.getTypeId(context, memberType));
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeType.toString(), metaPrimitive.getType().toString());
		curMember.setValue(context, MxObjectMember.MemberNames.AttributeTypeEnum.toString(), 
				builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()) != null ? builder.getPrimitiveTypesFromPrimitiveType(metaPrimitive.getType()).toString() : null);
		curMember.setValue(context, MxObjectMember.MemberNames.FieldLength.toString(), metaPrimitive.getLength());
		memberList.add(curMember);
		
		membersByName.remove(name);
	}
}
 
开发者ID:joelvdgraaf,项目名称:OQLMapper,代码行数:36,代码来源:MetaObjectBuilder.java


示例11: handleEnumMember

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的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


示例12: entry

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private SimpleEntry<String, IMetaPrimitive.PrimitiveType> entry(String name, IMetaPrimitive.PrimitiveType type) {
  return new SimpleEntry<>(name, type);
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:4,代码来源:JdbcConnectorTest.java


示例13: mockMetaPrimitive

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private IMetaPrimitive mockMetaPrimitive(String name, PrimitiveType type) {
  final IMetaPrimitive primitive = mock(IMetaPrimitive.class);
  when(primitive.getType()).thenReturn(type);
  when(primitive.getName()).thenReturn(name);
  return primitive;
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:7,代码来源:ResultSetIteratorTest.java


示例14: mockMetaObjectWithStringPrimitive

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private IMetaObject mockMetaObjectWithStringPrimitive() {
  final IMetaObject metaObject = mock(IMetaObject.class);
  final Collection<? extends IMetaPrimitive> allPrimitives = Arrays.asList(stringPrimitive);
  Mockito.<Collection<? extends IMetaPrimitive>>when(metaObject.getMetaPrimitives()).thenReturn(allPrimitives);
  return metaObject;
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:7,代码来源:ResultSetReaderTest.java


示例15: mockMetaPrimitive

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private IMetaPrimitive mockMetaPrimitive(PrimitiveType primitiveType) {
  return mockMetaPrimitive(primitiveType.name(), primitiveType);
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:4,代码来源:ResultSetReaderTest.java


示例16: handleEnumMember

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的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


示例17: consistencyCheck

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
private void consistencyCheck() throws CoreException {
	String secError = ConsistencyChecker.checkAccessRole(this.roleOrMicroflow);
	if (secError != null)
		throw new IllegalArgumentException("Cannot publish microflow " + microflowname + ": " + secError);

	int argCount = Utils.getArgumentTypes(microflowname).size();

	if (argCount > 1)
		throw new IllegalArgumentException("Cannot publish microflow " + microflowname + ", it should exist and have exactly zero or one argument");

	hasArgument = argCount == 1;
	
	List<String> pathParams = new UriTemplate(relativeUrl).getTemplateVariables();
	if (pathParams.size() > 0 && !hasArgument) {
		throw new IllegalArgumentException("Cannot publish microflow " + microflowname + " with path '" + relativeUrl + ", the microflow should have a single input argument object with at least attributes " + pathParams);
	}
	
	if (hasArgument) {
		IDataType argtype = Utils.getFirstArgumentType(microflowname);
		if (!argtype.isMendixObject())
			throw new IllegalArgumentException("Cannot publish microflow " + microflowname + ", it should have a single object as input argument");
		this.argType = argtype.getObjectType();
		this.argName = Utils.getArgumentTypes(microflowname).keySet().iterator().next();
		isFileSource = Core.isSubClassOf(FileDocument.entityName, argType);

		
		IMetaObject metaObject = Core.getMetaObject(argType);
		if (metaObject.isPersistable() && !isFileSource)
			throw new IllegalArgumentException("Cannot publish microflow " + microflowname + ", it should have a transient object of filedocument as input argument");
		
		Set<String> metaPrimitiveNames = Sets.newHashSet();
		for(IMetaPrimitive prim : metaObject.getMetaPrimitives()) {
			metaPrimitiveNames.add(prim.getName().toLowerCase());
		}
		for(String pathParam : pathParams) {
			if (!metaPrimitiveNames.contains(pathParam.toLowerCase()))
				throw new IllegalArgumentException("Cannot publish microflow " + microflowname + ", its input argument should have an attribute with name '" + pathParam +"', as required by the template path");
		}
		
	}

	if (httpMethod == null) {
		throw new IllegalArgumentException("Cannot publish microflow " + microflowname + ", it has no HTTP method defined.");
	}
		
	IDataType returnTypeFromMF = Core.getReturnType(microflowname);
	
	if (returnTypeFromMF.isMendixObject() || returnTypeFromMF.isList()){
		this.returnType = returnTypeFromMF.getObjectType();
		isFileTarget = Core.isSubClassOf(FileDocument.entityName, this.returnType); 

		if (Core.getMetaObject(this.returnType).isPersistable()  && !isFileTarget)
			throw new IllegalArgumentException("Cannot publish microflow " + microflowname+ ", its return type should be a non-persistable object or a file document");
	}
	else
		isReturnTypePrimitive = true;
}
 
开发者ID:mendix,项目名称:RestServices,代码行数:58,代码来源:MicroflowService.java


示例18: jsonAttributeToPrimitive

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private static Object jsonAttributeToPrimitive(IMetaPrimitive primitive, JSONObject object, String attr) throws Exception {
	switch(primitive.getType()) {
	case Currency:
	case Float:
		if (object.isNull(attr))
			return null;
		return object.getDouble(attr);
	case Decimal:
		if (object.isNull(attr))
			return null;
		String asString = object.optString(attr, null);
		if (asString != null)
			return new BigDecimal(asString);
		return new BigDecimal(object.getDouble(attr));
	case Boolean:
		return object.getBoolean(attr);
	case DateTime: 
		if (object.isNull(attr))
			return null;
		return new Date(object.getLong(attr));
	case Enum:
		// support for built-in BooleanValue enumeration
		if ("RestServices.BooleanValue".equals(primitive.getEnumeration().getName())) {
			if(object.isNull(attr))
				return null;
			return object.getBoolean(attr) ? BooleanValue._true.toString() : BooleanValue._false.toString();
		}
		
		// fall-through intentional
	case HashString:
	case String:
		if (object.isNull(attr))
			return null;
		return object.getString(attr);
	case AutoNumber:
	case Long:
		if (object.isNull(attr))
			return null;
		return object.getLong(attr);
	case Integer:
		if (object.isNull(attr))
			return null;
		return object.getInt(attr);
	case Binary:
	default:
		throw new Exception("Unsupported attribute type '" + primitive.getType() + "' in attribute '" + attr + "'");
	}	
}
 
开发者ID:mendix,项目名称:RestServices,代码行数:50,代码来源:JsonDeserializer.java


示例19: getMetaPrimitive

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
/**
 * Get the IMetaPrimtive based on a qualified attribute name (e.g. "System.User.Name").
 * @param qualifiedAttributeName the qualified attribute name.
 * @return the IMetaPrimtive.
 */
public static IMetaPrimitive getMetaPrimitive(String qualifiedAttributeName)
{
	return component.core().getMetaPrimitive(qualifiedAttributeName);
}
 
开发者ID:Finaps,项目名称:BootstrapCarousel,代码行数:10,代码来源:Core.java


示例20: getDatabaseColumnName

import com.mendix.systemwideinterfaces.core.meta.IMetaPrimitive; //导入依赖的package包/类
/**
 * @param iMetaPrimitive the meta primitive to get the database column name for
 * @return the name of the database column
 */
public static String getDatabaseColumnName(IMetaPrimitive iMetaPrimitive) {
	return component.core().getDatabaseColumnName(iMetaPrimitive);
}
 
开发者ID:Finaps,项目名称:BootstrapCarousel,代码行数:8,代码来源:Core.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Image类代码示例发布时间:2022-05-22
下一篇:
Java SaveDialog类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap