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


Java OProperty.getLinkedClass方法代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.metadata.schema.OProperty.getLinkedClass方法的典型用法代码示例。如果您正苦于以下问题:Java OProperty.getLinkedClass方法的具体用法?Java OProperty.getLinkedClass怎么用?Java OProperty.getLinkedClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.orientechnologies.orient.core.metadata.schema.OProperty的用法示例。


在下文中一共展示了OProperty.getLinkedClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertToCatalogLinkIfAble

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入方法依赖的package包/类
private Object convertToCatalogLinkIfAble(Object value,OProperty fieldProperty,ODocument mainDoc){
	String catalogsLinkNameAttribute = getOrientDBEndpoint().getCatalogsLinkAttr();//
	String catalogsLinkName = getOrientDBEndpoint().getCatalogsLinkName();//
	String catalogNameField = fieldProperty.getLinkedClass().getCustom(catalogsLinkNameAttribute); 
	if (catalogNameField==null){
		catalogNameField = catalogsLinkName;
	}
	List<OIdentifiable> catalogLinks = curDb.query(new OSQLSynchQuery<OIdentifiable>(
			"select from "+fieldProperty.getLinkedClass().getName()+" where "+catalogNameField+"=?"), value);
	if (catalogLinks.size()>0){
		value = catalogLinks.get(0).getIdentity();
	}else{
		boolean updateCatalogs = getOrientDBEndpoint().isCatalogsUpdate();//
		if (updateCatalogs){
			ODocument catalogRecord = new ODocument(fieldProperty.getLinkedClass());
			catalogRecord.field(catalogNameField,value);
			catalogRecord.save(true);
			value = catalogRecord.getIdentity();
		}
	}
	return value;
}
 
开发者ID:OrienteerBAP,项目名称:camel-orientdb,代码行数:23,代码来源:OrientDBProducer.java

示例2: validateLink

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入方法依赖的package包/类
protected void validateLink(final IValidatable<T> validatable,
		final OProperty p, final Object linkValue) {
	if (linkValue == null)
		validatable.error(newValidationError("nulllink"));
	else {
		ORecord linkedRecord = null;
		if (linkValue instanceof OIdentifiable)
			linkedRecord = ((OIdentifiable) linkValue).getRecord();
		else if (linkValue instanceof String)
			linkedRecord = new ORecordId((String) linkValue).getRecord();
		else
			validatable.error(newValidationError("linkwrong"));

		if (linkedRecord != null && p.getLinkedClass() != null) {
			if (!(linkedRecord instanceof ODocument))
				validatable.error(newValidationError("linktypewrong",
						"linkedClass", p.getLinkedClass(), "identity",
						linkedRecord.getIdentity()));

			final ODocument doc = (ODocument) linkedRecord;

			// AT THIS POINT CHECK THE CLASS ONLY IF != NULL BECAUSE IN CASE
			// OF GRAPHS THE RECORD COULD BE PARTIAL
			if (doc.getSchemaClass() != null
					&& !p.getLinkedClass().isSuperClassOf(
							doc.getSchemaClass()))
				validatable.error(newValidationError("linktypewrong",
						"linkedClass", p.getLinkedClass(), "identity",
						linkedRecord.getIdentity()));

		}
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:34,代码来源:OPropertyValueValidator.java

示例3: validateEmbedded

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入方法依赖的package包/类
protected void validateEmbedded(final IValidatable<T> validatable,
		final OProperty p, final Object fieldValue) {
	if (fieldValue instanceof ORecordId) {
		validatable.error(newValidationError("embeddedRecord"));
		return;
	} else if (fieldValue instanceof OIdentifiable) {
		if (((OIdentifiable) fieldValue).getIdentity().isValid()) {
			validatable.error(newValidationError("embeddedRecord"));
			return;
		}

		final OClass embeddedClass = p.getLinkedClass();
		if (embeddedClass != null) {
			final ORecord rec = ((OIdentifiable) fieldValue).getRecord();
			if (!(rec instanceof ODocument)) {
				validatable.error(newValidationError("embeddedNotDoc"));
				return;
			}

			final ODocument doc = (ODocument) rec;
			if (doc.getSchemaClass() == null
					|| !(doc.getSchemaClass().isSubClassOf(embeddedClass))) {
				validatable.error(newValidationError("embeddedWrongType", "expectedType", embeddedClass.getName()));
				return;
			}
		}

	} else {
		validatable.error(newValidationError("embeddedNotDoc"));
		return;
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:33,代码来源:OPropertyValueValidator.java


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