| author | Shawn F. Cook | 2011-09-30 18:06:12 (EDT) |
|---|---|---|
| committer | Roberto E. Escobar | 2011-09-30 18:06:12 (EDT) |
| commit | dca09fa3470d2b5c75e612200ba609503dda0ed2 (patch) (side-by-side diff) | |
| tree | 335d79273cd19078d810ae7d3f018bba27c000d5 | |
| parent | 0b99a5a8e99a6c2372d3328c057c64ee00e0372e (diff) | |
| download | org.eclipse.osee-dca09fa3470d2b5c75e612200ba609503dda0ed2.zip org.eclipse.osee-dca09fa3470d2b5c75e612200ba609503dda0ed2.tar.gz org.eclipse.osee-dca09fa3470d2b5c75e612200ba609503dda0ed2.tar.bz2 | |
feature[ats_8KF8L]: Convert to using new Search API
70 files changed, 1846 insertions, 869 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF index e735f46..f7db0d1 100644 --- a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF @@ -10,4 +10,5 @@ Export-Package: org.eclipse.osee.ats.api.components, org.eclipse.osee.ats.api.tokens Require-Bundle: org.eclipse.osee.display.api, org.eclipse.osee.framework.core -Require-Bundle: org.eclipse.osee.framework.core +Require-Bundle: org.eclipse.osee.framework.core, + org.eclipse.osee.display.api diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/components/AtsSearchHeaderComponent.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/components/AtsSearchHeaderComponentInterface.java index e1d25bd..65ef184 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/components/AtsSearchHeaderComponent.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/components/AtsSearchHeaderComponentInterface.java @@ -8,7 +8,7 @@ package org.eclipse.osee.ats.api.components; import org.eclipse.osee.display.api.components.SearchHeaderComponent; import org.eclipse.osee.display.api.data.WebId; -public interface AtsSearchHeaderComponent extends SearchHeaderComponent { +public interface AtsSearchHeaderComponentInterface extends SearchHeaderComponent { void addProgram(WebId program); @@ -18,4 +18,8 @@ public interface AtsSearchHeaderComponent extends SearchHeaderComponent { void setSearchCriteria(WebId program, WebId build, boolean nameOnly, String searchPhrase); + void setProgram(WebId program); + + void setBuild(WebId build); + } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/search/AtsWebSearchPresenter.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/search/AtsWebSearchPresenter.java index 05ac46c..5afb086 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/search/AtsWebSearchPresenter.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/search/AtsWebSearchPresenter.java @@ -10,9 +10,10 @@ *******************************************************************************/ package org.eclipse.osee.ats.api.search; -import org.eclipse.osee.ats.api.components.AtsSearchHeaderComponent; +import org.eclipse.osee.ats.api.components.AtsSearchHeaderComponentInterface; import org.eclipse.osee.display.api.components.SearchResultsListComponent; import org.eclipse.osee.display.api.data.WebId; +import org.eclipse.osee.display.api.search.SearchNavigator; import org.eclipse.osee.display.api.search.SearchPresenter; /* @@ -20,13 +21,13 @@ import org.eclipse.osee.display.api.search.SearchPresenter; */ public interface AtsWebSearchPresenter extends SearchPresenter { - void selectSearch(WebId program, WebId build, boolean nameOnly, String searchPhrase); + void selectProgram(WebId program, AtsSearchHeaderComponentInterface headerComponent); - void programSelected(AtsSearchHeaderComponent headerComponent, WebId program); + void selectSearch(WebId program, WebId build, boolean nameOnly, String searchPhrase, SearchNavigator atsNavigator); //overloaded to avoid casting - void initSearchHome(AtsSearchHeaderComponent headerComponent); + void initSearchHome(AtsSearchHeaderComponentInterface headerComponent); //overloaded to avoid casting - void initSearchResults(String url, AtsSearchHeaderComponent searchHeaderComponent, SearchResultsListComponent resultsComponent); + void initSearchResults(String url, AtsSearchHeaderComponentInterface searchHeaderComponent, SearchResultsListComponent resultsComponent); } diff --git a/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF index 2ce792d..e363491 100644 --- a/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF @@ -7,4 +7,5 @@ Bundle-Vendor: Eclipse Foundation Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: org.eclipse.osee.ats.api, org.eclipse.osee.orcs, + org.eclipse.osee.display.api, org.eclipse.osee.framework.core diff --git a/plugins/org.eclipse.osee.ats.presenter/build.properties b/plugins/org.eclipse.osee.ats.presenter/build.properties index d4fbf40..3eeead5 100644 --- a/plugins/org.eclipse.osee.ats.presenter/build.properties +++ b/plugins/org.eclipse.osee.ats.presenter/build.properties @@ -5,4 +5,5 @@ bin.includes = META-INF/,\ additional.bundles = org.eclipse.osee.ats.api,\ org.eclipse.osee.display.api,\ org.eclipse.osee.framework.core,\ - org.eclipse.osee.orcs + org.eclipse.osee.orcs,\ + org.eclipse.osee.display.presenter diff --git a/plugins/org.eclipse.osee.ats.presenter/src/org/eclipse/osee/ats/presenter/internal/WebProgramsPresenter.java b/plugins/org.eclipse.osee.ats.presenter/src/org/eclipse/osee/ats/presenter/WebProgramsPresenter.java index 4991b08..3a17b29 100644 --- a/plugins/org.eclipse.osee.ats.presenter/src/org/eclipse/osee/ats/presenter/internal/WebProgramsPresenter.java +++ b/plugins/org.eclipse.osee.ats.presenter/src/org/eclipse/osee/ats/presenter/WebProgramsPresenter.java @@ -8,92 +8,49 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.ats.presenter.internal; +package org.eclipse.osee.ats.presenter; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.List; -import org.eclipse.osee.ats.api.components.AtsSearchHeaderComponent; +import org.eclipse.osee.ats.api.components.AtsSearchHeaderComponentInterface; import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; import org.eclipse.osee.ats.api.tokens.AtsArtifactToken; +import org.eclipse.osee.ats.api.tokens.AtsAttributeTypes; import org.eclipse.osee.ats.api.tokens.AtsRelationTypes; -import org.eclipse.osee.display.api.components.ArtifactHeaderComponent; -import org.eclipse.osee.display.api.components.AttributeComponent; -import org.eclipse.osee.display.api.components.RelationComponent; -import org.eclipse.osee.display.api.components.SearchHeaderComponent; -import org.eclipse.osee.display.api.components.SearchResultComponent; import org.eclipse.osee.display.api.components.SearchResultsListComponent; import org.eclipse.osee.display.api.data.WebId; import org.eclipse.osee.display.api.search.SearchNavigator; -import org.eclipse.osee.framework.core.data.IRelationTypeSide; +import org.eclipse.osee.display.presenter.ArtifactProvider; +import org.eclipse.osee.display.presenter.WebSearchPresenter; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; -import org.eclipse.osee.framework.core.enums.LoadLevel; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.orcs.ArtifactQuery; -import org.eclipse.osee.orcs.IArtifactQueryService; +import org.eclipse.osee.orcs.data.ReadableArtifact; /* * @author John Misinco */ -public class WebProgramsPresenter implements AtsWebSearchPresenter { +public class WebProgramsPresenter extends WebSearchPresenter implements AtsWebSearchPresenter { - public interface IFakeArtifact { - - List<IFakeArtifact> getRelatedArtifacts(IRelationTypeSide relationSide); - - IFakeArtifact getRelatedArtifact(IRelationTypeSide relationSide); - - String getName(); - - String getGuid(); - } - - private IArtifactQueryService queryService; - private SearchNavigator navigator; - - public void setArtifactQueryService(IArtifactQueryService queryService) { - this.queryService = queryService; - } - - public void setSearchNavigator(SearchNavigator navigator) { - this.navigator = navigator; - } - - @Override - public void initSearchHome(SearchHeaderComponent searchHeaderComp) { - } - - @Override - public void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp) { - } - - @Override - public void selectArtifact(WebId id) { - } - - @Override - public void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp) { + public WebProgramsPresenter(ArtifactProvider artifactProvider) { + super(artifactProvider); } @Override - public void selectRelationType(WebId id) { - } - - @Override - public void selectSearch(WebId program, WebId build, boolean nameOnly, String searchPhrase) { + public void selectSearch(WebId program, WebId build, boolean nameOnly, String searchPhrase, SearchNavigator atsNavigator) { String url = encode(program, build, nameOnly, searchPhrase); - navigator.navigateSearchResults(url); + atsNavigator.navigateSearchResults(url); } @Override - public void initSearchHome(AtsSearchHeaderComponent headerComponent) { + public void initSearchHome(AtsSearchHeaderComponentInterface headerComponent) { headerComponent.clearAll(); Collection<WebId> programs = null; try { programs = getPrograms(); - } catch (OseeCoreException ex) { + } catch (Exception ex) { headerComponent.setErrorMessage(ex.getMessage()); return; } @@ -103,7 +60,7 @@ public class WebProgramsPresenter implements AtsWebSearchPresenter { } @Override - public void initSearchResults(String url, AtsSearchHeaderComponent searchHeaderComponent, SearchResultsListComponent resultsComponent) { + public void initSearchResults(String url, AtsSearchHeaderComponentInterface searchHeaderComponent, SearchResultsListComponent resultsComponent) { SearchParameters params = decode(url); WebId program = null, build = null; searchHeaderComponent.clearAll(); @@ -111,7 +68,7 @@ public class WebProgramsPresenter implements AtsWebSearchPresenter { try { programs = getPrograms(); - } catch (OseeCoreException ex) { + } catch (Exception ex) { searchHeaderComponent.setErrorMessage(ex.getMessage()); return; } @@ -122,10 +79,15 @@ public class WebProgramsPresenter implements AtsWebSearchPresenter { } } + if (program == null) { + searchHeaderComponent.setErrorMessage(String.format("Invalid program id: [%s]", params.getProgram().getGuid())); + return; + } + Collection<WebId> builds = null; try { builds = getbuilds(program); - } catch (OseeCoreException ex) { + } catch (Exception ex) { searchHeaderComponent.setErrorMessage(ex.getMessage()); return; } @@ -136,15 +98,28 @@ public class WebProgramsPresenter implements AtsWebSearchPresenter { } } - searchHeaderComponent.setSearchCriteria(program, build, params.getNameOnly(), params.getSearchPhrase()); + if (build == null) { + searchHeaderComponent.setErrorMessage(String.format("Invalid build id: [%s]", params.getBuild().getGuid())); + return; + } + + String branchGuid; + try { + branchGuid = getBranchGuid(build); + } catch (OseeCoreException ex) { + searchHeaderComponent.setErrorMessage(String.format("Cannot resolve branch id from build id: [%s]", + params.getBuild().getGuid())); + return; + } - resultsComponent.clearAll(); - SearchResultComponent searchResult = resultsComponent.createSearchResult(); + searchHeaderComponent.setSearchCriteria(program, build, params.getNameOnly(), params.getSearchPhrase()); + String newUrl = encode(new WebId(branchGuid, ""), params.getNameOnly(), params.getSearchPhrase()); + initSearchResults(newUrl, searchHeaderComponent, resultsComponent); } @Override - public void programSelected(AtsSearchHeaderComponent headerComponent, WebId program) { + public void selectProgram(WebId program, AtsSearchHeaderComponentInterface headerComponent) { Collection<WebId> builds = null; try { builds = getbuilds(program); @@ -159,24 +134,23 @@ public class WebProgramsPresenter implements AtsWebSearchPresenter { private Collection<WebId> getPrograms() throws OseeCoreException { Collection<WebId> toReturn = new LinkedList<WebId>(); - ArtifactQuery webProgramsQuery = queryService.getFromToken(AtsArtifactToken.WebPrograms, CoreBranches.COMMON); - IFakeArtifact webProgramsArtifact = (IFakeArtifact) webProgramsQuery.getArtifactExactlyOne(LoadLevel.RELATION); - List<IFakeArtifact> programs = + ReadableArtifact webProgramsArtifact = + artifactProvider.getArtifactByArtifactToken(CoreBranches.COMMON, AtsArtifactToken.WebPrograms); + List<ReadableArtifact> programs = webProgramsArtifact.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members); - for (IFakeArtifact program : programs) { + for (ReadableArtifact program : programs) { toReturn.add(new WebId(program.getGuid(), program.getName())); } return toReturn; } private Collection<WebId> getbuilds(WebId program) throws OseeCoreException { - ArtifactQuery programQuery = queryService.getFromGuidOrHrid(program.getGuid(), CoreBranches.COMMON); - IFakeArtifact programArtifact = (IFakeArtifact) programQuery.getArtifactExactlyOne(LoadLevel.RELATION); - IFakeArtifact teamDef = programArtifact.getRelatedArtifact(CoreRelationTypes.SupportingInfo_SupportingInfo); - Collection<IFakeArtifact> relatedArtifacts = + ReadableArtifact programArtifact = artifactProvider.getArtifactByGuid(CoreBranches.COMMON, program.getGuid()); + ReadableArtifact teamDef = programArtifact.getRelatedArtifact(CoreRelationTypes.SupportingInfo_SupportingInfo); + Collection<ReadableArtifact> relatedArtifacts = teamDef.getRelatedArtifacts(AtsRelationTypes.TeamDefinitionToVersion_Version); Collection<WebId> builds = new ArrayList<WebId>(); - for (IFakeArtifact build : relatedArtifacts) { + for (ReadableArtifact build : relatedArtifacts) { builds.add(new WebId(build.getGuid(), build.getName())); } return builds; @@ -196,15 +170,22 @@ public class WebProgramsPresenter implements AtsWebSearchPresenter { } private SearchParameters decode(String url) { - String[] tokens = url.split("?"); + String[] tokens = url.split("\\?"); WebId program = new WebId(tokens[0].split("=")[1], "unknown"); WebId build = new WebId(tokens[1].split("=")[1], "unknown"); - boolean nameOnly = Boolean.getBoolean(tokens[2].split("=")[1]); + boolean nameOnly = tokens[2].split("=")[1].equalsIgnoreCase("true") ? true : false; String searchPhrase = tokens[3].split("=")[1]; searchPhrase = searchPhrase.replaceAll("%20", " "); return new SearchParameters(program, build, nameOnly, searchPhrase); } + private String getBranchGuid(WebId build) throws OseeCoreException { + String guid = null; + ReadableArtifact buildArtifact = artifactProvider.getArtifactByGuid(CoreBranches.COMMON, build.getGuid()); + guid = buildArtifact.getSoleAttributeAsString(AtsAttributeTypes.BaselineBranchGuid); + return guid; + } + private class SearchParameters { private final WebId program, build; diff --git a/plugins/org.eclipse.osee.ats.view.web.test/.classpath b/plugins/org.eclipse.osee.ats.view.web.test/.classpath new file mode 100644 index 0000000..ad32c83 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web.test/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.osee.ats.view.web.test/.project b/plugins/org.eclipse.osee.ats.view.web.test/.project new file mode 100644 index 0000000..f9262c7 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web.test/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osee.ats.view.web.test</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.osee.ats.view.web.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.view.web.test/META-INF/MANIFEST.MF new file mode 100644 index 0000000..30a2e90 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web.test/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: ATS View Web Test +Bundle-SymbolicName: org.eclipse.osee.ats.view.web.test +Bundle-Version: 0.9.9.qualifier +Bundle-Vendor: Eclipse Foundation +Fragment-Host: org.eclipse.osee.ats.view.web +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Import-Package: org.eclipse.osee.ats.api.search, + org.eclipse.osee.display.api.components, + org.eclipse.osee.display.api.data diff --git a/plugins/org.eclipse.osee.ats.view.web.test/build.properties b/plugins/org.eclipse.osee.ats.view.web.test/build.properties new file mode 100644 index 0000000..34d2e4d --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web.test/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/plugins/org.eclipse.osee.ats.view.web.test/src/org/eclipse/osee/ats/view/web/placeholder.txt b/plugins/org.eclipse.osee.ats.view.web.test/src/org/eclipse/osee/ats/view/web/placeholder.txt new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web.test/src/org/eclipse/osee/ats/view/web/placeholder.txt diff --git a/plugins/org.eclipse.osee.ats.view.web/.project b/plugins/org.eclipse.osee.ats.view.web/.project index b6afbe3..0243ecc 100644 --- a/plugins/org.eclipse.osee.ats.view.web/.project +++ b/plugins/org.eclipse.osee.ats.view.web/.project @@ -20,6 +20,11 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ds.core.builder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.pde.PluginNature</nature> diff --git a/plugins/org.eclipse.osee.ats.view.web/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.view.web/META-INF/MANIFEST.MF index efad0a1..63b6b74 100644 --- a/plugins/org.eclipse.osee.ats.view.web/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.view.web/META-INF/MANIFEST.MF @@ -5,3 +5,13 @@ Bundle-SymbolicName: org.eclipse.osee.ats.view.web Bundle-Version: 0.9.9.qualifier Bundle-Vendor: Eclipse Foundation Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Service-Component: OSGI-INF/*.xml +Require-Bundle: com.vaadin, + org.eclipse.osee.vaadin.widgets, + org.eclipse.osee.display.view.web, + org.eclipse.osee.vaadin, + org.eclipse.osee.ats.api, + org.eclipse.osee.display.api +Import-Package: org.eclipse.osee.ats.api.components, + org.eclipse.osee.framework.core.data, + org.osgi.framework;version="1.6.0" diff --git a/plugins/org.eclipse.osee.ats.view.web/OSGI-INF/ats.ui.app.factory.xml b/plugins/org.eclipse.osee.ats.view.web/OSGI-INF/ats.ui.app.factory.xml new file mode 100644 index 0000000..791c999 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/OSGI-INF/ats.ui.app.factory.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.ats.view.web.AtsUiApplicationFactory"> + <implementation class="org.eclipse.osee.ats.view.web.AtsUiApplicationFactory"/> + <property name="context.name" type="String" value="ui/ats"/> + <service> + <provide interface="org.eclipse.osee.vaadin.ApplicationFactory"/> + </service> +</scr:component> diff --git a/plugins/org.eclipse.osee.ats.view.web/build.properties b/plugins/org.eclipse.osee.ats.view.web/build.properties index 34d2e4d..e1697f4 100644 --- a/plugins/org.eclipse.osee.ats.view.web/build.properties +++ b/plugins/org.eclipse.osee.ats.view.web/build.properties @@ -2,3 +2,9 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ . +additional.bundles = com.vaadin,\ + org.eclipse.osee.display.view.web,\ + org.eclipse.osee.vaadin.widgets,\ + org.eclipse.osee.vaadin,\ + org.eclipse.osee.ats.api,\ + org.eclipse.osee.display.api diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsAppData.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsAppData.java new file mode 100644 index 0000000..9bdceff --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsAppData.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2011 Boeing. + * All rightsimport com.vaadin.Application; +import com.vaadin.service.ApplicationContext.TransactionListener; +he 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.ats.view.web; + +import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; +import org.eclipse.osee.display.api.search.SearchPresenter; +import org.eclipse.osee.display.view.web.OseeAppData; +import org.eclipse.osee.vaadin.widgets.Navigator; +import com.vaadin.Application; + +/** + * @author Shawn F. Cook AppData contains thread-safe session-global data based on Vaadin demonstation: + * https://vaadin.com/book/-/page/advanced.global.html + */ +public class AtsAppData extends OseeAppData { + + public AtsAppData(Application app) { + super(app); + } + + @Override + public void transactionStart(Application application, Object transactionData) { + // Set this data instance of this application + // as the one active in the current thread. + if (this.app == application) { + instance.set(this); + } + } + + @Override + public void transactionEnd(Application application, Object transactionData) { + // Clear the reference to avoid potential problems + if (this.app == application) { + instance.set(null); + } + } + + public static AtsNavigator getAtsNavigator() { + return (AtsNavigator) OseeAppData.getNavigator(); + } + + public static AtsWebSearchPresenter getAtsWebSearchPresenter() { + return (AtsWebSearchPresenter) OseeAppData.getAtsBackend(); + } + + @Override + protected Navigator createNavigator() { + return new AtsNavigator(); + } + + @Override + protected SearchPresenter createSearchPresenter() { + return AtsWebSearchPresenter_TestBackend.getInstance(); + } +} diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsNavigator.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsNavigator.java new file mode 100644 index 0000000..0b8dece --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsNavigator.java @@ -0,0 +1,24 @@ +/* + * Created on Sep 30, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.ats.view.web; + +import org.eclipse.osee.ats.view.web.search.AtsSearchResultsView; +import org.eclipse.osee.display.api.search.SearchNavigator; +import org.eclipse.osee.vaadin.widgets.Navigator; + +public class AtsNavigator extends Navigator implements SearchNavigator { + + @Override + public void navigateSearchResults(String url) { + String classUri = getUri(AtsSearchResultsView.class); + this.navigateTo(String.format("%s%s", classUri, url)); + } + + @Override + public void navigateArtifactPage(String url) { + //TODO: + } +} diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplication.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplication.java new file mode 100644 index 0000000..7175ffc --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplication.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.ats.view.web; + +import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; +import org.eclipse.osee.vaadin.widgets.HasViews; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; +import com.vaadin.Application; +import com.vaadin.ui.Window; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class AtsUiApplication extends Application { + + private final AtsWebSearchPresenter atsBackend = AtsWebSearchPresenter_TestBackend.getInstance(); + + @Override + public void init() { + setTheme("osee"); + @SuppressWarnings("unused") + AtsAppData sessionData = new AtsAppData(this); + AtsWindowFactory factory = new AtsWindowFactory(); + HasViews viewProvider = new AtsUiViews(); + Window mainWindow = factory.createNavigatableWindow(viewProvider); + setMainWindow(mainWindow); + mainWindow.setApplication(this); + } + + @Override + public String getVersion() { + Bundle bundle = FrameworkUtil.getBundle(this.getClass()); + return bundle.getVersion().toString(); + } + + public AtsWebSearchPresenter getAtsWebSearchPresenter() { + return atsBackend; + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsListComponent.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplicationFactory.java index b03476b..5807c46 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsListComponent.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplicationFactory.java @@ -8,18 +8,24 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ +package org.eclipse.osee.ats.view.web; -package org.eclipse.osee.display.view.web.internal.search; - -import org.eclipse.osee.vaadin.widgets.Navigator; -import com.vaadin.ui.VerticalLayout; +import org.eclipse.osee.vaadin.ApplicationFactory; +import com.vaadin.Application; /** * @author Shawn F. Cook */ -@SuppressWarnings("serial") -public class OseeSearchResultsListComponent extends VerticalLayout { - public OseeSearchResultsListComponent(Navigator navigator) { +public class AtsUiApplicationFactory implements ApplicationFactory { + + @Override + public Application createInstance() { + return new AtsUiApplication(); + } + @Override + public Class<? extends Application> getApplicationClass() { + return AtsUiApplication.class; } + } diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiViews.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiViews.java new file mode 100644 index 0000000..c5ea169 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiViews.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.ats.view.web; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.osee.ats.view.web.search.AtsSearchHomeView; +import org.eclipse.osee.ats.view.web.search.AtsSearchResultsView; +import org.eclipse.osee.vaadin.widgets.HasViews; +import org.eclipse.osee.vaadin.widgets.Navigator; + +/** + * @author Roberto E. Escobar + */ +public class AtsUiViews implements HasViews { + + @Override + public List<Class<? extends Navigator.View>> getViews() { + // Dynamic View Registration? + List<Class<? extends Navigator.View>> views = new ArrayList<Class<? extends Navigator.View>>(); + views.add(AtsSearchHomeView.class); + views.add(AtsSearchResultsView.class); + return views; + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWebSearchPresenter_TestBackend.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWebSearchPresenter_TestBackend.java new file mode 100644 index 0000000..ade62e4 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWebSearchPresenter_TestBackend.java @@ -0,0 +1,290 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.ats.view.web; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import org.eclipse.osee.ats.api.components.AtsSearchHeaderComponentInterface; +import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; +import org.eclipse.osee.display.api.components.ArtifactHeaderComponent; +import org.eclipse.osee.display.api.components.AttributeComponent; +import org.eclipse.osee.display.api.components.RelationComponent; +import org.eclipse.osee.display.api.components.SearchHeaderComponent; +import org.eclipse.osee.display.api.components.SearchResultComponent; +import org.eclipse.osee.display.api.components.SearchResultsListComponent; +import org.eclipse.osee.display.api.data.SearchResultMatch; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.api.data.WebId; +import org.eclipse.osee.display.api.search.SearchNavigator; +import org.eclipse.osee.display.view.web.UrlParamNameConstants; + +/** + * @author Shawn F. Cook + */ +public class AtsWebSearchPresenter_TestBackend implements AtsWebSearchPresenter { + + private static final AtsWebSearchPresenter atsBackend = new AtsWebSearchPresenter_TestBackend(); + + //*** TEST DATA *** + WebId build0 = new WebId("baseline_guid", "Baseline"); + WebId build1 = new WebId("bld_1_guid", "Bld_1"); + WebId build2 = new WebId("ftb0_guid", "FTP0"); + WebId build3 = new WebId("FTB1_guid", "FTB1"); + WebId build4 = new WebId("FTB2_guid", "FTB2"); + WebId build5 = new WebId("FTB3_guid", "FTB3"); + WebId build6 = new WebId("EB0_guid", "EB0"); + WebId build7 = new WebId("EB1_guid", "EB1"); + + WebId program0 = new WebId("blk3_guid", "Blk 3"); + WebId program1 = new WebId("v131_guid", "V13.1"); + WebId program2 = new WebId("taiwan_guid", "Taiwan"); + + WebArtifact defaultroot = new WebArtifact("defaultHierarchRoot_GUID", "Default Hierarchy Root", "Root Artifact"); + WebArtifact swreqs = new WebArtifact("SWReq_GUID", "Software Requirements", "Folder"); + WebArtifact crewIntreqs = new WebArtifact("CrewInt_GUID", "Crew Interface", "Folder"); + WebArtifact commSubSysCrewIntreqs = new WebArtifact("commSubSysCrewInt_GUID", + "Communication Subsystem Crew Interface", "Heading"); + WebArtifact comm_page_Intreqs = new WebArtifact("com_page_GUID", "{COM_PAGE}", "Software Requirement"); + + private final Map<WebId, Collection<WebId>> programsAndBuilds = new HashMap<WebId, Collection<WebId>>(); + private final Map<String, WebArtifact> artifacts = new HashMap<String, WebArtifact>(); + + public AtsWebSearchPresenter_TestBackend() { + super(); + + //populate test data + programsAndBuilds.put(program0, Arrays.asList(build0, build1, build2)); + programsAndBuilds.put(program1, Arrays.asList(build3, build4, build5)); + programsAndBuilds.put(program2, Arrays.asList(build6, build7)); + + // Map<RelationType, Collection<Artifact>> swreqsRelations = new HashMap<RelationType, Collection<Artifact>>(); + // swreqsRelations.put(RelationType.PARENT, Arrays.asList(defaultroot)); + // Artifact swreqs = new Artifact("SWReq_GUID", "Software Requirements", "Folder", swreqsRelations); + // + // Map<RelationType, Collection<Artifact>> crewIntRelations = new HashMap<RelationType, Collection<Artifact>>(); + // crewIntRelations.put(RelationType.PARENT, Arrays.asList(swreqs)); + // Artifact crewIntreqs = new Artifact("CrewInt_GUID", "Crew Interface", "Folder", crewIntRelations); + // + // Map<RelationType, Collection<Artifact>> commSubSysCrewIntRelations = + // new HashMap<RelationType, Collection<Artifact>>(); + // commSubSysCrewIntRelations.put(RelationType.PARENT, Arrays.asList(crewIntreqs)); + // Artifact commSubSysCrewIntreqs = + // new Artifact("commSubSysCrewInt_GUID", "Communication Subsystem Crew Interface", "Heading", + // commSubSysCrewIntRelations); + // + // Map<RelationType, Collection<Artifact>> comm_page_Relations = new HashMap<RelationType, Collection<Artifact>>(); + // comm_page_Relations.put(RelationType.PARENT, Arrays.asList(commSubSysCrewIntreqs)); + // Artifact comm_page_Intreqs = + // new Artifact("com_page_GUID", "{COM_PAGE}", "Software Requirement", comm_page_Relations); + + artifacts.put(defaultroot.getGuid(), defaultroot); + artifacts.put(swreqs.getGuid(), swreqs); + artifacts.put(crewIntreqs.getGuid(), crewIntreqs); + artifacts.put(commSubSysCrewIntreqs.getGuid(), commSubSysCrewIntreqs); + artifacts.put(comm_page_Intreqs.getGuid(), comm_page_Intreqs); + + } + + @Override + public void selectSearch(WebId program, WebId build, boolean nameOnly, String searchPhrase, SearchNavigator atsNavigator) { + if (atsNavigator != null) { + Map<String, String> parameters = new HashMap<String, String>(); + if (program != null) { + parameters.put(UrlParamNameConstants.PARAMNAME_PROGRAM, program.getGuid()); + } + if (build != null) { + parameters.put(UrlParamNameConstants.PARAMNAME_BUILD, build.getGuid()); + } + parameters.put(UrlParamNameConstants.PARAMNAME_NAMEONLY, nameOnly ? "true" : "false"); + if (searchPhrase != null) { + parameters.put(UrlParamNameConstants.PARAMNAME_SEARCHPHRASE, searchPhrase); + } + if (parameters.size() > 0) { + String url = parameterMapToRequestString(parameters); + atsNavigator.navigateSearchResults(url); + } + } + } + + @Override + public void initSearchHome(AtsSearchHeaderComponentInterface headerComponent) { + if (headerComponent != null) { + headerComponent.clearAll(); + Set<Entry<WebId, Collection<WebId>>> entrySet = programsAndBuilds.entrySet(); + if (entrySet != null) { + for (Entry<WebId, Collection<WebId>> entry : entrySet) { + headerComponent.addProgram(entry.getKey()); + } + } + // headerComponent.setProgram(program0); + } + } + + public static AtsWebSearchPresenter getInstance() { + return atsBackend; + } + + @Override + public void selectProgram(WebId program, AtsSearchHeaderComponentInterface headerComponent) { + if (program != null && headerComponent != null) { + Collection<WebId> builds = programsAndBuilds.get(program); + headerComponent.clearBuilds(); + for (WebId build : builds) { + headerComponent.addBuild(build); + } + // headerComponent.setBuild(builds.iterator().next()); + } + } + + @Override + public void initSearchResults(String url, AtsSearchHeaderComponentInterface searchHeaderComponent, SearchResultsListComponent resultsComponent) { + Map<String, String> params = requestStringToParameterMap(url); + WebId program = new WebId("", ""); + WebId build = new WebId("", ""); + boolean nameOnly = false; + String searchPhrase = ""; + + if (params != null) { + String programGuid = params.get(UrlParamNameConstants.PARAMNAME_PROGRAM); + if (programGuid != null) { + program = getProgramWithGuid(programGuid); + } + String buildGuid = params.get(UrlParamNameConstants.PARAMNAME_BUILD); + if (buildGuid != null) { + build = getBuildWithGuid(buildGuid); + } + String nameOnlyStr = params.get(UrlParamNameConstants.PARAMNAME_NAMEONLY); + if (nameOnlyStr != null) { + nameOnly = nameOnlyStr.equalsIgnoreCase("true"); + } + + searchPhrase = params.get(UrlParamNameConstants.PARAMNAME_SEARCHPHRASE); + if (searchPhrase == null) { + searchPhrase = ""; + } + } + + if (searchHeaderComponent != null) { + searchHeaderComponent.clearAll(); + Set<Entry<WebId, Collection<WebId>>> entrySetProg = programsAndBuilds.entrySet(); + for (Entry<WebId, Collection<WebId>> entry : entrySetProg) { + searchHeaderComponent.addProgram(entry.getKey()); + } + searchHeaderComponent.setSearchCriteria(program, build, nameOnly, searchPhrase); + } + + if (resultsComponent != null) { + resultsComponent.clearAll(); + Set<Entry<String, WebArtifact>> entrySet = artifacts.entrySet(); + for (Entry<String, WebArtifact> artifactEntry : entrySet) { + SearchResultComponent searchResultComp = resultsComponent.createSearchResult(); + if (searchResultComp != null) { + WebArtifact artifact = artifactEntry.getValue(); + searchResultComp.setArtifact(artifact); + searchResultComp.addSearchResultMatch(new SearchResultMatch("Word Template Content", "...{COM_PAGE}...", + 10)); + } + } + } + } + + private static Map<String, String> requestStringToParameterMap(String requestedDataId) { + Map<String, String> parameters = new HashMap<String, String>(); + + //TODO: Need better error detection for malformed parameter strings here. + + if (requestedDataId != null) { + String[] tokens = requestedDataId.split("/"); + if (tokens.length > 1) { + for (int i = 0; i < tokens.length; i++) { + String paramName = tokens[i]; + i++; + String paramValue = tokens[i]; + parameters.put(paramName, paramValue); + } + } + } + + return parameters; + } + + private static String parameterMapToRequestString(Map<String, String> parameters) { + String requestedDataId = "/"; + + //TODO: Need to properly encode the URI parameters here. + + Set<Entry<String, String>> keyValuePairs = parameters.entrySet(); + for (Iterator<Entry<String, String>> iter = keyValuePairs.iterator(); iter.hasNext();) { + Entry<String, String> pair = iter.next(); + if (pair.getKey() != null && !pair.getKey().isEmpty() && pair.getValue() != null && !pair.getValue().isEmpty()) { + requestedDataId = String.format("%s%s/%s", requestedDataId, pair.getKey(), pair.getValue()); + if (iter.hasNext()) { + requestedDataId = String.format("%s/", requestedDataId); + } + } + } + + return requestedDataId; + } + + private WebId getProgramWithGuid(String programGuid) { + if (programGuid != null && !programGuid.isEmpty()) { + for (WebId program : programsAndBuilds.keySet()) { + if (program.getGuid().equals(programGuid)) { + return program; + } + } + } + + return null; + } + + private WebId getBuildWithGuid(String buildGuid) { + if (buildGuid != null && !buildGuid.isEmpty()) { + Set<Entry<WebId, Collection<WebId>>> entrySet = programsAndBuilds.entrySet(); + for (Entry<WebId, Collection<WebId>> programAndBuilds : entrySet) { + Collection<WebId> builds = programAndBuilds.getValue(); + for (WebId build : builds) { + if (build.getGuid().equals(buildGuid)) { + return build; + } + } + } + } + + return null; + } + + @Override + public void initSearchHome(SearchHeaderComponent searchHeaderComp) { + } + + @Override + public void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp) { + } + + @Override + public void selectArtifact(WebId id) { + } + + @Override + public void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp) { + } + + @Override + public void selectRelationType(WebId id) { + } +} diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWindowFactory.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWindowFactory.java new file mode 100644 index 0000000..b298714 --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWindowFactory.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 20011 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.ats.view.web; + +import org.eclipse.osee.display.view.web.OseeFooter; +import org.eclipse.osee.vaadin.widgets.AccountMenuBar; +import org.eclipse.osee.vaadin.widgets.HasViews; +import org.eclipse.osee.vaadin.widgets.Navigator; +import org.eclipse.osee.vaadin.widgets.Navigator.View; +import org.eclipse.osee.vaadin.widgets.Navigator.ViewChangeListener; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.MenuBar; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class AtsWindowFactory { + + public Window createNavigatableWindow(HasViews provider) { + AtsNavigator navigator = AtsAppData.getAtsNavigator(); + + VerticalLayout layout = new VerticalLayout(); + final Window w = new Window("OSEE", layout); + + w.addComponent(createNavigationBar(navigator, provider)); + w.addComponent(navigator); + w.addComponent(createFooter()); + + layout.setMargin(false); + layout.setSpacing(true); + layout.setSizeFull(); + layout.setExpandRatio(navigator, 1.0f); + + navigator.addListener(new ViewChangeListener() { + @Override + public void navigatorViewChange(View previous, View current) { + Window mainWindow = w.getApplication().getMainWindow(); + mainWindow.setCaption("OSEE - " + current.getClass().getSimpleName()); + mainWindow.showNotification("Navigated to " + current.getClass().getName()); + } + }); + return w; + } + + private Component createFooter() { + return new OseeFooter(); + } + + private Component createNavigationBar(final Navigator navigator, HasViews provider) { + HorizontalLayout layout = new HorizontalLayout(); + + MenuBar menu = new MenuBar(); + layout.addComponent(menu); + + menu.setWidth("100%"); + layout.setWidth("100%"); + for (final Class<?> viewClass : provider.getViews()) { + navigator.addView(viewClass.getSimpleName(), viewClass); + menu.addItem(viewClass.getSimpleName(), new MenuBar.Command() { + + @Override + public void menuSelected(MenuBar.MenuItem selectedItem) { + navigator.navigateTo(viewClass); + } + }); + } + + MenuBar menuBar = new AccountMenuBar(); + layout.addComponent(menuBar); + + layout.setComponentAlignment(menu, Alignment.BOTTOM_LEFT); + layout.setComponentAlignment(menuBar, Alignment.BOTTOM_RIGHT); + layout.setExpandRatio(menu, 1.0f); + return layout; + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchHeaderComponent.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderComponent.java index 6b42af0..b89d9de 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchHeaderComponent.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderComponent.java @@ -8,19 +8,24 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.display.view.web.internal.search; - -import org.eclipse.osee.display.api.search.SearchPresenter; -import org.eclipse.osee.display.api.search.SearchView; +package org.eclipse.osee.ats.view.web.components; + +import org.eclipse.osee.ats.api.components.AtsSearchHeaderComponentInterface; +import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; +import org.eclipse.osee.ats.view.web.AtsAppData; +import org.eclipse.osee.ats.view.web.AtsNavigator; +import org.eclipse.osee.ats.view.web.search.AtsSearchHomeView; +import org.eclipse.osee.display.api.data.WebId; +import org.eclipse.osee.display.view.web.CssConstants; +import org.eclipse.osee.display.view.web.components.OseeLogoLink; +import org.eclipse.osee.display.view.web.search.OseeSearchHeaderComponent; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.terminal.ThemeResource; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CheckBox; import com.vaadin.ui.ComboBox; -import com.vaadin.ui.Embedded; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.TextField; @@ -30,42 +35,40 @@ import com.vaadin.ui.VerticalLayout; * @author Shawn F. Cook */ @SuppressWarnings("serial") -public class OseeSearchHeaderComponent extends VerticalLayout implements SearchView { +public class AtsSearchHeaderComponent extends OseeSearchHeaderComponent implements AtsSearchHeaderComponentInterface { private boolean populated; private final ComboBox programCombo = new ComboBox("Program:"); private final ComboBox buildCombo = new ComboBox("Build:"); - final CheckBox nameOnlyCheckBox = new CheckBox("Name Only", false); - final TextField searchTextField = new TextField(); + private final CheckBox nameOnlyCheckBox = new CheckBox("Name Only", false); + private final TextField searchTextField = new TextField(); private final boolean showOseeTitleAbove; + private final AtsWebSearchPresenter atsBackend = AtsAppData.getAtsWebSearchPresenter(); + private final AtsNavigator atsNavigator = AtsAppData.getAtsNavigator(); - // private ProgramsAndBuilds builds; - - public OseeSearchHeaderComponent(boolean showOseeTitleAbove) { + public AtsSearchHeaderComponent(boolean showOseeTitleAbove) { this.showOseeTitleAbove = showOseeTitleAbove; - programCombo.setNullSelectionAllowed(false); - buildCombo.setNullSelectionAllowed(false); - SearchPresenter webBackend = new OseeWebBackend(); - // webBackend.getProgramsAndBuilds(this); - - programCombo.addListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - buildCombo.removeAllItems(); - // Program program = (Program) programCombo.getValue(); - // Collection<Build> buildList = builds.getBuilds(program); - // for (Build build : buildList) { - // buildCombo.addItem(build); - // } - } - }); - programCombo.setImmediate(true); + if (programCombo != null) { + programCombo.setNullSelectionAllowed(false); + final AtsSearchHeaderComponentInterface me = this; + programCombo.addListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + WebId program = (WebId) programCombo.getValue(); + atsBackend.selectProgram(program, me); + } + }); + programCombo.setImmediate(true); + } + if (buildCombo != null) { + buildCombo.setNullSelectionAllowed(false); + } searchTextField.setImmediate(true); } @Override - public void attach() { + protected void createLayout() { if (populated) { // Only populate the layout once return; @@ -79,8 +82,8 @@ public class OseeSearchHeaderComponent extends VerticalLayout implements SearchV HorizontalLayout hLayoutRow1 = new HorizontalLayout(); HorizontalLayout hLayoutRow2 = new HorizontalLayout(); - Embedded oseeTitleLabel = new Embedded("", new ThemeResource("../osee/osee_large.png")); - oseeTitleLabel.setType(Embedded.TYPE_IMAGE); + // Embedded oseeTitleLabel = new Embedded("", new ThemeResource("../osee/osee_large.png")); + // oseeTitleLabel.setType(Embedded.TYPE_IMAGE); Label spacer1 = new Label(""); spacer1.setHeight(null); @@ -104,12 +107,11 @@ public class OseeSearchHeaderComponent extends VerticalLayout implements SearchV Button searchButton = new Button("Search", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - // Program program = (Program) programCombo.getValue(); - // Build build = (Build) buildCombo.getValue(); - String isNameOnly = nameOnlyCheckBox.toString(); + WebId program = (WebId) programCombo.getValue(); + WebId build = (WebId) buildCombo.getValue(); + boolean nameOnly = nameOnlyCheckBox.toString().equalsIgnoreCase("true"); String searchPhrase = (String) searchTextField.getValue(); - // SearchCriteria searchCriteria = new SearchCriteria(program, build, isNameOnly.equals("true"), searchPhrase); - // OseeRoadMapAndNavigation.navigateToSearchResults(searchCriteria); + atsBackend.selectSearch(program, build, nameOnly, searchPhrase, atsNavigator); } }); hLayoutRow2.addComponent(searchTextField); @@ -119,6 +121,8 @@ public class OseeSearchHeaderComponent extends VerticalLayout implements SearchV hLayoutRow2.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); if (showOseeTitleAbove) { + OseeLogoLink oseeTitleLabel = + new OseeLogoLink(atsNavigator, CssConstants.OSEE_TITLE_LARGE_TEXT, AtsSearchHomeView.class); hLayoutRow0.addComponent(oseeTitleLabel); hLayoutRow0.setComponentAlignment(oseeTitleLabel, Alignment.MIDDLE_CENTER); oseeTitleLabel.setStyleName(CssConstants.OSEE_TITLE_LARGE_TEXT); @@ -134,6 +138,8 @@ public class OseeSearchHeaderComponent extends VerticalLayout implements SearchV setComponentAlignment(hLayoutRow1, Alignment.MIDDLE_CENTER); setComponentAlignment(hLayoutRow2, Alignment.MIDDLE_CENTER); } else { + OseeLogoLink oseeTitleLabel = + new OseeLogoLink(atsNavigator, CssConstants.OSEE_TITLE_MEDIUM_TEXT, AtsSearchHomeView.class); Label spacer4 = new Label(""); spacer4.setWidth(15, UNITS_PIXELS); oseeTitleLabel.setHeight(70, UNITS_PIXELS); @@ -160,50 +166,80 @@ public class OseeSearchHeaderComponent extends VerticalLayout implements SearchV addComponent(spacer5); } - // SearchCriteria searchCriteria = OseeRoadMapAndNavigation.getSearchCriteria(); - // if (searchCriteria != null) { - // programCombo.setValue(searchCriteria.getProgram()); - // buildCombo.setValue(searchCriteria.getBuild()); - // nameOnlyCheckBox.setValue(searchCriteria.isNameOnly()); - // searchTextField.setValue(searchCriteria.getSearchPhrase()); - // } - populated = true; } - // @Override - // public void setSearchResults(Collection<SearchResult> searchResults) { - // //Do Nothing - // } - - // @Override - // public void setProgramsAndBuilds(ProgramsAndBuilds builds) { - // programCombo.removeAllItems(); - // buildCombo.removeAllItems(); - // - // if (builds != null) { - // this.builds = builds; - // for (Program program : this.builds.getPrograms()) { - // programCombo.addItem(program); - // } - // } - // } - - // @Override - // public void setArtifact(Artifact artifact) { - // //Do nothing - // } - // - // @Override - // public void setProgram(Program program) { - // } - // - // @Override - // public void setBuild(Build build) { - // } - // - // @Override - // public void setErrorMessage(String message) { - // } + @Override + public void addProgram(WebId program) { + if (programCombo != null) { + programCombo.addItem(program); + } + } + + @Override + public void clearBuilds() { + if (buildCombo != null) { + buildCombo.removeAllItems(); + } + } + + @Override + public void addBuild(WebId build) { + if (buildCombo != null) { + buildCombo.addItem(build); + } + } + + @Override + public void setSearchCriteria(WebId program, WebId build, boolean nameOnly, String searchPhrase) { + if (programCombo != null) { + programCombo.setValue(program); + } + if (buildCombo != null) { + buildCombo.setValue(build); + } + if (nameOnlyCheckBox != null) { + nameOnlyCheckBox.setValue(nameOnly); + } + if (searchTextField != null) { + searchTextField.setValue(searchPhrase); + } + } + + @Override + public void clearAll() { + if (programCombo != null) { + // programCombo.removeAllItems(); + programCombo.setValue(null); + } + if (buildCombo != null) { + // buildCombo.removeAllItems(); + buildCombo.setValue(null); + } + if (nameOnlyCheckBox != null) { + nameOnlyCheckBox.setValue(false); + } + if (searchTextField != null) { + searchTextField.setValue(""); + } + } + + @Override + public void setProgram(WebId program) { + if (programCombo != null) { + programCombo.setValue(program); + } + } + + @Override + public void setBuild(WebId build) { + if (buildCombo != null) { + buildCombo.setValue(build); + } + } + + @Override + public void setErrorMessage(String message) { + } } diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchHomeView.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchHomeView.java new file mode 100644 index 0000000..257ab1f --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchHomeView.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.ats.view.web.search; + +import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; +import org.eclipse.osee.ats.view.web.AtsAppData; +import org.eclipse.osee.ats.view.web.components.AtsSearchHeaderComponent; +import org.eclipse.osee.display.view.web.search.OseeSearchHeaderComponent; +import org.eclipse.osee.display.view.web.search.OseeSearchHomeView; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class AtsSearchHomeView extends OseeSearchHomeView { + + private final AtsWebSearchPresenter atsBackend = AtsAppData.getAtsWebSearchPresenter(); + + @Override + protected OseeSearchHeaderComponent getOseeSearchHeader() { + return new AtsSearchHeaderComponent(true); + } + + @Override + protected void initComponents() { + if (atsBackend != null) { + atsBackend.initSearchHome((AtsSearchHeaderComponent) oseeSearchHeader); + } + } +} diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchResultsView.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchResultsView.java new file mode 100644 index 0000000..01388ba --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchResultsView.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.ats.view.web.search; + +import org.eclipse.osee.ats.api.components.AtsSearchHeaderComponentInterface; +import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; +import org.eclipse.osee.ats.view.web.AtsAppData; +import org.eclipse.osee.ats.view.web.components.AtsSearchHeaderComponent; +import org.eclipse.osee.display.view.web.search.OseeSearchHeaderComponent; +import org.eclipse.osee.display.view.web.search.OseeSearchResultsView; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class AtsSearchResultsView extends OseeSearchResultsView { + + private final AtsWebSearchPresenter atsBackend = AtsAppData.getAtsWebSearchPresenter(); + + @Override + protected OseeSearchHeaderComponent getOseeSearchHeader() { + return new AtsSearchHeaderComponent(false); + } + + @Override + protected void initComponents() { + // searchResultsListComponent.setSearchPresenter(atsBackend); + } + + @Override + public void navigateTo(String requestedDataId) { + if (atsBackend != null) { + atsBackend.initSearchResults(requestedDataId, (AtsSearchHeaderComponentInterface) oseeSearchHeader, + searchResultsListComponent); + } + } +} diff --git a/plugins/org.eclipse.osee.display.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.display.api/META-INF/MANIFEST.MF index 0af49f4..4e67339 100644 --- a/plugins/org.eclipse.osee.display.api/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.display.api/META-INF/MANIFEST.MF @@ -10,3 +10,4 @@ Import-Package: org.eclipse.osee.display.api.data, Export-Package: org.eclipse.osee.display.api.components, org.eclipse.osee.display.api.data, org.eclipse.osee.display.api.search +Require-Bundle: org.eclipse.osee.framework.core diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java index 73e0419..0f4bd2c 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java @@ -5,11 +5,11 @@ */ package org.eclipse.osee.display.api.components; -import org.eclipse.osee.display.api.data.Artifact; +import org.eclipse.osee.display.api.data.WebArtifact; public interface ArtifactHeaderComponent { void clearAll(); - void setArtifact(Artifact artifact); + void setArtifact(WebArtifact artifact); } diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/AttributeComponent.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/AttributeComponent.java index 37b7e29..10e1531 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/AttributeComponent.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/AttributeComponent.java @@ -5,11 +5,11 @@ */ package org.eclipse.osee.display.api.components; -import org.eclipse.osee.display.api.data.Artifact; +import org.eclipse.osee.display.api.data.WebArtifact; public interface AttributeComponent { void clearAll(); - void setArtifact(Artifact artifact); + void setArtifact(WebArtifact artifact); } diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultComponent.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultComponent.java index 9524b64..ceed1b5 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultComponent.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultComponent.java @@ -5,12 +5,12 @@ */ package org.eclipse.osee.display.api.components; -import org.eclipse.osee.display.api.data.Artifact; +import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.api.data.SearchResultMatch; public interface SearchResultComponent { - void setArtifact(Artifact artifact); + void setArtifact(WebArtifact artifact); void addSearchResultMatch(SearchResultMatch match); } diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultsListComponent.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultsListComponent.java index 19e1827..421fbcf 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultsListComponent.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/SearchResultsListComponent.java @@ -5,11 +5,12 @@ */ package org.eclipse.osee.display.api.components; - public interface SearchResultsListComponent { void clearAll(); SearchResultComponent createSearchResult(); + void setErrorMessage(String message); + } diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/Artifact.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/Artifact.java deleted file mode 100644 index 4aad902..0000000 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/Artifact.java +++ b/dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.display.api.data; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * @author Shawn F. Cook - */ -public class Artifact { - private final String guid; - private final String artifactName; - private final String artifactType; - private final Map<RelationType, Collection<Artifact>> relations = new HashMap<RelationType, Collection<Artifact>>(); - - public Artifact(String guid, String artifactName, String artifactType, Map<RelationType, Collection<Artifact>> relations) { - this.guid = guid; - this.artifactName = artifactName; - this.artifactType = artifactType; - if (relations != null) { - this.relations.putAll(relations); - } - } - - public String getArtifactName() { - return artifactName; - } - - public String getArtifactType() { - return artifactType; - } - - public Map<RelationType, Collection<Artifact>> getRelations() { - return relations; - } - - public Collection<RelationType> getRelationTypes() { - return relations.keySet(); - } - - public Collection<Artifact> getRelationsWithRelationType(RelationType relationType) { - return relations.get(relationType); - } - - public String getGuid() { - return guid; - } - - public Artifact getParent() { - Collection<Artifact> listOfParents = relations.get(RelationType.PARENT); - if (listOfParents == null || listOfParents.size() <= 0) { - return null; - } - return listOfParents.iterator().next(); - } - - /* - * Returns list of ancestor Artifacts or empty list if there are no ancestors (i.e.: parent is null). - */ - public Collection<Artifact> getAncestry() { - Collection<Artifact> ancestry = new ArrayList<Artifact>(); - Artifact parent = this.getParent(); - if (parent != null) { - ancestry.addAll(parent.getAncestry()); - ancestry.add(parent); - } - return ancestry; - } - - @Override - public String toString() { - return artifactName; - } -} diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/WebArtifact.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/WebArtifact.java new file mode 100644 index 0000000..24bff25 --- a/dev/null +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/WebArtifact.java @@ -0,0 +1,128 @@ +/******************************************************************************* + * Copyright (c) 2011 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.display.api.data; + +/** + * @author Shawn F. Cook + */ +public class WebArtifact { + private final String guid; + private final String artifactName; + private final String artifactType; + private String attr_Category; + private String attr_DevAssurLevel; + private String attr_ImpoParaNum; + private String attr_Partition; + private String attr_QualMethod; + private String attr_Subsystm; + private String attr_TechPerfParam; + + public WebArtifact(String guid, String artifactName, String artifactType) { + this.guid = guid; + this.artifactName = artifactName; + this.artifactType = artifactType; + } + + public String getArtifactName() { + return artifactName; + } + + public String getArtifactType() { + return artifactType; + } + + public String getGuid() { + return guid; + } + + // public Artifact getParent() { + // Collection<Artifact> listOfParents = relations.get(RelationType.PARENT); + // if (listOfParents == null || listOfParents.size() <= 0) { + // return null; + // } + // return listOfParents.iterator().next(); + // } + // + // /* + // * Returns list of ancestor Artifacts or empty list if there are no ancestors (i.e.: parent is null). + // */ + // public Collection<Artifact> getAncestry() { + // Collection<Artifact> ancestry = new ArrayList<Artifact>(); + // Artifact parent = this.getParent(); + // if (parent != null) { + // ancestry.addAll(parent.getAncestry()); + // ancestry.add(parent); + // } + // return ancestry; + // } + + @Override + public String toString() { + return artifactName; + } + + public String getAttr_Category() { + return attr_Category; + } + + public void setAttr_Category(String attr_Category) { + this.attr_Category = attr_Category; + } + + public String getAttr_DevAssurLevel() { + return attr_DevAssurLevel; + } + + public void setAttr_DevAssurLevel(String attr_DevAssurLevel) { + this.attr_DevAssurLevel = attr_DevAssurLevel; + } + + public String getAttr_ImpoParaNum() { + return attr_ImpoParaNum; + } + + public void setAttr_ImpoParaNum(String attr_ImpoParaNum) { + this.attr_ImpoParaNum = attr_ImpoParaNum; + } + + public String getAttr_Partition() { + return attr_Partition; + } + + public void setAttr_Partition(String attr_Partition) { + this.attr_Partition = attr_Partition; + } + + public String getAttr_QualMethod() { + return attr_QualMethod; + } + + public void setAttr_QualMethod(String attr_QualMethod) { + this.attr_QualMethod = attr_QualMethod; + } + + public String getAttr_Subsystm() { + return attr_Subsystm; + } + + public void setAttr_Subsystm(String attr_Subsystm) { + this.attr_Subsystm = attr_Subsystm; + } + + public String getAttr_TechPerfParam() { + return attr_TechPerfParam; + } + + public void setAttr_TechPerfParam(String attr_TechPerfParam) { + this.attr_TechPerfParam = attr_TechPerfParam; + } + +} diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java index 8bb80c1..e2f2411 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java @@ -31,4 +31,5 @@ public interface SearchPresenter { void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp); void selectRelationType(WebId id); + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.display.presenter/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.display.presenter/META-INF/MANIFEST.MF index 3ba4c9e..1e2860a 100644 --- a/plugins/org.eclipse.osee.display.presenter/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.display.presenter/META-INF/MANIFEST.MF @@ -13,3 +13,5 @@ Import-Package: org.eclipse.core.runtime, org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.jdk.core.type +Require-Bundle: org.eclipse.osee.display.api +Export-Package: org.eclipse.osee.display.presenter diff --git a/plugins/org.eclipse.osee.display.presenter/build.properties b/plugins/org.eclipse.osee.display.presenter/build.properties index 92ba272..b6def40 100644 --- a/plugins/org.eclipse.osee.display.presenter/build.properties +++ b/plugins/org.eclipse.osee.display.presenter/build.properties @@ -4,4 +4,5 @@ bin.includes = META-INF/,\ . additional.bundles = org.eclipse.osee.framework.core,\ org.eclipse.osee.framework.jdk.core,\ - org.eclipse.osee.display.api + org.eclipse.osee.display.api,\ + org.eclipse.osee.orcs diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProvider.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProvider.java new file mode 100644 index 0000000..c0cfffd --- a/dev/null +++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProvider.java @@ -0,0 +1,21 @@ +/* + * Created on Oct 5, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.display.presenter; + +import java.util.List; +import org.eclipse.osee.framework.core.data.IArtifactToken; +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.orcs.data.ReadableArtifact; + +public interface ArtifactProvider { + + ReadableArtifact getArtifactByArtifactToken(IOseeBranch branch, IArtifactToken token) throws OseeCoreException; + + ReadableArtifact getArtifactByGuid(IOseeBranch branch, String guid) throws OseeCoreException; + + List<ReadableArtifact> getSearchResults(IOseeBranch branch, boolean nameOnly, String searchPhrase) throws OseeCoreException; +} diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java new file mode 100644 index 0000000..df06922 --- a/dev/null +++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java @@ -0,0 +1,46 @@ +/* + * Created on Oct 5, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.display.presenter; + +import java.util.List; +import org.eclipse.osee.framework.core.data.IArtifactToken; +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.core.enums.LoadLevel; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.orcs.data.ReadableArtifact; +import org.eclipse.osee.orcs.search.CaseType; +import org.eclipse.osee.orcs.search.QueryFactory; +import org.eclipse.osee.orcs.search.StringOperator; + +public class ArtifactProviderImpl implements ArtifactProvider { + + private final QueryFactory factory; + + public ArtifactProviderImpl(QueryFactory factory) { + this.factory = factory; + } + + @Override + public ReadableArtifact getArtifactByArtifactToken(IOseeBranch branch, IArtifactToken token) throws OseeCoreException { + return factory.fromArtifact(branch, token).build(LoadLevel.FULL).getOneOrNull(); + } + + @Override + public ReadableArtifact getArtifactByGuid(IOseeBranch branch, String guid) throws OseeCoreException { + return factory.fromGuidOrHrid(branch, guid).build(LoadLevel.FULL).getOneOrNull(); + } + + @Override + public List<ReadableArtifact> getSearchResults(IOseeBranch branch, boolean nameOnly, String searchPhrase) throws OseeCoreException { + if (nameOnly) { + return factory.fromBranch(branch).and(CoreAttributeTypes.Name, StringOperator.CONTAINS, CaseType.IGNORE_CASE, + searchPhrase).build(LoadLevel.FULL).getList(); + } else { + return null; + } + } +} diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java index 3098860..6d614c2 100644 --- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java +++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java @@ -10,25 +10,55 @@ *******************************************************************************/ package org.eclipse.osee.display.presenter; +import java.util.List; import org.eclipse.osee.display.api.components.ArtifactHeaderComponent; import org.eclipse.osee.display.api.components.AttributeComponent; import org.eclipse.osee.display.api.components.RelationComponent; import org.eclipse.osee.display.api.components.SearchHeaderComponent; +import org.eclipse.osee.display.api.components.SearchResultComponent; import org.eclipse.osee.display.api.components.SearchResultsListComponent; +import org.eclipse.osee.display.api.data.SearchResultMatch; import org.eclipse.osee.display.api.data.WebId; import org.eclipse.osee.display.api.search.SearchPresenter; +import org.eclipse.osee.framework.core.data.TokenFactory; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.orcs.data.ReadableArtifact; /* * @author John Misinco */ public class WebSearchPresenter implements SearchPresenter { + protected final ArtifactProvider artifactProvider; + + public WebSearchPresenter(ArtifactProvider artifactProvider) { + this.artifactProvider = artifactProvider; + } + @Override public void initSearchHome(SearchHeaderComponent searchHeaderComp) { } @Override public void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp) { + searchResultsComp.clearAll(); + SearchParameters params = decode(url); + List<ReadableArtifact> searchResults = null; + try { + searchResults = + artifactProvider.getSearchResults(TokenFactory.createBranch(params.getBranchId(), ""), params.isNameOnly(), + params.getSearchPhrase()); + } catch (OseeCoreException ex) { + searchResultsComp.setErrorMessage("Error while searching"); + return; + } + for (ReadableArtifact art : searchResults) { + SearchResultComponent searchResult = searchResultsComp.createSearchResult(); + org.eclipse.osee.display.api.data.WebArtifact displayArtifact = null; // = new org.eclipse.osee.display.api.data.Artifact(); + searchResult.setArtifact(displayArtifact); + SearchResultMatch match = null; + searchResult.addSearchResultMatch(match); + } } @Override @@ -43,4 +73,50 @@ public class WebSearchPresenter implements SearchPresenter { public void selectRelationType(WebId id) { } + protected String encode(WebId id, boolean nameOnly, String searchPhrase) { + StringBuilder sb = new StringBuilder(); + sb.append("?branch="); + sb.append(id.getGuid()); + sb.append("?nameOnly="); + sb.append(nameOnly); + sb.append("?search="); + sb.append(searchPhrase); + return sb.toString().replaceAll("\\s", "%20"); + } + + private SearchParameters decode(String url) { + String[] tokens = url.split("\\?"); + String branchId = tokens[0].split("=")[1]; + boolean nameOnly = tokens[1].split("=")[1].equalsIgnoreCase("true") ? true : false; + String searchPhrase = tokens[2].split("=")[1]; + searchPhrase = searchPhrase.replaceAll("%20", " "); + return new SearchParameters(branchId, nameOnly, searchPhrase); + } + + private class SearchParameters { + + private final String branchId; + private final boolean nameOnly; + private final String searchPhrase; + + public SearchParameters(String branchId, boolean nameOnly, String searchPhrase) { + this.branchId = branchId; + this.nameOnly = nameOnly; + this.searchPhrase = searchPhrase; + } + + public String getBranchId() { + return branchId; + } + + public boolean isNameOnly() { + return nameOnly; + } + + public String getSearchPhrase() { + return searchPhrase; + } + + } + } diff --git a/plugins/org.eclipse.osee.display.test/.project b/plugins/org.eclipse.osee.display.test/.project new file mode 100644 index 0000000..7c5bac4 --- a/dev/null +++ b/plugins/org.eclipse.osee.display.test/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osee.display.api.test</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF index 5e4b7f9..761e423 100644 --- a/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF @@ -17,3 +17,8 @@ Import-Package: com.vaadin, org.eclipse.osee.vaadin, org.eclipse.osee.vaadin.widgets, org.osgi.framework;version="1.6.0" +Export-Package: org.eclipse.osee.display.view.web, + org.eclipse.osee.display.view.web.components, + org.eclipse.osee.display.view.web.search +Require-Bundle: org.eclipse.osee.display.api, + org.eclipse.osee.vaadin diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/CssConstants.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/CssConstants.java index dcba0d1..6077d89 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/CssConstants.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/CssConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. + * Copyright (c) 2011 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 @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.display.view.web.internal.search; +package org.eclipse.osee.display.view.web; /** * @author Shawn F. Cook diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeAppData.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeAppData.java new file mode 100644 index 0000000..06b17f3 --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeAppData.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2011 Boeing. + * All rightsimport com.vaadin.Application; +import com.vaadin.service.ApplicationContext.TransactionListener; +he 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.display.view.web; + +import org.eclipse.osee.display.api.search.SearchPresenter; +import org.eclipse.osee.vaadin.widgets.Navigator; +import com.vaadin.Application; +import com.vaadin.service.ApplicationContext.TransactionListener; + +/** + * @author Shawn F. Cook AppData contains thread-safe session-global data based on Vaadin demonstation: + * https://vaadin.com/book/-/page/advanced.global.html + */ +@SuppressWarnings("serial") +public class OseeAppData implements TransactionListener { + + protected final Application app; // For distinguishing between apps + protected static ThreadLocal<OseeAppData> instance = new ThreadLocal<OseeAppData>(); + + private final Navigator navigator = createNavigator(); + private final SearchPresenter atsBackend = createSearchPresenter(); + + public OseeAppData(Application app) { + this.app = app; + + // It's usable from now on in the current request + instance.set(this); + } + + @Override + public void transactionStart(Application application, Object transactionData) { + } + + @Override + public void transactionEnd(Application application, Object transactionData) { + } + + protected Navigator createNavigator() { + return new Navigator(); + } + + protected SearchPresenter createSearchPresenter() { + return null; + } + + public static Navigator getNavigator() { + return instance.get().navigator; + } + + public static SearchPresenter getAtsBackend() { + return instance.get().atsBackend; + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeFooter.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeFooter.java index 7e43c52..a4ac05a 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeFooter.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeFooter.java @@ -1,4 +1,4 @@ -package org.eclipse.osee.display.view.web.internal; +package org.eclipse.osee.display.view.web; import com.vaadin.ui.Alignment; import com.vaadin.ui.Label; diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsListComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/UrlParamNameConstants.java index b03476b..ea598a2 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsListComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/UrlParamNameConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. + * Copyright (c) 2011 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 @@ -8,18 +8,15 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ - -package org.eclipse.osee.display.view.web.internal.search; - -import org.eclipse.osee.vaadin.widgets.Navigator; -import com.vaadin.ui.VerticalLayout; +package org.eclipse.osee.display.view.web; /** * @author Shawn F. Cook */ -@SuppressWarnings("serial") -public class OseeSearchResultsListComponent extends VerticalLayout { - public OseeSearchResultsListComponent(Navigator navigator) { - - } +public class UrlParamNameConstants { + public final static String PARAMNAME_ARTIFACT = "artifact"; + public final static String PARAMNAME_PROGRAM = "program"; + public final static String PARAMNAME_BUILD = "build"; + public final static String PARAMNAME_NAMEONLY = "nameonly"; + public final static String PARAMNAME_SEARCHPHRASE = "searchphrase"; } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/ArtifactNameLinkComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/ArtifactNameLinkComponent.java index 10cac59..00381ea 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/ArtifactNameLinkComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/ArtifactNameLinkComponent.java @@ -8,11 +8,15 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.display.view.web.internal.search; +package org.eclipse.osee.display.view.web.components; import java.util.HashMap; import java.util.Map; -import org.eclipse.osee.display.api.data.Artifact; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.view.web.CssConstants; +import org.eclipse.osee.display.view.web.OseeAppData; +import org.eclipse.osee.display.view.web.internal.search.OseeArtifactView; +import org.eclipse.osee.display.view.web.internal.search.OseeRoadMapAndNavigation; import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.terminal.ExternalResource; import com.vaadin.terminal.Resource; @@ -24,11 +28,13 @@ import com.vaadin.ui.Link; @SuppressWarnings("serial") public class ArtifactNameLinkComponent extends Link { - public ArtifactNameLinkComponent(Navigator navigator, Artifact artifact) { - this(navigator, artifact, CssConstants.OSEE_SEARCHRESULT_ARTNAME); + private final Navigator navigator = OseeAppData.getNavigator(); + + public ArtifactNameLinkComponent(WebArtifact artifact) { + this(artifact, CssConstants.OSEE_SEARCHRESULT_ARTNAME); } - public ArtifactNameLinkComponent(Navigator navigator, Artifact artifact, String styleName) { + public ArtifactNameLinkComponent(WebArtifact artifact, String styleName) { super(); this.setCaption(artifact.getArtifactName()); diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeLogoLink.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeLogoLink.java new file mode 100644 index 0000000..9ce3732 --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeLogoLink.java @@ -0,0 +1,25 @@ +/* + * Created on Oct 3, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.display.view.web.components; + +import org.eclipse.osee.vaadin.widgets.Navigator; +import com.vaadin.terminal.ExternalResource; +import com.vaadin.terminal.Resource; +import com.vaadin.terminal.ThemeResource; +import com.vaadin.ui.Link; + +@SuppressWarnings("serial") +public class OseeLogoLink extends Link { + + public OseeLogoLink(Navigator navigator, String styleName, Class<?> viewClass) { + //super("", new ExternalResource(String.format("ats#%s", navigator.getUri(viewClass)))); + super("", new ExternalResource("ats")); + Resource logoIconRes = new ThemeResource("../osee/osee_large.png"); + setIcon(logoIconRes); + setStyleName(styleName); + + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultComponent.java new file mode 100644 index 0000000..0af60ae --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultComponent.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2011 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.display.view.web.components; + +import java.util.ArrayList; +import java.util.Collection; +import org.eclipse.osee.display.api.components.SearchResultComponent; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.api.data.SearchResultMatch; +import org.eclipse.osee.display.view.web.CssConstants; +import org.eclipse.osee.display.view.web.OseeAppData; +import org.eclipse.osee.display.view.web.internal.search.OseeBreadcrumbComponent; +import org.eclipse.osee.vaadin.widgets.Navigator; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeSearchResultComponent extends VerticalLayout implements SearchResultComponent { + + private final Navigator navigator = OseeAppData.getNavigator(); + private WebArtifact artifact; + private final Collection<SearchResultMatch> matches = new ArrayList<SearchResultMatch>(); + + public OseeSearchResultComponent() { + //Stupid hack. Web layout is driving me crazy. + //setHeight(65, UNITS_PIXELS); + this.setSizeUndefined(); + } + + private void createLayout() { + // Layout: + // (0) ArtName [ArtType] + // (1) breadcrumb #1 >> breadcrumb #2 >> + // (2) match hint #1 + // (n-1) match hint #n + // ... + // (n) [spacer] + + HorizontalLayout row0 = new HorizontalLayout(); + + ArtifactNameLinkComponent artifactName = + new ArtifactNameLinkComponent(artifact, CssConstants.OSEE_SEARCHRESULT_ARTNAME); + Label spacer1 = new Label(""); + spacer1.setHeight(null); + spacer1.setWidth(15, UNITS_PIXELS); + Label artifactType = new Label(String.format("[%s]", artifact.getArtifactType()), Label.CONTENT_XHTML); + artifactType.setStyleName(CssConstants.OSEE_SEARCHRESULT_ARTTYPE); + row0.addComponent(artifactName); + row0.addComponent(spacer1); + row0.addComponent(artifactType); + row0.setComponentAlignment(artifactName, Alignment.BOTTOM_LEFT); + row0.setComponentAlignment(artifactType, Alignment.MIDDLE_LEFT); + + OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(navigator, artifact); + + addComponent(row0); + addComponent(breadcrumbComp); + + for (SearchResultMatch match : matches) { + OseeSearchResultMatchComponent matchComp = new OseeSearchResultMatchComponent(match); + addComponent(matchComp); + } + + Label spacer2 = new Label(""); + spacer2.setHeight(15, UNITS_PIXELS); + addComponent(spacer2); + } + + @Override + public void setArtifact(WebArtifact artifact) { + this.artifact = artifact; + removeAllComponents(); + createLayout(); + } + + @Override + public void addSearchResultMatch(SearchResultMatch match) { + matches.add(match); + removeAllComponents(); + createLayout(); + } + + private class OseeSearchResultMatchComponent extends HorizontalLayout { + public OseeSearchResultMatchComponent(SearchResultMatch match) { + Label matchLabel = new Label(String.format("%s: ", match.getAttributeType(), Label.CONTENT_XHTML)); + matchLabel.setStyleName(CssConstants.OSEE_SEARCHRESULT_MATCH); + Label spacer4 = new Label(); + spacer4.setWidth(15, UNITS_PIXELS); + Label matchLabelHint = new Label(String.format("%s", match.getMatchHint()), Label.CONTENT_XHTML); + Label spacer3 = new Label(); + spacer3.setWidth(15, UNITS_PIXELS); + Label matchManyLabel = new Label(String.format("(%d matches)", match.getManyMatches()), Label.CONTENT_XHTML); + matchManyLabel.setStyleName(CssConstants.OSEE_SEARCHRESULT_MATCH_MANY); + + addComponent(matchLabel); + addComponent(spacer4); + addComponent(matchLabelHint); + addComponent(spacer3); + addComponent(matchManyLabel); + } + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java new file mode 100644 index 0000000..5a7542b --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2011 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.display.view.web.components; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import org.eclipse.osee.display.api.components.SearchResultComponent; +import org.eclipse.osee.display.api.components.SearchResultsListComponent; +import com.vaadin.ui.Component; +import com.vaadin.ui.VerticalLayout; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeSearchResultsListComponent extends VerticalLayout implements SearchResultsListComponent { + + VerticalLayout bottomSpacer = new VerticalLayout(); + + public OseeSearchResultsListComponent() { + bottomSpacer.setSizeFull(); + addComponent(bottomSpacer); + setExpandRatio(bottomSpacer, 1.0f); + } + + @Override + public void clearAll() { + Collection<Component> removeTheseComponents = new ArrayList<Component>(); + for (Iterator<Component> iter = getComponentIterator(); iter.hasNext();) { + Component component = iter.next(); + if (component.getClass() == OseeSearchResultComponent.class) { + removeTheseComponents.add(component); + } + } + + //Remove the components + for (Component component : removeTheseComponents) { + removeComponent(component); + } + } + + @Override + public SearchResultComponent createSearchResult() { + OseeSearchResultComponent searchResultComp = new OseeSearchResultComponent(); + int spacerIndex = this.getComponentIndex(bottomSpacer); + addComponent(searchResultComp, spacerIndex); + return searchResultComp; + } + + @Override + public void setErrorMessage(String message) { + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java index 8888cf4..7282be3 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java @@ -13,8 +13,8 @@ package org.eclipse.osee.display.view.web.internal; import java.util.ArrayList; import java.util.List; import org.eclipse.osee.display.view.web.internal.search.OseeArtifactView; -import org.eclipse.osee.display.view.web.internal.search.OseeSearchHomeView; -import org.eclipse.osee.display.view.web.internal.search.OseeSearchResultsView; +import org.eclipse.osee.display.view.web.search.OseeSearchHomeView; +import org.eclipse.osee.display.view.web.search.OseeSearchResultsView; import org.eclipse.osee.vaadin.widgets.HasViews; import org.eclipse.osee.vaadin.widgets.Navigator; diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/WindowFactory.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/WindowFactory.java index 6dc633c..1da428d 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/WindowFactory.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/WindowFactory.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.display.view.web.internal; +import org.eclipse.osee.display.view.web.OseeFooter; import org.eclipse.osee.display.view.web.internal.search.OseeRoadMapAndNavigation; import org.eclipse.osee.vaadin.widgets.AccountMenuBar; import org.eclipse.osee.vaadin.widgets.HasViews; diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeArtifactView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeArtifactView.java index 31e4b3b..37a4802 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeArtifactView.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeArtifactView.java @@ -11,8 +11,10 @@ package org.eclipse.osee.display.view.web.internal.search; import java.util.Map; -import org.eclipse.osee.display.api.data.Artifact; +import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.api.search.SearchView; +import org.eclipse.osee.display.view.web.components.ArtifactNameLinkComponent; +import org.eclipse.osee.display.view.web.search.OseeSearchHeaderComponent; import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.Application; import com.vaadin.ui.Alignment; @@ -28,9 +30,8 @@ public class OseeArtifactView extends CustomComponent implements Navigator.View, private OseeSearchHeaderComponent oseeSearchHeader; private Navigator navigator; private OseeRelationsComponent relationsComp; - private final OseeWebBackend webBackend = new OseeWebBackend(); private final OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(null, null); - private Artifact artifact; + private WebArtifact artifact; private void initLayout() { final VerticalLayout vertLayout = new VerticalLayout(); @@ -39,7 +40,7 @@ public class OseeArtifactView extends CustomComponent implements Navigator.View, if (artifact != null) { vertLayout.removeAllComponents(); - ArtifactNameLinkComponent artifactName = new ArtifactNameLinkComponent(navigator, artifact); + ArtifactNameLinkComponent artifactName = new ArtifactNameLinkComponent(artifact); final VerticalLayout paddedVertLayout = new VerticalLayout(); paddedVertLayout.setSizeFull(); @@ -62,9 +63,9 @@ public class OseeArtifactView extends CustomComponent implements Navigator.View, public void init(Navigator navigator, Application application) { this.navigator = navigator; - oseeSearchHeader = new OseeSearchHeaderComponent(false); + oseeSearchHeader = new OseeSearchHeaderComponent(); breadcrumbComp.setNavigator(navigator); - relationsComp = new OseeRelationsComponent(navigator, webBackend, null); + //relationsComp = new OseeRelationsComponent(navigator, webBackend, null); setSizeFull(); initLayout(); diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeBreadcrumbComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeBreadcrumbComponent.java index 0151697..340859d 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeBreadcrumbComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeBreadcrumbComponent.java @@ -12,7 +12,9 @@ package org.eclipse.osee.display.view.web.internal.search; import java.util.ArrayList; import java.util.Collection; -import org.eclipse.osee.display.api.data.Artifact; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.view.web.CssConstants; +import org.eclipse.osee.display.view.web.components.ArtifactNameLinkComponent; import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; @@ -23,21 +25,21 @@ import com.vaadin.ui.Label; @SuppressWarnings("serial") public class OseeBreadcrumbComponent extends HorizontalLayout { private Navigator navigator; - private Artifact artifact; + private WebArtifact artifact; private void init() { this.removeAllComponents(); - Collection<Artifact> crumbs = new ArrayList<Artifact>(); - if (artifact != null && artifact.getAncestry() != null && artifact.getAncestry().size() > 0) { - crumbs.addAll(artifact.getAncestry()); - } + Collection<WebArtifact> crumbs = new ArrayList<WebArtifact>(); + // if (artifact != null && artifact.getAncestry() != null && artifact.getAncestry().size() > 0) { + // crumbs.addAll(artifact.getAncestry()); + // } int count = 0; int manyBreadCrumbs = crumbs.size(); - for (Artifact crumb : crumbs) { + for (WebArtifact crumb : crumbs) { ArtifactNameLinkComponent crumbLabel = - new ArtifactNameLinkComponent(navigator, crumb, CssConstants.OSEE_BREADCRUMB_ARTNAME); + new ArtifactNameLinkComponent(crumb, CssConstants.OSEE_BREADCRUMB_ARTNAME); addComponent(crumbLabel); if (count < manyBreadCrumbs - 1) { Label delimiter = new Label(" >> ", Label.CONTENT_XHTML); @@ -48,14 +50,14 @@ public class OseeBreadcrumbComponent extends HorizontalLayout { } } - public OseeBreadcrumbComponent(Navigator navigator, Artifact artifact) { + public OseeBreadcrumbComponent(Navigator navigator, WebArtifact artifact) { this.navigator = navigator; this.artifact = artifact; init(); } - public void setArtifact(Artifact artifact) { + public void setArtifact(WebArtifact artifact) { this.artifact = artifact; init(); } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRelationsComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRelationsComponent.java index ceaf2b7..30eeddd 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRelationsComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRelationsComponent.java @@ -10,19 +10,12 @@ *******************************************************************************/ package org.eclipse.osee.display.view.web.internal.search; -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.osee.display.api.data.Artifact; -import org.eclipse.osee.display.api.data.RelationType; +import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.api.search.SearchPresenter; import org.eclipse.osee.vaadin.widgets.Navigator; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.ListSelect; import com.vaadin.ui.VerticalLayout; /** @@ -32,7 +25,7 @@ import com.vaadin.ui.VerticalLayout; public class OseeRelationsComponent extends VerticalLayout { private final Navigator navigator; private final SearchPresenter webBackend; - private Artifact artifact; + private WebArtifact artifact; private void initLayout() { if (artifact != null) { @@ -52,30 +45,30 @@ public class OseeRelationsComponent extends VerticalLayout { } }); - final ListSelect relationTypesListSelect = new ListSelect("Relation Types:", artifact.getRelationTypes()); - relationTypesListSelect.setNullSelectionAllowed(false); - relationTypesListSelect.setImmediate(true); - Label spacer = new Label(); - spacer.setWidth(15, UNITS_PIXELS); - final ListSelect relationsListSelect = new ListSelect("Relations:", new ArrayList<String>()); - relationsListSelect.setNullSelectionAllowed(false); - relationsListSelect.setImmediate(true); - - relationTypesListSelect.addListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - RelationType relationType = (RelationType) relationTypesListSelect.getValue(); - Collection<Artifact> relations = artifact.getRelationsWithRelationType(relationType); - relationsListSelect.removeAllItems(); - for (Artifact artifact : relations) { - relationsListSelect.addItem(artifact); - } - } - }); - - listBoxesLayout.addComponent(relationTypesListSelect); - listBoxesLayout.addComponent(spacer); - listBoxesLayout.addComponent(relationsListSelect); + // final ListSelect relationTypesListSelect = new ListSelect("Relation Types:", artifact.getRelationTypes()); + // relationTypesListSelect.setNullSelectionAllowed(false); + // relationTypesListSelect.setImmediate(true); + // Label spacer = new Label(); + // spacer.setWidth(15, UNITS_PIXELS); + // final ListSelect relationsListSelect = new ListSelect("Relations:", new ArrayList<String>()); + // relationsListSelect.setNullSelectionAllowed(false); + // relationsListSelect.setImmediate(true); + // + // relationTypesListSelect.addListener(new Property.ValueChangeListener() { + // @Override + // public void valueChange(ValueChangeEvent event) { + // RelationType relationType = (RelationType) relationTypesListSelect.getValue(); + // Collection<Artifact> relations = artifact.getRelationsWithRelationType(relationType); + // relationsListSelect.removeAllItems(); + // for (Artifact artifact : relations) { + // relationsListSelect.addItem(artifact); + // } + // } + // }); + // + // listBoxesLayout.addComponent(relationTypesListSelect); + // listBoxesLayout.addComponent(spacer); + // listBoxesLayout.addComponent(relationsListSelect); addComponent(showHideButton); addComponent(listBoxesLayout); @@ -83,7 +76,7 @@ public class OseeRelationsComponent extends VerticalLayout { } } - public OseeRelationsComponent(Navigator navigator, SearchPresenter webBackend, Artifact artifact) { + public OseeRelationsComponent(Navigator navigator, SearchPresenter webBackend, WebArtifact artifact) { this.navigator = navigator; this.webBackend = webBackend; this.artifact = artifact; @@ -91,7 +84,7 @@ public class OseeRelationsComponent extends VerticalLayout { initLayout(); } - public void setArtifact(Artifact artifact) { + public void setArtifact(WebArtifact artifact) { this.artifact = artifact; initLayout(); } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultComponent.java deleted file mode 100644 index 6f78fb3..0000000 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultComponent.java +++ b/dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.display.view.web.internal.search; - -import com.vaadin.ui.VerticalLayout; - -@SuppressWarnings("serial") -public class OseeSearchResultComponent extends VerticalLayout { - - // private final Navigator navigator; - - // private final SearchResult result; - - // public OseeSearchResultComponent(final Navigator navigator) { - // this.navigator = navigator; - // // this.result = result; - // - // // Layout: - // // ArtName [ArtType] - // // breadcrumb #1 >> breadcrumb #2 >> - // // match hint #1 - // // match hint #2 - // // ... - // - // HorizontalLayout row0 = new HorizontalLayout(); - // HorizontalLayout row2 = new HorizontalLayout(); - // - // ArtifactNameLinkComponent artifactName = - // new ArtifactNameLinkComponent(navigator, result.getArtifact(), CssConstants.OSEE_SEARCHRESULT_ARTNAME); - // Label spacer1 = new Label(""); - // spacer1.setHeight(null); - // spacer1.setWidth(15, UNITS_PIXELS); - // Label artifactType = - // new Label(String.format("[%s]", result.getArtifact().getArtifactType()), Label.CONTENT_XHTML); - // artifactType.setStyleName(CssConstants.OSEE_SEARCHRESULT_ARTTYPE); - // row0.addComponent(artifactName); - // row0.addComponent(spacer1); - // row0.addComponent(artifactType); - // row0.setComponentAlignment(artifactName, Alignment.BOTTOM_LEFT); - // row0.setComponentAlignment(artifactType, Alignment.MIDDLE_LEFT); - // - // OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(navigator, result.getArtifact()); - // - // VerticalLayout matchVertLayout = new VerticalLayout(); - // for (SearchResultMatch match : result.getMatches()) { - // HorizontalLayout matchHorzLayout = new HorizontalLayout(); - // Label matchLabel = new Label(String.format("%s: ", match.getAttributeType(), Label.CONTENT_XHTML)); - // matchLabel.setStyleName(CssConstants.OSEE_SEARCHRESULT_MATCH); - // Label spacer4 = new Label(); - // spacer4.setWidth(15, UNITS_PIXELS); - // Label matchLabelHint = new Label(String.format("%s", match.getMatchHint()), Label.CONTENT_XHTML); - // Label spacer3 = new Label(); - // spacer3.setWidth(15, UNITS_PIXELS); - // Label matchManyLabel = new Label(String.format("(%d matches)", match.getManyMatches()), Label.CONTENT_XHTML); - // matchManyLabel.setStyleName(CssConstants.OSEE_SEARCHRESULT_MATCH_MANY); - // - // matchHorzLayout.addComponent(matchLabel); - // matchHorzLayout.addComponent(spacer4); - // matchHorzLayout.addComponent(matchLabelHint); - // matchHorzLayout.addComponent(spacer3); - // matchHorzLayout.addComponent(matchManyLabel); - // - // matchVertLayout.addComponent(matchHorzLayout); - // } - // row2.addComponent(matchVertLayout); - // - // Label spacer2 = new Label(""); - // spacer2.setHeight(30, UNITS_PIXELS); - // - // addComponent(row0); - // addComponent(breadcrumbComp); - // addComponent(row2); - // addComponent(spacer2); - // } -} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsView.java deleted file mode 100644 index 24a56b5..0000000 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsView.java +++ b/dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.display.view.web.internal.search; - -import org.eclipse.osee.display.api.search.SearchView; -import org.eclipse.osee.vaadin.widgets.Navigator; -import com.vaadin.Application; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.VerticalLayout; - -/** - * @author Shawn F. Cook - */ -@SuppressWarnings("serial") -public class OseeSearchResultsView extends CustomComponent implements Navigator.View, SearchView { - - private OseeSearchHeaderComponent oseeSearchHeader; - //private final SearchPresenter searchPresenter = new SearchPresenter(this); - private final OseeWebBackend webBackend = new OseeWebBackend(); - private Navigator navigator; - private final VerticalLayout searchResultsVertLayout = new VerticalLayout(); - - @Override - public void init(Navigator navigator, Application application) { - this.navigator = navigator; - setSizeFull(); - oseeSearchHeader = new OseeSearchHeaderComponent(false); - - final HorizontalLayout headerHorzLayout = new HorizontalLayout(); - headerHorzLayout.addComponent(oseeSearchHeader); - headerHorzLayout.setComponentAlignment(oseeSearchHeader, Alignment.TOP_LEFT); - - final HorizontalLayout bodyHorzLayout = new HorizontalLayout(); - bodyHorzLayout.setSizeFull(); - Label spacer = new Label(""); - spacer.setWidth(85, UNITS_PIXELS); - bodyHorzLayout.addComponent(spacer); - bodyHorzLayout.addComponent(searchResultsVertLayout); - searchResultsVertLayout.setSizeFull(); - bodyHorzLayout.setExpandRatio(searchResultsVertLayout, 1.0f); - - final VerticalLayout vertLayout = new VerticalLayout(); - vertLayout.addComponent(headerHorzLayout); - vertLayout.addComponent(bodyHorzLayout); - vertLayout.setSizeFull(); - vertLayout.setExpandRatio(bodyHorzLayout, 1.0f); - - setCompositionRoot(vertLayout); - } - - @Override - public void navigateTo(String requestedDataId) { - //TODO: parse request string and properly populate searchCriteria - // SearchCriteria searchCriteria = new SearchCriteria(null, null, false, ""); - // webBackend.getSearchResults(this, searchCriteria); - } - - @Override - public String getWarningForNavigatingFrom() { - return null; - } - - // @Override - // public void setSearchResults(Collection<SearchResult> searchResults) { - // searchResultsVertLayout.removeAllComponents(); - // if (navigator != null) { - // for (SearchResult result : searchResults) { - // OseeSearchResultComponent resultComponent = new OseeSearchResultComponent(navigator, result); - // searchResultsVertLayout.addComponent(resultComponent); - // } - // } - // Label spacer1 = new Label(""); - // searchResultsVertLayout.addComponent(spacer1); - // searchResultsVertLayout.setExpandRatio(spacer1, 1.0f); - // } - - // @Override - // public void setProgramsAndBuilds(ProgramsAndBuilds builds) { - // } - // - // @Override - // public void setArtifact(Artifact artifact) { - // } - // - // @Override - // public void setProgram(Program program) { - // } - // - // @Override - // public void setBuild(Build build) { - // } - // - // @Override - // public void setErrorMessage(String message) { - // } - -} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeWebBackend.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeWebBackend.java deleted file mode 100644 index add3ec6..0000000 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeWebBackend.java +++ b/dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.display.view.web.internal.search; - -import org.eclipse.osee.display.api.components.ArtifactHeaderComponent; -import org.eclipse.osee.display.api.components.AttributeComponent; -import org.eclipse.osee.display.api.components.RelationComponent; -import org.eclipse.osee.display.api.components.SearchHeaderComponent; -import org.eclipse.osee.display.api.components.SearchResultsListComponent; -import org.eclipse.osee.display.api.data.WebId; -import org.eclipse.osee.display.api.search.SearchPresenter; - -/** - * @author Shawn F. Cook - */ -public class OseeWebBackend implements SearchPresenter { - - @Override - public void initSearchHome(SearchHeaderComponent searchHeaderComp) { - } - - @Override - public void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp) { - } - - @Override - public void selectArtifact(WebId id) { - } - - @Override - public void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp) { - } - - @Override - public void selectRelationType(WebId id) { - } - // private final OseeWebBackendTestData oseeWebBackendTestData = OseeWebBackendTestData.getSingleinstance(); - - // @Override - // public void getProgramsAndBuilds(SearchView webView) { - // webView.setProgramsAndBuilds(OseeWebBackendTestData.getBuilds()); - // } - // - // @Override - // public void getSearchResults(SearchView webView, SearchCriteria searchCriteria) { - // Collection<SearchResult> searchResults = new ArrayList<SearchResult>(); - // - // SearchResultMatch match0 = - // new SearchResultMatch("Word Template Content", "... page ({<b>COM</b>_PAGE}) provides...", 10); - // SearchResultMatch match1 = new SearchResultMatch("Subsystem", "<b>Com</b>munications", 1); - // SearchResultMatch match2 = new SearchResultMatch("Partition", "<b>COM</b>, CND", 1); - // - // Map<String, Artifact> artifacts = oseeWebBackendTestData.getArtifacts(); - // for (Artifact art : artifacts.values()) { - // SearchResult result = new SearchResult(art, Arrays.asList(match0, match1, match2)); - // searchResults.add(result); - // } - // - // webView.setSearchResults(searchResults); - // } - - // @Override - // public void getArtifact(SearchView webView, String artifactGuid) { - // Artifact artifact = oseeWebBackendTestData.getArtifactWithGuid(artifactGuid); - // webView.setArtifact(artifact); - // } - // - // public void getProgramFromArtUuid(SearchView webView, String artifactUuid) { - // Program program = oseeWebBackendTestData.getProgramForArtUuid(artifactUuid); - // webView.setProgram(program); - // } - // - // public void getBuildFromArtUuid(SearchView webView, String artifactUuid) { - // Build build = oseeWebBackendTestData.getBuildForArtUuid(artifactUuid); - // webView.setBuild(build); - // } -} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeWebBackendTestData.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeWebBackendTestData.java deleted file mode 100644 index 7cf5fd2..0000000 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeWebBackendTestData.java +++ b/dev/null @@ -1,117 +0,0 @@ -/* - * Created on Sep 26, 2011 - * - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ -package org.eclipse.osee.display.view.web.internal.search; - - -public class OseeWebBackendTestData { - // private final static OseeWebBackendTestData singleInstance = new OseeWebBackendTestData(); - // private final static ProgramsAndBuilds builds = new ProgramsAndBuilds(); - // private final static Map<String, Artifact> artifacts = new HashMap<String, Artifact>(); - // private static boolean hasBeenInitialized = false; - // - // private static void initProgramsAndBuilds() { - // Program blk3 = new Program("Blk 3", "blk3_guid"); - // Program v131 = new Program("V13.1", "v131_guid"); - // Program taiwan = new Program("Taiwan", "taiwan_guid"); - // - // builds.addBuilds(blk3, Arrays.asList(new Build("Baseline", "baseline_guid"), new Build("Bld_1", "bld_1_guid"), - // new Build("FTP0", "ftb0_guid"))); - // builds.addBuilds(v131, - // Arrays.asList(new Build("FTB1", "FTB1_guid"), new Build("FTB2", "FTB2_guid"), new Build("FTB3", "FTB3_guid"))); - // builds.addBuilds(taiwan, - // Arrays.asList(new Build("EB0", "EB0_guid"), new Build("EB1", "EB1_guid"), new Build("PIDS", "PIDS_guid"))); - // } - // - // private static void initArtifacts() { - // Artifact defaultroot = new Artifact("defaultHierarchRoot_GUID", "Default Hierarchy Root", "Root Artifact", null); - // - // Map<RelationType, Collection<Artifact>> swreqsRelations = new HashMap<RelationType, Collection<Artifact>>(); - // swreqsRelations.put(RelationType.PARENT, Arrays.asList(defaultroot)); - // Artifact swreqs = new Artifact("SWReq_GUID", "Software Requirements", "Folder", swreqsRelations); - // - // Map<RelationType, Collection<Artifact>> crewIntRelations = new HashMap<RelationType, Collection<Artifact>>(); - // crewIntRelations.put(RelationType.PARENT, Arrays.asList(swreqs)); - // Artifact crewIntreqs = new Artifact("CrewInt_GUID", "Crew Interface", "Folder", crewIntRelations); - // - // Map<RelationType, Collection<Artifact>> commSubSysCrewIntRelations = - // new HashMap<RelationType, Collection<Artifact>>(); - // commSubSysCrewIntRelations.put(RelationType.PARENT, Arrays.asList(crewIntreqs)); - // Artifact commSubSysCrewIntreqs = - // new Artifact("commSubSysCrewInt_GUID", "Communication Subsystem Crew Interface", "Heading", - // commSubSysCrewIntRelations); - // - // Map<RelationType, Collection<Artifact>> comm_page_Relations = new HashMap<RelationType, Collection<Artifact>>(); - // comm_page_Relations.put(RelationType.PARENT, Arrays.asList(commSubSysCrewIntreqs)); - // Artifact comm_page_Intreqs = - // new Artifact("com_page_GUID", "{COM_PAGE}", "Software Requirement", comm_page_Relations); - // - // artifacts.put(defaultroot.getGuid(), defaultroot); - // artifacts.put(swreqs.getGuid(), swreqs); - // artifacts.put(crewIntreqs.getGuid(), crewIntreqs); - // artifacts.put(commSubSysCrewIntreqs.getGuid(), commSubSysCrewIntreqs); - // artifacts.put(comm_page_Intreqs.getGuid(), comm_page_Intreqs); - // } - // - // public OseeWebBackendTestData() { - // } - // - // public static OseeWebBackendTestData getSingleinstance() { - // if (!hasBeenInitialized) { - // initProgramsAndBuilds(); - // initArtifacts(); - // hasBeenInitialized = true; - // } - // return singleInstance; - // } - // - // public static ProgramsAndBuilds getBuilds() { - // return builds; - // } - // - // public Collection<Build> getBuildsWithProgram(Program program) { - // return builds.getBuilds(program); - // } - // - // public Collection<Program> getPrograms() { - // return builds.getPrograms(); - // } - // - // public Map<String, Artifact> getArtifacts() { - // return artifacts; - // } - // - // public Artifact getArtifactWithGuid(String artifactGuid) { - // if (artifacts == null || artifacts.size() <= 0) { - // return null; - // } - // return artifacts.get(artifactGuid); - // } - // - // public Program getProgramForArtUuid(String artifactUuid) { - // Collection<Program> programs = builds.getPrograms(); - // Program[] programsArray = (Program[]) programs.toArray(); - // if (programsArray.length > 0) { - // return programsArray[1]; - // } else { - // return null; - // } - // } - // - // public Build getBuildForArtUuid(String artifactUuid) { - // Program program = getProgramForArtUuid(artifactUuid); - // if (program != null) { - // Collection<Build> local_builds = builds.getBuilds(program); - // Build[] buildsArray = (Build[]) local_builds.toArray(); - // if (buildsArray.length > 0) { - // return buildsArray[1]; - // } else { - // return null; - // } - // } else { - // return null; - // } - // } -} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsListComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHeaderComponent.java index b03476b..3e49500 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchResultsListComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHeaderComponent.java @@ -8,18 +8,23 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ +package org.eclipse.osee.display.view.web.search; -package org.eclipse.osee.display.view.web.internal.search; - -import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.ui.VerticalLayout; /** * @author Shawn F. Cook */ @SuppressWarnings("serial") -public class OseeSearchResultsListComponent extends VerticalLayout { - public OseeSearchResultsListComponent(Navigator navigator) { +public class OseeSearchHeaderComponent extends VerticalLayout { + + @Override + public void attach() { + createLayout(); + } + protected void createLayout() { + //Do nothing. } + } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchHomeView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHomeView.java index bcbfd3f..161cb8c 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeSearchHomeView.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHomeView.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.display.view.web.internal.search; +package org.eclipse.osee.display.view.web.search; import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.Application; @@ -22,20 +22,31 @@ import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") public class OseeSearchHomeView extends CustomComponent implements Navigator.View { + protected OseeSearchHeaderComponent oseeSearchHeader = getOseeSearchHeader(); + @Override public void init(Navigator navigator, Application application) { + initComponents(); + this.setSizeFull(); final VerticalLayout vertLayout = new VerticalLayout(); vertLayout.setSizeFull(); - OseeSearchHeaderComponent oseeSearchHeader = new OseeSearchHeaderComponent(true); vertLayout.addComponent(oseeSearchHeader); vertLayout.setComponentAlignment(oseeSearchHeader, Alignment.MIDDLE_CENTER); setCompositionRoot(vertLayout); } + protected void initComponents() { + //Do nothing + } + + protected OseeSearchHeaderComponent getOseeSearchHeader() { + return new OseeSearchHeaderComponent(); + } + @Override public void navigateTo(String requestedDataId) { //Do nothing diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchResultsView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchResultsView.java new file mode 100644 index 0000000..265104b --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchResultsView.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2011 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.display.view.web.search; + +import org.eclipse.osee.display.view.web.components.OseeSearchResultsListComponent; +import org.eclipse.osee.vaadin.widgets.Navigator; +import com.vaadin.Application; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeSearchResultsView extends CustomComponent implements Navigator.View { + + protected OseeSearchHeaderComponent oseeSearchHeader = getOseeSearchHeader(); + protected OseeSearchResultsListComponent searchResultsListComponent = new OseeSearchResultsListComponent(); + + @Override + public void init(Navigator navigator, Application application) { + initComponents(); + + setSizeFull(); + + final HorizontalLayout headerHorzLayout = new HorizontalLayout(); + headerHorzLayout.addComponent(oseeSearchHeader); + headerHorzLayout.setComponentAlignment(oseeSearchHeader, Alignment.TOP_LEFT); + oseeSearchHeader.setSizeUndefined(); + + //This is a fixed-height spacer that simply forms a nice margin between the search + // results and the search header. + // Label topSpacer = new Label(""); + // topSpacer.setHeight(85, UNITS_PIXELS); + // topSpacer.setSizeUndefined(); + + HorizontalLayout leftMarginAndBody = new HorizontalLayout(); + leftMarginAndBody.setSizeFull(); + Label leftMarginSpace = new Label(""); + leftMarginSpace.setWidth(80, UNITS_PIXELS); + leftMarginAndBody.addComponent(leftMarginSpace); + leftMarginAndBody.addComponent(searchResultsListComponent); + searchResultsListComponent.setSizeFull(); + leftMarginAndBody.setExpandRatio(searchResultsListComponent, 1.0f); + + final VerticalLayout vertLayout = new VerticalLayout(); + vertLayout.addComponent(headerHorzLayout); + // vertLayout.addComponent(topSpacer); + vertLayout.addComponent(leftMarginAndBody); + vertLayout.setExpandRatio(leftMarginAndBody, 1.0f); + + vertLayout.setSizeFull(); + setCompositionRoot(vertLayout); + } + + protected OseeSearchHeaderComponent getOseeSearchHeader() { + return new OseeSearchHeaderComponent(); + } + + @Override + public void navigateTo(String requestedDataId) { + //Do nothing + } + + @Override + public String getWarningForNavigatingFrom() { + return null; + } + + protected void initComponents() { + //Do nothing + } + +} diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java index e21d4e7..cb1f249 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java @@ -19,9 +19,11 @@ import org.eclipse.osee.orcs.core.ds.Criteria; import org.eclipse.osee.orcs.core.ds.CriteriaSet; import org.eclipse.osee.orcs.core.ds.QueryOptions; import org.eclipse.osee.orcs.data.ReadableArtifact; +import org.eclipse.osee.orcs.search.CaseType; import org.eclipse.osee.orcs.search.Operator; import org.eclipse.osee.orcs.search.QueryBuilder; import org.eclipse.osee.orcs.search.ResultSet; +import org.eclipse.osee.orcs.search.StringOperator; /** * @author Roberto E. Escobar @@ -178,4 +180,14 @@ public class QueryBuilderImpl implements QueryBuilder { public int getCount() throws OseeCoreException { return rsetFactory.getCount(criteriaSet.clone(), options.clone()); } + + @Override + public QueryBuilder and(IAttributeType attributeType, StringOperator operator, CaseType match, String value) throws OseeCoreException { + return null; + } + + @Override + public QueryBuilder and(IAttributeType attributeType, StringOperator operator, CaseType match, Collection<String> values) throws OseeCoreException { + return null; + } } diff --git a/plugins/org.eclipse.osee.orcs.mock/build.properties b/plugins/org.eclipse.osee.orcs.mock/build.properties index ea95690..48e8103 100644 --- a/plugins/org.eclipse.osee.orcs.mock/build.properties +++ b/plugins/org.eclipse.osee.orcs.mock/build.properties @@ -2,4 +2,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ . -additional.bundles = org.eclipse.osee.orcs +additional.bundles = org.eclipse.osee.orcs,\ + org.eclipse.osee.framework.core diff --git a/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/FakeArtifact.java b/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/FakeArtifact.java deleted file mode 100644 index 0d0ce4f..0000000 --- a/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/FakeArtifact.java +++ b/dev/null @@ -1,61 +0,0 @@ -/* - * Created on Sep 27, 2011 - * - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ -package org.eclipse.osee.orcs.mock; - - -public class FakeArtifact { - //implements IFakeArtifact { - // - // private final Map<IRelationTypeSide, Collection<IFakeArtifact>> relationMap = - // new HashMap<IRelationTypeSide, Collection<IFakeArtifact>>(); - // private final Map<IAttributeType, String> attributeMap = new HashMap<IAttributeType, String>(); - // private final String guid; - // - // public FakeArtifact(String name, String guid) { - // attributeMap.put(CoreAttributeTypes.Name, name); - // this.guid = guid; - // } - // - // public void addRelation(IRelationTypeSide relationType, IFakeArtifact artifact) { - // Collection<IFakeArtifact> related; - // if (relationMap.containsKey(relationType)) { - // related = relationMap.get(relationType); - // } else { - // related = new LinkedList<IFakeArtifact>(); - // } - // related.add(artifact); - // relationMap.put(relationType, related); - // } - // - // @Override - // public List<IFakeArtifact> getRelatedArtifacts(IRelationTypeSide relationSide) { - // return new LinkedList<IFakeArtifact>(relationMap.get(relationSide)); - // } - // - // @Override - // public IFakeArtifact getRelatedArtifact(IRelationTypeSide relationSide) { - // if (relationMap.containsKey(relationSide)) { - // return relationMap.get(relationSide).iterator().next(); - // } else { - // return null; - // } - // } - // - // @Override - // public String getName() { - // return attributeMap.get(CoreAttributeTypes.Name); - // } - // - // @Override - // public String getGuid() { - // return guid; - // } - // - // public void setSoleAttributeFromString(IAttributeType type, String value) { - // attributeMap.put(type, value); - // } - -} diff --git a/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/MockArtifact.java b/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/MockArtifact.java new file mode 100644 index 0000000..f62b4a3 --- a/dev/null +++ b/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/MockArtifact.java @@ -0,0 +1,96 @@ +/* + * Created on Sep 27, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.orcs.mock; + +import java.util.Collection; +import java.util.List; +import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.core.data.IAttributeType; +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; +import org.eclipse.osee.framework.core.data.Identity; +import org.eclipse.osee.framework.core.enums.ModificationType; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.orcs.data.ReadableArtifact; +import org.eclipse.osee.orcs.data.ReadableAttribute; + +public class MockArtifact implements ReadableArtifact { + + @Override + public int getGammaId() { + return 0; + } + + @Override + public ModificationType getModificationType() { + return null; + } + + @Override + public int getId() { + return 0; + } + + @Override + public IOseeBranch getBranch() { + return null; + } + + @Override + public String getHumanReadableId() { + return null; + } + + @Override + public int getTransactionId() { + return 0; + } + + @Override + public IArtifactType getArtifactType() { + return null; + } + + @Override + public Collection<IAttributeType> getAttributeTypes() throws OseeCoreException { + return null; + } + + @Override + public <T> List<ReadableAttribute<T>> getAttributes(IAttributeType attributeType) throws OseeCoreException { + return null; + } + + @Override + public ReadableArtifact getRelatedArtifact(IRelationTypeSide relationSide) throws OseeCoreException { + return null; + } + + @Override + public List<ReadableArtifact> getRelatedArtifacts(IRelationTypeSide relationEnum) throws OseeCoreException { + return null; + } + + @Override + public String getSoleAttributeAsString(IAttributeType attributeType) throws OseeCoreException { + return null; + } + + @Override + public String getGuid() { + return null; + } + + @Override + public boolean matches(Identity<?>... identities) { + return false; + } + + @Override + public String getName() { + return null; + } +} diff --git a/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/MockArtifactQueryService.java b/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/MockArtifactQueryService.java deleted file mode 100644 index 7702613..0000000 --- a/plugins/org.eclipse.osee.orcs.mock/src/org/eclipse/osee/orcs/mock/MockArtifactQueryService.java +++ b/dev/null @@ -1,51 +0,0 @@ -/* - * Created on Sep 27, 2011 - * - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ -package org.eclipse.osee.orcs.mock; - - -public class MockArtifactQueryService { - //implements IArtifactQuery { - // - // @Override - // public IFakeArtifact getArtifactFromToken(IArtifactToken art, IOseeBranch branch) throws OseeCoreException { - // FakeArtifact base = new FakeArtifact("base", GUID.create()); - // - // FakeArtifact prg1 = new FakeArtifact("prog1", GUID.create()); - // FakeArtifact prg1Team = new FakeArtifact("progTeam1", GUID.create()); - // - // FakeArtifact version1 = new FakeArtifact("version1", GUID.create()); - // FakeArtifact version2 = new FakeArtifact("version2", GUID.create()); - // FakeArtifact version3 = new FakeArtifact("version3", GUID.create()); - // FakeArtifact version4 = new FakeArtifact("version4", GUID.create()); - // - // version1.setSoleAttributeFromString(AtsAttributeTypes.BaselineBranchGuid, GUID.create()); - // version2.setSoleAttributeFromString(AtsAttributeTypes.BaselineBranchGuid, GUID.create()); - // version3.setSoleAttributeFromString(AtsAttributeTypes.BaselineBranchGuid, GUID.create()); - // version4.setSoleAttributeFromString(AtsAttributeTypes.BaselineBranchGuid, GUID.create()); - // - // prg1Team.addRelation(AtsRelationTypes.TeamDefinitionToVersion_Version, version1); - // prg1.addRelation(CoreRelationTypes.SupportingInfo_SupportingInfo, prg1Team); - // - // FakeArtifact prg2 = new FakeArtifact("prog2", GUID.create()); - // FakeArtifact prg2Team = new FakeArtifact("prog2Team", GUID.create()); - // prg2Team.addRelation(AtsRelationTypes.TeamDefinitionToVersion_Version, version1); - // prg2Team.addRelation(AtsRelationTypes.TeamDefinitionToVersion_Version, version2); - // prg2Team.addRelation(AtsRelationTypes.TeamDefinitionToVersion_Version, version4); - // prg2.addRelation(CoreRelationTypes.SupportingInfo_SupportingInfo, prg2Team); - // - // FakeArtifact prg3 = new FakeArtifact("prog3", GUID.create()); - // FakeArtifact prg3Team = new FakeArtifact("prog3Team", GUID.create()); - // prg3Team.addRelation(AtsRelationTypes.TeamDefinitionToVersion_Version, version3); - // prg3Team.addRelation(AtsRelationTypes.TeamDefinitionToVersion_Version, version1); - // prg3.addRelation(CoreRelationTypes.SupportingInfo_SupportingInfo, prg3Team); - // - // base.addRelation(CoreRelationTypes.Universal_Grouping__Members, prg1); - // base.addRelation(CoreRelationTypes.Universal_Grouping__Members, prg2); - // base.addRelation(CoreRelationTypes.Universal_Grouping__Members, prg3); - // - // return base; - // } -} diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ReadableArtifact.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ReadableArtifact.java index cb7b47b..7f2b465 100644 --- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ReadableArtifact.java +++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ReadableArtifact.java @@ -15,6 +15,7 @@ import java.util.List; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.exception.OseeCoreException; /** @@ -37,6 +38,12 @@ public interface ReadableArtifact extends Readable, HasVersion, Identifiable { <T> List<ReadableAttribute<T>> getAttributes(IAttributeType attributeType) throws OseeCoreException; + ReadableArtifact getRelatedArtifact(IRelationTypeSide relationSide) throws OseeCoreException; + + List<ReadableArtifact> getRelatedArtifacts(IRelationTypeSide relationEnum) throws OseeCoreException; + + String getSoleAttributeAsString(IAttributeType attributeType) throws OseeCoreException; + @Override String toString(); }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java index 72ce7fe..3ee1263 100644 --- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java +++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java @@ -86,6 +86,19 @@ public interface QueryBuilder { QueryBuilder and(IAttributeType attributeType, Operator operator, Collection<String> values) throws OseeCoreException; /** + * Search criteria that finds an attribute of the given type with its current value relative to the given value based + * on the operator provided. + */ + QueryBuilder and(IAttributeType attributeType, StringOperator operator, CaseType match, String value) throws OseeCoreException; + + /** + * Search criteria that finds an attribute of the given type with its current value exactly equal (or not equal) to + * any one of the given literal values. If the list only contains one value, then the search is conducted exactly as + * if the single value constructor was called. This search does not support the (* wildcard) for multiple values. + */ + QueryBuilder and(IAttributeType attributeType, StringOperator operator, CaseType match, Collection<String> values) throws OseeCoreException; + + /** * Creates a result set based on query settings * * @see LoadLevel level diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch b/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch index 3b2a2bb..5888196 100644 --- a/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch +++ b/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch @@ -20,9 +20,9 @@ <stringAttribute key="pde.version" value="3.3"/> <booleanAttribute key="show_selected_only" value="false"/> <stringAttribute key="target_bundles" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.ibm.icu@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.commons.codec@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/> -<stringAttribute key="timestamp" value="1317321239778"/> +<stringAttribute key="timestamp" value="1317764951871"/> <booleanAttribute key="tracing" value="false"/> <booleanAttribute key="useCustomFeatures" value="false"/> <booleanAttribute key="useDefaultConfigArea" value="true"/> -<stringAttribute key="workspace_bundles" value="com.vaadin@default:default,org.eclipse.osee.display.presenter.test@default:false,org.eclipse.osee.display.presenter@default:default,org.eclipse.osee.display.test@default:false,org.eclipse.osee.display.view.web@default:default,org.eclipse.osee.display@default:default,org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:default,org.eclipse.osee.vaadin.themes@default:default,org.eclipse.osee.vaadin.widgets@default:default,org.eclipse.osee.vaadin@default:default"/> +<stringAttribute key="workspace_bundles" value="com.vaadin@default:default,org.eclipse.osee.ats.api@default:default,org.eclipse.osee.ats.view.web@default:default,org.eclipse.osee.display.api@default:default,org.eclipse.osee.display.presenter.test@default:false,org.eclipse.osee.display.presenter@default:default,org.eclipse.osee.display.view.web@default:default,org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:default,org.eclipse.osee.vaadin.themes@default:false,org.eclipse.osee.vaadin.widgets@default:default,org.eclipse.osee.vaadin@default:default"/> </launchConfiguration> diff --git a/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css b/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css index de6c0cb..1c7ea24 100644 --- a/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css +++ b/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css @@ -91,24 +91,37 @@ .osee-title-medium-text { font-size: 70px; + width: 70px; + height: 70px; } .osee-search-textfield { width: 350px; } -.osee-search-result-artname { +.osee-searchresult-artname { font-size: 20px; color: blue; } -.osee-search-result-arttype { +.osee-searchresult-arttype { font-size: 15px; color: black; } +.osee-searchresult-match { + font-size: 12px; + color: green; +} + +.osee-searchresult-match-many { + font-size: 12px; + color: red; +} + .osee-horizontal-line { background-image:url('linespacer.png'); background-repeat:repeat-x; } + diff --git a/plugins/org.eclipse.osee.vaadin.widgets/src/org/eclipse/osee/vaadin/widgets/Navigator.java b/plugins/org.eclipse.osee.vaadin.widgets/src/org/eclipse/osee/vaadin/widgets/Navigator.java index 2924361..fb9c254 100644 --- a/plugins/org.eclipse.osee.vaadin.widgets/src/org/eclipse/osee/vaadin/widgets/Navigator.java +++ b/plugins/org.eclipse.osee.vaadin.widgets/src/org/eclipse/osee/vaadin/widgets/Navigator.java @@ -58,7 +58,7 @@ public class Navigator extends CustomComponent { }); } - private void fragmentChanged() { + public void fragmentChanged() { String newFragment = uriFragmentUtil.getFragment(); if ("".equals(newFragment)) { newFragment = mainViewUri; @@ -97,7 +97,14 @@ public class Navigator extends CustomComponent { @Override public void buttonClick(ClickEvent event) { uriFragmentUtil.setFragment(currentFragment, false); - main.removeWindow(wDialog); + + //Vaadin library bug in which without catching and using the return value of this method + // the Java compiler will silently generate bytecode that drops the extra value from the stack + // https://vaadin.com/forum/-/message_boards/view_message/311111 + boolean catchButDontUseBoolean = main.removeWindow(wDialog); + if (catchButDontUseBoolean) { + //Do Nothing + } } }); Button cont = new Button("Continue", new Button.ClickListener() { @@ -168,7 +175,7 @@ public class Navigator extends CustomComponent { /** * Get the main view. Main view is the default view shown to user when he opens application without specifying view * uri. - * + * * @return Uri of the main view. */ public String getMainView() { @@ -179,7 +186,7 @@ public class Navigator extends CustomComponent { * Set the main view. Main view is the default view shown to user when he opens application without specifying view * uri. If main view has not been set, the first view registered with addView() is used as main view. Note that the * view must be registered with addView() before calling this method. - * + * * @param mainViewUri Uri of the main view. */ public void setMainView(String mainViewUri) { @@ -195,7 +202,7 @@ public class Navigator extends CustomComponent { /** * Add a new view to navigator. Register a view to navigator. - * + * * @param uri String that identifies a view. This is the string that is shown in URL after # * @param viewClass Component class that implements Navigator.View interface */ @@ -236,7 +243,7 @@ public class Navigator extends CustomComponent { /** * Remove view from navigator. - * + * * @param uri Uri of the view to remove. */ public void removeView(String uri) { @@ -256,7 +263,7 @@ public class Navigator extends CustomComponent { /** * Get the uri for given view implementation class. - * + * * @param viewClass Class that implements the view. * @return Uri registered for the view class. */ @@ -266,7 +273,7 @@ public class Navigator extends CustomComponent { /** * Get the view class for given uri. - * + * * @param uri Uri to get view for * @return View that corresponds to the uri */ @@ -277,7 +284,7 @@ public class Navigator extends CustomComponent { /** * Switch to view identified with uri. Uri can be either the exact uri registered previously with addView() or it can * also contain data id passed to the view. In case data id is included, the format is 'uri/freeFormedDataIdString'. - * + * * @param uri Uri where to navigate. */ public void navigateTo(String uri) { @@ -287,7 +294,7 @@ public class Navigator extends CustomComponent { /** * Switch to view implemented by given class. Note that the view must be registered to navigator with addView() * before calling this method. - * + * * @param viewClass Class that implements the view. */ public void navigateTo(Class<?> viewClass) { @@ -299,7 +306,7 @@ public class Navigator extends CustomComponent { /** * Listen to the view changes. The listener will get notified after the view has changed. - * + * * @param listener Listener to invoke after view changes. */ public void addListener(ViewChangeListener listener) { @@ -308,7 +315,7 @@ public class Navigator extends CustomComponent { /** * Remove the view change listener. - * + * * @param listener Listener to remove. */ public void removeListener(ViewChangeListener listener) { @@ -323,7 +330,7 @@ public class Navigator extends CustomComponent { /** * Invoked after the view has changed. Be careful for deadlocks if you decide to change the view again in the * listener. - * + * * @param previous Preview view before the change. * @param current New view after the change. */ @@ -341,7 +348,7 @@ public class Navigator extends CustomComponent { * Init view. Convenience method which navigator call before slightly before the view is first time rendered. This * is called only once in the lifetime of each view instance. In many cases it is better to construct UI within * this method than in constructor as you are guaranteed to get references to application and navigator here. - * + * * @param navigator Reference to navigator that controls the window where this view is attached to. * @param application Application instance this view lives in. */ @@ -350,7 +357,7 @@ public class Navigator extends CustomComponent { /** * This view is navigated to. This method is always called before the view is shown on screen. If there is any * additional id to data what should be shown in the view, it is also optionally passed as parameter. - * + * * @param requestedDataId Id of the data extracted from URI fragment or null if not given. This is the string that * appears in URI after #viewname/ */ @@ -361,7 +368,7 @@ public class Navigator extends CustomComponent { * state where navigating away from it could lead to data loss, this method should return a message that will be * shown to user before he confirms that he will leave the screen. If there is no need to ask questions from user, * this should return null. - * + * * @return Message to be shown or null if no message should be shown. */ public String getWarningForNavigatingFrom(); @@ -378,7 +385,7 @@ public class Navigator extends CustomComponent { * there are multiple instances of concurrently. Each window can contain anything you like, but at least they * should contain a new Navigator instance for controlling navigation within the window. Typically one also adds * some kind of menu for commanding navigator. - * + * * @return New window. */ public Window createNewWindow(); @@ -390,14 +397,14 @@ public class Navigator extends CustomComponent { * This helper makes implementing support for multiple browser tabs or browser windows easy. Just override * Application.getWindow(String) in your application like this: * </p> - * + * * <pre> * @Override * public Window getWindow(String name) { * return Navigator.getWindow(this, name, super.getWindow(name)); * } * </pre> - * + * * @param application Application instance, which implements Navigator.NavigableApplication interface. * @param name Name parameter from Application.getWindow(String name) * @param superGetWindow The window returned by super.getWindow(name) |

