@Override protected ObjectProperty create() { return new ObjectProperty(); } },
public void loadAllItems() { String sql = buildSQL(); List<Map<String, Object>> query = DB.rows(sql, new RowBounds(0, maxRows+1)); this.rows = new ArrayList<Item>(); for (Map<String,Object> row : query) { Item item = new PropertysetItem(); for (Object colName : this.colNames) { Object value = row.get(colName); if (value!=null) { item.addItemProperty(colName, new ObjectProperty(value)); } } this.rows.add(item); } }
@Override public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("allergen", new ObjectProperty()) //FIXME type .property("severity", new ObjectProperty() .property("uuid", new StringProperty())) .property("comment", new StringProperty()) .property("reactions", new ArrayProperty(new ObjectProperty() .property("allergy", new ObjectProperty().property("uuid", new StringProperty())) .property("reaction", new ObjectProperty().property("uuid", new StringProperty())))) .required("allergen"); }
public IncludedResource() { super(); /* These will always be empty. */ ObjectProperty attributes = new ObjectProperty(); ObjectProperty relationships = new ObjectProperty(); property("type", new StringProperty()); property("id", new StringProperty()); property("attributes", attributes); property("relationships", relationships); } }
public Resource() { super(); attributes = new ObjectProperty(); relationships = new ObjectProperty(); idProperty = new StringProperty(); typeProperty = new StringProperty(); property("type", typeProperty); property("id", idProperty); property("attributes", attributes); property("relationships", relationships); }
protected ModelImpl generateEntityModel(MetaClass entityClass) { Map<String, Property> properties = new LinkedHashMap<>(); properties.put(ENTITY_NAME_PROP, new StringProperty() ._default(entityClass.getName())); properties.put(INSTANCE_NAME_PROP, getNamePatternProperty(entityClass)); for (MetaProperty metaProperty : entityClass.getProperties()) { String fieldName = metaProperty.getName(); Class<?> propertyType = metaProperty.getJavaType(); String propertyTypeName = propertyType.getName(); if (Collection.class.isAssignableFrom(propertyType)) { String collectionItemsType = metaProperty.getRange().asClass().getJavaClass().getName(); Property itemsProperty = getPropertyFromJavaType(collectionItemsType); Property collectionProperty = new ArrayProperty(itemsProperty); properties.put(fieldName, collectionProperty); } else if (Map.class.isAssignableFrom(propertyType)) { properties.put(fieldName, new ObjectProperty(Collections.emptyMap())); } else { properties.put(fieldName, getPropertyFromJavaType(propertyTypeName)); } } ModelImpl model = new ModelImpl() .name(entityClass.getName()); model.setProperties(properties); definitions.put("entities_" + model.getName(), model); return model; }
protected Property getObjectProperty(String classFqn) { Class<?> clazz; try { clazz = ReflectionHelper.loadClass(classFqn); } catch (ClassNotFoundException e) { return null; } MetaClass metaClass = metadata.getClass(clazz); if (metaClass != null) { return new ObjectProperty() .description(metaClass.getName()); } if (Enum.class.isAssignableFrom(clazz)) { return new StringProperty().description(classFqn); } return null; }
protected Property getErrorSchema() { return new ObjectProperty() .property("error", new StringProperty().description("Error message")) .property("details", new StringProperty().description("Detailed error description")); } }
break; default: property = new ObjectProperty(); break;
private void addDefaultDefinitions() { // schema of the default response // received from fetchAll and search operations swagger.addDefinition("FetchAll", new ModelImpl() .property("results", new ArrayProperty() .items(new ObjectProperty() .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty().example("self")) .property("uri", new StringProperty(StringProperty.Format.URI))))))); }
@Override public Model getCREATEModel(Representation rep) { return ((ModelImpl) super.getCREATEModel(rep)) .property("allergyType", new EnumProperty(AllergyType.class)) .property("reaction", new ObjectProperty() .property("uuid", new StringProperty())) .property("severity", new EnumProperty(AllergySeverity.class)) .property("allergen", new StringProperty()); }
public Model getGETModel(Representation rep) { ModelImpl modelImpl = ((ModelImpl) super.getGETModel(rep)) .property("uuid", new StringProperty()) .property("display", new StringProperty()); if (rep instanceof DefaultRepresentation) { modelImpl .property("name", new RefProperty("#/definitions/ConceptNameGet")) .property("datatype", new RefProperty("#/definitions/ConceptdatatypeGetRef")) .property("conceptClass", new RefProperty("#/definitions/ConceptclassGetRef")) .property("set", new BooleanProperty()) .property("version", new StringProperty()) .property("retired", new BooleanProperty()) .property("names", new ArrayProperty(new RefProperty("#/definitions/ConceptNameGetRef"))) //FIXME .property("descriptions", new ArrayProperty(new RefProperty("#/definitions/ConceptDescriptionGetRef"))) //FIXME .property("mappings", new ArrayProperty(new RefProperty("#/definitions/ConceptMappingGetRef"))) //FIXME .property("answers", new ArrayProperty(new ObjectProperty())) //FIXME .property("setMembers", new ArrayProperty(new ObjectProperty())); //FIXME } return modelImpl; }
private static Response constructResponse(int status, String error) { Property statusProp = new IntegerProperty() .description("The status code of the error (also provided in the HTTP header)"); statusProp.setExample(status); Property errorProp = new StringProperty() .description("The error message describing the error"); errorProp.setExample((Object)error); return new Response() .description(error) .schema(new ObjectProperty() .property("status", statusProp) .property("error", errorProp)); }
@Override public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("orderType", new ObjectProperty() .property("uuid", new StringProperty())) .property("orderTemplate", new StringProperty()) .property("concept", new StringProperty().example("uuid")) .property("retired", new BooleanProperty()); }
@Override public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof RefRepresentation || rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("uuid", new StringProperty()) .property("startDate", new DateProperty()) .property("endDate", new DateProperty()) .property("voided", new BooleanProperty()); } if (rep instanceof DefaultRepresentation) { model .property("state", new RefProperty("#/definitions/WorkflowStateGet")); } else if (rep instanceof RefRepresentation) { model .property("state", new RefProperty("#/definitions/WorkflowStateGetRef")) .property("patientProgram", new ObjectProperty()); //FIXME type } else if (rep instanceof FullRepresentation) { model .property("state", new RefProperty("#/definitions/WorkflowStateGetRef")) .property("patientProgram", new ObjectProperty()); //FIXME type } return model; }
@Override public Model getCREATEModel(Representation rep) { return ((ModelImpl) super.getCREATEModel(rep)) .property("username", new StringProperty()) .property("password", new StringProperty()) .property("person", new RefProperty("#/definitions/PersonCreate")) .property("systemId", new StringProperty()) .property("userProperties", new MapProperty()) //FIXME type .property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleCreate"))) .property("proficientLocales", new ArrayProperty(new ObjectProperty())) .property("secretQuestion", new StringProperty()) .required("username").required("password").required("person"); }
@Override public Model getGETModel(Representation rep) { ModelImpl model = new ModelImpl(); if (rep instanceof DefaultRepresentation) { model .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty().example("self|full")) .property("uri", new StringProperty(StringProperty.Format.URI)))); } else if (rep instanceof FullRepresentation) { model .property("auditInfo", new StringProperty()) .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty()).example("self") .property("uri", new StringProperty(StringProperty.Format.URI)))); } else if (rep instanceof RefRepresentation) { model .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty().example("self")) .property("uri", new StringProperty(StringProperty.Format.URI)))); } return model; }
private static Map<String, Property> initProperties() { Map<String, Property> properties = new LinkedHashMap<>(); properties.put(PROPERTY_ONE_NAME, new StringProperty() .example(PROPERTY_ONE_EXAMPLE) .required(true) .description(PROPERTY_ONE_DESCRIPTION)); properties.put(PROPERTY_TWO_NAME, new StringProperty() .example(PROPERTY_TWO_EXAMPLE) .required(true) .description(PROPERTY_TWO_DESCRIPTION)); IntegerProperty integerProp = new IntegerProperty(); LongProperty longProp = new LongProperty(); BooleanProperty booleanProp = new BooleanProperty(); integerProp.setExample(""); longProp.setExample(""); booleanProp.setExample(""); properties.put(ARRAY_PROP_NAME, new ArrayProperty().example("").description("")); properties.put(DOUBLE_PROP_NAME, new DoubleProperty().example("").description("")); properties.put(FLOAT_PROP_NAME, new FloatProperty().example("").description("")); properties.put(INTEGER_PROP_NAME, integerProp.description("")); properties.put(LONG_PROP_NAME, longProp.description("")); properties.put(BOOLEAN_PROP_NAME, booleanProp.description("")); properties.put(OBJECT_PROP_NAME, new ObjectProperty().example("").description("")); return properties; } }
@Override public Model getGETModel(Representation rep) { //FIXME check valid supportedClass ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("username", new StringProperty()) .property("systemId", new StringProperty()) .property("userProperties", new MapProperty()); //FIXME type } if (rep instanceof DefaultRepresentation) { model .property("person", new RefProperty("#/definitions/PersonGetRef")) .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeGetRef"))) .property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleGetRef"))); } else if (rep instanceof FullRepresentation) { model .property("person", new RefProperty("#/definitions/PersonGet")) .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeGet"))) .property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleGet"))) .property("allRoles", new ArrayProperty(new RefProperty("#/definitions/RoleGet"))) .property("proficientLocales", new ArrayProperty(new ObjectProperty())) .property("secretQuestion", new StringProperty()); } return model; }
@Override public Model getGETModel(Representation rep) { ModelImpl model = ((ModelImpl) super.getGETModel(rep)); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("display", new StringProperty()) .property("uuid", new StringProperty()) .property("allergen", new ObjectProperty()) //FIXME type .property("severity", new RefProperty("#/definitions/ConceptGetRef")) .property("comment", new StringProperty()) .property("reactions", new ArrayProperty(new RefProperty("#/definitions/ConceptGetRef"))) .property("patient", new RefProperty("#/definitions/PatientGetRef")); } if (rep instanceof FullRepresentation) { model .property("severity", new RefProperty("#/definitions/ConceptGet")) .property("reactions", new ArrayProperty(new RefProperty("#/definitions/ConceptGet"))) .property("patient", new RefProperty("#/definitions/PatientGet")); } return model; }