@Override public SchemaImpl postProcessRegister(SchemaImpl schema, SchemaFactory factory) { schema.setCreate(false); schema.setUpdate(false); schema.setDeletable(false); for (Field field : schema.getResourceFields().values()) { if (field instanceof FieldImpl) { ((FieldImpl) field).setCreate(false); ((FieldImpl) field).setUpdate(false); } } return schema; }
@Override public SchemaImpl postProcess(SchemaImpl schema, SchemaFactory factory) { Class<?> clz = factory.getSchemaClass(schema.getId()); if (clz == null || clz.getAnnotation(Entity.class) == null) { return schema; } schema.setCreate(true); schema.setUpdate(true); schema.setDeletable(true); for (PropertyDescriptor prop : PropertyUtils.getPropertyDescriptors(clz)) { processProperty(schema, prop); } return schema; }
protected SchemaImpl readSchema(String name) { Class<?> clz = typeToClass.get(name); if (clz == null) clz = Object.class; SchemaImpl schema = schemasByName.get(name); if (schema == null) schema = schemaFromObject(clz); io.github.ibuildthecloud.gdapi.annotation.Type type = clz.getAnnotation(io.github.ibuildthecloud.gdapi.annotation.Type.class); if (type == null) type = defaultType; if (type == defaultType) { schema.setCreate(writableByDefault); schema.setUpdate(writableByDefault); schema.setDeletable(writableByDefault); } else { schema.setCreate(type.create()); schema.setUpdate(type.update()); schema.setDeletable(type.delete()); } schema.setById(type.byId()); schema.setList(type.list()); return schema; }
schema.setCreate(perm.isCreate()); schema.setUpdate(perm.isUpdate()); schema.setDeletable(perm.isDelete());