Skip to content

Commit

Permalink
Merge pull request #1998 from KoukiHama/tden-license-note
Browse files Browse the repository at this point in the history
feat(ui): add note filed in license page

Reviewed by : anupam.ghosh@siemens.com
Tested by: tien1.le@toshiba.co.jp
  • Loading branch information
ag4ums committed Jun 19, 2023
2 parents e90a860 + b6d58b9 commit 2170a5b
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ private License updateLicenseFromInputLicense(Optional<License> oldLicense, Lice
license.setExternalLicenseLink(inputLicense.getExternalLicenseLink());
license.setChecked(inputLicense.isChecked());
license.setObligationDatabaseIds(inputLicense.getObligationDatabaseIds());
license.setNote(inputLicense.getNote());

return license;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public final class SW360License extends SW360SimpleHalResource {
private String text;
private String shortName;
private String fullName;
private String note;

@JsonInclude(JsonInclude.Include.NON_NULL)
public String getText() {
Expand Down Expand Up @@ -51,19 +52,30 @@ public SW360License setFullName(String fullName) {
return this;
}

@JsonInclude(JsonInclude.Include.NON_NULL)
public String getNote() {
return this.note;
}

public SW360License setNote(String note) {
this.note = note;
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SW360License) || !super.equals(o)) return false;
SW360License that = (SW360License) o;
return Objects.equals(text, that.text) &&
Objects.equals(shortName, that.shortName) &&
Objects.equals(fullName, that.fullName);
Objects.equals(fullName, that.fullName) &&
Objects.equals(note, that.note);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), text, shortName, fullName);
return Objects.hash(super.hashCode(), text, shortName, fullName, note);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,14 @@ private License updateLicenseFromRequest(License license, ActionRequest request)
boolean checked = "true".equals(request.getParameter(License._Fields.CHECKED.toString()));
String licenseTypeString =
request.getParameter(License._Fields.LICENSE_TYPE.toString() + LicenseType._Fields.LICENSE_TYPE.toString());
String note = request.getParameter(License._Fields.NOTE.name());
license.setText(CommonUtils.nullToEmptyString(text));
license.setFullname(CommonUtils.nullToEmptyString(fullname));
license.setShortname((CommonUtils.nullToEmptyString(shortname)));
license.setOSIApproved(osiApproved);
license.setFSFLibre(fsfLibre);
license.setChecked(checked);
license.setNote(note);
String obligationIds = request.getParameter("obligations");
List<String> oblIds = CommonUtils.isNotNullEmptyOrWhitespace(obligationIds) ? Arrays.asList(obligationIds.split(",")) : Lists.newArrayList();
license.setObligationDatabaseIds(Sets.newHashSet(oblIds));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,8 @@
</core_rt:choose>
</td>
</tr>
<tr>
<td><liferay-ui:message key="note" />:</td>
<td><sw360:out value="${licenseDetail.note}"/></td>
</tr>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,13 @@
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group">
<label for="lic_note"><liferay-ui:message key="note" /></label>
<textarea id="lic_note" name="<portlet:namespace/><%=License._Fields.NOTE%>" type="text" class="form-control"
placeholder="<liferay-ui:message key="enter.note" />">${licenseDetail.note}</textarea>
</div>
</td>
</tr>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ enter.mail.address=Enter mail address
enter.mailing.list.url=Enter Mailing List Url
enter.material.index.number=Enter material index number
enter.name=Enter Name
enter.note=Enter Note
enter.obligation.comment=Enter obligation comment
enter.oidc.client.id=Enter OIDC Client Id
enter.oidc.client.name=Enter OIDC Client Name
Expand Down Expand Up @@ -900,6 +901,7 @@ not.checked=Not Checked
in.analysis=In Analysis
not.decided.so.far=Not decided so far
not.loaded.yet=Not loaded yet
note=Note
note.other.documents.might.use.the.licenses=Note: other documents might use the licenses.
not.used.in.any.project.yet=not used in any project yet
no.type.restriction.is.the.same.as.looking.for.all.types.even.on.types.that.are.not.in.the.list=No type restriction is the same as looking for all types, even on types that are not in the list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ enter.mail.address=メールアドレスを入力
enter.mailing.list.url=メーリングリストのURLを入力
enter.material.index.number=部品指標番号(Material index number)を入力
enter.name=名前を入力
enter.note=ノートを入力
enter.obligation.comment=オブリゲーションコメントを入力
enter.oidc.client.id=Enter OIDC Client Id
enter.oidc.client.name=Enter OIDC Client Name
Expand Down Expand Up @@ -899,6 +900,7 @@ not.checked=未チェック
in.analysis=分析中
not.decided.so.far=今のところ未定
not.loaded.yet=まだロードされていない
note=ノート
note.other.documents.might.use.the.licenses=注意: 他のドキュメントではライセンスが使用されている可能性があります。
not.used.in.any.project.yet=まだどのプロジェクトでも使用されていない
no.type.restriction.is.the.same.as.looking.for.all.types.even.on.types.that.are.not.in.the.list=タイプ制限がないのは、すべてのタイプを探すのと同じ。リストにない型でも使用可。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ enter.mail.address=Nhập địa chỉ thư
enter.mailing.list.url=Nhập Url danh sách gửi thư
enter.material.index.number=Nhập số chỉ mục tài liệu
enter.name=Nhập tên
enter.note=Nhập ghi chú
enter.obligation.comment=Nhập nghĩa vụ bình luận
enter.oidc.client.id=Enter OIDC Client Id
enter.oidc.client.name=Enter OIDC Client Name
Expand Down Expand Up @@ -902,6 +903,7 @@ not.checked=Chưa được kiểm tra
in.analysis=In Analysis
not.decided.so.far=Không quyết định cho đến nay
not.loaded.yet=Not loaded yet
note=ghi chú
note.other.documents.might.use.the.licenses=Lưu ý: các tài liệu khác có thể sử dụng giấy phép.
not.used.in.any.project.yet=chưa được sử dụng trong bất kỳ dự án nào
no.type.restriction.is.the.same.as.looking.for.all.types.even.on.types.that.are.not.in.the.list=Không có giới hạn loại nào giống như tìm kiếm tất cả các loại, ngay cả trên các loại không có trong danh sách.
Expand Down
1 change: 1 addition & 0 deletions libraries/datahandler/src/main/thrift/licenses.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct License {
6: optional LicenseType licenseType,
7: optional string licenseTypeDatabaseId,
8: optional string externalLicenseLink,
10: optional string note,

// 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 @@ -702,6 +702,7 @@ static abstract class VendorMixin extends Vendor {
"setChecked",
"additionalDataSize",
"setAdditionalData",
"setNote",
})
static abstract class LicenseMixin extends License {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ public void before() throws TException {
externalIds.put("Trove", "License :: OSI Approved :: Apache Software License");
license.setExternalIds(externalIds);
license.setAdditionalData(Collections.singletonMap("Key", "Value"));
license.setNote("License's Note");

License license2 = new License();
license2.setId("MIT");
license2.setFullname("The MIT License (MIT)");
license2.setShortname("MIT");
license2.setText("placeholder for the MIT license text");
license2.setNote("License2's Note");

List<License> licenseList = new ArrayList<>();
licenseList.add(license);
Expand Down Expand Up @@ -150,7 +152,8 @@ public void should_document_get_license() throws Exception {
subsectionWithPath("OSIApproved").description("The OSI aprroved information, possible values are: " + Arrays.asList(Quadratic.values())),
fieldWithPath("FSFLibre").description("The FSF libre information, possible values are: " + Arrays.asList(Quadratic.values())),
subsectionWithPath("_embedded.sw360:obligations").description("An array of <<resources-obligations, Obligations obligations>>"),
subsectionWithPath("_links").description("<<resources-index-links,Links>> to other resources")
subsectionWithPath("_links").description("<<resources-index-links,Links>> to other resources"),
fieldWithPath("note").description("The license's note")
)));
}

Expand Down

0 comments on commit 2170a5b

Please sign in to comment.