protected void addActions(SchemaImpl schema, SchemaFactory factory) { Set<String> actions = this.actions.get(schema.getId()); if (actions == null || actions.size() == 0) { return; } Map<String, Action> resourceActions = schema.getResourceActions(); if (resourceActions == null) { resourceActions = new LinkedHashMap<String, Action>(); schema.setResourceActions(resourceActions); } for (String action : actions) { if (!resourceActions.containsKey(action)) { Action newAction = new Action(); newAction.setOutput(schema.getId()); resourceActions.put(action, newAction); } } }
@Override public Schema parseSchema(String name) { SchemaImpl schema = readSchema(name); Class<?> clz = typeToClass.get(name); processParent(schema); List<Field> fields = getFields(clz); for (Map.Entry<String, Field> entry : schema.getResourceFields().entrySet()) { Field field = entry.getValue(); if (field instanceof FieldImpl) { ((FieldImpl)field).setName(entry.getKey()); } fields.add(field); } Map<String, Field> resourceFields = sortFields(fields); schema.setResourceFields(resourceFields); schema.getResourceActions().putAll(getResourceActions(clz)); schema.getCollectionActions().putAll(getCollectionActions(clz)); for (SchemaPostProcessor processor : postProcessors) { schema = processor.postProcess(schema, this); } addToMap(schemasByName, schema, schema); if (clz == null && schema.getParent() != null) { clz = typeToClass.get(schema.getParent()); if (clz != null) { addToMap(typeToClass, schema, clz); } } return schema; }
fieldImpl.setReadOnCreateOnly(perm.isReadOnCreateOnly()); Iterator<Map.Entry<String, Action>> actionIter = schema.getResourceActions().entrySet().iterator();
public void load(SchemaImpl schema) { this.create = schema.isCreate(); this.update = schema.isUpdate(); this.list = schema.isList(); this.deletable = schema.isDeletable(); this.byId = schema.isById(); this.includeableLinks = new ArrayList<String>(schema.getIncludeableLinks()); this.resourceFields = copyFields(schema.getResourceFields()); this.collectionFilters = copyFilters(schema.getCollectionFilters()); this.resourceActions = copyActions(schema.getResourceActions()); this.collectionActions = copyActions(schema.getCollectionActions()); this.collectionFields = copyFields(schema.getCollectionFields()); }