Skip to content

Commit

Permalink
Merge pull request eclipse-sw360#540 from siemens/feat/NewFieldDomain…
Browse files Browse the repository at this point in the history
…ForProject-539

feat(Projects): Added new field "domain" to project summary

tested-by: [email protected]
review-by: [email protected]
  • Loading branch information
lepokle authored Jul 18, 2019
2 parents c81a988 + 33397be commit 8d18da2
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class PortalConstants {

public static final String PROPERTIES_FILE_PATH = "/sw360.properties";
public static final String PROGRAMMING_LANGUAGES;
public static final Set<String> DOMAIN;
public static final String SOFTWARE_PLATFORMS;
public static final String OPERATING_SYSTEMS;
public static final Set<String> SET_CLEARING_TEAMS_STRING;
Expand Down Expand Up @@ -417,6 +418,7 @@ public class PortalConstants {
Properties props = CommonUtils.loadProperties(PortalConstants.class, PROPERTIES_FILE_PATH);

PROGRAMMING_LANGUAGES = props.getProperty("programming.languages", "[ \"ActionScript\", \"AppleScript\", \"Asp\",\"Bash\", \"BASIC\", \"C\", \"C++\", \"C#\", \"Cocoa\", \"Clojure\",\"COBOL\",\"ColdFusion\", \"D\", \"Delphi\", \"Erlang\", \"Fortran\", \"Go\", \"Groovy\",\"Haskell\", \"JSP\", \"Java\",\"JavaScript\", \"Objective-C\", \"Ocaml\",\"Lisp\", \"Perl\", \"PHP\", \"Python\", \"Ruby\", \"SQL\", \"SVG\",\"Scala\",\"SmallTalk\", \"Scheme\", \"Tcl\", \"XML\", \"Node.js\", \"JSON\" ]");
DOMAIN = CommonUtils.splitToSet(props.getProperty("domain", "Application Software, Documentation, Embedded Software, Hardware, Test and Diagnostics"));
SOFTWARE_PLATFORMS = props.getProperty("software.platforms", "[ \"Adobe AIR\", \"Adobe Flash\", \"Adobe Shockwave\", \"Binary Runtime Environment for Wireless\", \"Cocoa (API)\", \"Cocoa Touch\", \"Java (software platform)|Java platform\", \"Java Platform, Micro Edition\", \"Java Platform, Standard Edition\", \"Java Platform, Enterprise Edition\", \"JavaFX\", \"JavaFX Mobile\", \"Microsoft XNA\", \"Mono (software)|Mono\", \"Mozilla Prism\", \".NET Framework\", \"Silverlight\", \"Open Web Platform\", \"Oracle Database\", \"Qt (framework)|Qt\", \"SAP NetWeaver\", \"Smartface\", \"Vexi\", \"Windows Runtime\" ]");
OPERATING_SYSTEMS = props.getProperty("operating.systems", "[ \"Android\", \"BSD\", \"iOS\", \"Linux\", \"OS X\", \"QNX\", \"Microsoft Windows\", \"Windows Phone\", \"IBM z/OS\"]");
SET_CLEARING_TEAMS_STRING = CommonUtils.splitToSet(props.getProperty("clearing.teams", "org1,org2,org3"));
Expand Down
2 changes: 1 addition & 1 deletion frontend/sw360-portlet/src/main/resources/sw360.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

## values just used for UI, not forcing DB writes
# operating.systems= [ "Android", "BSD", "iOS", "Linux", "Mac OS X", "QNX", "Microsoft Windows", "Windows Phone", "IBM z/OS"]

#domain= Application Software, Documentation, Embedded Software, Hardware, Test and Diagnostics
## values just used for UI, not forcing DB writes, should be in sync with fossology config
# clearing.teams=org1,org2,org3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<core_rt:set var="clearingTeamsStringSet" value='<%=PortalConstants.SET_CLEARING_TEAMS_STRING%>'/>
<core_rt:set var="preferredCountryCodes" value='<%=PortalConstants.PREFERRED_COUNTRY_CODES%>'/>
<core_rt:set var="domain" value='<%=PortalConstants.DOMAIN%>'/>

<table class="table info_table" id="ProjectBasicInfo">
<thead>
Expand Down Expand Up @@ -96,6 +97,29 @@
placeholder="Enter Description"><sw360:out value="${project.description}" stripNewlines="false"/></textarea>
</td>
</tr>
<tr>
<td width="33%">
<label class="textlabel stackedLabel" for="proj_domain">Domain</label>
<select class="toplabelledInput" id="domain" name="<portlet:namespace/><%=Project._Fields.DOMAIN%>" data-selected="${project.domain}"
style="min-width: 162px; min-height: 28px;">
<option value>-- Select Domain --</option>
<core_rt:forEach items="${domain}" var="entry">
<c:choose>
<c:when test="${entry eq project.domain}">
<option selected="selected" value="<sw360:out value="${entry}"/>" class="textlabel stackedLabel"> ${entry} </option>
</c:when>
<c:otherwise>
<option value="<sw360:out value="${entry}"/>" class="textlabel stackedLabel"> ${entry} </option>
</c:otherwise>
</c:choose>
</core_rt:forEach>
</select>
</td>
<td width="33%">
</td>
<td width="33%">
</td>
</tr>
<tr>
<td width="33%">
<label class="checkboxlabel" for="enable_svm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
<td>Project type:</td>
<td><sw360:DisplayEnum value="${project.projectType}"/></td>
</tr>
<tr>
<td>Domain:</td>
<td><sw360:out value="${project.domain}"/></td>
</tr>
<tr>
<td>Tag:</td>
<td><sw360:out value="${project.tag}"/></td>
Expand Down
1 change: 1 addition & 0 deletions libraries/lib-datahandler/src/main/thrift/projects.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct Project {
4: required string name,
5: optional string description,
6: optional string version,
7: optional string domain,

// information from external data sources
9: optional map<string, string> externalIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.springframework.hateoas.hal.DefaultCurieProvider;

import java.util.Properties;
import java.util.Set;

@SpringBootApplication
@Import(Sw360CORSFilter.class)
Expand All @@ -44,12 +45,15 @@ public class Sw360ResourceServer extends SpringBootServletInitializer {
public static final String API_TOKEN_HASH_SALT;
public static final String API_TOKEN_MAX_VALIDITY_READ_IN_DAYS;
public static final String API_TOKEN_MAX_VALIDITY_WRITE_IN_DAYS;
public static final Set<String> DOMAIN;

static {
Properties props = CommonUtils.loadProperties(Sw360ResourceServer.class, PROPERTIES_FILE_PATH);
API_TOKEN_MAX_VALIDITY_READ_IN_DAYS = props.getProperty("rest.apitoken.read.validity.days", "90");
API_TOKEN_MAX_VALIDITY_WRITE_IN_DAYS = props.getProperty("rest.apitoken.write.validity.days", "30");
API_TOKEN_HASH_SALT = props.getProperty("rest.apitoken.hash.salt", "$2a$04$Software360RestApiSalt");
DOMAIN = CommonUtils.splitToSet(props.getProperty("domain",
"Application Software, Documentation, Embedded Software, Hardware, Test and Diagnostics"));
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static abstract class MultiStatusMixin extends MultiStatus {
"setType",
"setName",
"setDescription",
"setDomain",
"setVersion",
"setExternalIds",
"setAttachments",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.sw360.datahandler.thrift.projects.ProjectRelationship;
import org.eclipse.sw360.datahandler.thrift.projects.ProjectType;
import org.eclipse.sw360.datahandler.thrift.users.User;
import org.eclipse.sw360.rest.resourceserver.Sw360ResourceServer;
import org.eclipse.sw360.rest.resourceserver.TestHelper;
import org.eclipse.sw360.rest.resourceserver.attachment.Sw360AttachmentService;
import org.eclipse.sw360.rest.resourceserver.licenseinfo.Sw360LicenseInfoService;
Expand Down Expand Up @@ -118,6 +119,7 @@ public void before() throws TException, IOException {
project.setProjectType(ProjectType.PRODUCT);
project.setVersion("1.0.2");
project.setDescription("Emerald Web provides a suite of components for Critical Infrastructures.");
project.setDomain("Hardware");
project.setCreatedOn("2016-12-15");
project.setCreatedBy("[email protected]");
project.setModerators(new HashSet<>(Arrays.asList("[email protected]", "[email protected]")));
Expand Down Expand Up @@ -155,6 +157,7 @@ public void before() throws TException, IOException {
project2.setVersion("2.0.1");
project2.setProjectType(ProjectType.PRODUCT);
project2.setDescription("Orange Web provides a suite of components for documentation.");
project.setDomain("Hardware");
project2.setCreatedOn("2016-12-17");
project2.setCreatedBy("[email protected]");
project2.setBusinessUnit("sw360 EX DF");
Expand Down Expand Up @@ -302,6 +305,7 @@ public void should_document_get_project() throws Exception {
fieldWithPath("createdOn").description("The date the project was created"),
fieldWithPath("description").description("The project description"),
fieldWithPath("projectType").description("The project type, possible values are: " + Arrays.asList(ProjectType.values())),
fieldWithPath("domain").description("The domain, possible values are:" + Sw360ResourceServer.DOMAIN.toString()),
fieldWithPath("visibility").description("The project visibility, possible values are: " + Arrays.asList(Visibility.values())),
fieldWithPath("businessUnit").description("The business unit this project belongs to"),
fieldWithPath("externalIds").description("When projects are imported from other tools, the external ids can be stored here"),
Expand Down Expand Up @@ -547,6 +551,7 @@ public void should_document_update_project() throws Exception {
fieldWithPath("version").description("The project version"),
fieldWithPath("createdOn").description("The date the project was created"),
fieldWithPath("description").description("The project description"),
fieldWithPath("domain").description("The domain, possible values are:" + Sw360ResourceServer.DOMAIN.toString()),
fieldWithPath("projectType").description("The project type, possible values are: "
+ Arrays.asList(ProjectType.values())),
fieldWithPath("visibility").description("The project visibility, possible values are: "
Expand Down

0 comments on commit 8d18da2

Please sign in to comment.