diff options
Diffstat (limited to 'ecomp-portal-widget-ms')
9 files changed, 106 insertions, 286 deletions
diff --git a/ecomp-portal-widget-ms/common-widgets/pom.xml b/ecomp-portal-widget-ms/common-widgets/pom.xml index 16416034..5b574d87 100644 --- a/ecomp-portal-widget-ms/common-widgets/pom.xml +++ b/ecomp-portal-widget-ms/common-widgets/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.portal</groupId> <artifactId>widget-ms-parent</artifactId> - <version>2.5.0</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>common-widgets</artifactId> diff --git a/ecomp-portal-widget-ms/pom.xml b/ecomp-portal-widget-ms/pom.xml index cb246513..d8b33301 100644 --- a/ecomp-portal-widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.portal</groupId> <artifactId>onap-portal-parent</artifactId> - <version>2.5.0</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>widget-ms-parent</artifactId> diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml index a6ed0aa8..95b06adc 100644 --- a/ecomp-portal-widget-ms/widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/widget-ms/pom.xml @@ -13,7 +13,7 @@ <groupId>org.onap.portal</groupId> <artifactId>widget-ms</artifactId> - <version>2.5.0</version> + <version>2.6.0-SNAPSHOT</version> <packaging>jar</packaging> <name>widget-microservice</name> @@ -178,6 +178,11 @@ <artifactId>spring-security-web</artifactId> <version>4.1.4.RELEASE</version> </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.4</version> + </dependency> </dependencies> <build> 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 index d950d035..212826cd 100644 --- 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 @@ -8,6 +8,10 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import org.hibernate.validator.constraints.SafeHtml; @Entity @Table(name = "FN_APP") @@ -18,9 +22,13 @@ public class App implements Serializable{ @Id @Column(name = "APP_ID") @GeneratedValue(strategy=GenerationType.AUTO) + @Digits(integer = 11, fraction = 0) private Long appId; - + @Column(name = "APP_Name") + @SafeHtml + @Size(max = 100) + @NotNull private String appName; public Long getAppId() { 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 index 7d45a112..43e7b2b0 100644 --- 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 @@ -6,6 +6,12 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; /** * TODO: moved all microservice-related code (domain, controller, service) @@ -13,109 +19,57 @@ import javax.persistence.Table; */ @Entity @Table(name="EP_MICROSERVICE") +@Getter +@Setter public class MicroserviceData { @Id @Column(name = "id") + @Digits(integer = 11, fraction = 0) @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @Column(name = "name") + @Size(max = 50) + @SafeHtml private String name; @Column(name = "description") + @Size(max = 50) + @SafeHtml private String desc; @Column(name = "appId") + @Digits(integer = 11, fraction = 0) private long appId; @Column(name = "endpoint_url") + @Size(max = 200) + @SafeHtml private String url; @Column(name = "security_type") + @Size(max = 50) + @SafeHtml private String securityType; @Column(name = "username") + @Size(max = 50) + @SafeHtml private String username; @Column(name = "password") + @Size(max = 50) + @SafeHtml + @NotNull private String password; @Column(name = "active") + @Size(max = 1) + @SafeHtml + @NotNull 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 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 index d95d46c6..7207d0ae 100644 --- 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 @@ -6,6 +6,11 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; /** * TODO: moved all microservice-related code (domain, controller, service) @@ -13,54 +18,30 @@ import javax.persistence.Table; */ @Entity @Table(name="EP_MICROSERVICE_PARAMETER") +@Getter +@Setter public class MicroserviceParameter { @Id @Column(name = "id") @GeneratedValue(strategy=GenerationType.AUTO) + @Digits(integer = 11, fraction = 0) private Long id; @Column(name = "service_id") + @Digits(integer = 11, fraction = 0) private long serviceId; @Column(name = "para_key") + @Size(max = 50) + @SafeHtml private String para_key; @Column(name = "para_value") + @Size(max = 50) + @SafeHtml 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 index 807067b2..aae9bfed 100644 --- 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 @@ -16,77 +16,43 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; +import javax.validation.Valid; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; @Entity @Table(name = "FN_ROLE") +@Getter +@Setter public class RoleApp implements Serializable{ private static final long serialVersionUID = 1L; @Id @Column(name = "ROLE_ID") @GeneratedValue(strategy=GenerationType.AUTO) + @Digits(integer = 11, fraction = 0) private Long roleId; - - + @Column(name = "ROLE_Name") + @SafeHtml + @Size(max = 300) + @NotNull private String roleName; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name="APP_ID") + @Valid private App app; @JsonIgnore @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, mappedBy="widgetRoles") + @Valid 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/WidgetCatalog.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java index 9d153e2a..1dc0582c 100644 --- 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 @@ -14,30 +14,51 @@ import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.persistence.Transient; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; @Entity @Table(name="EP_WIDGET_CATALOG") +@Getter +@Setter public class WidgetCatalog{ @Id @Column(name = "widget_id") @GeneratedValue(strategy=GenerationType.AUTO) + @Digits(integer = 11, fraction = 0) private long id; @Column(name = "wdg_name") + @Size(max = 100) + @SafeHtml + @NotNull private String name; @Column(name = "wdg_desc") + @Size(max = 200) + @SafeHtml private String desc; @Column(name = "wdg_file_loc") + @Size(max = 256) + @SafeHtml + @NotNull private String fileLocation; @Column(name = "all_user_flag") + @Size(max = 1) + @SafeHtml + @NotNull private String allowAllUser; @Column(name = "service_id") + @Digits(integer = 11, fraction = 0) private Long serviceId; @Transient @@ -53,78 +74,6 @@ public class WidgetCatalog{ ) 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 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 index e9c6ffc2..7ba22982 100644 --- 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 @@ -4,18 +4,31 @@ import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; @Entity @Table(name = "ep_widget_catalog_files") +@Getter +@Setter public class WidgetFile { @Id @Column (name = "file_id") + @Digits(integer = 11, fraction = 0) private int id; @Column(name = "widget_name") + @Size(max = 11) + @SafeHtml + @NotNull private String name; @Column(name = "widget_id") + @Digits(integer = 11, fraction = 0) private long widgetId; @Column(name = "markup_html") @@ -30,62 +43,6 @@ public class WidgetFile { @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 + "]"; |