diff options
author | 2018-01-30 17:29:36 -0500 | |
---|---|---|
committer | 2018-02-01 15:10:02 -0500 | |
commit | 21a8761f684745bb300e075c7e98ad897ace9eed (patch) | |
tree | 6d585c3fe39fbb42a314941dbc8646e6ccf188cf /ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain | |
parent | 3af8af1310d5a27cb58be29505573f0bbdc1717c (diff) |
Security/ Package Name changes
Issue-ID: PORTAL-174, PORTAL-157, PORTAL-156, PORTAL-148, PORTAL-145,
PORTAL-140, PORTAL-133, PORTAL-121, PORTAL-111, PORTAL-88
Includes security fixes, Role Centralization, replace certain ECOMP
occurrences etc
Change-Id: I3c8b706709c6b92e646e3cbe50c2d660e8a46ef4
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain')
7 files changed, 602 insertions, 0 deletions
diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java new file mode 100644 index 00000000..d950d035 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java @@ -0,0 +1,47 @@ +package org.onap.portalapp.widget.domain; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "FN_APP") +public class App implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "APP_ID") + @GeneratedValue(strategy=GenerationType.AUTO) + private Long appId; + + @Column(name = "APP_Name") + private String appName; + + public Long getAppId() { + return appId; + } + + public void setAppId(Long appId) { + this.appId = appId; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + @Override + public String toString() { + return "App [appId=" + appId + ", appName=" + appName + "]"; + } + +} diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java new file mode 100644 index 00000000..e0b0f722 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java @@ -0,0 +1,126 @@ +package org.onap.portalapp.widget.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * TODO: moved all microservice-related code (domain, controller, service) + * from ecomp portal Backend to widget microservice + */ +@Entity +@Table(name="EP_MICROSERVICE") +public class MicroserviceData { + + @Id + @Column(name = "id") + @GeneratedValue(strategy=GenerationType.AUTO) + private Long id; + + @Column(name = "name") + private String name; + + @Column(name = "description") + private String desc; + + @Column(name = "appId") + private long appId; + + @Column(name = "endpoint_url") + private String url; + + @Column(name = "security_type") + private String securityType; + + @Column(name = "username") + private String username; + + @Column(name = "password") + private String password; + + @Column(name = "active") + private String active; + + 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 String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public long getAppId() { + return appId; + } + + public void setAppId(long appId) { + this.appId = appId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getSecurityType() { + return securityType; + } + + public void setSecurityType(String securityType) { + this.securityType = securityType; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + @Override + public String toString() { + return "MicroserviceData [name=" + name + ", desc=" + desc + ", appId=" + appId + ", url=" + url + + ", securityType=" + securityType + ", username=" + username + ", password=" + password + ", active=" + + active + "]"; + } + +} diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java new file mode 100644 index 00000000..64e22967 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java @@ -0,0 +1,70 @@ +package org.onap.portalapp.widget.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * TODO: moved all microservice-related code (domain, controller, service) + * from ecomp portal Backend to widget microservice + */ +@Entity +@Table(name="EP_MICROSERVICE_PARAMETER") +public class MicroserviceParameter { + + @Id + @Column(name = "id") + @GeneratedValue(strategy=GenerationType.AUTO) + private Long id; + + @Column(name = "service_id") + private long serviceId; + + @Column(name = "para_key") + private String para_key; + + @Column(name = "para_value") + private String para_value; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public long getServiceId() { + return serviceId; + } + + public void setServiceId(long serviceId) { + this.serviceId = serviceId; + } + + public String getPara_key() { + return para_key; + } + + public void setPara_key(String para_key) { + this.para_key = para_key; + } + + public String getPara_value() { + return para_value; + } + + public void setPara_value(String para_value) { + this.para_value = para_value; + } + + @Override + public String toString() { + return "MicroserviceParameter [serviceId=" + serviceId + ", para_key=" + para_key + ", para_value=" + para_value + + "]"; + } + +} diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java new file mode 100644 index 00000000..807067b2 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java @@ -0,0 +1,95 @@ +package org.onap.portalapp.widget.domain; + +import java.io.Serializable; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +@Entity +@Table(name = "FN_ROLE") +public class RoleApp implements Serializable{ + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "ROLE_ID") + @GeneratedValue(strategy=GenerationType.AUTO) + private Long roleId; + + + @Column(name = "ROLE_Name") + private String roleName; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name="APP_ID") + private App app; + + @JsonIgnore + @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, mappedBy="widgetRoles") + private Set<WidgetCatalog> widgets; + + /*@PreRemove + private void removeGroupsFromUsers() { + for (WidgetCatalog w : widgets) { + w.getWidgetRoles().remove(this); + } + }*/ + + /*@ManyToOne + @JoinColumn(name = "WIDGET_ID", nullable = false) + WidgetCatalog widgetCatalog;*/ + + //@JsonIgnore + //@ManyToMany(mappedBy = "widgetRoles") + //@ManyToMany(fetch = FetchType.EAGER, mappedBy = "widgetRoles") + //private Set<WidgetCatalog> widgets = new HashSet<WidgetCatalog>(); + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public App getApp() { + return app; + } + + public void setApp(App app) { + this.app = app; + } + + public Set<WidgetCatalog> getWidgets() { + return widgets; + } + + public void setWidgets(Set<WidgetCatalog> widgets) { + this.widgets = widgets; + } + + @Override + public String toString() { + return "RoleApp [roleId=" + roleId + ", roleName=" + roleName + ", app=" + app + "]"; + } + +} diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/ValidationRespond.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/ValidationRespond.java new file mode 100644 index 00000000..287e8c65 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/ValidationRespond.java @@ -0,0 +1,34 @@ +package org.onap.portalapp.widget.domain; + +public class ValidationRespond { + private boolean valid; + private String error; + + public ValidationRespond(boolean valid, String error){ + this.valid = valid; + this.error = error; + } + + public boolean isValid() { + return valid; + } + + public void setValid(boolean valid) { + this.valid = valid; + } + + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + @Override + public String toString() { + return "ValidationRespond [valid=" + valid + ", error=" + error + "]"; + } + + +} diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java new file mode 100644 index 00000000..9d153e2a --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java @@ -0,0 +1,134 @@ +package org.onap.portalapp.widget.domain; + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.Table; +import javax.persistence.Transient; + + +@Entity +@Table(name="EP_WIDGET_CATALOG") +public class WidgetCatalog{ + + @Id + @Column(name = "widget_id") + @GeneratedValue(strategy=GenerationType.AUTO) + private long id; + + @Column(name = "wdg_name") + private String name; + + @Column(name = "wdg_desc") + private String desc; + + @Column(name = "wdg_file_loc") + private String fileLocation; + + @Column(name = "all_user_flag") + private String allowAllUser; + + @Column(name = "service_id") + private Long serviceId; + + @Transient + private String sortOrder; + + @Transient + private String statusCode; + + @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + @JoinTable(name = "ep_widget_catalog_role", + joinColumns = {@JoinColumn(name = "WIDGET_ID")}, + inverseJoinColumns = {@JoinColumn(name = "ROLE_ID")} + ) + 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 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 Set<RoleApp> getWidgetRoles() { + return widgetRoles; + } + + public void setWidgetRoles(Set<RoleApp> widgetRoles) { + this.widgetRoles = widgetRoles; + } + + public String getAllowAllUser() { + return allowAllUser; + } + + public void setAllowAllUser(String allowAllUser) { + this.allowAllUser = allowAllUser; + } + + 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; + } + + public Long getServiceId() { + return serviceId; + } + + public void setServiceId(Long serviceId) { + this.serviceId = serviceId; + } + + @Override + public String toString() { + return "WidgetCatalog [id=" + id + ", name=" + name + ", desc=" + desc + ", fileLocation=" + fileLocation + + ", allowAllUser=" + allowAllUser + ", serviceId=" + serviceId + ", sortOrder=" + sortOrder + + ", statusCode=" + statusCode + ", widgetRoles=" + widgetRoles + "]"; + } +} diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetFile.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetFile.java new file mode 100644 index 00000000..e9c6ffc2 --- /dev/null +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetFile.java @@ -0,0 +1,96 @@ +package org.onap.portalapp.widget.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "ep_widget_catalog_files") +public class WidgetFile { + @Id + @Column (name = "file_id") + private int id; + + @Column(name = "widget_name") + private String name; + + @Column(name = "widget_id") + private long widgetId; + + @Column(name = "markup_html") + private byte[] markup; + + @Column(name = "controller_js") + private byte[] controller; + + @Column(name = "framework_js") + private byte[] framework; + + @Column(name = "widget_css") + private byte[] css; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public byte[] getMarkup() { + return markup; + } + + public void setMarkup(byte[] markup) { + this.markup = markup; + } + + public byte[] getController() { + return controller; + } + + public void setController(byte[] controller) { + this.controller = controller; + } + + public byte[] getFramework() { + return framework; + } + + public void setFramework(byte[] framework) { + this.framework = framework; + } + + public byte[] getCss() { + return css; + } + + public void setCss(byte[] css) { + this.css = css; + } + + public long getWidgetId() { + return widgetId; + } + + public void setWidgetId(long widgetId) { + this.widgetId = widgetId; + } + + @Override + public String toString() { + return "WidgetFile [name=" + name + ", widgetId=" + widgetId + "]"; + } + + + +} |