@Override public SchemaImpl postProcessRegister(SchemaImpl schema, SchemaFactory factory) { if (ignoreTypes.contains(schema.getId())) { return schema; } try { List<URL> resources = lookUpResource(schema.getId()); if (whiteList && resources.size() == 0) { return null; } } catch (IOException e) { throw new IllegalStateException("Failed to lookup schema for [" + schema.getId() + "] at [" + path + "]"); } return super.postProcessRegister(schema, factory); }
protected void processParent(SchemaImpl schema) { SchemaImpl parent = null; Class<?> parentClass = parentClasses.get(schema); String parentName = schema.getParent(); if (parentClass == null && parentName != null) { parent = schemasByName.get(parentName); if (parent == null) { throw new IllegalArgumentException("Failed to find parent schema for [" + parentName + "] for type [" + schema.getId() + "]"); } } else if (parentClass != null) { parent = schemasByClass.get(parentClass); if (parent == null) { throw new IllegalArgumentException("Failed to find parent schema for class [" + parentClass + "] for type [" + schema.getId() + "]"); } } if (parent != null) { schema.setParent(parent.getId()); parent.getChildren().add(schema.getId()); schema.load(parent); } }
@Override public Map<String, URL> getLinks() { Map<String, URL> result = links; if (!links.containsKey(UrlBuilder.SELF)) { result = new HashMap<String, URL>(links); result.put(UrlBuilder.SELF, ApiContext.getUrlBuilder().resourceReferenceLink(this)); } if (list && !result.containsKey(UrlBuilder.COLLECTION)) { result = result == null ? new HashMap<String, URL>(links) : result; result.put(UrlBuilder.COLLECTION, ApiContext.getUrlBuilder().resourceCollection(getId())); } return result == null ? links : result; }
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); } } }
protected void addTransitioningFields(SchemaImpl schema, SchemaFactory factory) { Set<String> states = transitioningStates.get(schema.getId()); if (states == null || states.size() == 0) { return; } addField(schema, TRANSITIONING_FIELD, FieldType.ENUM, TRANSITIONING_YES, TRANSITIONING_NO, TRANSITIONING_ERROR); addField(schema, TRANSITIONING_MESSAGE_FIELD, FieldType.STRING); addField(schema, TRANSITIONING_PROGRESS_FIELD, FieldType.INT); }
@Override public SchemaImpl postProcess(SchemaImpl schema, SchemaFactory factory) { if(schema.getId().equals("projectMember")) { FieldImpl field = getField(schema, "externalIdType"); if(field != null){ field.getOptions().addAll(AUTH_SERVICE_EXTERNAL_ID_TYPES.get()); } } return schema; }
@Override public SchemaImpl postProcessRegister(SchemaImpl schema, SchemaFactory factory) { Perm perm = getPerm(schema.getId()); return perm == null || perm.isRead() ? schema : null; }
protected void addStates(SchemaImpl schema, SchemaFactory factory) { String type = factory.getBaseType(schema.getId()); Set<String> validStates = this.validStates.get(type); Field stateField = schema.getResourceFields().get(ObjectMetaDataManager.STATE_FIELD); if (validStates != null && stateField instanceof FieldImpl) { FieldImpl field = (FieldImpl) stateField; field.setOptions(new ArrayList<String>(validStates)); field.setTypeEnum(FieldType.ENUM); } }
@Override protected void prune(SchemaImpl schema) { super.prune(schema); schema.getIncludeableLinks().clear(); Map<String, Relationship> rels = metaDataManager.getLinkRelationships(this, schema.getId()); if (rels == null || rels.size() == 0) { return; } else { for (Relationship rel : rels.values()) { schema.getIncludeableLinks().add(rel.getName()); } } }
public SchemaImpl(SchemaImpl schema) { this(); this.name = schema.getId(); this.parent = schema.getParent(); this.children = new ArrayList<String>(schema.getChildren()); this.pluralName = schema.getPluralName(); this.load(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; }
@Override public SchemaImpl postProcess(SchemaImpl schema, SchemaFactory factory) { Perm perm = getPerm(schema.getId());
schemaMap.put(impl.getId(), impl);
mergedSchema.setResourceMethods(newSchema.getResourceMethods()); if (mergedSchema.getParent().equals(mergedSchema.getId())) { mergedSchema.setParent(parentSchema.getParent());