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

Java OProperty类代码示例

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

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



OProperty类属于com.orientechnologies.orient.core.metadata.schema包,在下文中一共展示了OProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: testUpgradeSchema_TypeDoesNotYetExist

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testUpgradeSchema_TypeDoesNotYetExist() throws Exception {
  service.upgradeSchema();
  try (ODatabaseDocumentTx db = database.getInstance().connect()) {
    OSchema schema = db.getMetadata().getSchema();
    OClass type = schema.getClass("key_store");
    assertThat(type, is(notNullValue()));
    OProperty prop = type.getProperty("name");
    assertThat(prop, is(notNullValue()));
    assertThat(prop.isMandatory(), is(true));
    assertThat(prop.isNotNull(), is(true));
    assertThat(prop.getType(), is(OType.STRING));
    prop = type.getProperty("bytes");
    assertThat(prop, is(notNullValue()));
    assertThat(prop.isMandatory(), is(true));
    assertThat(prop.isNotNull(), is(true));
    assertThat(prop.getType(), is(OType.BINARY));
    assertThat(type.getInvolvedIndexes("name"), hasSize(1));
    assertThat(type.getInvolvedIndexes("name").iterator().next().getType(), is("UNIQUE"));
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:LegacyKeyStoreUpgradeServiceTest.java


示例3: getData

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Override
public Collection<OProperty> getData() {
	OClass oClass = oClassModel.getObject();
	if(oClass==null)
	{
		return null;
	}
	else if(allPropertiesModel==null||Boolean.TRUE.equals(allPropertiesModel.getObject()))
	{
		return oClass.properties();
	}
	else
	{
		return oClass.declaredProperties();
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:17,代码来源:ListOPropertiesModel.java


示例4: load

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected T load() {
	ODocument doc = docModel.getObject();
	OProperty prop = propertyModel!=null?propertyModel.getObject():null;
	if(doc==null) return null;
	if(prop==null) return (T) doc;
	if(valueType==null) {
		return (T) doc.field(prop.getName());
	} else
	{
		Object ret = doc.field(prop.getName(), valueType);
		if(ORecord.class.isAssignableFrom(valueType) && ret instanceof ORID) {
			ret = ((ORID)ret).getRecord();
		}
		return (T) ret;
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:19,代码来源:DynamicPropertyValueModel.java


示例5: testOPropertiesDataProvider

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testOPropertiesDataProvider()
{
	OSchema schema = wicket.getTester().getSchema();
	OClass oClass = schema.getClass("ClassA");
	OPropertiesDataProvider provider = new OPropertiesDataProvider(oClass, true);
	provider.setSort("name", SortOrder.ASCENDING);
	Iterator<? extends OProperty> it = provider.iterator(0, -1);
	List<OProperty> allProperties = new ArrayList<OProperty>(oClass.properties());
	while(it.hasNext())
	{
		OProperty oProperty = it.next();
		assertTrue(allProperties.remove(provider.model(oProperty).getObject()));
	}
	assertTrue(allProperties.size()==0);
	provider.detach();
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:18,代码来源:TestModels.java


示例6: testListModels

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testListModels()
{
	IModel<String> classNameModel = Model.of();
	IModel<OClass> classModel = new OClassModel(classNameModel);
	IModel<List<OProperty>> propertiesModel = new ListOPropertiesModel(classModel, null);
	IModel<List<OIndex<?>>> indexesModel = new ListOIndexesModel(classModel, null);
	List<OProperty> properties = propertiesModel.getObject();
	List<OIndex<?>> indexes = indexesModel.getObject();
	assertNotNull(properties);
	assertNotNull(indexes);
	assertTrue(properties.isEmpty());
	assertTrue(indexes.isEmpty());
	classModel.detach();
	propertiesModel.detach();
	indexesModel.detach();
	
	classNameModel.setObject("OUser");
	properties = propertiesModel.getObject();
	indexes = indexesModel.getObject();
	assertNotNull(properties);
	assertNotNull(indexes);
	assertFalse(properties.isEmpty());
	assertFalse(indexes.isEmpty());
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:26,代码来源:TestModels.java


示例7: testOPropertyModel

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testOPropertyModel()
{
	OProperty userNameProperty = wicket.getTester().getSchema().getClass("OUser").getProperty("name");
	OPropertyModel propertyModel = new OPropertyModel("OUser", "name");
	assertModelObjectEquals(userNameProperty, propertyModel);
	//Test for null
	propertyModel.setObject(null);
	assertModelObjectEquals(null, propertyModel);
	//Test for classRename
	OClass newClass = wicket.getTester().getSchema().createClass("TestRenameOProperty");
	OProperty property = newClass.createProperty("newProperty", OType.STRING);
	propertyModel.setObject(property);
	assertModelObjectEquals(property, propertyModel);
	property.setName("newProperty2");
	assertModelObjectEquals(property, propertyModel);
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:18,代码来源:TestModels.java


示例8: testRemovingReadonlyField

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testRemovingReadonlyField()
{
	ODatabaseDocument db = wicket.getTester().getDatabase();
	OSchema schema = db.getMetadata().getSchema();
	OClass classA = schema.createClass("TestRemovingField");
	classA.createProperty("name", OType.STRING);
	OProperty property = classA.createProperty("property", OType.STRING);
	property.setReadonly(true);
	
	ODocument doc = new ODocument(classA);
	doc.field("name", "My Name");
	doc.field("property", "value1");
	doc.save();
	
	doc.field("name", "My Name 2");
	doc.field("property", "value2");
	doc.undo("property");
	doc.save();
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:21,代码来源:TestInAppOrientDBCompatibility.java


示例9: testRemovingReadonlyField2

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testRemovingReadonlyField2()
{
	ODatabaseDocument db = wicket.getTester().getDatabase();
	OSchema schema = db.getMetadata().getSchema();
	OClass classA = schema.createClass("TestRemovingField2");
	classA.createProperty("name", OType.STRING);
	OProperty property = classA.createProperty("property", OType.STRING);
	property.setReadonly(true);
	
	ODocument doc = new ODocument(classA);
	doc.field("name", "My Name");
	doc.field("property", "value1");
	doc.save();
	
	doc.field("name", "My Name 2");
	doc.field("property", "value2");
	doc.undo();
	doc.field("name", "My Name 3");
	doc.save();
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:22,代码来源:TestInAppOrientDBCompatibility.java


示例10: testEqualsToDateTimeFilterCriteria

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testEqualsToDateTimeFilterCriteria() throws ParseException {
    IModel<OProperty> property = wicket.getProperty(DATETIME_FIELD);
    IFilterCriteriaManager manager = new FilterCriteriaManager(property);
    IModel<String> model = Model.of(DATETIME_VALUE_1);
    manager.addFilterCriteria(manager.createEqualsFilterCriteria(model, Model.of(true)));
    queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
    assertTrue(queryModel.size() == 1);
    queryModel.clearFilterCriteriaManagers();
    queryModel.detach();

    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    IModel<Date> dateModel = Model.of(dateFormat.parse(DATETIME_VALUE_1));
    manager.addFilterCriteria(manager.createEqualsFilterCriteria(dateModel, Model.of(true)));
    queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
    assertTrue(queryModel.size() == 1);
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:18,代码来源:TestFilters.java


示例11: testEqualsToDateFilterCriteria

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testEqualsToDateFilterCriteria() throws ParseException {
    IModel<OProperty> property = wicket.getProperty(DATE_FIELD);
    IFilterCriteriaManager manager = new FilterCriteriaManager(property);
    IModel<String> model = Model.of(DATE_VALUE_1);
    manager.addFilterCriteria(manager.createEqualsFilterCriteria(model, Model.of(true)));
    queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
    assertTrue(queryModel.size() == 1);
    queryModel.clearFilterCriteriaManagers();
    queryModel.detach();

    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    IModel<Date> dateModel = Model.of(dateFormat.parse(DATE_VALUE_1));
    manager.addFilterCriteria(manager.createEqualsFilterCriteria(dateModel, Model.of(true)));
    queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
    assertTrue(queryModel.size() == 1);
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:18,代码来源:TestFilters.java


示例12: testLinkFilter

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testLinkFilter() {
    IModel<OProperty> property = wicket.getProperty(NUMBER_FIELD);
    IFilterCriteriaManager manager = new FilterCriteriaManager(property);
    IFilterCriteria equalsFilterCriteria = manager.createEqualsFilterCriteria(Model.of(NUM_VALUE_1), Model.of(true));
    manager.addFilterCriteria(equalsFilterCriteria);
    queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
    ODocument document = queryModel.getObject().get(0).field(LINK_FIELD);
    queryModel.clearFilterCriteriaManagers();
    queryModel.detach();

    property = wicket.getProperty(LINK_FIELD);
    manager = new FilterCriteriaManager(property);
    equalsFilterCriteria = manager.createEqualsFilterCriteria(new ODocumentModel(document), Model.of(true));
    manager.addFilterCriteria(equalsFilterCriteria);
    queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
    assertTrue(queryModel.size() == 1);
    assertTrue(queryModel.getObject().get(0).field(STRING_FIELD).equals(STR_VALUE_1));
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:20,代码来源:TestFilters.java


示例13: testODocumentLinkQueryProvider

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Test
public void testODocumentLinkQueryProvider() {
    IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
    IFilterCriteria equalsFilterCriteria = manager.createEqualsFilterCriteria(Model.of(NUM_VALUE_1), Model.of(true));
    manager.addFilterCriteria(equalsFilterCriteria);
    String numField = wicket.getProperty(NUMBER_FIELD).getObject().getName();
    queryModel.addFilterCriteriaManager(numField, manager);
    ODocument doc = queryModel.getObject().get(0);
    IModel<OProperty> property = wicket.getProperty(LINK_LIST_FIELD);
    ODocumentLinksQueryDataProvider provider = new ODocumentLinksQueryDataProvider(new ODocumentModel(doc), property);
    OQueryModel<ODocument> state = provider.getFilterState();
    state.addFilterCriteriaManager(numField, manager);
    state.detach();
    assertTrue("size must be 1, but it is " + provider.size(), provider.size() == 1);
    assertTrue(state.getObject().get(0) != null);
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:17,代码来源:TestFilters.java


示例14: configureProperty

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void configureProperty(OClass oClass, RProperty rProperty) {
  PropertyMapping mapping = PropertyMapping.forPropertyType(rProperty.getType());
  if (mapping == null) {
    throw new IllegalArgumentException(String.format("No mapping found for property type '%s'.",
        rProperty.getType()));
  }
  String oPropertyName = schemaMapping.getRFeatureMapping(rProperty).getOPropertyName();
  OProperty oProperty = oClass.getProperty(oPropertyName);
  OType oType = mapping.getSchemaType();
  if (oProperty == null) {
    logger.info("Creating property '{}.{}' of type {}.", oClass.getName(), oPropertyName, oType);
    oProperty = oClass.createProperty(oPropertyName, oType);
  }
  if (oProperty.getType() != oType) {
    logger.error("Property '{}.{}' is not of type {}. Errors might occur when modifying this property.",
        oClass.getName(), oPropertyName, oType);
  }
  oProperty.setMandatory(rProperty.isMandatory());
  oProperty.setNotNull(rProperty.isMandatory());
  if (rProperty.isUnique() && !oProperty.isIndexed()) {
    logger.info("Creating index for property '{}.{}'.", oClass.getName(), oPropertyName);
    oProperty.createIndex(OClass.INDEX_TYPE.UNIQUE);
  }
}
 
开发者ID:lfridael,项目名称:resourceful-java-prototype,代码行数:26,代码来源:OrientDbSchemaConfigurer.java


示例15: configureLink

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
private void configureLink(OSchema oSchema, RClass rClass) {
  final OClass oClass = oSchema.getClass(schemaMapping.getRTypeMapping(rClass).getOClassName());
  rClass.getFeatures().stream().
      filter(rFeature -> rFeature instanceof RLink)
      .map(it -> (RLink) it)
      .forEach(rLink -> {
        String oPropertyName = schemaMapping.getRFeatureMapping(rLink).getOPropertyName();
        OProperty oProperty = oClass.getProperty(oPropertyName);
        OType oType = schemaMapping.getRFeatureMapping(rLink).getOPropertyType();
        RClass targetRClass = rLink.getTargetClass();
        OClass oTargetClass = oSchema.getClass(schemaMapping.getRTypeMapping(targetRClass).getOClassName());
        if (oProperty == null) {
          logger.info("Creating link '{}.{}' of type {} to class '{}'.", oClass.getName(), oPropertyName, oType,
              oTargetClass.getName());
          oProperty = oClass.createProperty(oPropertyName, oType, oTargetClass);
        }
        if (oProperty.getType() != oType || !oProperty.getLinkedClass().equals(oTargetClass)) {
          logger.error("Property '{}.{}' is not of type {} or does not reference class '{}'. " +
                  "Errors might occur when modifying this property; consider migrating this property manually.",
              oClass.getName(), oPropertyName, oType, oTargetClass.getName());
        }
        oProperty.setMandatory(rLink.isMandatory());
        oProperty.setNotNull(rLink.isMandatory());
      });
}
 
开发者ID:lfridael,项目名称:resourceful-java-prototype,代码行数:26,代码来源:OrientDbSchemaConfigurer.java


示例16: createProperties

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
protected void createProperties(Row row) {
    OClass clazz;
    if (className != null) {
        clazz = getOrCreateClass(className);
    } else {
        clazz = ((ODocument) row.getPayload()).getSchemaClass();
    }

    int count = row.getFieldCount();
    for (int i = 0; i < count; i++) {
        String fieldName = row.getFieldName(i);
        OProperty property = clazz.getProperty(fieldName);
        if (property == null) {
            OType type = OType.getTypeByClass(row.getFieldType(i));
            try {
                clazz.createProperty(fieldName, type);
            } catch (OSchemaException e) {
                log.error(e.getMessage(), e);
            }

            log.debug("Created property '{}' of type '{}'", fieldName, type);
        }
    }
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:25,代码来源:OrientDbLoader.java


示例17: modifyCaseInsensitiveNameField

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
private void modifyCaseInsensitiveNameField(final OClass type) {
  log.info("Modifying case-insensitive name field on component");
  OProperty ciNameProperty = type.getProperty(P_CI_NAME);
  if (!ciNameProperty.isMandatory()) {
    ciNameProperty.setMandatory(true);
  }
  if (!ciNameProperty.isNotNull()) {
    ciNameProperty.setNotNull(true);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:11,代码来源:ComponentDatabaseUpgrade_1_5.java


示例18: initClazz

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Override
public void initClazz(ODatabaseDocumentTx db) {

  OSchemaProxy schema = db.getMetadata().getSchema();
  OClass rectangle = schema.createAbstractClass(getName(),superClass(db));
  OProperty coordinates = rectangle.createProperty(COORDINATES, OType.EMBEDDEDLIST, OType.DOUBLE);
  coordinates.setMin("4");
  coordinates.setMin("4");
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:10,代码来源:ORectangleShapeBuilder.java


示例19: initClazz

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
@Override
public void initClazz(ODatabaseDocumentTx db) {

  OSchemaProxy schema = db.getMetadata().getSchema();
  OClass point = schema.createAbstractClass(getName(),superClass(db));
  OProperty coordinates = point.createProperty(COORDINATES, OType.EMBEDDEDLIST, OType.DOUBLE);
  coordinates.setMin("2");
  coordinates.setMin("2");
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:10,代码来源:OPointShapeBuilder.java


示例20: PropertySchema

import com.orientechnologies.orient.core.metadata.schema.OProperty; //导入依赖的package包/类
public PropertySchema(Collection<OProperty> properties) {
    final HashObjIntMap<String> map = HashObjIntMaps.newUpdatableMap(properties.size());
    int i = 0;
    for (OProperty property : properties) {
        map.put(property.getName(), i++);
    }
    this.propertyMap = HashObjIntMaps
            .getDefaultFactory()
            .withDefaultValue(-1)
            .newImmutableMap(map);
}
 
开发者ID:gsson,项目名称:dependency-grapher,代码行数:12,代码来源:OrientElements.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java PullToRefreshExpandableListView类代码示例发布时间:2022-05-22
下一篇:
Java IActionFilter类代码示例发布时间: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