Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java29
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchQueryData.java (renamed from plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/branch/BranchQueryOptions.java)17
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java110
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/branch/BranchQueryResource.java224
7 files changed, 150 insertions, 236 deletions
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF
index bb1613a7fec..1a05996e530 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF
@@ -6,8 +6,7 @@ Bundle-Version: 0.21.0.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.orcs.rest.model,
- org.eclipse.osee.orcs.rest.model.search.artifact,
- org.eclipse.osee.orcs.rest.model.search.branch
+ org.eclipse.osee.orcs.rest.model.search.artifact
Import-Package: javax.annotation.security;version="1.2.0",
javax.ws.rs;version="2.0.0",
javax.ws.rs.core;version="2.0.0",
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java
index 6e32054c76a..d9ad8d3cbb0 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java
@@ -39,6 +39,30 @@ public interface BranchEndpoint {
@Produces({MediaType.APPLICATION_JSON})
List<Branch> getBranches();
+ /**
+ * Perform a branch query based on query parameter input
+ *
+ * @param branchUuids comma separated list of branch uuids
+ * @param branchTypes comma separated list of {@link org.eclipse.osee.framework.core.enums.BranchType BranchType}
+ * @param branchStates comma separated list of {@link org.eclipse.osee.framework.core.enums.BranchState BranchState}
+ * @param deleted to include deleted branches in the search
+ * @param archived to include archived branches in the search
+ * @param childOf branch uuid of the parent to search children of
+ * @param ancestorOf branch uuid of ancestor to search decendents of
+ * @param pretty if the returned JSON should be pretty printed
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ List<Branch> getBranches(@DefaultValue("") @QueryParam("branchUuids") String branchUuids, //
+ @DefaultValue("") @QueryParam("branchTypes") String branchTypes, //
+ @DefaultValue("") @QueryParam("branchStates") String branchStates, //
+ @QueryParam("deleted") boolean deleted, //
+ @QueryParam("archived") boolean archived, //
+ @DefaultValue("") @QueryParam("nameEquals") String nameEquals, //
+ @DefaultValue("") @QueryParam("namePattern") String namePattern, //
+ @QueryParam("childOf") Long childOf, //
+ @QueryParam("ancestorOf") Long ancestorOf);
+
@GET
@Path("baseline")
@Produces(MediaType.APPLICATION_JSON)
@@ -70,6 +94,11 @@ public interface BranchEndpoint {
Transaction getBranchTx(@PathParam("branch-uuid") long branchUuid, @PathParam("tx-id") int txId);
@POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ List<Branch> getBranches(BranchQueryData query);
+
+ @POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
Response createBranch(NewBranch data);
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/branch/BranchQueryOptions.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchQueryData.java
index d7eec7bf6d9..4ed7c5e3ee3 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/search/branch/BranchQueryOptions.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchQueryData.java
@@ -8,16 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.orcs.rest.model.search.branch;
+package org.eclipse.osee.orcs.rest.model;
+import java.util.Collections;
import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
/**
* @author John Misinco
*/
-public class BranchQueryOptions {
+@XmlRootElement
+public class BranchQueryData {
private List<Long> branchUuids;
private List<BranchType> branchTypes;
@@ -30,7 +33,7 @@ public class BranchQueryOptions {
private Long isAncestorOf = -1L;
public List<Long> getBranchIds() {
- return branchUuids;
+ return branchUuids != null ? branchUuids : Collections.<Long> emptyList();
}
public void setBranchIds(List<Long> branchUuids) {
@@ -38,7 +41,7 @@ public class BranchQueryOptions {
}
public List<BranchType> getBranchTypes() {
- return branchTypes;
+ return branchTypes != null ? branchTypes : Collections.<BranchType> emptyList();
}
public void setBranchTypes(List<BranchType> branchTypes) {
@@ -46,7 +49,7 @@ public class BranchQueryOptions {
}
public List<BranchState> getBranchStates() {
- return branchStates;
+ return branchStates != null ? branchStates : Collections.<BranchState> emptyList();
}
public void setBranchStates(List<BranchState> branchStates) {
@@ -90,7 +93,7 @@ public class BranchQueryOptions {
}
public Long getIsChildOf() {
- return isChildOf;
+ return isChildOf != null ? isChildOf : -1L;
}
public void setIsAncestorOf(Long isAncestorOf) {
@@ -98,7 +101,7 @@ public class BranchQueryOptions {
}
public Long getIsAncestorOf() {
- return isAncestorOf;
+ return isAncestorOf != null ? isAncestorOf : -1L;
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF
index 05e250f4178..9414e74cd30 100644
--- a/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF
@@ -29,7 +29,6 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
org.eclipse.osee.orcs.data,
org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.rest.model.search.artifact,
- org.eclipse.osee.orcs.rest.model.search.branch,
org.eclipse.osee.orcs.search,
org.eclipse.osee.orcs.transaction
Osee-JaxRs-Resource: OSEE-INF/web/*;path=/orcs/script/ui
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java
index eb21ee63e23..bf41460e171 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java
@@ -20,6 +20,7 @@ import static org.eclipse.osee.orcs.rest.internal.OrcsRestUtil.asTransactions;
import static org.eclipse.osee.orcs.rest.internal.OrcsRestUtil.executeCallable;
import java.net.URI;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -37,6 +38,7 @@ import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.util.Compare;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.jaxrs.OseeWebApplicationException;
@@ -51,6 +53,7 @@ import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.rest.model.Branch;
import org.eclipse.osee.orcs.rest.model.BranchCommitOptions;
import org.eclipse.osee.orcs.rest.model.BranchEndpoint;
+import org.eclipse.osee.orcs.rest.model.BranchQueryData;
import org.eclipse.osee.orcs.rest.model.CompareResults;
import org.eclipse.osee.orcs.rest.model.NewBranch;
import org.eclipse.osee.orcs.rest.model.NewTransaction;
@@ -153,6 +156,60 @@ public class BranchEndpointImpl implements BranchEndpoint {
}
@Override
+ public List<Branch> getBranches(BranchQueryData options) {
+ ResultSet<BranchReadable> results = searchBranches(options);
+ return asBranches(results);
+ }
+
+ @Override
+ public List<Branch> getBranches(String branchUuids, String branchTypes, String branchStates, boolean deleted, boolean archived, String nameEquals, String namePattern, Long childOf, Long ancestorOf) {
+ BranchQueryData options = new BranchQueryData();
+ if (Strings.isValid(branchUuids)) {
+ List<Long> branchUuidVals = new LinkedList<Long>();
+ for (String branchUuid : branchUuids.split(",")) {
+ branchUuidVals.add(Long.parseLong(branchUuid));
+ }
+ options.setBranchIds(branchUuidVals);
+ }
+
+ if (Strings.isValid(branchTypes)) {
+ List<BranchType> branchTypeVals = new LinkedList<BranchType>();
+ for (String branchType : branchTypes.split(",")) {
+ branchTypeVals.add(BranchType.valueOf(branchType.toUpperCase()));
+ }
+ options.setBranchTypes(branchTypeVals);
+ }
+
+ if (Strings.isValid(branchStates)) {
+ List<BranchState> branchStateVals = new LinkedList<BranchState>();
+ for (String branchState : branchStates.split(",")) {
+ branchStateVals.add(BranchState.valueOf(branchState.toUpperCase()));
+ }
+ options.setBranchStates(branchStateVals);
+ }
+
+ options.setIncludeDeleted(deleted);
+ options.setIncludeArchived(archived);
+
+ if (Strings.isValid(nameEquals)) {
+ options.setNameEquals(nameEquals);
+ }
+
+ if (Strings.isValid(namePattern)) {
+ options.setNamePattern(namePattern);
+ }
+
+ if (childOf != null) {
+ options.setIsChildOf(childOf);
+ }
+
+ if (ancestorOf != null) {
+ options.setIsAncestorOf(ancestorOf);
+ }
+ return getBranches(options);
+ }
+
+ @Override
public List<Branch> getBaselineBranches() {
ResultSet<BranchReadable> results = newBranchQuery()//
.includeArchived(false) //
@@ -457,4 +514,57 @@ public class BranchEndpointImpl implements BranchEndpoint {
}
}
}
+
+ private ResultSet<BranchReadable> searchBranches(BranchQueryData options) {
+ BranchQuery query = orcsApi.getQueryFactory(null).branchQuery();
+ if (Conditions.hasValues(options.getBranchIds())) {
+ query.andUuids(options.getBranchIds());
+ }
+
+ List<BranchState> branchStates = options.getBranchStates();
+ if (Conditions.hasValues(branchStates)) {
+ query.andStateIs(branchStates.toArray(new BranchState[branchStates.size()]));
+ }
+
+ List<BranchType> branchTypes = options.getBranchTypes();
+ if (Conditions.hasValues(branchTypes)) {
+ query.andIsOfType(branchTypes.toArray(new BranchType[branchTypes.size()]));
+ }
+
+ List<Long> branchUuids = options.getBranchIds();
+ if (Conditions.hasValues(branchUuids)) {
+ query.andUuids(branchUuids);
+ }
+
+ if (options.isIncludeArchived()) {
+ query.includeArchived();
+ }
+
+ if (options.isIncludeDeleted()) {
+ query.includeDeleted();
+ }
+
+ String nameEquals = options.getNameEquals();
+ if (Strings.isValid(nameEquals)) {
+ query.andNameEquals(nameEquals);
+ }
+
+ String namePattern = options.getNamePattern();
+ if (Strings.isValid(namePattern)) {
+ query.andNamePattern(namePattern);
+ }
+
+ Long ancestorOf = options.getIsAncestorOf();
+ if (ancestorOf > 0) {
+ IOseeBranch ancestorOfToken = TokenFactory.createBranch(ancestorOf, "queryAncestorOf");
+ query.andIsAncestorOf(ancestorOfToken);
+ }
+
+ Long childOf = options.getIsChildOf();
+ if (childOf > 0) {
+ IOseeBranch childOfToken = TokenFactory.createBranch(ancestorOf, "queryChildOf");
+ query.andIsAncestorOf(childOfToken);
+ }
+ return query.getResults();
+ }
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
index d296dae9a5c..ba4129a647e 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
@@ -16,7 +16,6 @@ import javax.script.ScriptEngine;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import org.eclipse.osee.orcs.OrcsApi;
-import org.eclipse.osee.orcs.rest.internal.search.branch.BranchQueryResource;
/**
* Get application.wadl at this context to get rest documentation
@@ -43,7 +42,6 @@ public class OrcsApplication extends Application {
resources.add(new OrcsScriptResource(engine));
classes.add(BranchesResource.class);
- resources.add(new BranchQueryResource(orcsApi));
resources.add(new IdeClientResource());
resources.add(new BranchEndpointImpl(orcsApi));
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/branch/BranchQueryResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/branch/BranchQueryResource.java
deleted file mode 100644
index 7ac7b6ca339..00000000000
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/search/branch/BranchQueryResource.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.rest.internal.search.branch;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.orcs.OrcsApi;
-import org.eclipse.osee.orcs.data.BranchReadable;
-import org.eclipse.osee.orcs.rest.model.search.branch.BranchQueryOptions;
-import org.eclipse.osee.orcs.search.BranchQuery;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * @author John Misinco
- */
-@Path("branchQuery")
-public class BranchQueryResource {
-
- private final Gson plainG = new Gson();
- private final Gson prettyG = new GsonBuilder().setPrettyPrinting().create();
- private final OrcsApi orcsApi;
-
- public BranchQueryResource(OrcsApi orcsApi) {
- this.orcsApi = orcsApi;
- }
-
- /**
- * Perform a branch query based on a JSON input
- *
- * @param branchQueryJson JSON of {@link org.eclipse.osee.orcs.rest.model.search.branch.BranchQueryOptions
- * BranchQueryOptions} class
- * @return JSON representation of the branch query results
- */
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response searchBranches(String branchQueryJson) {
- BranchQueryOptions options = plainG.fromJson(branchQueryJson, BranchQueryOptions.class);
- List<BranchReadable> results = getResultsFromOptions(options);
- return Response.ok(plainG.toJson(results)).build();
- }
-
- /**
- * Perform a branch query based on the input query parameters
- *
- * @param branchUuids comma separated list of branch uuids
- * @param branchTypes comma separated list of {@link org.eclipse.osee.framework.core.enums.BranchType BranchType}
- * @param branchStates comma separated list of {@link org.eclipse.osee.framework.core.enums.BranchState BranchState}
- * @param deleted to include deleted branches in the search
- * @param archived to include archived branches in the search
- * @param childOf branch uuid of the parent to search children of
- * @param ancestorOf branch uuid of ancestor to search decendents of
- * @param pretty if the returned JSON should be pretty printed
- * @return JSON representation of the branch query results
- */
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response searchBranchesFromQuery(@QueryParam("branchUuids") String branchUuids, @QueryParam("branchTypes") String branchTypes, @QueryParam("branchStates") String branchStates, @QueryParam("deleted") boolean deleted, @QueryParam("archived") boolean archived, @QueryParam("nameEquals") String nameEquals, @QueryParam("namePattern") String namePattern, @QueryParam("childOf") Long childOf, @QueryParam("ancestorOf") Long ancestorOf, @QueryParam("pretty") boolean pretty) {
- BranchQueryOptions options = new BranchQueryOptions();
- if (Strings.isValid(branchUuids)) {
- List<Long> branchUuidVals = new LinkedList<Long>();
- for (String branchUuid : branchUuids.split(",")) {
- branchUuidVals.add(Long.parseLong(branchUuid));
- }
- options.setBranchIds(branchUuidVals);
- }
-
- if (Strings.isValid(branchTypes)) {
- List<BranchType> branchTypeVals = new LinkedList<BranchType>();
- for (String branchType : branchTypes.split(",")) {
- branchTypeVals.add(BranchType.valueOf(branchType.toUpperCase()));
- }
- options.setBranchTypes(branchTypeVals);
- }
-
- if (Strings.isValid(branchStates)) {
- List<BranchState> branchStateVals = new LinkedList<BranchState>();
- for (String branchState : branchStates.split(",")) {
- branchStateVals.add(BranchState.valueOf(branchState.toUpperCase()));
- }
- options.setBranchStates(branchStateVals);
- }
-
- options.setIncludeDeleted(deleted);
- options.setIncludeArchived(archived);
-
- if (Strings.isValid(nameEquals)) {
- options.setNameEquals(nameEquals);
- }
-
- if (Strings.isValid(namePattern)) {
- options.setNamePattern(namePattern);
- }
-
- if (childOf != null) {
- options.setIsChildOf(childOf);
- }
-
- if (ancestorOf != null) {
- options.setIsAncestorOf(ancestorOf);
- }
-
- List<BranchReadable> results = getResultsFromOptions(options);
- Gson gson = pretty ? prettyG : plainG;
- return Response.ok(gson.toJson(results)).build();
- }
-
- /**
- * Perform a branch query for all working branches
- *
- * @param pretty if the returned JSON should be pretty printed
- * @return JSON representation of the branch query results
- */
- @Path("/working")
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response getWorkingBranches(@QueryParam("pretty") boolean pretty) {
- BranchQueryOptions options = new BranchQueryOptions();
- options.setBranchTypes(Collections.singletonList(BranchType.WORKING));
- List<BranchReadable> results = getResultsFromOptions(options);
- Gson gson = pretty ? prettyG : plainG;
- return Response.ok(gson.toJson(results)).build();
- }
-
- /**
- * Perform a branch query for all baseline branches
- *
- * @param pretty if the returned JSON should be pretty printed
- * @return JSON representation of the branch query results
- */
- @Path("/baseline")
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response getBaselineBranches(@QueryParam("pretty") boolean pretty) throws OseeCoreException {
- BranchQueryOptions options = new BranchQueryOptions();
- options.setBranchTypes(Collections.singletonList(BranchType.BASELINE));
- List<BranchReadable> results = getResultsFromOptions(options);
- Gson gson = pretty ? prettyG : plainG;
- return Response.ok(gson.toJson(results)).build();
- }
-
- private List<BranchReadable> getResultsFromOptions(BranchQueryOptions options) {
- BranchQuery query = orcsApi.getQueryFactory(null).branchQuery();
- if (Conditions.hasValues(options.getBranchIds())) {
- query.andUuids(options.getBranchIds());
- }
-
- List<BranchState> branchStates = options.getBranchStates();
- if (Conditions.hasValues(branchStates)) {
- query.andStateIs(branchStates.toArray(new BranchState[branchStates.size()]));
- }
-
- List<BranchType> branchTypes = options.getBranchTypes();
- if (Conditions.hasValues(branchTypes)) {
- query.andIsOfType(branchTypes.toArray(new BranchType[branchTypes.size()]));
- }
-
- List<Long> branchUuids = options.getBranchIds();
- if (Conditions.hasValues(branchUuids)) {
- query.andUuids(branchUuids);
- }
-
- if (options.isIncludeArchived()) {
- query.includeArchived();
- }
-
- if (options.isIncludeDeleted()) {
- query.includeDeleted();
- }
-
- String nameEquals = options.getNameEquals();
- if (Strings.isValid(nameEquals)) {
- query.andNameEquals(nameEquals);
- }
-
- String namePattern = options.getNamePattern();
- if (Strings.isValid(namePattern)) {
- query.andNamePattern(namePattern);
- }
-
- Long ancestorOf = options.getIsAncestorOf();
- if (ancestorOf > 0) {
- IOseeBranch ancestorOfToken = TokenFactory.createBranch(ancestorOf, "queryAncestorOf");
- query.andIsAncestorOf(ancestorOfToken);
- }
-
- Long childOf = options.getIsChildOf();
- if (childOf > 0) {
- IOseeBranch childOfToken = TokenFactory.createBranch(ancestorOf, "queryChildOf");
- query.andIsAncestorOf(childOfToken);
- }
-
- List<BranchReadable> toReturn = new LinkedList<BranchReadable>();
- for (BranchReadable branch : query.getResults()) {
- toReturn.add(branch);
- }
- return toReturn;
- }
-}

Back to the top