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

Commit

Permalink
fix: could not create api from scratch with plan
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGeraud authored and brasseld committed Jan 4, 2018
1 parent 56b83a0 commit 77dc680
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package io.gravitee.management.model.plan;

import io.gravitee.management.model.PlanType;
import io.gravitee.management.model.PlanSecurityType;

/**
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com)
Expand All @@ -25,12 +25,12 @@ public class PlanQuery {

private String api;
private String name;
private PlanType type;
private PlanSecurityType security;

private PlanQuery(Builder builder) {
api = builder.api;
name = builder.name;
type = builder.type;
security = builder.security;
}

public String getApi() {
Expand All @@ -41,14 +41,14 @@ public String getName() {
return name;
}

public PlanType getType() {
return type;
public PlanSecurityType getSecurity() {
return security;
}

public static class Builder {
private String api;
private String name;
private PlanType type;
private PlanSecurityType security;

public PlanQuery build() {
return new PlanQuery(this);
Expand All @@ -64,8 +64,8 @@ public Builder name(String name) {
return this;
}

public Builder type(PlanType type) {
this.type = type;
public Builder security(PlanSecurityType security) {
this.security = security;
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ public ApiEntity createOrUpdateWithDefinition(final ApiEntity apiEntity, String
PlanQuery query = new PlanQuery.Builder().
api(createdOrUpdatedApiEntity.getId()).
name(planNode.get("name").asText()).
type(PlanType.valueOf(planNode.get("type").asText())).
security(PlanSecurityType.valueOf(planNode.get("security").asText())).
build();
List<PlanEntity> planEntities = planService.search(query);
if (planEntities == null || planEntities.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public List<PlanEntity> search(final PlanQuery query) {
if (query.getName() != null) {
filtered = p.getName().equals(query.getName());
}
if (filtered && query.getType() != null) {
filtered = p.getType().equals(query.getType());
if (filtered && query.getSecurity() != null) {
filtered = p.getSecurity().equals(query.getSecurity());
}
return filtered;
}).
Expand Down

0 comments on commit 77dc680

Please sign in to comment.