Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

Commit

Permalink
feat: lifecycle API and review workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aelamrani committed May 7, 2019
1 parent 651b130 commit 5dc3cbf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<name>Gravitee.io APIM - Repository - MongoDB</name>

<properties>
<gravitee-repository.version>1.25.0</gravitee-repository.version>
<gravitee-repository-test.version>1.25.0</gravitee-repository-test.version>
<gravitee-repository.version>1.26.0-SNAPSHOT</gravitee-repository.version>
<gravitee-repository-test.version>1.26.0-SNAPSHOT</gravitee-repository-test.version>
<embed.mongo.version>2.0.0</embed.mongo.version>
<mongo.version>3.8.0</mongo.version>
<spring.data.mongodb.version>2.1.5.RELEASE</spring.data.mongodb.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,7 @@ public Api update(Api api) throws TechnicalException {
throw new IllegalStateException(String.format("No api found with id [%s]", api.getId()));
}

apiMongo.setName(api.getName());
apiMongo.setDescription(api.getDescription());
apiMongo.setCreatedAt(api.getCreatedAt());
apiMongo.setUpdatedAt(api.getUpdatedAt());
apiMongo.setLifecycleState(api.getLifecycleState().toString());
apiMongo.setDefinition(api.getDefinition());
apiMongo.setVisibility(api.getVisibility().toString());
apiMongo.setVersion(api.getVersion());
apiMongo.setDeployedAt(api.getDeployedAt());
apiMongo.setPicture(api.getPicture());
apiMongo.setGroups(api.getGroups());
apiMongo.setViews(api.getViews());
apiMongo.setLabels(api.getLabels());

ApiMongo apiMongoUpdated = internalApiRepo.save(apiMongo);
final ApiMongo apiMongoUpdated = internalApiRepo.save(mapApi(api));
return mapApi(apiMongoUpdated);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public Page<ApiMongo> search(final ApiCriteria criteria, final Pageable pageable
if (criteria.getVisibility() != null) {
query.addCriteria(where("visibility").is(criteria.getVisibility()));
}
if (criteria.getLifecycleStates() != null && !criteria.getLifecycleStates().isEmpty()) {
query.addCriteria(where("apiLifecycleState").in(criteria.getLifecycleStates()));
}
}

query.with(new Sort(ASC, "name"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public class ApiMongo extends Auditable {

private List<ApiMetadataMongo> metadatas;

private String apiLifecycleState;

private String workflowState;

public String getId() {
return id;
}
Expand Down Expand Up @@ -166,6 +170,22 @@ public void setMetadatas(List<ApiMetadataMongo> metadatas) {
this.metadatas = metadatas;
}

public String getApiLifecycleState() {
return apiLifecycleState;
}

public void setApiLifecycleState(String apiLifecycleState) {
this.apiLifecycleState = apiLifecycleState;
}

public String getWorkflowState() {
return workflowState;
}

public void setWorkflowState(String workflowState) {
this.workflowState = workflowState;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -189,6 +209,8 @@ public String toString() {
sb.append(", visibility='").append(visibility).append('\'');
sb.append(", groups='").append(groups).append('\'');
sb.append(", metadatas='").append(metadatas).append('\'');
sb.append(", apiLifecycleState='").append(apiLifecycleState).append('\'');
sb.append(", workflowState='").append(workflowState).append('\'');
sb.append('}');
return sb.toString();
}
Expand Down

0 comments on commit 5dc3cbf

Please sign in to comment.