本文整理汇总了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;
}
示例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()));
}
}
}
示例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;
}
}