Java Code Examples for com.orientechnologies.orient.core.metadata.schema.OProperty#setCustom()
The following examples show how to use
com.orientechnologies.orient.core.metadata.schema.OProperty#setCustom() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomAttribute.java From Orienteer with Apache License 2.0 | 6 votes |
public <V> void setValue(OProperty property, V value) { if(OProperty.class.isAssignableFrom(javaClass) && value instanceof OProperty) { OProperty valueProperty = (OProperty)value; boolean fullNameRequired = !Objects.equals(property.getOwnerClass(), valueProperty.getOwnerClass()); property.setCustom(name, fullNameRequired?valueProperty.getFullName():valueProperty.getName()); } else { if(defaultValue!=null && defaultValue.equals(value)) value = null; String stringValue = value!=null?value.toString():null; if(stringValue!=null && stringValue.length()==0) stringValue=null; if(encode) stringValue = encodeCustomValue(stringValue); property.setCustom(name, stringValue); } }
Example 2
Source File: TestPrototypers.java From wicket-orientdb with Apache License 2.0 | 5 votes |
@Test public void testOPropertyPrototyper() throws Exception { OClass newClass = wicket.getTester().getSchema().createClass("NewClass"); OProperty toCompare = newClass.createProperty("toCompare", OType.STRING); try { OProperty newProperty = OPropertyPrototyper.newPrototype("NewClass"); assertNull(newClass.getProperty("newProperty")); newProperty.setName("newProperty"); assertEquals("newProperty", newProperty.getName()); assertNull(newClass.getProperty("newProperty")); assertEquals("NewClass.newProperty", newProperty.getFullName()); newProperty.setType(OType.STRING); assertEquals(OType.STRING, newProperty.getType()); newProperty.setCustom("myCustom", "myCustomValue"); assertEquals("myCustomValue", newProperty.getCustom("myCustom")); assertTrue(newProperty.compareTo(toCompare)<0); //Realization assertTrue(newProperty instanceof IPrototype); OProperty realizedNewProperty = ((IPrototype<OProperty>)newProperty).realizePrototype(); assertEquals(newClass.getProperty("newProperty"), realizedNewProperty); assertEquals("myCustomValue", realizedNewProperty.getCustom("myCustom")); } finally { //Drop wicket.getTester().getSchema().dropClass(newClass.getName()); } }
Example 3
Source File: OPropertyCustomModel.java From wicket-orientdb with Apache License 2.0 | 4 votes |
@Override protected void setValue(OProperty object, String param, String value) { object.setCustom(param, value); }