Filtering through dropdown for My Projects in Homepage.
### Description
Not getting desired results when filtering My Projects through dropdown in Homepage.

#### How to reproduce
- Create a project with user A and assign user B as Project Lead Architect.
- Now login to sw360 with user B.
- Go to homepage and check the lead architect field from My Projects dropdown and uncheck all the other fields under role section.
- You won't get any result.

Note: check for other dropdown fields too.


diff --git a/rest/resource-server/src/docs/asciidoc/projects.adoc b/rest/resource-server/src/docs/asciidoc/projects.adoc
index 81d8c931..6050ce3e 100644
--- a/rest/resource-server/src/docs/asciidoc/projects.adoc
+++ b/rest/resource-server/src/docs/asciidoc/projects.adoc
@@ -176,6 +176,27 @@ include::{snippets}/should_document_get_projects_by_external-ids/curl-request.ad
 include::{snippets}/should_document_get_projects_by_external-ids/http-response.adoc[]
 
 
+[[resources-projects-myprojects]]
+==== Listing my projects
+
+A `GET` request will list all projects associated to the user.
+
+===== Request parameter
+include::{snippets}/should_document_get_my_projects/request-parameters.adoc[]
+
+===== Response structure
+include::{snippets}/should_document_get_my_projects/response-fields.adoc[]
+
+===== Example request
+include::{snippets}/should_document_get_my_projects/curl-request.adoc[]
+
+===== Example response
+include::{snippets}/should_document_get_my_projects/http-response.adoc[]
+
+===== Links
+include::{snippets}/should_document_get_my_projects/links.adoc[]
+
+
 [[resources-project-attachment-info-get]]
 ==== Listing attachment info
 
diff --git a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java
index 0d77fca3..464329e5 100644
--- a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java
+++ b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java
@@ -11,6 +11,12 @@
  */
 package org.eclipse.sw360.rest.resourceserver.project;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang.StringUtils;
@@ -18,25 +24,25 @@ import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.thrift.TException;
 import org.apache.thrift.TSerializer;
-import org.springframework.data.domain.Pageable;
 import org.apache.thrift.protocol.TSimpleJSONProtocol;
+import org.apache.thrift.transport.TTransportException;
 import org.eclipse.sw360.datahandler.common.CommonUtils;
 import org.eclipse.sw360.datahandler.common.SW360Constants;
-import org.eclipse.sw360.datahandler.resourcelists.PaginationParameterException;
-import org.eclipse.sw360.datahandler.resourcelists.PaginationResult;
 import org.eclipse.sw360.datahandler.common.SW360Utils;
 import org.eclipse.sw360.datahandler.common.ThriftEnumUtils;
 import org.eclipse.sw360.datahandler.couchdb.lucene.LuceneAwareDatabaseConnector;
+import org.eclipse.sw360.datahandler.resourcelists.PaginationParameterException;
+import org.eclipse.sw360.datahandler.resourcelists.PaginationResult;
+import org.eclipse.sw360.datahandler.resourcelists.ResourceClassNotFoundException;
 import org.eclipse.sw360.datahandler.thrift.MainlineState;
 import org.eclipse.sw360.datahandler.thrift.ProjectReleaseRelationship;
 import org.eclipse.sw360.datahandler.thrift.ReleaseRelationship;
 import org.eclipse.sw360.datahandler.thrift.RequestStatus;
-import org.eclipse.sw360.datahandler.thrift.SW360Exception;
+import org.eclipse.sw360.datahandler.thrift.Source;
 import org.eclipse.sw360.datahandler.thrift.attachments.Attachment;
 import org.eclipse.sw360.datahandler.thrift.attachments.AttachmentContent;
 import org.eclipse.sw360.datahandler.thrift.attachments.AttachmentType;
 import org.eclipse.sw360.datahandler.thrift.attachments.AttachmentUsage;
-import org.eclipse.sw360.datahandler.thrift.attachments.LicenseInfoUsage;
 import org.eclipse.sw360.datahandler.thrift.attachments.UsageData;
 import org.eclipse.sw360.datahandler.thrift.components.ClearingState;
 import org.eclipse.sw360.datahandler.thrift.components.Release;
