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


Java OProperty类代码示例

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


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


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