diff --git a/src/main/java/io/gravitee/repository/management/api/NodeRepository.java b/src/main/java/io/gravitee/repository/management/api/NodeRepository.java deleted file mode 100644 index 35c799bb..00000000 --- a/src/main/java/io/gravitee/repository/management/api/NodeRepository.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.api; - -import java.util.Set; - -import io.gravitee.repository.exceptions.TechnicalException; -import io.gravitee.repository.management.model.Node; - -/** - * @author David BRASSELY (brasseld at gmail.com) - */ -public interface NodeRepository { - - /** - * Register a gateway {@link Node} - * @param node Node to register - */ - void register(Node node) throws TechnicalException; - - /** - * Unregister a gateway {@link Node} - * @param nodename Node name - */ - void unregister(String nodename) throws TechnicalException; - - /** - * Find all {@link Node} (registered an unregistered) - * @return Node found - */ - Set findAll() throws TechnicalException; -} diff --git a/src/main/java/io/gravitee/repository/management/api/TeamMembershipRepository.java b/src/main/java/io/gravitee/repository/management/api/TeamMembershipRepository.java deleted file mode 100644 index 34a73b15..00000000 --- a/src/main/java/io/gravitee/repository/management/api/TeamMembershipRepository.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.api; - -import io.gravitee.repository.exceptions.TechnicalException; -import io.gravitee.repository.management.model.Member; -import io.gravitee.repository.management.model.Team; - -import java.util.Set; - -/** - * @author David BRASSELY (brasseld at gmail.com) - */ -public interface TeamMembershipRepository { - - /** - * Add {@link Member} to a {@link Team}. - * - * @param teamName Team name of the member - * @param member Member - */ - void addMember(String teamName, Member member) throws TechnicalException; - - /** - * Update the role of a given {@link Team} {@link Member}. - * - * @param teamName Team name of the member - * @param member Member - */ - void updateMember(String teamName, Member member) throws TechnicalException; - - /** - * Remove a team user {@link Member} - * - * @param teamName Team name where the member will be removed - * @param username User name removed as member - */ - void deleteMember(String teamName, String username) throws TechnicalException; - - /** - * List all team {@link Member}s - * - * @param teamName Team name off members - * @return Team members - */ - Set listMembers(String teamName) throws TechnicalException; - - /** - * List {@link Team} where the user is a member. - * - * @param username The name used to identify a user. - * @return List of {@link Team} - */ - Set findByUser(String username) throws TechnicalException; - - Member getMember(String teamName, String memberName) throws TechnicalException; - -} diff --git a/src/main/java/io/gravitee/repository/management/api/TeamRepository.java b/src/main/java/io/gravitee/repository/management/api/TeamRepository.java deleted file mode 100644 index e2658ff4..00000000 --- a/src/main/java/io/gravitee/repository/management/api/TeamRepository.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.api; - -import java.util.Optional; -import java.util.Set; - -import io.gravitee.repository.exceptions.TechnicalException; -import io.gravitee.repository.management.model.Team; - -/** - * @author David BRASSELY (brasseld at gmail.com) - */ -public interface TeamRepository { - - /** - * List teams - * - * @param publicOnly - * @return - */ - Set findAll(boolean publicOnly) throws TechnicalException; - - /** - * Find a {@link Team} by name - * - * @param name team name - * @return {@link Optional} {@link Team} found - */ - Optional findByName(String name) throws TechnicalException; - - /** - * Create a {@link Team} - * - * @param team team to create - * @return Team created - */ - Team create(Team team) throws TechnicalException; - - /** - * Update a {@link Team} - * - * @param team team to update - * @return Team updated - */ - Team update(Team team) throws TechnicalException; - - /** - * Delete a team by name - * - * @param name Team name. - */ - void delete(String name) throws TechnicalException; -} diff --git a/src/main/java/io/gravitee/repository/management/model/Api.java b/src/main/java/io/gravitee/repository/management/model/Api.java index 4e9eba41..1f5e1134 100644 --- a/src/main/java/io/gravitee/repository/management/model/Api.java +++ b/src/main/java/io/gravitee/repository/management/model/Api.java @@ -23,6 +23,11 @@ */ public class Api { + /** + * The api ID. + */ + private String id; + /** * The api name. */ @@ -127,6 +132,14 @@ public void setDefinition(String definition) { this.definition = definition; } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -144,6 +157,7 @@ public int hashCode() { @Override public String toString() { final StringBuilder sb = new StringBuilder("Api{"); + sb.append("id='").append(id).append('\''); sb.append("name='").append(name).append('\''); sb.append(", version='").append(version).append('\''); sb.append(", lifecycleState=").append(lifecycleState); diff --git a/src/main/java/io/gravitee/repository/management/model/Application.java b/src/main/java/io/gravitee/repository/management/model/Application.java index 3c120290..248a6e61 100644 --- a/src/main/java/io/gravitee/repository/management/model/Application.java +++ b/src/main/java/io/gravitee/repository/management/model/Application.java @@ -23,6 +23,11 @@ */ public class Application { + /** + * The application ID. + */ + private String id; + /** * The application name */ @@ -89,22 +94,31 @@ public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Application that = (Application) o; - return Objects.equals(name, that.name); + return Objects.equals(id, that.id); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(id); } @Override public String toString() { final StringBuilder sb = new StringBuilder("Application{"); + sb.append("id='").append(id).append('\''); sb.append("name='").append(name).append('\''); sb.append(", type='").append(type).append('\''); sb.append('}'); diff --git a/src/main/java/io/gravitee/repository/management/model/Member.java b/src/main/java/io/gravitee/repository/management/model/Member.java deleted file mode 100644 index 096dae30..00000000 --- a/src/main/java/io/gravitee/repository/management/model/Member.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.model; - -import java.util.Date; - -/** - * @author David BRASSELY (brasseld at gmail.com) - */ -public class Member { - - /** - * The name of user member - */ - private String username; - - /** - * The role give to the user - */ - private TeamRole role; - - /** - * The membership creation date - */ - private Date createdAt; - - /** - * The membership last updated date - */ - private Date updatedAt; - - public TeamRole getRole() { - return role; - } - - public void setRole(TeamRole role) { - this.role = role; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } -} diff --git a/src/main/java/io/gravitee/repository/management/model/Node.java b/src/main/java/io/gravitee/repository/management/model/Node.java deleted file mode 100644 index 950383ac..00000000 --- a/src/main/java/io/gravitee/repository/management/model/Node.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.model; - -import java.util.Date; - -/** - * @author David BRASSELY (brasseld at gmail.com) - */ -public class Node { - - /** - * The unique node name - */ - private String name; - - /** - * The host where the node is running - */ - private String host; - - /** - * Current node state - */ - private NodeState state; - - /** - * The last node start date - */ - private Date lastStartupTime; - - /** - * The last node stop date - */ - private Date lastStopTime; - - /** - * The node cluster - */ - private String cluster; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCluster() { - return cluster; - } - - public void setCluster(String cluster) { - this.cluster = cluster; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public Date getLastStartupTime() { - return lastStartupTime; - } - - public void setLastStartupTime(Date lastStartupTime) { - this.lastStartupTime = lastStartupTime; - } - - public Date getLastStopTime() { - return lastStopTime; - } - - public void setLastStopTime(Date lastStopTime) { - this.lastStopTime = lastStopTime; - } - - public NodeState getState() { - return state; - } - - public void setState(NodeState state) { - this.state = state; - } - - -} diff --git a/src/main/java/io/gravitee/repository/management/model/NodeState.java b/src/main/java/io/gravitee/repository/management/model/NodeState.java deleted file mode 100644 index 84418734..00000000 --- a/src/main/java/io/gravitee/repository/management/model/NodeState.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.model; - -/** - * Node states - * - * @author David BRASSELY (brasseld at gmail.com) - */ -public enum NodeState { - - REGISTERED, UNREGISTERED; -} diff --git a/src/main/java/io/gravitee/repository/management/model/OwnerType.java b/src/main/java/io/gravitee/repository/management/model/OwnerType.java deleted file mode 100644 index 1da652af..00000000 --- a/src/main/java/io/gravitee/repository/management/model/OwnerType.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.model; - - -/** - * Owner types for Api, Application.. - * - * @author Loic DASSONVILLE (loic.dassonville at gmail.com) - */ -public enum OwnerType { - - TEAM, USER; -} - diff --git a/src/main/java/io/gravitee/repository/management/model/Page.java b/src/main/java/io/gravitee/repository/management/model/Page.java index 6a73df38..3495ed6f 100644 --- a/src/main/java/io/gravitee/repository/management/model/Page.java +++ b/src/main/java/io/gravitee/repository/management/model/Page.java @@ -16,15 +16,21 @@ package io.gravitee.repository.management.model; import java.util.Date; +import java.util.Objects; /** * @author Titouan COMPIEGNE */ public class Page { + /** + * The page ID. + */ + private String id; + private String name; - private PageType type; + private String type; private String title; @@ -35,14 +41,25 @@ public class Page { private int order; private boolean published; - - private String apiName; + + /** + * The api ID. + */ + private String api; private Date createdAt; private Date updatedAt; - public PageType getType() { + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { return type; } @@ -54,7 +71,7 @@ public void setName(String name) { this.name = name; } - public void setType(PageType type) { + public void setType(String type) { this.type = type; } @@ -90,12 +107,12 @@ public void setOrder(int order) { this.order = order; } - public String getApiName() { - return apiName; + public String getApi() { + return api; } - public void setApiName(String apiName) { - this.apiName = apiName; + public void setApi(String api) { + this.api = api; } public Date getCreatedAt() { @@ -121,4 +138,17 @@ public boolean isPublished() { public void setPublished(boolean published) { this.published = published; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Page page = (Page) o; + return Objects.equals(id, page.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } } diff --git a/src/main/java/io/gravitee/repository/management/model/PageType.java b/src/main/java/io/gravitee/repository/management/model/PageType.java deleted file mode 100644 index 8653c582..00000000 --- a/src/main/java/io/gravitee/repository/management/model/PageType.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.model; - -/** - * @author Titouan COMPIEGNE - */ -public enum PageType { - - MARKDOWN, - RAML, - SWAGGER -} diff --git a/src/main/java/io/gravitee/repository/management/model/Team.java b/src/main/java/io/gravitee/repository/management/model/Team.java deleted file mode 100644 index 65cd516c..00000000 --- a/src/main/java/io/gravitee/repository/management/model/Team.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.model; - -import java.util.Date; -import java.util.Objects; - -/** - * @author David BRASSELY (brasseld at gmail.com) - */ -public class Team { - - /** - * The shorthand name of the team. - */ - private String name; - - /** - * The description of the team. - */ - private String description; - - /** - * The team can only be visible for members. - */ - private boolean privateTeam; - - /** - * The publicly visible email address. - */ - private String email; - - /** - * The team creation date - */ - private Date createdAt; - - /** - * The team last updated date - */ - private Date updatedAt; - - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public boolean isPrivateTeam() { - return privateTeam; - } - - public void setPrivateTeam(boolean privateTeam) { - this.privateTeam = privateTeam; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Team)) { - return false; - } - Team team = (Team) o; - return Objects.equals(name, team.name); - } - - public int hashCode() { - return Objects.hash(name); - } - - public String toString() { - return "Team{" + - "name='" + name + '\'' + - ", description='" + description + '\'' + - ", privateTeam=" + privateTeam + - ", email='" + email + '\'' + - ", createdAt=" + createdAt + - ", updatedAt=" + updatedAt + - '}'; - } -} diff --git a/src/main/java/io/gravitee/repository/management/model/TeamRole.java b/src/main/java/io/gravitee/repository/management/model/TeamRole.java deleted file mode 100644 index 1c9058ff..00000000 --- a/src/main/java/io/gravitee/repository/management/model/TeamRole.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (C) 2015 The Gravitee team (http://gravitee.io) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.gravitee.repository.management.model; - -/** - * User team roles - * - * @author David BRASSELY (brasseld at gmail.com) - */ -public enum TeamRole { - MEMBER, ADMIN; -}