Java Code Examples for com.orientechnologies.orient.core.metadata.schema.OProperty#setReadonly()
The following examples show how to use
com.orientechnologies.orient.core.metadata.schema.OProperty#setReadonly() .
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: TestInAppOrientDBCompatibility.java From wicket-orientdb with Apache License 2.0 | 6 votes |
@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(); }
Example 2
Source File: TestInAppOrientDBCompatibility.java From wicket-orientdb with Apache License 2.0 | 6 votes |
@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(); }
Example 3
Source File: ReadonlyFieldExtension.java From guice-persist-orient with MIT License | 5 votes |
@Override public void afterRegistration(final ODatabaseObject db, final SchemeDescriptor descriptor, final Field field, final Readonly annotation) { final String name = field.getName(); final boolean readonly = annotation.value(); final OProperty property = db.getMetadata().getSchema() .getClass(descriptor.schemeClass).getProperty(name); if (property.isReadonly() != readonly) { property.setReadonly(readonly); logger.debug("Set {}.{} property readonly={}", descriptor.schemeClass, name, readonly); } }