diff options
author | Lorraine Welch <lb2391@att.com> | 2019-09-16 15:48:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-09-16 15:48:10 +0000 |
commit | fadf5206f07dada8b60b8ee5923cb33de90dbe5b (patch) | |
tree | ac2c954f3d8adf4f6b545c717bc24f6787a14a47 | |
parent | 5fe839bc8f5b536d5cb48297cf16c4d63e456413 (diff) | |
parent | 17eaed467b83748eb842075527a1955da42c6e31 (diff) |
Merge "Ecomp DTO up"
68 files changed, 5874 insertions, 9 deletions
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java index eda3fb26..05c3cf08 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java @@ -69,6 +69,7 @@ import org.onap.portal.domain.db.ep.EpAppRoleFunction; import org.onap.portal.domain.db.ep.EpRoleNotification; import org.onap.portal.domain.db.ep.EpUserRolesRequestDet; import org.onap.portal.domain.db.ep.EpWidgetCatalogRole; +import org.onap.portal.domain.dto.DomainVo; /* CREATE TABLE `fn_role` ( @@ -120,7 +121,7 @@ CREATE TABLE `fn_role` ( @Getter @Setter @Entity -public class FnRole { +public class FnRole extends DomainVo { @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -133,11 +134,8 @@ public class FnRole { @SafeHtml private String roleName; @Column(name = "active_yn", length = 1, columnDefinition = "character varying(1) default 'y'", nullable = false) - @Pattern(regexp = "[YNyn]") - @Size(max = 1) @NotNull - @SafeHtml - private String activeYn; + private Boolean activeYn; @Column(name = "priority", length = 4, columnDefinition = "decimal(4,0) DEFAULT NULL") @Digits(integer = 4, fraction = 0) private Long priority; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java index dffa7f72..1c3435df 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java @@ -78,6 +78,7 @@ import org.onap.portal.domain.db.ep.EpPersUserWidgetSel; import org.onap.portal.domain.db.ep.EpUserNotification; import org.onap.portal.domain.db.ep.EpUserRolesRequest; import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; +import org.onap.portal.domain.dto.DomainVo; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @@ -180,7 +181,7 @@ CREATE TABLE `fn_user` ( @AllArgsConstructor @DynamicUpdate @SequenceGenerator(name = "seq", initialValue = 1000, allocationSize = 100000) -public class FnUser implements UserDetails { +public class FnUser extends DomainVo implements UserDetails { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq") diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java index e14b9372..df99ed87 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java @@ -60,9 +60,11 @@ import org.onap.portalsdk.core.domain.FusionVo; @Setter @NoArgsConstructor @AllArgsConstructor -@Inheritance(strategy = InheritanceType.JOINED) +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable { + private static final long serialVersionUID = 1L; + protected Long id; protected Date created; protected Date modified; @@ -75,7 +77,7 @@ public class DomainVo extends FusionVo implements Serializable, Cloneable, Compa @Override public int compareTo(Object obj) { Long c1 = this.getId(); - Long c2 = ((org.onap.portalsdk.core.domain.support.DomainVo)obj).getId(); + Long c2 = ((org.onap.portalsdk.core.domain.support.DomainVo) obj).getId(); return c1 != null && c2 != null ? c1.compareTo(c2) : 1; } @@ -92,7 +94,7 @@ public class DomainVo extends FusionVo implements Serializable, Cloneable, Compa oos.writeObject(this); bais = new ByteArrayInputStream(baos.toByteArray()); ois = new ObjectInputStream(bais); - newVo = (DomainVo)ois.readObject(); + newVo = (DomainVo) ois.readObject(); if (isIdNull) { newVo.setId(null); } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AdminUserApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AdminUserApp.java new file mode 100644 index 00000000..5b4aec7c --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AdminUserApp.java @@ -0,0 +1,64 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class AdminUserApp implements Serializable{ + + private static final long serialVersionUID = 1L; + + private Long user_Id; + private String firstName; + private String lastName; + private String orgUserId; + private Long appId; + private String appName; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AdminUserApplications.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AdminUserApplications.java new file mode 100644 index 00000000..19806bfa --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AdminUserApplications.java @@ -0,0 +1,82 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.ArrayList; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class AdminUserApplications { + private List<Application> apps = new ArrayList<>(); + + private Long user_Id; + private String firstName; + private String lastName; + private String orgUserId; + + public AdminUserApplications(AdminUserApp app) { + setUser_Id(app.getUser_Id()); + setOrgUserId(app.getOrgUserId()); + setFirstName(app.getFirstName()); + setLastName(app.getLastName()); + + addApp(app.getAppId(), app.getAppName()); + } + + private void addApp(Long otherAppId, String otherAppName) { + apps.add(new Application(otherAppId, otherAppName)); + } + + @Getter + @Setter + @AllArgsConstructor + public class Application { + private Long appId; + private String appName; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/App.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/App.java new file mode 100644 index 00000000..6739f458 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/App.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class App implements Serializable{ + + private static final long serialVersionUID = 1L; + + private Long appId; + private String appName; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java new file mode 100644 index 00000000..a7be2173 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCatalogItem.java @@ -0,0 +1,75 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AppCatalogItem extends DomainVo { + + private static final long serialVersionUID = 6619663784935017846L; + + private Long id; + private String name; + private String mlAppName; + private String imageUrl; + private String description; + private String notes; + private String url; + private String alternateUrl; + private Boolean restricted; + private Boolean open; + private Boolean access; + private Boolean select; + private Boolean pending; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java new file mode 100644 index 00000000..706c3a31 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppCategoryFunctionsItem.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@ToString +@EqualsAndHashCode(callSuper = false) +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AppCategoryFunctionsItem extends DomainVo { + + private static final long serialVersionUID = -1573834082471206458L; + + private String rowId; + private String appId; + private String application; + private String category; + private String functions; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java new file mode 100644 index 00000000..9f215a05 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUs.java @@ -0,0 +1,74 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonBackReference; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class AppContactUs extends DomainVo { + + private static final long serialVersionUID = -2742197830465055134L; + + @JsonBackReference + @Valid + private EPApp app; + @SafeHtml + private String description; + @SafeHtml + private String contactEmail; + @SafeHtml + private String contactName; + @SafeHtml + private String url; + @SafeHtml + private String activeYN; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java new file mode 100644 index 00000000..491a82de --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppContactUsItem.java @@ -0,0 +1,74 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AppContactUsItem extends DomainVo { + + private static final long serialVersionUID = 6964210807573346262L; + + private Long appId; + @SafeHtml + private String appName; + @SafeHtml + private String description; + @SafeHtml + private String contactName; + @SafeHtml + private String contactEmail; + @SafeHtml + private String url; + @SafeHtml + private String activeYN; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppIdAndNameTransportModel.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppIdAndNameTransportModel.java new file mode 100644 index 00000000..5c13a4aa --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppIdAndNameTransportModel.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class AppIdAndNameTransportModel implements Serializable{ + + private static final long serialVersionUID = 1L; + + private Long id; + private String name; + private Integer appType; + + public Boolean isRestrictedApp() { + return (this.appType == 2); + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppsResponse.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppsResponse.java new file mode 100644 index 00000000..b40f85d1 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/AppsResponse.java @@ -0,0 +1,73 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Setter() +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class AppsResponse { + + private Long index; + private String title; + private String value; + private Boolean restrictedApp; + private Boolean enabled; + + public AppsResponse(Long id, String name, Boolean restrictedApp, Boolean enabled) { + this.index = id; + this.title = this.value = name; + this.restrictedApp = restrictedApp; + this.enabled = enabled; + } + + // Hide the implementation of restricted and normal app from the front end. + // The json sent and received will include restrictedApp but not appType. + private Boolean getRestrictedApp(){ + return this.restrictedApp; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BEProperty.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BEProperty.java new file mode 100644 index 00000000..aa6b6bc7 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BEProperty.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +public class BEProperty { + + private String key; + private String value; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java new file mode 100644 index 00000000..23d11a34 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/BasicAuthCredentials.java @@ -0,0 +1,71 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class BasicAuthCredentials extends DomainVo { + + private static final long serialVersionUID = 1L; + + private Long id; + private String applicationName; + private String username; + private String password; + private String isActive; + private List<EPEndpoint> endpoints; + + @Override + public String toString() { + return "BasicAuthCredentials [id=" + id + ", applicationName=" + applicationName + ", username=" + username + + ", password=" + password + ", isActive=" + isActive + "]"; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java new file mode 100644 index 00000000..de19cbd2 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralV2RoleFunction.java @@ -0,0 +1,111 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +@NoArgsConstructor +@AllArgsConstructor +public class CentralV2RoleFunction extends DomainVo implements Serializable, Comparable { + + private static final long serialVersionUID = -4018975640065252688L; + + @SafeHtml + private String code; + @SafeHtml + private String name; + @JsonIgnore + private Long appId; + @JsonIgnore + private Long roleId; + private String type; + @SafeHtml + private String action; + @SafeHtml + private String editUrl; + + public CentralV2RoleFunction(Long id, String code, String name, Long appId, String type, String action, + String editUrl) { + super(); + this.id = id; + this.code = code; + this.name = name; + this.appId = appId; + this.type = type; + this.action = action; + this.editUrl = editUrl; + } + + public CentralV2RoleFunction(Long id, String code, String name, Long appId, String editUrl) { + super(); + this.id = id; + this.code = code; + this.name = name; + this.appId = appId; + this.editUrl = editUrl; + } + + + public CentralV2RoleFunction(String code, String name) { + super(); + this.code = code; + this.name = name; + } + + public int compareTo(Object obj) { + String c1 = getName(); + String c2 = ((CentralV2RoleFunction) obj).getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralizedApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralizedApp.java new file mode 100644 index 00000000..fd563fc6 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CentralizedApp.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CentralizedApp implements Serializable{ + + private static final long serialVersionUID = -3773410386555027935L; + + private int appId; + private String appName; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java new file mode 100644 index 00000000..cda66229 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/CommonWidgetsEnum.java @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +public enum CommonWidgetsEnum{ + NEWS("news"), + EVENTS("events"), + RESOURCES("resources"); + + private String value; + CommonWidgetsEnum(String value){ + this.value = value; + } + + @Override + public String toString() { + return value; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/DisplayText.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/DisplayText.java new file mode 100644 index 00000000..0994070d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/DisplayText.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.Data; + +@Data +public class DisplayText { + + private Integer id; + private Integer languageId; + private Long textId; + private String label; +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java new file mode 100644 index 00000000..def3e688 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPApp.java @@ -0,0 +1,226 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import javax.persistence.Lob; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang.StringUtils; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +public class EPApp extends DomainVo { + + private static final long serialVersionUID = 1L; + + @SafeHtml + private String name; + @SafeHtml + private String imageUrl; + @SafeHtml + private String description; + @SafeHtml + private String notes; + @SafeHtml + private String url; + @SafeHtml + private String alternateUrl; + @SafeHtml + private String appRestEndpoint; + @SafeHtml + private String mlAppName; + @SafeHtml + private String mlAppAdminId; + private Long motsId; + @SafeHtml + private String username; + @SafeHtml + private String appPassword; + @Lob + private byte[] thumbnail; + private Boolean open; + private Boolean enabled; + @SafeHtml + private String uebTopicName; + @SafeHtml + private String uebKey; + @SafeHtml + private String uebSecret; + private Integer appType; + @Valid + private AppContactUs contactUs; + private Boolean centralAuth; + @SafeHtml + private String nameSpace; + + public EPApp() { + this.name = ""; + this.mlAppName = ""; + this.mlAppAdminId = ""; + this.username = ""; + this.appPassword = ""; + this.open = Boolean.FALSE; + this.enabled = Boolean.TRUE; + this.uebTopicName = ""; + this.uebKey = ""; + this.uebSecret = ""; + this.appType = 1; + } + + + public void setName(String name) { + if (StringUtils.isEmpty(name)) { + name = ""; + } + this.name = name; + } + + public void setMlAppName(String mlAppName) { + if (StringUtils.isEmpty(mlAppName)) { + mlAppName = ""; + } + this.mlAppName = mlAppName; + } + + public void setMlAppAdminId(String mlAppAdminId) { + if (StringUtils.isEmpty(mlAppAdminId)) { + mlAppAdminId = ""; + } + this.mlAppAdminId = mlAppAdminId; + } + + + public void setAppPassword(String appPassword) { + if (StringUtils.isEmpty(appPassword)) { + appPassword = ""; + } + this.appPassword = appPassword; + } + + public void setOpen(Boolean open) { + if (open == null) { + open = Boolean.FALSE; + } + this.open = open; + } + + public void setEnabled(Boolean enabled) { + if (enabled == null) { + enabled = Boolean.TRUE; + } + this.enabled = enabled; + } + + public void setAppType(Integer appType) { + if (appType == null) { + appType = 1; + } + this.appType = appType; + } + + public void setRestrictedApp(Boolean restrictedApp) { + Integer result = 1; + if (restrictedApp) { + result = 2; + } + this.appType = result; + } + + public Boolean isRestrictedApp() { + return (this.appType == 2); + } + + public int compareTo(Object obj) { + Long c1 = getId(); + Long c2 = ((EPApp) obj).getId(); + + return c1.compareTo(c2); + } + + public void setUebTopicName(String topicName) { + if (StringUtils.isEmpty(topicName)) { + this.uebTopicName = ""; + } + this.uebTopicName = topicName; + } + + public void setUebKey(String uebKey) { + if (StringUtils.isEmpty(uebKey)) { + this.uebKey = ""; + } + this.uebKey = uebKey; + } + + + public void setUebSecret(String uebSecret) { + if (StringUtils.isEmpty(uebSecret)) { + this.uebSecret = ""; + } + this.uebSecret = uebSecret; + } + + public void setCentralAuth(Boolean centralAuth) { + if (centralAuth == null) { + centralAuth = Boolean.FALSE; + } + this.centralAuth = centralAuth; + } + + public void setNameSpace(String nameSpace) { + if (StringUtils.isEmpty(nameSpace)) { + nameSpace = null; + } + this.nameSpace = nameSpace; + } + + @Override + public String toString() { + return "[" + getId() + ":" + getName() + "]"; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java new file mode 100644 index 00000000..254a0e67 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPAppRoleFunction.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPAppRoleFunction extends DomainVo implements java.io.Serializable{ + + private static final long serialVersionUID = 7752385247460299630L; + + private Long roleId; + private Long appId; + private String code; + private String roleAppId; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java new file mode 100644 index 00000000..8c6052c2 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpoint.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class EPEndpoint extends DomainVo { + + private static final long serialVersionUID = 1L; + + private Long id; + private String name; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java new file mode 100644 index 00000000..535470c3 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPEndpointAccount.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPEndpointAccount extends DomainVo { + + private static final long serialVersionUID = 1L; + + private Long id; + private Long ep_id; + private Long account_id; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java new file mode 100644 index 00000000..dff4876c --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPRole.java @@ -0,0 +1,158 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.SortedSet; +import java.util.TreeSet; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPRole extends DomainVo { + + private static final long serialVersionUID = 1L; + @SafeHtml + private String name; + private boolean active; + private Integer priority; + private Long appId; // used by ONAP only + private Long appRoleId; // used by ONAP only + private SortedSet<RoleFunction> roleFunctions = new TreeSet<>(); + @Valid + private SortedSet<EPRole> childRoles = new TreeSet<>(); + @JsonIgnore + private SortedSet<EPRole> parentRoles = new TreeSet<>(); + + + public void addRoleFunction(RoleFunction roleFunction) { + this.roleFunctions.add(roleFunction); + } + + public void addChildRole(EPRole role) { + this.childRoles.add(role); + } + + public void addParentRole(EPRole role) { + this.parentRoles.add(role); + } + + public String getEditUrl() { + return "/role.htm?role_id=" + getId(); + } + + public String getToggleActiveImage() { + return "/static/fusion/images/" + (isActive() ? "active.png" : "inactive.png"); + } + + public String getToggleActiveAltText() { + return isActive() ? "Click to Deactivate Role" : "Click to Activate Role"; + } + + public void removeChildRole(Long roleId) { + + for (EPRole childRole : this.childRoles) { + if (childRole.getId().equals(roleId)) { + this.childRoles.remove(childRole); + break; + } + } + } + + public void removeParentRole(Long roleId) { + + for (EPRole parentRole : this.parentRoles) { + if (parentRole.getId().equals(roleId)) { + this.parentRoles.remove(parentRole); + break; + } + } + } + + public void removeRoleFunction(String roleFunctionCd) { + + for (RoleFunction roleFunction : this.roleFunctions) { + if (roleFunction.getCode().equals(roleFunctionCd)) { + this.roleFunctions.remove(roleFunction); + break; + } + } + } + + public int compareTo(Object obj) { + EPRole other = (EPRole) obj; + + if (this.appId == null) { + if (other.getAppId() == null) { + return compareByName(other); //equal + } else { + return -1; + } + } else if (other.getAppId() == null) { + return 1; + } else { + int appIdCompareResult = appId.compareTo(other.getAppId()); + return appIdCompareResult == 0 ? compareByName(other) : appIdCompareResult; + } + } + + private int compareByName(EPRole other) { + String c1 = getName(); + String c2 = other.getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + @Override + public String toString() { + return "[Id = " + id + ", name = " + name + "]"; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUser.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUser.java new file mode 100644 index 00000000..d22fb084 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUser.java @@ -0,0 +1,235 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Date; +import java.util.Iterator; +import java.util.SortedSet; +import java.util.TreeSet; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; + +@Getter +@Setter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class EPUser extends User { + + private Long orgId; + private Long managerId; + @SafeHtml + private String firstName; + @SafeHtml + private String middleInitial; + @SafeHtml + private String lastName; + @SafeHtml + private String phone; + @SafeHtml + private String fax; + @SafeHtml + private String cellular; + @SafeHtml + private String email; + private Long addressId; + @SafeHtml + private String alertMethodCd; + @SafeHtml + private String hrid; + @SafeHtml + private String orgUserId; + @SafeHtml + private String orgCode; + @SafeHtml + private String address1; + @SafeHtml + private String address2; + @SafeHtml + private String city; + @SafeHtml + private String state; + @SafeHtml + private String zipCode; + @SafeHtml + private String country; + @SafeHtml + private String orgManagerUserId; + @SafeHtml + private String locationClli; + @SafeHtml + private String businessCountryCode; + @SafeHtml + private String businessCountryName; + @SafeHtml + private String businessUnit; + @SafeHtml + private String businessUnitName; + @SafeHtml + private String department; + @SafeHtml + private String departmentName; + @SafeHtml + private String companyCode; + @SafeHtml + private String company; + @SafeHtml + private String zipCodeSuffix; + @SafeHtml + private String jobTitle; + @SafeHtml + private String commandChain; + @SafeHtml + private String siloStatus; + @SafeHtml + private String costCenter; + @SafeHtml + private String financialLocCode; + @SafeHtml + private String loginId; + @SafeHtml + private String loginPwd; + private Date lastLoginDate; + private boolean active; + private boolean internal; + private Long selectedProfileId; + private Long timeZoneId; + private boolean online; + @SafeHtml + private String chatId; + private boolean systemUser; + private Integer languageId; + private static final long serialVersionUID = 1L; + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUser.class); + private static final String ECOMP_PORTAL_NAME = "ECOMP"; + private boolean isGuest = false; + @Valid + private SortedSet<EPUserApp> userApps = new TreeSet<>(); + @Valid + private SortedSet<EPRole> pseudoRoles = new TreeSet<>(); + + @JsonIgnore + public String getFullName() { + return getFirstName() + " " + getLastName(); + } + + public int compareTo(Object obj) { + EPUser user = (EPUser) obj; + + String c1 = getLastName() + getFirstName() + getMiddleInitial(); + String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial(); + + return c1.compareTo(c2); + } + + + public void addAppRoles(EPApp app, SortedSet<EPRole> roles) { + if (roles != null) { + // add all + SortedSet<EPUserApp> userApps = new TreeSet<>(); + // this.userApps.removeAll(this.userApps); + for (EPRole role : roles) { + EPUserApp userApp = new EPUserApp(); + userApp.setUserId(this.id); + userApp.setApp(app); + userApp.setRole(role); + userApps.add(userApp); + } + setUserApps(userApps); + } else { + setUserApps(null); + } + + } + + public SortedSet<EPRole> getAppEPRoles(EPApp app) { + + logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - app = {}", app.getName()); + + SortedSet<EPRole> roles = new TreeSet<>(); + SortedSet<EPUserApp> userAppRoles = getUserApps(); + + logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - userApps = {} ", + userAppRoles.size()); + + Iterator<EPUserApp> userAppRolesIterator = userAppRoles.iterator(); + + EPUserApp userAppRole; + // getting default app + while (userAppRolesIterator.hasNext()) { + EPUserApp tempUserApp = userAppRolesIterator.next(); + if (tempUserApp.getApp().getId().equals(app.getId())) { + + logger.debug(EELFLoggerDelegate.debugLogger, + "In EPUser.getAppEPRoles() - for user {}, found application {}", this.getFullName(), + app.getName()); + + userAppRole = tempUserApp; + + EPRole role = userAppRole.getRole(); + if (role.isActive()) { + logger.debug(EELFLoggerDelegate.debugLogger, + "In EPUser.getAppEPRoles() - Role {} is active - adding for user {} and app {}", + role.getName(), this.getFullName(), app.getName()); + roles.add(role); + } else { + logger.debug(EELFLoggerDelegate.debugLogger, + "In EPUser.getAppEPRoles() - Role {} is NOT active - NOT adding for user {} and app {}", + role.getName(), this.getFullName(), app.getName()); + } + } + } + logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - roles = {}", roles.size()); + + return roles; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java new file mode 100644 index 00000000..5eb0da96 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserApp.java @@ -0,0 +1,136 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPUserApp extends DomainVo implements java.io.Serializable, Comparable { + + private static final long serialVersionUID = 1L; + + private Long userId; + @Valid + private EPApp app; + @Valid + private EPRole role; + private Integer priority; + + public Long getAppId() { + return this.getApp().getId(); + } + + public Long getRoleId() { + return (role == null) ? null : role.getId(); + } + + public Long getAppRoleId() { + return this.role.getAppRoleId(); + } + + @Override + public String toString() { + return "[u: "+getUserId()+"; a: "+getAppId()+", r: "+getRoleId()+"; appRoleId: "+getAppRoleId()+"]"; + } + + public Integer getPriority() { + return (this.priority == null) ? 1 : priority; + } + + + @Override + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof EPUserApp)) + return false; + EPUserApp castOther = (EPUserApp) other; + + return (otherUserIdIsSameAsThisUserId(castOther)) + && (otherAppIdIsSameAsThis(castOther)) + && (otherRoleIsSameAsThis(castOther)) + && (otherPriorityIsSameAsThis(castOther)); + } + + public int hashCode() { + int result = 17; + + result = 37 * result + (this.getUserId()==null ? 0 : this.getUserId().intValue()); + result = 37 * result + (this.getApp().getId()==null ? 0 : this.getApp().getId().intValue()); + result = 37 * result + (this.getRole().getId()==null ? 0 : this.getRole().getId().intValue()); + result = 37 * result + (this.priority==null ? 0 : this.priority); + return result; + } + + public int compareTo(Object other){ + EPUserApp castOther = (EPUserApp) other; + + Long c1 = (this.getUserId()==null ? 0 : this.getUserId()) + (this.getApp()==null||this.getApp().getId()==null ? 0 : this.getApp().getId()) + (this.getRole()==null||this.getRole().getId()==null ? 0 : this.getRole().getId()) + (this.priority==null ? 0 : this.priority); + Long c2 = (castOther.getUserId()==null ? 0 : castOther.getUserId()) + (castOther.getApp()==null||castOther.getApp().getId()==null ? 0 : castOther.getApp().getId()) + (castOther.getRole()==null||castOther.getRole().getId()==null ? 0 : castOther.getRole().getId()) + (castOther.priority==null ? 0 : castOther.priority); + + return c1.compareTo(c2); + } + private boolean otherPriorityIsSameAsThis(EPUserApp other){ + return (this.priority==null && other.getPriority()==null) || this.getPriority().equals(other.getPriority()); + } + + private boolean otherRoleIsSameAsThis(EPUserApp other){ + return this.getRole().getId().equals(other.getRole().getId()); + } + + private boolean otherAppIdIsSameAsThis(EPUserApp other){ + return this.getApp().getId().equals(other.getApp().getId()); + } + + private boolean otherUserIdIsSameAsThisUserId(EPUserApp other){ + return this.getUserId().equals(other.getUserId()); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java new file mode 100644 index 00000000..c5fbd40d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppCatalogRoles.java @@ -0,0 +1,66 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude +public class EPUserAppCatalogRoles extends DomainVo { + + private static final long serialVersionUID = -5259869298825093816L; + + private Long requestedRoleId; + private String rolename; + private String requestStatus; + private Long appId; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java new file mode 100644 index 00000000..12cad851 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRoles.java @@ -0,0 +1,66 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EPUserAppRoles extends DomainVo { + + private static final long serialVersionUID = -1484592641766545668L; + + private Long roleId; + private Long appId; + +} + diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java new file mode 100644 index 00000000..61585355 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequest.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.Date; +import java.util.Set; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +@NoArgsConstructor +@AllArgsConstructor +public class EPUserAppRolesRequest extends DomainVo { + + private static final long serialVersionUID = -7225288307806389019L; + + private Long userId; + private Long appId; + private Date createdDate; + private Date updatedDate; + private String requestStatus; + private Set<EPUserAppRolesRequestDetail> epRequestIdDetail; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java new file mode 100644 index 00000000..61e746ae --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppRolesRequestDetail.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPUserAppRolesRequestDetail extends DomainVo { + + private static final long serialVersionUID = -4908856671135348157L; + + private Long reqRoleId; + private String reqType; + private EPUserAppRolesRequest epRequestIdData; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java new file mode 100644 index 00000000..67779ce1 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsManualSortPreference.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPUserAppsManualSortPreference extends DomainVo { + + private static final long serialVersionUID = -6270136291139278216L; + private Long userId; + private Long appId; + private int appManualSortOrder; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java new file mode 100644 index 00000000..ad821a2f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserAppsSortPreference.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPUserAppsSortPreference extends DomainVo{ + + private static final long serialVersionUID = -5267000174894006433L; + + private int userId; + private String sortPref; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserNotification.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserNotification.java new file mode 100644 index 00000000..864db8bc --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPUserNotification.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.Date; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPUserNotification extends DomainVo { + + private Long userId; + private Long notificationId; + private String viewed; + private Date updateTime; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java new file mode 100644 index 00000000..85146c12 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EPWidgetsManualSortPreference.java @@ -0,0 +1,64 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EPWidgetsManualSortPreference extends DomainVo { + + private static final long serialVersionUID = 4607102334801223570L; + + private Long userId; + private Long widgetId; + private int widgetRow; + private int widgetCol; + private int widgetWidth; + private int widgetHeight; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompApp.java new file mode 100644 index 00000000..35cfb96f --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompApp.java @@ -0,0 +1,71 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EcompApp { + + protected Long id; + private String name; + private String imageUrl; + private String description; + private String notes; + private String url; + private String alternateUrl; + private String uebTopicName; + private String uebKey; + private String uebSecret; + private Boolean enabled; + private Boolean restrictedApp; + private Boolean centralAuth; + private String nameSpace; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAppRole.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAppRole.java new file mode 100644 index 00000000..20f2a886 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAppRole.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import javax.persistence.IdClass; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@IdClass(EcompAppRoleId.class) +public class EcompAppRole { + + private Long appId; + private String appName; + private Integer roleId; + private String roleName; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAppRoleId.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAppRoleId.java new file mode 100644 index 00000000..49795c37 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAppRoleId.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class EcompAppRoleId implements Serializable{ + + private static final long serialVersionUID = 1L; + + private Long appId; + private String appName; + private Integer roleId; + private String roleName; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAuditLog.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAuditLog.java new file mode 100644 index 00000000..5241d68d --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/EcompAuditLog.java @@ -0,0 +1,82 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.Date; +import org.onap.portalsdk.core.domain.AuditLog; + +public class EcompAuditLog extends AuditLog { + + private static final long serialVersionUID = 7970458389782626231L; + + public static final String CD_ACTIVITY_ADD_CHILD_ROLE = "add_child_role"; + public static final String CD_ACTIVITY_ADD_ROLE = "add_role"; + public static final String CD_ACTIVITY_ADD_ROLE_FUNCTION = "add_role_function"; + public static final String CD_ACTIVITY_ADD_USER_ROLE = "add_user_role"; + public static final String CD_ACTIVITY_APP_ACCESS = "app_access"; + public static final String CD_ACTIVITY_FUNCTIONAL_ACCESS = "functional_access"; + public static final String CD_ACTIVITY_GUEST_LOGIN = "guest_login"; + public static final String CD_ACTIVITY_LOGIN = "login"; + public static final String CD_ACTIVITY_LOGOUT = "logout"; + public static final String CD_ACTIVITY_MOBILE_LOGIN = "mobile_login"; + public static final String CD_ACTIVITY_MOBILE_LOGOUT = "mobile_logout"; + public static final String CD_ACTIVITY_REMOVE_CHILD_ROLE = "remove_child_role"; + public static final String CD_ACTIVITY_REMOVE_ROLE = "remove_role"; + public static final String CD_ACTIVITY_REMOVE_ROLE_FUNCTION = "remove_role_function"; + public static final String CD_ACTIVITY_REMOVE_USER_ROLE = "remove_user_role"; + public static final String CD_ACTIVITY_TAB_ACCESS = "tab_access"; + public static final String CD_ACTIVITY_SEARCH = "search"; + public static final String CD_ACTIVITY_ADD_PORTAL_ADMIN = "apa "; + public static final String CD_ACTIVITY_DELETE_PORTAL_ADMIN = "dpa"; + public static final String CD_ACTIVITY_UPDATE_USER = "uu "; + public static final String CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN = "uaa "; + public static final String CD_ACTIVITY_STORE_ANALYTICS = "store_analytics"; + public static final String CD_ACTIVITY_EXTERNAL_AUTH_ADD_ROLE = "eaar"; + public static final String CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION = "eaaf"; + public static final String CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION = "eauf"; + public static final String CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_ROLE_AND_FUNCTION = "eaurf"; + public static final String CD_ACTIVITY_EXTERNAL_AUTH_DELETE_ROLE = "eadr"; + public static final String CD_ACTIVITY_EXTERNAL_AUTH_DELETE_FUNCTION = "eadf"; + + public EcompAuditLog() { + setCreated(new Date()); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/ExternalRoleDetails.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/ExternalRoleDetails.java new file mode 100644 index 00000000..be28e2cc --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/ExternalRoleDetails.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +public class ExternalRoleDetails implements Comparable { + + private String name; + private boolean active; + private Integer priority; + private Long appId; // used by ONAP only + private Long appRoleId; // used by ONAP only + private List<EPAppRoleFunction> perms; + + @Override + public int compareTo(Object obj) { + EPRole other = (EPRole) obj; + return (this.getName() == null || other.getName() == null) ? 1 : getName().equals(other.getName()) ? 0 : 1; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/ExternalSystemAccess.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/ExternalSystemAccess.java new file mode 100644 index 00000000..2e8100cb --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/ExternalSystemAccess.java @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class ExternalSystemAccess { + + private String key; + private Boolean accessValue; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/FunctionalMenuItemWithAppID.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/FunctionalMenuItemWithAppID.java new file mode 100644 index 00000000..275d1f9b --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/FunctionalMenuItemWithAppID.java @@ -0,0 +1,98 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.List; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Max; +import javax.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.validator.constraints.SafeHtml; + + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class FunctionalMenuItemWithAppID { + + private static final long serialVersionUID = 1L; + + @Digits(integer = 11, fraction = 0) + private Long menuId; + @Digits(integer = 2, fraction = 0) + @NotNull + private Integer column; + @Max(value = 100) + @SafeHtml + @NotNull + private String text; + @Digits(integer = 11, fraction = 0) + private Integer parentMenuId; + @Max(value = 128) + @SafeHtml + @NotNull + private String url; + @Max(value = 1) + @SafeHtml + @NotNull + private String active_yn; + private Integer appid; + private List<Integer> roles; + private Boolean restrictedApp; + + public void normalize() { + if (this.column == null) { + this.column = 1; + } + this.text = (this.text == null) ? "" : this.text.trim(); + if (this.parentMenuId == null) { + this.parentMenuId = -1; + } + this.url = (this.url == null) ? "" : this.url.trim(); + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/GetAccessResult.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/GetAccessResult.java new file mode 100644 index 00000000..185a9fc3 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/GetAccessResult.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude +public class GetAccessResult implements Serializable{ + + + private static final long serialVersionUID = 5239527705869613411L; + + private String rowId; + private Long roleId; + private String ecompFunction; + private String appName; + private Integer appMotsId; + private String roleName; + private String roleActive; + private String reqType; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/GetAccessResultId.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/GetAccessResultId.java new file mode 100644 index 00000000..7602aede --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/GetAccessResultId.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class GetAccessResultId implements Serializable{ + + private static final long serialVersionUID = 1L; + + private String ecompFunction; + private String appName; + private String roleName; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Language.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Language.java new file mode 100644 index 00000000..7e7d3107 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Language.java @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.Data; + +@Data +public class Language { + + private String languageId; + private String languageName; + private String languageAlias; +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java new file mode 100644 index 00000000..232c8d1b --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceData.java @@ -0,0 +1,81 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.List; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class MicroserviceData extends DomainVo { + + private static final long serialVersionUID = 1L; + + private Long id; + @SafeHtml + private String name; + @SafeHtml + private String active; + @SafeHtml + private String desc; + private long appId; + @SafeHtml + private String url; + @SafeHtml + private String securityType; + @SafeHtml + private String username; + @SafeHtml + private String password; + @Valid + private List<MicroserviceParameter> parameterList; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java new file mode 100644 index 00000000..99782958 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/MicroserviceParameter.java @@ -0,0 +1,67 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class MicroserviceParameter extends DomainVo { + + private static final long serialVersionUID = 1L; + + private Long id; + private long serviceId; + @SafeHtml + private String para_key; + @SafeHtml + private String para_value; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java new file mode 100644 index 00000000..b2d322b5 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserAppSelection.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class PersUserAppSelection extends DomainVo { + + private static final long serialVersionUID = 1545308654500121206L; + + private Long userId; + private Long appId; + private String statusCode; + + public PersUserAppSelection(final Long id, final Long userId, final Long appId, final String statusCode) { + super.id = id; + this.userId = userId; + this.appId = appId; + this.statusCode = statusCode; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java new file mode 100644 index 00000000..54eba6ad --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PersUserWidgetSelection.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class PersUserWidgetSelection extends DomainVo { + + private static final long serialVersionUID = -6547880514779039200L; + + private Long userId; + private Long widgetId; + private String statusCode; + + public PersUserWidgetSelection(final Long id, final Long userId, final Long widgetId, final String statusCode) { + super.id = id; + this.userId = userId; + this.widgetId = widgetId; + this.statusCode = statusCode; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestResponse.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestResponse.java new file mode 100644 index 00000000..36540554 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestResponse.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class PortalRestResponse<T> { + + private PortalRestStatusEnum status; + private String message; + private T response; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java new file mode 100644 index 00000000..d8b69fce --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/PortalRestStatusEnum.java @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +public enum PortalRestStatusEnum{ + OK("ok"), + WARN("WARNING"), + ERROR("error"); + + private String value; + PortalRestStatusEnum(String value){ + this.value = value; + } + + @Override + public String toString() { + return value; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/RoleApp.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/RoleApp.java new file mode 100644 index 00000000..e7a9d573 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/RoleApp.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import java.util.Set; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class RoleApp implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long roleId; + private String roleName; + private App app; + private Set<WidgetCatalog> widgets; + + @Override + public String toString() { + return "Role [roleId=" + roleId + ", roleName=" + roleName + ", app=" + app + "]"; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java new file mode 100644 index 00000000..4d4b6d57 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SearchResultItem.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SearchResultItem extends DomainVo{ + + private String rowId; + @JsonProperty("category") + private String category; + @JsonProperty("name") + private String name; + @JsonProperty("target") + private String target; + @JsonProperty("uuid") + private String uuid; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java new file mode 100644 index 00000000..2a31d1cd --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/SharedContext.java @@ -0,0 +1,85 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.util.Date; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class SharedContext extends DomainVo { + + private static final long serialVersionUID = 7287469622586677888L; + + @Digits(integer = 11, fraction = 0) + private Long id; + @NotNull + private Date create_time; + @NotNull + @SafeHtml + @Size(max = 64) + private String context_id; + @NotNull + @SafeHtml + @Size(max = 128) + private String ckey; + @NotNull + @SafeHtml + @Size(max = 1024) + private String cvalue; + + public SharedContext(final String contextId, final String key, final String value) { + this.context_id = contextId; + this.ckey = key; + this.cvalue = value; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UploadRoleFunctionExtSystem.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UploadRoleFunctionExtSystem.java new file mode 100644 index 00000000..1450576a --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UploadRoleFunctionExtSystem.java @@ -0,0 +1,66 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class UploadRoleFunctionExtSystem implements Serializable { + + private static final long serialVersionUID = -5543202387278296091L; + + private String roleName; + private String type; + private String instance; + private String action; + private String name; + private boolean isGlobalRolePartnerFunc; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserIdRoleId.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserIdRoleId.java new file mode 100644 index 00000000..d0833987 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserIdRoleId.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class UserIdRoleId implements Serializable{ + + private static final long serialVersionUID = 1L; + + private String user_Id; + private String roleId; + private String orgUserId; + private String appId; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserRole.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserRole.java new file mode 100644 index 00000000..75b4b2d7 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserRole.java @@ -0,0 +1,64 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class UserRole implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long user_Id; + private Long roleId; + private String orgUserId; + private String firstName; + private String lastName; + private String roleName; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserRoles.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserRoles.java new file mode 100644 index 00000000..3b435e89 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/UserRoles.java @@ -0,0 +1,80 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class UserRoles implements Serializable { + + private static final long serialVersionUID = 1L; + + private String orgUserId; + private String firstName; + private String lastName; + private boolean guestSession; + private List<String> roles = new ArrayList<>(); + + public UserRoles(UserRole user) { + setOrgUserId(user.getOrgUserId()); + setFirstName(user.getFirstName()); + setLastName(user.getLastName()); + setGuestSession(user.getUser_Id() == -1); + + addRole(user.getRoleName()); + } + + private void addRole(String roleName) { + if (!getRoles().contains(roleName)) { + this.roles.add(roleName); + } + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java new file mode 100644 index 00000000..86c92269 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/Widget.java @@ -0,0 +1,97 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang.StringUtils; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@AllArgsConstructor +public class Widget extends DomainVo { + + private static final long serialVersionUID = 1L; + + private String name; + private Integer width; + private Integer height; + private String url; + private Long appId; + + public Widget() { + this.name = ""; + this.width = 0; + this.height = 0; + this.url = ""; + } + + public void setName(String name) { + if (StringUtils.isEmpty(name)) { + name = ""; + } + this.name = name; + } + + public void setWidth(Integer width) { + if (width == null) { + width = 0; + } + this.width = width; + } + + public void setHeight(Integer height) { + if (height == null) { + height = 0; + } + this.height = height; + } + + public void setUrl(String url) { + if (StringUtils.isEmpty(url)) { + url = ""; + } + this.url = url; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalog.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalog.java new file mode 100644 index 00000000..0542b167 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalog.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portal.domain.dto.ecomp; + +import java.io.Serializable; +import java.util.Set; + +public class WidgetCatalog implements Serializable{ + + private static final long serialVersionUID = 1L; + + private long id; + + private String name; + + private String desc; + + private String fileLocation; + + private String allowAllUser; + + private Long serviceId; + + private String sortOrder; + + private String statusCode; + + private Set<RoleApp> widgetRoles; + + public long getId() { + return id; + } + public void setId(long id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + public Long getServiceId() { + return serviceId; + } + public void setServiceId(Long serviceId) { + this.serviceId = serviceId; + } + public String getDesc() { + return desc; + } + public void setDesc(String desc) { + this.desc = desc; + } + public String getFileLocation() { + return fileLocation; + } + public void setFileLocation(String fileLocation) { + this.fileLocation = fileLocation; + } + + public String getAllowAllUser() { + return allowAllUser; + } + public void setAllowAllUser(String allowAllUser) { + this.allowAllUser = allowAllUser; + } + public Set<RoleApp> getWidgetRoles() { + return widgetRoles; + } + public void setWidgetRoles(Set<RoleApp> widgetRoles) { + this.widgetRoles = widgetRoles; + } + + public String getSortOrder() { + return sortOrder; + } + public void setSortOrder(String sortOrder) { + this.sortOrder = sortOrder; + } + public String getStatusCode() { + return statusCode; + } + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + @Override + public String toString() { + return "WidgetCatalog [id=" + id + ", name=" + name + ", desc=" + desc + ", fileLocation=" + fileLocation + + ", allowAllUser=" + allowAllUser + "]"; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java new file mode 100644 index 00000000..cd1b2a7b --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetCatalogParameter.java @@ -0,0 +1,63 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.DomainVo; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class WidgetCatalogParameter extends DomainVo{ + + private static final long serialVersionUID = 1L; + + private Long id; + private Long widgetId; + private Long userId; + private Long paramId; + private String user_value; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetParameterResult.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetParameterResult.java new file mode 100644 index 00000000..37b1873e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetParameterResult.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class WidgetParameterResult { + + private Long paramId; + private String paramKey; + private String userValue; + private String defaultValue; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetServiceHeaders.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetServiceHeaders.java new file mode 100644 index 00000000..3e665fc2 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/ecomp/WidgetServiceHeaders.java @@ -0,0 +1,80 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.ecomp; + +import java.nio.charset.Charset; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.commons.codec.binary.Base64; +import org.onap.portal.utils.EcompPortalUtils; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.springframework.http.HttpHeaders; + +@Getter +@Setter +public class WidgetServiceHeaders { + + private WidgetServiceHeaders(){} + + private static HttpHeaders widgetHeaders; + + public static HttpHeaders getInstance() throws Exception{ + if(null == widgetHeaders){ + return new HttpHeaders(){{ + + String username = EcompPortalUtils + .getPropertyOrDefault("microservices.widget.username", "widget_user"); + String password = CipherUtil.decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password")); + String auth = username + ":" + password; + byte[] encodedAuth = Base64.encodeBase64( + auth.getBytes(Charset.forName("US-ASCII")) ); + String authHeader = "Basic " + new String( encodedAuth ); + set( "Authorization", authHeader ); + } + }; + } + else + return widgetHeaders; + + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/exception/RoleFunctionException.java b/portal-BE/src/main/java/org/onap/portal/exception/RoleFunctionException.java new file mode 100644 index 00000000..75ecfa39 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/exception/RoleFunctionException.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.exception; + +import org.apache.commons.codec.DecoderException; + +public class RoleFunctionException extends Exception{ + + /** + * + */ + private static final long serialVersionUID = -3280548136475923423L; + + public RoleFunctionException(String msg, DecoderException e) { + super(msg,e); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/old/EPRoleFunctionService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/old/EPRoleFunctionService.java new file mode 100644 index 00000000..b044dfb9 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/old/EPRoleFunctionService.java @@ -0,0 +1,105 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portal.service.fn.old; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import org.onap.portal.domain.db.fn.FnRole; +import org.onap.portal.domain.db.fn.FnRoleFunction; +import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.utils.EPUserUtils; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +@Transactional +public class EPRoleFunctionService { + @Autowired + private DataAccessService dataAccessService; + + + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + @SuppressWarnings("unchecked") + public List<RoleFunction> getRoleFunctions() { + return getDataAccessService().getList(RoleFunction.class, null); + } + + @SuppressWarnings("unchecked") + public Set getRoleFunctions(HttpServletRequest request, FnUser user) { + HashSet roleFunctions = null; + + HttpSession session = request.getSession(); + roleFunctions = (HashSet) session + .getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)); + + if (roleFunctions == null) { + HashMap roles = (HashMap) EPUserUtils.getRoles(request); + roleFunctions = new HashSet(); + + for (Object o : roles.keySet()) { + Long roleKey = (Long) o; + FnRole role = (FnRole) roles.get(roleKey); + + for (FnRoleFunction fnRoleFunction : role.getFnRoleFunctions()) { + FnRoleFunction function = fnRoleFunction; + roleFunctions.add(function.getFunctionCd()); + } + } + + session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME), + roleFunctions); + } + + return roleFunctions; + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/utils/EPCommonSystemProperties.java b/portal-BE/src/main/java/org/onap/portal/utils/EPCommonSystemProperties.java new file mode 100644 index 00000000..bfe86614 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/utils/EPCommonSystemProperties.java @@ -0,0 +1,107 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.utils; + +import org.onap.portalsdk.core.util.SystemProperties; + +public class EPCommonSystemProperties extends SystemProperties { + + public static final String LOGIN_URL_NO_RET_VAL = "login_url_no_ret_val"; + public static final String ECOMP_APP_ID = "ecomp_app_id"; + public static final String SYS_ADMIN_ROLE_ID = "sys_admin_role_id"; + public static final String DUBLICATED_FIELD_VALUE_ECOMP_ERROR = "1201"; + public static final String ACCOUNT_ADMIN_ROLE_ID = "account_admin_role_id"; + public static final String RESTRICTED_APP_ROLE_ID = "restricted_app_role_id"; + public static final String FE_URL = "frontend_url"; + public static final String HEALTH_POLL_INTERVAL_SECONDS = "health_poll_interval_seconds"; + public static final String HEALTHFAIL_ALERT_EVERY_X_INTERVALS = "health_fail_alert_every_x_intervals"; + public static final String USER_GUIDE_URL = "user_guide_link"; + + public static final String USER_FIRST_NAME = "USER_FIRST_NAME"; + public static final String USER_LAST_NAME = "USER_LAST_NAME"; + public static final String USER_EMAIL = "USER_EMAIL"; + public static final String USER_ORG_USERID = "USER_ORG_USERID"; + + public static final String USH_TICKET_URL = "ush_ticket_url"; + + public static final String EXTERNAL_API_RESPONSE_CODE = "External_API_ResponseCode"; + public static final String COOKIE_DOMAIN = "cookie_domain"; + + public static final String FEEDBACK_EMAIL_ADDRESS = "feedback_email_address"; + public static final String PORTAL_INFO_URL = "portal_info_url"; + + public static final String ONLINE_USER_UPDATE_RATE = "online_user_update_rate"; + public static final String ONLINE_USER_UPDATE_DURATION = "online_user_update_duration"; + + public static final String NOTIFICATION_UPDATE_RATE = "notification_update_rate"; + public static final String NOTIFICATION_UPDATE_DURATION = "notification_update_duration"; + + public static final String WINDOW_WIDTH_THRESHOLD_LEFT_MENU = "window_width_threshold_left_menu"; + public static final String WINDOW_WIDTH_THRESHOLD_RIGHT_MENU = "window_width_threshold_right_menu"; + + public static final String AUDITLOG_DEL_DAY_FROM = "auditlog_del_day_from"; + public static final String AUDITLOG_DELETE_CRON = "auditlog_delete_cron"; + + public static final String AUTH_USER_SERVER = "auth_user_server"; + public static final String EXTERNAL_ACCESS_ENABLE = "external_access_enable"; + + public static final String EXTERNAL_SYSTEM_NOTIFICATION_URL = "external_system_notification_url"; + public static final String EXTERNAL_CENTRAL_AUTH_USER_NAME = "ext_central_access_user_name"; + public static final String EXTERNAL_CENTRAL_AUTH_PASSWORD = "ext_central_access_password"; + public static final String EXTERNAL_CENTRAL_ACCESS_URL = "ext_central_access_url"; + public static final String EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN = "ext_central_access_user_domain"; + public static final String REMOTE_CENTRALISED_SYSTEM_ACCESS = "remote_centralized_system_access"; + + public static final String WIDGET_MS_PROTOCOL = "microservices.widget.protocol"; + public static final String WIDGET_MS_HOSTNAME = "microservices.widget.hostname"; + + public static final String REMOTE_CENTRALIZED_SYSTEM_ACCESS = "remote_centralized_system_access"; + + public static final String APP_DISPLAY_PASSWORD = "*******"; + + public static final String MS_WIDGET_LOCAL_PORT = "microservices.widget.local.port"; + public static final String MS_WIDGET_UPLOAD_FLAG = "microservices.widget.upload.flag"; + public static final String UEB_KEY = "uebkey"; + public static final String AUTHORIZATION = "Authorization"; + public static final String USERNAME = "username"; + public static final String PASSWORD = "password"; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java b/portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java new file mode 100644 index 00000000..b72a8297 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/utils/EPUserUtils.java @@ -0,0 +1,408 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.utils; + +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import lombok.NoArgsConstructor; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Hex; +import org.onap.portal.domain.db.fn.FnRole; +import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.domain.db.fn.FnUserRole; +import org.onap.portal.exception.RoleFunctionException; +import org.onap.portal.service.fn.old.EPRoleFunctionService; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.exception.SessionExpiredException; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.menu.MenuBuilder; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.AppUtils; +import org.springframework.beans.factory.annotation.Autowired; + +@NoArgsConstructor +public class EPUserUtils { + + public static final String ALL_ROLE_FUNCTIONS = "allRoleFunctions"; + + private static final String decodeValueOfForwardSlash = "2f"; + private static final String decodeValueOfHyphen = "2d"; + private static final String decodeValueOfAsterisk = "2a"; + private static final Long ACCOUNT_ADMIN_ROLE_ID = 999L; + + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUserUtils.class); + private static DataAccessService dataAccessService; + + /** + * Gets the EPUser object from the session. + * + * @param request HttpServletRequest + * @return EPUser object that was created upon login + * @throws SessionExpiredException if no session exists. + */ + public static FnUser getUserSession(HttpServletRequest request) { + HttpSession session = AppUtils.getSession(request); + if (session == null) { + throw new SessionExpiredException(); + } + return (FnUser) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); + } + + /** + * Establishes the user's portal session + * + * @param request HttpServletRequest + * @param user EPUser + * @param applicationMenuData Menu data + * @param businessDirectMenuData Menu data + * @param ePRoleFunctionService role function service + */ + @SuppressWarnings("rawtypes") + public static void setUserSession(HttpServletRequest request, FnUser user, Set applicationMenuData, + Set businessDirectMenuData, EPRoleFunctionService ePRoleFunctionService) throws RoleFunctionException { + HttpSession session = request.getSession(true); + + // clear the current user session to avoid any conflicts + EPUserUtils.clearUserSession(request); + session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); + + setAllRoleFunctions(ePRoleFunctionService.getRoleFunctions(), session); + + ePRoleFunctionService.getRoleFunctions(request, user); + + // truncate the role (and therefore the role function) data to save + // memory in the session + user.setFnRoles(null); + session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME), user.getFullName()); + + ServletContext context = session.getServletContext(); + try { + context.getAttribute("licenseVerification"); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "setUserSession failed to get licenseVerification attribute", + e); + } + session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), "My Portal"); + session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME), + MenuBuilder.filterMenu(applicationMenuData, request)); + session.setAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME), + MenuBuilder.filterMenu(businessDirectMenuData, request)); + } + + /** + * Creates a set of role function names and stores the set as a session attribute. + * + * @param allRoleFunctions List of role functions. + * @param session HttpSession + */ + private static void setAllRoleFunctions(List<RoleFunction> allRoleFunctions, HttpSession session) + throws RoleFunctionException { + if (allRoleFunctions == null) { + return; + } + Set<String> roleFnSet = new HashSet<>(); + for (RoleFunction roleFn : allRoleFunctions) { + roleFnSet.add(decodeFunctionCode(roleFn.getCode())); + } + session.setAttribute(ALL_ROLE_FUNCTIONS, roleFnSet); + } + + + public static String decodeFunctionCode(String str) throws RoleFunctionException { + String decodedString = str; + List<Pattern> decodingList = new ArrayList<>(); + decodingList.add(Pattern.compile(decodeValueOfForwardSlash)); + decodingList.add(Pattern.compile(decodeValueOfHyphen)); + decodingList.add(Pattern.compile(decodeValueOfAsterisk)); + for (Pattern xssInputPattern : decodingList) { + try { + decodedString = decodedString.replaceAll("%" + xssInputPattern, + new String(Hex.decodeHex(xssInputPattern.toString().toCharArray()))); + } catch (DecoderException e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to decode the Rolefunction: " + str, + e); + throw new RoleFunctionException("decode failed", e); + } + } + + return decodedString; + } + + /** + * Removes all stored attributes from the user's session + * + * @param request HttpServletRequest + * @throws SessionExpiredException if no session exists + */ + private static void clearUserSession(HttpServletRequest request) { + HttpSession session = AppUtils.getSession(request); + if (session == null) { + throw new SessionExpiredException(); + } + + // removes all stored attributes from the current user's session + session.removeAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); + session.removeAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + session.removeAttribute( + SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME)); + session.removeAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME)); + session.removeAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)); + } + + /** + * Gets role information from the user session, in the cached user object. As a side effect sets a session + * variable with the roles. + * + * @param request HttpServletRequest + * @return Map of role ID to role object + */ + @SuppressWarnings("rawtypes") + public static Map getRoles(HttpServletRequest request) { + HashMap roles; + + HttpSession session = AppUtils.getSession(request); + roles = (HashMap) session + .getAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME)); + + // if roles are not already cached, let's grab them from the user + // session + if (roles == null) { + FnUser user = getUserSession(request); + + // get all user roles (including the tree of child roles) + roles = getAllUserRoles(user); + + session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME), roles); + } + + return roles; + } + + /** + * Builds a map of role ID to role object. + * + * @param user EPUser + * @return Map of role ID to role object + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + private static HashMap getAllUserRoles(FnUser user) { + HashMap roles = new HashMap(); + + for (FnRole role : user.getFnRoles()) { + if (role.getActiveYn()) { + roles.put(role.getId(), role); + addChildRoles(role, roles); + } + } + + // Additionally; the account admin role is overloaded between onap + // portal and partners; lets also include that + for (FnUserRole epUserApp : user.getFnUserRoles()) { + FnRole role = epUserApp.getRoleId(); + + if (role.getActiveYn() && role.getRoleId().equals(ACCOUNT_ADMIN_ROLE_ID)) { + roles.put(role.getId(), role); + + // let's take a recursive trip down the tree to add all child + // roles + addChildRoles(role, roles); + } + } + + return roles; + } + + /** + * Adds all child roles of the specified role to the map of roles. + * + * @param role EPRole + * @param roles Maps role id to role object + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + private static void addChildRoles(FnRole role, HashMap roles) { + Set<FnRole> childRoles = role.getFnRoles(); + if (childRoles != null && !childRoles.isEmpty()) { + for (Object o : childRoles) { + FnRole childRole = (FnRole) o; + if (childRole.getActiveYn()) { + roles.put(childRole.getId(), childRole); + addChildRoles(childRole, roles); + } + } + } + + } + + public static boolean hasRole(FnUser user, String roleKey) { + return getAllUserRoles(user).keySet().contains(new Long(roleKey)); + } + + public static DataAccessService getDataAccessService() { + return dataAccessService; + } + + @Autowired + public static void setDataAccessService(DataAccessService dataAccessService) { + EPUserUtils.dataAccessService = dataAccessService; + } + + /** + * Gets the user's ID from the user object in the session + * + * @param request HttpServletRequest + * @return Integer ID of current user + */ + public static int getUserId(HttpServletRequest request) { + return getUserIdAsLong(request).intValue(); + } + + /** + * Gets the user's ID from the user object in the session + * + * @param request HttpServletREquest + * @return Long ID of current user + */ + static Long getUserIdAsLong(HttpServletRequest request) { + Long userId = new Long(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID)); + if (request != null && getUserSession(request) != null) { + userId = getUserSession(request).getId(); + } + return userId; + } + + /** + * Gets the request ID from the request. + * + * @param request HttpServletRequest + * @return Request ID + */ + public static String getRequestId(HttpServletRequest request) { + Enumeration<String> headerNames = request.getHeaderNames(); + + String requestId = ""; + try { + while (headerNames.hasMoreElements()) { + String headerName = headerNames.nextElement(); + logger.debug(EELFLoggerDelegate.debugLogger, + "One header is " + headerName + " : " + request.getHeader(headerName)); + if (headerName.equalsIgnoreCase(SystemProperties.ECOMP_REQUEST_ID)) { + requestId = request.getHeader(headerName); + break; + } + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRequestId failed", e); + } + + return (requestId.isEmpty() ? UUID.randomUUID().toString() : requestId); + } + + /** + * Gets the full URL from the request. + * + * @param request HttpServletRequest + * @return Full URL + */ + static String getFullURL(HttpServletRequest request) { + if (request != null) { + StringBuffer requestURL = request.getRequestURL(); + String queryString = request.getQueryString(); + + if (queryString == null) { + return requestURL.toString(); + } else { + return requestURL.append('?').append(queryString).toString(); + } + } + return ""; + } + + public static Boolean matchRoleFunctions(String portalApiPath, Set<? extends String> roleFunctions) { + String[] path = portalApiPath.split("/"); + List<String> roleFunList; + if (path.length > 1) { + roleFunList = roleFunctions.stream().filter(item -> item.startsWith(path[0])) + .collect(Collectors.toList()); + if (roleFunList.size() >= 1) { + for (String roleFunction : roleFunList) { + String[] roleFunctionArray = roleFunction.split("/"); + boolean b = true; + if (roleFunctionArray.length == path.length) { + for (int i = 0; i < roleFunctionArray.length; i++) { + if (!roleFunctionArray[i].equals("*")) { + Pattern p = Pattern.compile(Pattern.quote(path[i]), + Pattern.CASE_INSENSITIVE); + Matcher m = p.matcher(roleFunctionArray[i]); + b = m.matches(); + } + } + if (b) { + return true; + } + } + } + } + } else { + for (String roleFunction : roleFunctions) { + if (roleFunction.equals(("*"))) { + return true; + } else if (portalApiPath.matches(roleFunction)) { + return true; + } + } + } + return false; + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java b/portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java new file mode 100644 index 00000000..9e3a5d4b --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/utils/EcompPortalUtils.java @@ -0,0 +1,591 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.utils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.nio.charset.Charset; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Base64; +import java.util.Date; +import java.util.List; +import java.util.regex.Pattern; +import javax.servlet.http.HttpServletResponse; +import javax.xml.bind.DatatypeConverter; +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.lang.StringUtils; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.logging.format.EPAppMessagesEnum; +import org.onap.portal.logging.logic.EPLogUtil; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.util.SystemProperties; +import org.slf4j.MDC; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; + +public class EcompPortalUtils { + + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EcompPortalUtils.class); + + private static final String FUNCTION_PIPE = "|"; + + // TODO: GLOBAL_LOGIN_URL is the same as in SessionTimeoutInterceptor. + // It should be defined in SystemProperties. + private static final String GLOBAL_LOGIN_URL = "global-login-url"; + + // It is a regular expression used for while creating a External Central Auth + // Role + public static final String EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS = "([^A-Z^a-z^0-9^\\.^%^(^)^=^:])"; + + public static final String slash = "/"; + + /** + * @param orgUserId User ID to validate + * @return true if orgUserId is not empty and contains only alphanumeric, false + * otherwise + */ + public static boolean legitimateUserId(String orgUserId) { + return orgUserId.matches("^[a-zA-Z0-9/_/-/@]+$"); + } + + /** + * Splits the string into a list of tokens using the specified regular + * expression + * + * @param source String to split + * @param regex tokens + * @return List of tokens split from the source + */ + public static List<String> parsingByRegularExpression(String source, String regex) { + List<String> tokens = new ArrayList<String>(); + if (source != null && source.length() > 0) { + String[] parsed = source.split(regex); + for (String token : parsed) { + if (token.length() > 0) { + tokens.add(token); + } + } + } + return tokens; + } + + /** + * Builds a JSON object with error code and message information. + * + * @param errorCode error code + * @param errorMessage message + * @return JSON object as a String + */ + public static String jsonErrorMessageResponse(int errorCode, String errorMessage) { + return "{\"error\":{\"code\":" + errorCode + "," + "\"message\":\"" + errorMessage + "\"}}"; + } + + /** + * Builds a JSON object with the specified message + * + * @param message Message to embed + * @return JSON object as a String + */ + public static String jsonMessageResponse(String message) { + return String.format("{\"message\":\"%s\"}", message); + } + + /** + * Serializes the specified object as JSON and writes the result to the debug + * log. If serialization fails, logs a message to the error logger. + * + * @param logger Logger for the class where the object was built; the logger + * carries the class name. + * @param source First portion of the log message + * @param msg Second portion of the log message + * @param obj Object to serialize as JSON + */ + public static void logAndSerializeObject(EELFLoggerDelegate logger, String source, String msg, Object obj) { + try { + String objectAsJson = new ObjectMapper().writeValueAsString(obj); + logger.debug(EELFLoggerDelegate.debugLogger, + String.format("source= [%s]; %s [%s];", source, msg, objectAsJson)); + } catch (JsonProcessingException e) { + logger.warn(EELFLoggerDelegate.errorLogger, "logAndSerializedObject failed to serialize", e); + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, e); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "logAndSerializedObject failed", e); + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, e); + } + } + + /** + * Serializes the specified object as JSON and writes the result to the debug + * log. If serialization fails, logs a message to the error logger. + * + * @param source First portion of the log message + * @param msg Second portion of the log message + * @param obj Object to serialize as JSON + */ + public static void logAndSerializeObject(String source, String msg, Object obj) { + logAndSerializeObject(logger, source, msg, obj); + } + + public static void rollbackTransaction(Transaction transaction, String errorMessage) { + logger.error(EELFLoggerDelegate.errorLogger, errorMessage); + try { + if (transaction != null) { + transaction.rollback(); + } + } catch (Exception e) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeExecuteRollbackError, e); + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while performing a rollback transaction", + e); + } + } + + public static void closeLocalSession(Session localSession, String errorMessage) { + logger.error(EELFLoggerDelegate.errorLogger, errorMessage); + try { + if (localSession != null) { + localSession.close(); + } + } catch (Exception e) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoCloseSessionError, e); + logger.error(EELFLoggerDelegate.errorLogger, errorMessage + ", closeLocalSession exception", e); + } + } + + /** + * Set response status to Unauthorized if user == null and to Forbidden in all + * (!) other cases. Logging is not performed if invocator == null + * + * @param user User object + * @param response HttpServletResponse + * @param invocator may be null + */ + public static void setBadPermissions(FnUser user, HttpServletResponse response, String invocator) { + if (user == null) { + String loginUrl = SystemProperties.getProperty(EPCommonSystemProperties.LOGIN_URL_NO_RET_VAL); + response.setHeader(GLOBAL_LOGIN_URL, loginUrl); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + MDC.put(EPCommonSystemProperties.RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_UNAUTHORIZED)); + } else { + response.setStatus(HttpServletResponse.SC_FORBIDDEN); + MDC.put(EPCommonSystemProperties.RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_FORBIDDEN)); + } + if (invocator != null) { + logger.warn(EELFLoggerDelegate.errorLogger, + invocator + ", permissions problem, response status = " + response.getStatus()); + } + } + + public static int getExternalAppResponseCode() { + String responseCode = MDC.get(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE); + int responseCodeInt = 0; + try { + if (responseCode != null && responseCode != "") { + responseCodeInt = Integer.valueOf(responseCode); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getExternalAppResponseCode failed", e); + } + return responseCodeInt; + } + + // This method might be just for testing purposes. + public static void setExternalAppResponseCode(int responseCode) { + try { + /* + * String code = String.valueOf(responseCode); + * MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE,code ); + * code=StringUtils.EMPTY; + */ + String code = Integer.toString(responseCode); + MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE, code); + char[] chars = code.toCharArray(); + Arrays.fill(chars, ' '); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "setExternalAppResponseCode failed", e); + } + } + + public static String getHTTPStatusString(int httpStatusCode) { + String httpStatusString = "unknown_error"; + try { + httpStatusString = org.springframework.http.HttpStatus.valueOf(httpStatusCode).name(); + if (httpStatusString != null) { + httpStatusString = httpStatusString.toLowerCase(); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getHTTPStatusString failed", e); + } + return httpStatusString; + } + + public static String getFEErrorString(Boolean internal, int responseCode) { + // Return a String like the following: + // "Internal Onap Error: 500 internal_server_error" or + // "External App Error: 404 not_found" + // TODO: create our own Ecomp error codes, starting with 1000 and up. + String internalExternalString = internal ? "Ecomp Error: " : "App Error: "; + String httpStatusString = "unknown_error"; + try { + if (responseCode < 1000) { + httpStatusString = getHTTPStatusString(responseCode); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getFEErrorString failed", e); + } + String responseString = internalExternalString + responseCode + " " + httpStatusString; + return responseString; + } + + public static boolean isProductionBuild() { + boolean productionBuild = true; + String epVersion = EcompVersion.buildNumber; + if (epVersion != null) { + int buildNum = epVersion.lastIndexOf('.'); + if (buildNum > 0) { + int buildNumber = Integer.parseInt(epVersion.substring(buildNum + 1)); + if (buildNumber < 3000) // Production versions are 3000+, (ie + // 1.0.3003) + { + productionBuild = false; + } + } + } + return productionBuild; + } + + public static String getMyIpAdddress() { + InetAddress ip; + String localIp; + try { + ip = InetAddress.getLocalHost(); + localIp = ip.getHostAddress(); + } catch (UnknownHostException e) { + localIp = "unknown"; + logger.error(EELFLoggerDelegate.errorLogger, "getMyIpAdddress failed ", e); + } + return localIp; + } + + public static String getMyHostName() { + InetAddress ip; + String hostName; + try { + ip = InetAddress.getLocalHost(); + hostName = ip.getHostName(); + } catch (UnknownHostException e) { + hostName = "unknown"; + logger.error(EELFLoggerDelegate.errorLogger, "getMyHostName failed", e); + } + return hostName; + } + + /** + * Returns a default property if the expected one is not available + * + * @param property Key + * @param defaultValue default Value + * @return Default value if property is not defined or yields the empty string; + * else the property value. + */ + public static String getPropertyOrDefault(String property, String defaultValue) { + if (!SystemProperties.containsProperty(property)) + return defaultValue; + String value = SystemProperties.getProperty(property); + if (value == null || "".equals(value)) + return defaultValue; + return value; + } + + /** + * Calculates the time duration of a function call for logging purpose. It + * stores the result by using "MDC.put(SystemProperties.MDC_TIMER, + * timeDifference);" It is important to call + * "MDC.remove(SystemProperties.MDC_TIMER);" after this method call to clean up + * the record in MDC + * + * @param beginDateTime the given begin time for the call + * @param endDateTime the given end time for the call + * + */ + public static void calculateDateTimeDifferenceForLog(String beginDateTime, String endDateTime) { + if (beginDateTime != null && endDateTime != null) { + try { + SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + + Date beginDate = ecompLogDateFormat.parse(beginDateTime); + Date endDate = ecompLogDateFormat.parse(endDateTime); + String timeDifference = String.format("%d", endDate.getTime() - beginDate.getTime()); + MDC.put(SystemProperties.MDC_TIMER, timeDifference); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "calculateDateTimeDifferenceForLog failed", e); + } + } + } + + /** + * Answers the protocol to use. + * + * @return Protocol name from property file; defaults to https. + */ + public static String widgetMsProtocol() { + return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_MS_PROTOCOL, "https"); + } + + /** + * Answers the host to use. + * + * @return Host name from property file; defaults to localhost. + */ + public static String localOrDockerHost() { + return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_MS_HOSTNAME, "localhost"); + } + + /** + * It returns headers where username and password of external central auth is + * encoded to base64 + * + * @return header which contains external central auth username and password + * base64 encoded + * @throws Exception if unable to decrypt the password + */ + public static HttpHeaders base64encodeKeyForAAFBasicAuth() throws Exception { + String userName = ""; + String decryptedPass = ""; + if (EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_USER_NAME) + && EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_PASSWORD)) { + decryptedPass = SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_PASSWORD); + userName = SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_USER_NAME); + } + String decPass = decrypted(decryptedPass); + String usernamePass = userName + ":" + decPass; + String encToBase64 = String.valueOf((DatatypeConverter.printBase64Binary(usernamePass.getBytes()))); + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", "Basic " + encToBase64); + headers.setContentType(MediaType.APPLICATION_JSON); + return headers; + } + + private static String decrypted(String encrypted) throws Exception { + String result = ""; + if (encrypted != null && encrypted.length() > 0) { + try { + result = CipherUtil.decryptPKC(encrypted, + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e); + throw e; + } + } + return result; + } + + public static String truncateString(String originString, int size) { + if (originString.length() >= size) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(originString); + stringBuilder.setLength(size); + stringBuilder.append("..."); + return stringBuilder.toString(); + } + return originString; + } + + /** + * + * If function code value has any pipes it does pipe filter and returns value. + * + * @param functionCode + * @return function instance without pipe + */ + public static String getFunctionCode(String functionCode) { + String finalFunctionCodeVal = ""; + if (functionCode.contains(FUNCTION_PIPE)) { + int count = StringUtils.countMatches(functionCode, FUNCTION_PIPE); + if (count == 2) + finalFunctionCodeVal = functionCode.substring(functionCode.indexOf(FUNCTION_PIPE) + 1, + functionCode.lastIndexOf(FUNCTION_PIPE)); + else + finalFunctionCodeVal = functionCode.substring(functionCode.lastIndexOf(FUNCTION_PIPE) + 1); + } else { + finalFunctionCodeVal = functionCode; + } + return finalFunctionCodeVal; + } + + /** + * + * If function code value has any pipes it does pipe filter and returns value. + * + * @param functionCode + * @return function Type without pipe + */ + public static String getFunctionType(String functionCode) { + String finalFunctionCodeVal = ""; + if (functionCode.contains(FUNCTION_PIPE)) { + int count = StringUtils.countMatches(functionCode, FUNCTION_PIPE); + if (count == 2) { + String[] getTypeValue = functionCode.split("\\" + FUNCTION_PIPE); + finalFunctionCodeVal = getTypeValue[0]; + } + } else { + finalFunctionCodeVal = functionCode; + } + return finalFunctionCodeVal; + } + + /** + * + * If function code value has any pipes it does pipe filter and returns value. + * + * @param functionCode + * @return function Action without pipe + */ + public static String getFunctionAction(String functionCode) { + String finalFunctionCodeVal = ""; + if (functionCode.contains(FUNCTION_PIPE)) { + int count = StringUtils.countMatches(functionCode, FUNCTION_PIPE); + if (count == 2) + finalFunctionCodeVal = functionCode.substring(functionCode.lastIndexOf(FUNCTION_PIPE) + 1); + } else { + finalFunctionCodeVal = functionCode; + } + return finalFunctionCodeVal; + } + + /** + * + * It check whether the external auth namespace is matching with current + * namespace exists in local DB + * + * @param permTypeVal + * @param appNamespaceVal + * @return true or false + */ + public static boolean checkNameSpaceMatching(String permTypeVal, String appNamespaceVal) { + String[] typeNamespace = permTypeVal.split("\\."); + String[] appNamespace = appNamespaceVal.split("\\."); + boolean isNamespaceMatching = true; + if (appNamespace.length <= typeNamespace.length) { + for (int k = 0; k < appNamespace.length; k++) { + if (!appNamespace[k].equals(typeNamespace[k])) + isNamespaceMatching = false; + } + } else { + isNamespaceMatching = false; + } + return isNamespaceMatching; + } + + public static boolean checkIfRemoteCentralAccessAllowed() { + boolean result = false; + String rmtCentralAccess = SystemProperties + .getProperty(EPCommonSystemProperties.REMOTE_CENTRALISED_SYSTEM_ACCESS); + if (rmtCentralAccess == null) { + logger.error(EELFLoggerDelegate.errorLogger, + "Please check in system.properties whether the property exists or not!"); + return false; + } else if (new Boolean(rmtCentralAccess)) { + logger.debug(EELFLoggerDelegate.debugLogger, "checkIfRemoteCentralAccessAllowed: {}", rmtCentralAccess); + result = true; + } + return result; + } + + /** + * + * It validates whether given string is JSON or not + * + * @param jsonInString + * @return true or false + */ + public static boolean isJSONValid(String jsonInString) { + try { + final ObjectMapper mapper = new ObjectMapper(); + mapper.readTree(jsonInString); + return true; + } catch (IOException e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to parse Json!", e); + return false; + } + } + + /** + * + * It retrieves account information from input String + * + * @param authValue + * @return Array of Account information + * + */ + public static String[] getUserNamePassword(String authValue) { + String base64Credentials = authValue.substring("Basic".length()).trim(); + String credentials = new String(Base64.getDecoder().decode(base64Credentials), Charset.forName("UTF-8")); + final String[] values = credentials.split(":", 2); + return values; + } + + /** + * It encodes the function code based on Hex encoding + * + * @param funCode + * + */ + public static String encodeFunctionCode(String funCode) { + String encodedString = funCode; + Pattern encodePattern = Pattern.compile(EcompPortalUtils.slash); + return encodedString = encodePattern.matcher(encodedString) + .replaceAll("%" + Hex.encodeHexString(encodePattern.toString().getBytes())) + .replaceAll("\\*", "%" + Hex.encodeHexString("*".getBytes())); + } + + public static boolean checkFunctionCodeHasEncodePattern(String code) { + return code.contains(EcompPortalUtils.slash); + } + +} diff --git a/portal-BE/src/main/java/org/onap/portal/utils/EcompVersion.java b/portal-BE/src/main/java/org/onap/portal/utils/EcompVersion.java new file mode 100644 index 00000000..527ae640 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/utils/EcompVersion.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.utils; + +// +// Hardcoded for now, wanted to use maven and resource file. Possibly just read +// pom.properties file with version added, but spent several hours already running +// into issues with that and other ideas not working. So, for 1604 deadlines I +// am just putting the version in the code here... for now. +// +public final class EcompVersion { + + // TODO - not used - manifest service reads from manifest + public static final String buildNumber="1610.1.999"; + +} diff --git a/portal-BE/src/main/java/org/onap/portal/utils/PortalConstants.java b/portal-BE/src/main/java/org/onap/portal/utils/PortalConstants.java new file mode 100644 index 00000000..0379bbe6 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/utils/PortalConstants.java @@ -0,0 +1,53 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.utils; + +public interface PortalConstants { + public static final Long PORTAL_APP_ID = 1L; + public static final Long DEFAULT_NOTIFICATION_CREATOR = 1L; + public static final String REST_AUX_API = "/auxapi"; + public static final String PORTAL_AUX_API = "/portalApi"; + public static final Long ACCOUNT_ADMIN_ROLE_ID = 999L; + public static final Long SYS_ADMIN_ROLE_ID = 1L; + public static final String ADMIN_ROLE = "Account Administrator"; + public static final String PORTAL_ADMIN_ROLE = "System Administrator"; + public static final Integer AUDIT_LOG_COMMENT_SIZE = 990; +} |