Additional dependency meta-data

This commit add two additional attributes to a dependency: weight
and keywords.

Weight is a numeric value (default to 0) that allows to order
dependencies search result in a sensible manner. This is a UI feature
only and is not exposed in the meta-data.

Keywords provides a list of words that are added to the source of terms
that the UI use to discover dependencies. It's not exposed either.

Both are exposed by the UI specific controller (`/ui/dependencies`).

See gh-145
This commit is contained in:
Stephane Nicoll
2015-10-01 11:41:28 +02:00
parent 80eb14cb59
commit 5b062dd9c0
7 changed files with 64 additions and 25 deletions

View File

@@ -31,6 +31,7 @@ initializr:
- name: Security
id: security
description: Secure your application via spring-security
weight: 100
- name: AOP
id: aop
description: Aspect-oriented programming including spring-aop and AspectJ
@@ -64,6 +65,7 @@ initializr:
- name: Web
id: web
description: Full-stack web development with Tomcat and Spring MVC
weight: 100
facets:
- web
- name: Websocket
@@ -87,6 +89,7 @@ initializr:
bom: vaadin-bom
- name: Rest Repositories
id: data-rest
weight: 10
description: Exposing Spring Data repositories over REST via spring-data-rest-webmvc
- name: HATEOAS
id: hateoas
@@ -115,11 +118,15 @@ initializr:
description: FreeMarker templating engine
facets:
- web
keywords:
- template
- name: Velocity
id: velocity
description: Velocity templating engine
facets:
- web
keywords:
- template
- name: Groovy Templates
id: groovy-templates
description: Groovy templating engine
@@ -130,12 +137,16 @@ initializr:
description: Thymeleaf templating engine, including integration with Spring
facets:
- web
keywords:
- template
- name: Mustache
id: mustache
description: Mustache templating engine
versionRange: 1.2.2.RELEASE
facets:
- web
keywords:
- template
- name: Data
content:
- name: JDBC
@@ -144,11 +155,13 @@ initializr:
- name: JPA
id: data-jpa
description: Java Persistence API including spring-data-jpa, spring-orm and Hibernate
weight: 100
aliases:
- jpa
- name: MongoDB
id: data-mongodb
description: MongoDB NoSQL Database, including spring-data-mongodb
weight: 50
- name: Redis
id: redis
description: REDIS key-value data store, including spring-redis
@@ -161,6 +174,7 @@ initializr:
- name: Elasticsearch
id: data-elasticsearch
description: Elasticsearch search and analytics engine including spring-data-elasticsearch
weight: 10
- name: Cloud
bom: cloud-bom
versionRange: "1.2.3.RELEASE"
@@ -382,6 +396,7 @@ initializr:
- name: Facebook
id: social-facebook
description: spring-social-facebook
weight: 25
- name: LinkedIn
id: social-linkedin
description: spring-social-linkedin

View File

@@ -63,6 +63,10 @@ class Dependency extends MetadataElement {
String repository
int weight
List<String> keywords = []
void setScope(String scope) {
if (!SCOPE_ALL.contains(scope)) {
throw new InvalidInitializrMetadataException("Invalid scope $scope must be one of $SCOPE_ALL")

View File

@@ -72,7 +72,15 @@ class UiController {
def result = [:]
result.id = d.id
result.name = d.name
if (d.description) {
result.description = d.description
}
if (d.weight) {
result.weight = d.weight
}
if (d.keywords) {
result.keywords = d.keywords.join(',')
}
result
}

View File

@@ -24,6 +24,10 @@ initializr:
groupId: org.acme
artifactId: foo
version: 1.3.5
weight: 42
keywords:
- thefoo
- dafoo
- name: Bar
id: org.acme:bar
version: 2.1.0

View File

@@ -58,6 +58,8 @@
"content": [
{
"aliases": [],
"keywords": [],
"weight": 0,
"artifactId": "spring-boot-starter-web",
"description": "Web dependency description",
"facets": ["web"],
@@ -68,6 +70,8 @@
},
{
"aliases": [],
"keywords": [],
"weight": 0,
"artifactId": "spring-boot-starter-security",
"facets": [],
"groupId": "org.springframework.boot",
@@ -77,6 +81,8 @@
},
{
"aliases": ["jpa"],
"keywords": [],
"weight": 0,
"artifactId": "spring-boot-starter-data-jpa",
"facets": [],
"groupId": "org.springframework.boot",
@@ -96,11 +102,15 @@
"groupId": "org.acme",
"id": "org.acme:foo",
"name": "Foo",
"weight": 42,
"keywords": ["thefoo", "dafoo"],
"scope": "compile",
"version": "1.3.5"
},
{
"aliases": [],
"keywords": [],
"weight": 0,
"artifactId": "bar",
"facets": [],
"groupId": "org.acme",
@@ -111,6 +121,8 @@
},
{
"aliases": [],
"keywords": [],
"weight": 0,
"artifactId": "biz",
"facets": [],
"groupId": "org.acme",
@@ -122,6 +134,8 @@
},
{
"aliases": [],
"keywords": [],
"weight": 0,
"artifactId": "bur",
"facets": [],
"groupId": "org.acme",
@@ -133,6 +147,8 @@
},
{
"aliases": [],
"keywords": [],
"weight": 0,
"artifactId": "my-api",
"facets": [],
"groupId": "org.acme",

View File

@@ -7,28 +7,25 @@
},
{
"id": "security",
"name": "Security",
"description": null
"name": "Security"
},
{
"id": "data-jpa",
"name": "Data JPA",
"description": null
"name": "Data JPA"
},
{
"id": "org.acme:foo",
"name": "Foo",
"description": null
"keywords": "thefoo,dafoo",
"weight": 42
},
{
"id": "org.acme:bar",
"name": "Bar",
"description": null
"name": "Bar"
},
{
"id": "my-api",
"name": "My API",
"description": null
"name": "My API"
}
]
}

View File

@@ -7,38 +7,33 @@
},
{
"id": "security",
"name": "Security",
"description": null
"name": "Security"
},
{
"id": "data-jpa",
"name": "Data JPA",
"description": null
"name": "Data JPA"
},
{
"id": "org.acme:foo",
"name": "Foo",
"description": null
"keywords": "thefoo,dafoo",
"weight": 42
},
{
"id": "org.acme:bar",
"name": "Bar",
"description": null
"name": "Bar"
},
{
"id": "org.acme:biz",
"name": "Biz",
"description": null
"name": "Biz"
},
{
"id": "org.acme:bur",
"name": "Bur",
"description": null
"name": "Bur"
},
{
"id": "my-api",
"name": "My API",
"description": null
"name": "My API"
}
]
}