@@ -47,12 +53,10 @@ import org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseInfoParsingResult
 import org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseNameWithText;
 import org.eclipse.sw360.datahandler.thrift.licenseinfo.OutputFormatInfo;
 import org.eclipse.sw360.datahandler.thrift.licenses.License;
-import org.eclipse.sw360.datahandler.thrift.projects.ProjectProjectRelationship;
 import org.eclipse.sw360.datahandler.thrift.projects.Project;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectClearingState;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectLink;
-import org.eclipse.sw360.datahandler.thrift.projects.ProjectRelationship;
-import org.eclipse.sw360.datahandler.thrift.Source;
+import org.eclipse.sw360.datahandler.thrift.projects.ProjectProjectRelationship;
 import org.eclipse.sw360.datahandler.thrift.users.User;
 import org.eclipse.sw360.datahandler.thrift.vendors.Vendor;
 import org.eclipse.sw360.datahandler.thrift.vulnerabilities.ProjectVulnerabilityRating;
@@ -60,7 +64,6 @@ import org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityCheckSt
 import org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityDTO;
 import org.eclipse.sw360.datahandler.thrift.vulnerabilities.VulnerabilityRatingForProject;
 import org.eclipse.sw360.rest.resourceserver.attachment.Sw360AttachmentService;
-import org.eclipse.sw360.datahandler.resourcelists.ResourceClassNotFoundException;
 import org.eclipse.sw360.rest.resourceserver.component.Sw360ComponentService;
 import org.eclipse.sw360.rest.resourceserver.core.HalResource;
 import org.eclipse.sw360.rest.resourceserver.core.RestControllerHelper;
@@ -69,62 +72,58 @@ import org.eclipse.sw360.rest.resourceserver.licenseinfo.Sw360LicenseInfoService
 import org.eclipse.sw360.rest.resourceserver.release.Sw360ReleaseService;
 import org.eclipse.sw360.rest.resourceserver.user.Sw360UserService;
 import org.eclipse.sw360.rest.resourceserver.vulnerability.Sw360VulnerabilityService;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.json.GsonJsonParser;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.rest.webmvc.BasePathAwareController;
 import org.springframework.data.rest.webmvc.RepositoryLinksResource;
-import org.springframework.data.rest.webmvc.ResourceNotFoundException;
+import org.springframework.hateoas.CollectionModel;
 import org.springframework.hateoas.EntityModel;
 import org.springframework.hateoas.server.RepresentationModelProcessor;
-import org.springframework.hateoas.CollectionModel;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.converter.HttpMessageNotReadableException;
-import org.springframework.security.access.AccessDeniedException;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.util.MultiValueMap;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import static com.google.common.base.Strings.isNullOrEmpty;
 import static org.eclipse.sw360.datahandler.common.CommonUtils.wrapThriftOptionalReplacement;
-import static org.eclipse.sw360.datahandler.common.WrappedException.wrapException;
 import static org.eclipse.sw360.datahandler.common.WrappedException.wrapTException;
+import static org.eclipse.sw360.rest.resourceserver.Sw360ResourceServer.REPORT_FILENAME_MAPPING;
 import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
-import static org.eclipse.sw360.rest.resourceserver.Sw360ResourceServer.*;
-
-import org.apache.thrift.transport.TTransportException;
 
 @BasePathAwareController
 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
@@ -228,8 +227,18 @@ public class ProjectController implements RepresentationModelProcessor<Repositor
                 sw360Projects.addAll(projectService.getProjectsForUser(sw360User));
             }
         }
