private void addLookupEndpoints(SwaggerModel swaggerModel, Entity entity, Locale locale) { for (Lookup lookup : entity.getLookupsExposedByRest()) { String lookupUrl = ClassName.restLookupUrl( entity.getName(), entity.getModule(), entity.getNamespace(), lookup.getMethodName()); swaggerModel.addPathEntry(lookupUrl, HttpMethod.GET, lookupPathEntry(entity, lookup, locale)); } }
private void addCrudEndpoints(SwaggerModel swaggerModel, Entity entity, Locale locale) { final String entityPath = ClassName.restUrl(entity.getName(), entity.getModule(), entity.getNamespace()); RestOptions restOptions = restOptionsOrDefault(entity); if (restOptions.isAllowRead()) { // retrieveAll and retrieveById swaggerModel.addPathEntry(entityPath, HttpMethod.GET, readPathEntry(entity, locale)); } if (restOptions.isAllowCreate()) { // post new item swaggerModel.addPathEntry(entityPath, HttpMethod.POST, postPathEntry(entity, locale)); } if (restOptions.isAllowUpdate()) { // update an existing item swaggerModel.addPathEntry(entityPath, HttpMethod.PUT, putPathEntry(entity, locale)); } if (restOptions.isAllowDelete()) { // delete an item swaggerModel.addPathEntry( entityPath + ID_PATHVAR, HttpMethod.DELETE, deletePathEntry(entity, locale)); } }