+        return getProjectResponse(pageable, projectType, group, tag, allDetails, luceneSearch, request, sw360User,
+                mapOfProjects, isSearchByName, sw360Projects);
+    }
+
+    @NotNull
+    private ResponseEntity<CollectionModel<EntityModel<Project>>> getProjectResponse(Pageable pageable,
+            String projectType, String group, String tag, boolean allDetails, boolean luceneSearch,
+            HttpServletRequest request, User sw360User, Map<String, Project> mapOfProjects, boolean isSearchByName,
+            List<Project> sw360Projects) throws ResourceClassNotFoundException, PaginationParameterException, URISyntaxException {
         sw360Projects.stream().forEach(prj -> mapOfProjects.put(prj.getId(), prj));
-        PaginationResult<Project> paginationResult = restControllerHelper.createPaginationResult(request, pageable, sw360Projects, SW360Constants.TYPE_PROJECT);
+        PaginationResult<Project> paginationResult = restControllerHelper.createPaginationResult(request, pageable,
+                sw360Projects, SW360Constants.TYPE_PROJECT);
 
         List<EntityModel<Project>> projectResources = new ArrayList<>();
         Consumer<Project> consumer = p -> {
@@ -266,6 +275,47 @@ public class ProjectController implements RepresentationModelProcessor<Repositor
         return new ResponseEntity<>(resources, status);
     }
 
+    @RequestMapping(value = PROJECTS_URL + "/myprojects", method = RequestMethod.GET)
+    public ResponseEntity<CollectionModel<EntityModel<Project>>> getProjectsFilteredForUser(
+            Pageable pageable,
+            @RequestParam(value = "createdBy", required = false, defaultValue = "true") boolean createdBy,
+            @RequestParam(value = "moderator", required = false, defaultValue = "true") boolean moderator,
+            @RequestParam(value = "contributor", required = false, defaultValue = "true") boolean contributor,
+            @RequestParam(value = "projectOwner", required = false, defaultValue = "true") boolean projectOwner,
+            @RequestParam(value = "leadArchitect", required = false, defaultValue = "true") boolean leadArchitect,
+            @RequestParam(value = "projectResponsible", required = false, defaultValue = "true") boolean projectResponsible,
+            @RequestParam(value = "securityResponsible", required = false, defaultValue = "true") boolean securityResponsible,
+            @RequestParam(value = "stateOpen", required = false, defaultValue = "true") boolean stateOpen,
+            @RequestParam(value = "stateClosed", required = false, defaultValue = "true") boolean stateClosed,
+            @RequestParam(value = "stateInProgress", required = false, defaultValue = "true") boolean stateInProgress,
+            @RequestParam(value = "allDetails", required = false) boolean allDetails,
+            HttpServletRequest request) throws TException, URISyntaxException, PaginationParameterException, ResourceClassNotFoundException {
+        User sw360User = restControllerHelper.getSw360UserFromAuthentication();
+        Map<String, Project> mapOfProjects = new HashMap<>();
+
+        ImmutableMap<String, Boolean> userRoles = ImmutableMap.<String, Boolean>builder()
+                .put(Project._Fields.CREATED_BY.toString(), createdBy)
+                .put(Project._Fields.MODERATORS.toString(), moderator)
+                .put(Project._Fields.CONTRIBUTORS.toString(), contributor)
+                .put(Project._Fields.PROJECT_OWNER.toString(), projectOwner)
+                .put(Project._Fields.LEAD_ARCHITECT.toString(), leadArchitect)
+                .put(Project._Fields.PROJECT_RESPONSIBLE.toString(), projectResponsible)
+                .put(Project._Fields.SECURITY_RESPONSIBLES.toString(), securityResponsible)
+                .build();
+
+        ImmutableMap<String, Boolean> clearingState = ImmutableMap.<String, Boolean>builder()
+                .put(ProjectClearingState.OPEN.toString(), stateOpen)
+                .put(ProjectClearingState.CLOSED.toString(), stateClosed)
+                .put(ProjectClearingState.IN_PROGRESS.toString(), stateInProgress)
+                .build();
+
+        List<Project> sw360Projects = projectService.getMyProjects(sw360User, userRoles);
+        sw360Projects = projectService.getWithFilledClearingStatus(sw360Projects, clearingState);
+
+        return getProjectResponse(pageable, null, null, null, allDetails, true, request, sw360User,
+                mapOfProjects, true, sw360Projects);
+    }
+
     @RequestMapping(value = PROJECTS_URL + "/{id}", method = RequestMethod.GET)
     public ResponseEntity<EntityModel<Project>> getProject(
             @PathVariable("id") String id) throws TException {
@@ -1028,16 +1078,16 @@ public class ProjectController implements RepresentationModelProcessor<Repositor
         HalResource<Project> halProject = new HalResource<>(sw360Project);
         halProject.addEmbeddedResource("createdBy", sw360Project.getCreatedBy());
 
-        List<String> obsolateFields = List.of("homepage", "wiki");
+        List<String> obsoleteFields = List.of("homepage", "wiki");
         for (Entry<Project._Fields, String> field : mapOfFieldsTobeEmbedded.entrySet()) {
             if (Project._Fields.EXTERNAL_URLS.equals(field.getKey())) {
                 Map<String, String> externalUrls = CommonUtils
                         .nullToEmptyMap((Map<String, String>) sw360Project.getFieldValue(field.getKey()));
-                restControllerHelper.addEmbeddedFields(obsolateFields.get(0),
-                        externalUrls.get(obsolateFields.get(0)) == null ? "" : externalUrls.get(obsolateFields.get(0)),
+                restControllerHelper.addEmbeddedFields(obsoleteFields.get(0),
+                        externalUrls.get(obsoleteFields.get(0)) == null ? "" : externalUrls.get(obsoleteFields.get(0)),
                         halProject);
-                restControllerHelper.addEmbeddedFields(obsolateFields.get(1),
-                        externalUrls.get(obsolateFields.get(1)) == null ? "" : externalUrls.get(obsolateFields.get(1)),
+                restControllerHelper.addEmbeddedFields(obsoleteFields.get(1),
+                        externalUrls.get(obsoleteFields.get(1)) == null ? "" : externalUrls.get(obsoleteFields.get(1)),
                         halProject);
             } else {
                 restControllerHelper.addEmbeddedFields(field.getValue(), sw360Project.getFieldValue(field.getKey()),
diff --git a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/Sw360ProjectService.java b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/Sw360ProjectService.java
index 671a1915..aa34b2ac 100644
--- a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/Sw360ProjectService.java
+++ b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/Sw360ProjectService.java
@@ -14,13 +14,9 @@ package org.eclipse.sw360.rest.resourceserver.project;
 
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
-
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TCompactProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.THttpClient;
 import org.apache.thrift.transport.TTransportException;
 import org.eclipse.sw360.datahandler.common.CommonUtils;
 import org.eclipse.sw360.datahandler.common.SW360Utils;
@@ -34,12 +30,11 @@ import org.eclipse.sw360.datahandler.thrift.SW360Exception;
 import org.eclipse.sw360.datahandler.thrift.ThriftClients;
 import org.eclipse.sw360.datahandler.thrift.attachments.Attachment;
 import org.eclipse.sw360.datahandler.thrift.attachments.AttachmentType;
-import org.eclipse.sw360.datahandler.thrift.components.Component;
 import org.eclipse.sw360.datahandler.thrift.components.Release;
 import org.eclipse.sw360.datahandler.thrift.components.ReleaseClearingStatusData;
 import org.eclipse.sw360.datahandler.thrift.components.ReleaseLink;
-import org.eclipse.sw360.datahandler.thrift.licenses.LicenseService;
 import org.eclipse.sw360.datahandler.thrift.projects.Project;
+import org.eclipse.sw360.datahandler.thrift.projects.ProjectClearingState;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectData;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectLink;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectService;
@@ -50,10 +45,7 @@ import org.eclipse.sw360.rest.resourceserver.core.RestControllerHelper;
 import org.eclipse.sw360.rest.resourceserver.release.ReleaseController;
 import org.eclipse.sw360.rest.resourceserver.release.Sw360ReleaseService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
 import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.data.rest.webmvc.ResourceNotFoundException;
 import org.springframework.hateoas.Link;
@@ -61,20 +53,11 @@ import org.springframework.http.converter.HttpMessageNotReadableException;
 import org.springframework.security.access.AccessDeniedException;
 import org.springframework.stereotype.Service;
 
-import com.google.common.collect.ImmutableMap;
-
-import static com.google.common.base.Strings.nullToEmpty;
-import static org.eclipse.sw360.datahandler.common.CommonUtils.nullToEmptyList;
-
+import javax.annotation.PreDestroy;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
-
-import static org.eclipse.sw360.datahandler.common.WrappedException.wrapTException;
-import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
-
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -90,10 +73,12 @@ import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
-import javax.annotation.PreDestroy;
-
-import static org.eclipse.sw360.datahandler.common.CommonUtils.isNullEmptyOrWhitespace;
+import static com.google.common.base.Strings.nullToEmpty;
 import static org.eclipse.sw360.datahandler.common.CommonUtils.getSortedMap;
+import static org.eclipse.sw360.datahandler.common.CommonUtils.isNullEmptyOrWhitespace;
+import static org.eclipse.sw360.datahandler.common.CommonUtils.nullToEmptyList;
+import static org.eclipse.sw360.datahandler.common.WrappedException.wrapTException;
+import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
 
 @Service
 @RequiredArgsConstructor(onConstructor = @__(@Autowired))
@@ -446,4 +431,43 @@ public class Sw360ProjectService implements AwareOfRestServices<Project> {
         }
         return listOfProjects;
     }
+
+    /**
+     * From list of projects, filter projects based on their clearing state.
+     * @param projects      List of projects to filter
+     * @param clearingState Map of clearing states to filter projects for
+     * @return List of filtered projects.
+     */
+    public List<Project> getWithFilledClearingStatus(List<Project> projects, Map<String, Boolean> clearingState) {
+        if (!CommonUtils.isNullOrEmptyMap(clearingState)) {
+            Boolean open = clearingState.getOrDefault(ProjectClearingState.OPEN.toString(), true);
+            Boolean closed = clearingState.getOrDefault(ProjectClearingState.CLOSED.toString(), true);
+            Boolean inProgress = clearingState.getOrDefault(ProjectClearingState.IN_PROGRESS.toString(), true);
+
+            projects = projects.stream().filter(project -> {
+                if (open != null && open && ProjectClearingState.OPEN.equals(project.getClearingState())) {
+                    return true;
+                } else if (closed != null && closed && ProjectClearingState.CLOSED.equals(project.getClearingState())) {
+                    return true;
+                } else if (inProgress != null && inProgress
+                        && ProjectClearingState.IN_PROGRESS.equals(project.getClearingState())) {
+                    return true;
+                }
+                return false;
+            }).collect(Collectors.toList());
+        }
+        return projects;
+    }
+
+    /**
+     * Get my projects from the thrift client.
+     * @param user      User to get projects for
+     * @param userRoles User roles to filter projects
+     * @return List of projects
+     * @throws TException
+     */
+    public List<Project> getMyProjects(User user, Map<String, Boolean> userRoles) throws TException {
+        ProjectService.Iface sw360ProjectClient = getThriftProjectClient();
+        return sw360ProjectClient.getMyProjects(user, userRoles);
+    }
 }
diff --git a/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/ProjectSpecTest.java b/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/ProjectSpecTest.java
index 806b0c91..ce33b8f9 100644
--- a/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/ProjectSpecTest.java
+++ b/rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/ProjectSpecTest.java
@@ -9,6 +9,9 @@
  */
 package org.eclipse.sw360.rest.resourceserver.restdocs;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
 import org.apache.thrift.TException;
 import org.eclipse.sw360.datahandler.common.SW360Utils;
 import org.eclipse.sw360.datahandler.thrift.MainlineState;
@@ -33,8 +36,9 @@ import org.eclipse.sw360.datahandler.thrift.components.Release;
 import org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseInfoFile;
 import org.eclipse.sw360.datahandler.thrift.licenseinfo.OutputFormatInfo;
 import org.eclipse.sw360.datahandler.thrift.licenseinfo.OutputFormatVariant;
-import org.eclipse.sw360.datahandler.thrift.projects.ProjectProjectRelationship;
 import org.eclipse.sw360.datahandler.thrift.projects.Project;
+import org.eclipse.sw360.datahandler.thrift.projects.ProjectClearingState;
+import org.eclipse.sw360.datahandler.thrift.projects.ProjectProjectRelationship;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectRelationship;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectState;
 import org.eclipse.sw360.datahandler.thrift.projects.ProjectType;
@@ -59,20 +63,24 @@ import org.junit.runner.RunWith;
 import org.mockito.Mockito;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.hateoas.MediaTypes;
-import org.springframework.hateoas.EntityModel;
 import org.springframework.hateoas.CollectionModel;
+import org.springframework.hateoas.EntityModel;
+import org.springframework.hateoas.MediaTypes;
 import org.springframework.http.MediaType;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
 
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
 import java.io.IOException;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import static org.eclipse.sw360.datahandler.thrift.MainlineState.MAINLINE;
 import static org.eclipse.sw360.datahandler.thrift.MainlineState.OPEN;
@@ -84,14 +92,17 @@ import static org.mockito.Mockito.when;
 import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.linkWithRel;
 import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.links;
 import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
-import static org.springframework.restdocs.payload.PayloadDocumentation.*;
+import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields;
+import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
 import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
 import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 public class ProjectSpecTest extends TestRestDocsSpecBase {
@@ -314,6 +325,13 @@ public class ProjectSpecTest extends TestRestDocsSpecBase {
                         .setState(ProjectState.ACTIVE)
                         .setCreatedOn(new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
                         .setVendor((new  Vendor("Test", "Test short", "http://testvendoraddress.com").setId("987567468"))));
+        given(this.projectServiceMock.getMyProjects(any(), any())).willReturn(new ArrayList<>(projectList));
+        given(this.projectServiceMock.getWithFilledClearingStatus(
+                eq(new ArrayList<>(projectList)), eq(ImmutableMap.<String, Boolean>builder()
+                        .put(ProjectClearingState.OPEN.toString(), true)
+                        .put(ProjectClearingState.CLOSED.toString(), true)
+                        .put(ProjectClearingState.IN_PROGRESS.toString(), true)
+                        .build()))).willReturn(new ArrayList<>(projectList));
 
         Release release = new Release();
         release.setId("3765276512");
@@ -1532,4 +1550,47 @@ public class ProjectSpecTest extends TestRestDocsSpecBase {
                 .header("Authorization", "Bearer " + accessToken)).andExpect(status().isCreated());
     }
 
+    @Test
+    public void should_document_get_my_projects() throws Exception {
+        String accessToken = TestHelper.getAccessToken(mockMvc, testUserId, testUserPassword);
+        mockMvc.perform(get("/api/projects/myprojects")
+                        .header("Authorization", "Bearer " + accessToken)
+                        .param("createdBy", "true")
+                        .param("moderator", "true")
+                        .param("contributor", "true")
+                        .param("projectOwner", "true")
+                        .param("leadArchitect", "true")
+                        .param("projectResponsible", "true")
+                        .param("securityResponsible", "true")
+                        .param("stateOpen", "true")
+                        .param("stateClosed", "true")
+                        .param("stateInProgress", "true")
+                        .param("allDetails", "true")
+                        .accept(MediaTypes.HAL_JSON))
+                .andExpect(status().isOk())
+                .andDo(this.documentationHandler.document(
+                        requestParameters(
+                                parameterWithName("createdBy").description("Projects with current user as creator. Possible values are `<true|false>`"),
+                                parameterWithName("moderator").description("Projects with current user as moderator. Possible values are `<true|false>`"),
+                                parameterWithName("contributor").description("Projects with current user as contributor. Possible values are `<true|false>`"),
+                                parameterWithName("projectOwner").description("Projects with current user as owner. Possible values are `<true|false>`"),
+                                parameterWithName("leadArchitect").description("Projects with current user as lead architect. Possible values are `<true|false>`"),
+                                parameterWithName("projectResponsible").description("Projects with current user as project responsible. Possible values are `<true|false>`"),
+                                parameterWithName("securityResponsible").description("Projects with current user as security responsible. Possible values are `<true|false>`"),
+                                parameterWithName("stateOpen").description("Projects with state as open. Possible values are `<true|false>`"),
+                                parameterWithName("stateClosed").description("Projects with state as closed. Possible values are `<true|false>`"),
+                                parameterWithName("stateInProgress").description("Projects with state as in progress. Possible values are `<true|false>`"),
+                                parameterWithName("allDetails").description("Flag to get projects with all details. Possible values are `<true|false>`")
+                        ),
+                        links(
+                                linkWithRel("curies").description("Curies are used for online documentation")
+                        ),
+                        responseFields(
+                                subsectionWithPath("_embedded.sw360:projects.[]name").description("The name of the project"),
+                                subsectionWithPath("_embedded.sw360:projects.[]version").description("The project version"),
+                                subsectionWithPath("_embedded.sw360:projects.[]projectType").description("The project type, possible values are: " + Arrays.asList(ProjectType.values())),
+                                subsectionWithPath("_embedded.sw360:projects").description("An array of <<resources-projects, Projects resources>>"),
+                                subsectionWithPath("_links").description("<<resources-index-links,Links>> to other resources")
+                        )));
+    }
 }
['rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java', 'rest/resource-server/src/docs/asciidoc/projects.adoc', 'rest/resource-server/src/test/java/org/eclipse/sw360/rest/resourceserver/restdocs/ProjectSpecTest.java', 'rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/Sw360ProjectService.java']