X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=portal-BE%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportal%2Fdomain%2Fdb%2Fep%2FEpAppFunction.java;h=5cccdcbdbc3e60b156450340d7527b6ad5d27e07;hb=39fb119cdaea6bd8d801b22d195db39f6d8faaca;hp=0f2f9500a762d161a73dc32967034881edf29080;hpb=255dcfbf8a0dfb7f5aa853d223425559411abf2a;p=portal.git diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java index 0f2f9500..5cccdcbd 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java @@ -51,6 +51,8 @@ import javax.persistence.IdClass; import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.Valid; @@ -64,6 +66,7 @@ import lombok.Setter; import org.hibernate.validator.constraints.SafeHtml; import org.onap.portal.domain.db.ep.EpAppFunction.EpAppFunctionId; import org.onap.portal.domain.db.fn.FnApp; +import org.onap.portal.domain.dto.DomainVo; /* CREATE TABLE `ep_app_function` ( @@ -76,6 +79,20 @@ CREATE TABLE `ep_app_function` ( ) */ +@NamedQueries({ + @NamedQuery( + name = "EpAppFunction.getAppRoleFunctionList", + query = "from\n" + + " EpAppRoleFunction rf,\n" + + " EpAppFunction f\n" + + " where\n" + + " rf.fnRole.roleId = :roleId\n" + + " and rf.appId.appId = :appId\n" + + " and rf.appId.appId = f.appId.appId\n" + + " and rf.epAppFunction.functionCd = f.functionCd" + ) +}) + @Table(name = "ep_app_function", indexes = {@Index(name = "fk_ep_app_function_app_id", columnList = "app_id")}) @Getter @@ -84,43 +101,64 @@ CREATE TABLE `ep_app_function` ( @IdClass(EpAppFunctionId.class) @NoArgsConstructor @AllArgsConstructor -public class EpAppFunction { - @Id - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @JoinColumn(name = "app_id") - @Valid - private FnApp appId; - @Id - @Column(name = "function_cd", length = 250, nullable = false) - @Size(max = 250) - @NotNull - @SafeHtml - private String functionCd; - @Column(name = "function_name", length = 250, nullable = false) - @Size(max = 250) - @NotNull - @SafeHtml - private String functionName; - @OneToMany( - targetEntity = EpAppRoleFunction.class, - mappedBy = "epAppFunction", - cascade = CascadeType.ALL, - fetch = FetchType.LAZY - ) - private Set epAppRoleFunctions; +public class EpAppFunction extends DomainVo implements Serializable { + + @Id + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "app_id") + @Valid + private FnApp appId; + @Id + @Column(name = "function_cd", length = 250, nullable = false) + @Size(max = 250) + @NotNull + @SafeHtml + private String functionCd; + @Column(name = "function_name", length = 250, nullable = false) + @Size(max = 250) + @NotNull + @SafeHtml + private String functionName; + + private Long roleId; + private String type; + @SafeHtml + private String action; + @SafeHtml + private String editUrl; + + @OneToMany( + targetEntity = EpAppRoleFunction.class, + mappedBy = "epAppFunction", + cascade = CascadeType.ALL, + fetch = FetchType.LAZY + ) + private Set epAppRoleFunctions; + + public EpAppFunction(Long id, String code, String name, FnApp appId, String type, String action, String editUrl) { + super(); + this.id = id; + this.functionCd = code; + this.functionName = name; + this.appId = appId; + this.type = type; + this.action = action; + this.editUrl = editUrl; + } + + @Getter + @Setter + @EqualsAndHashCode + @NoArgsConstructor + @AllArgsConstructor + public static class EpAppFunctionId implements Serializable { - @Getter - @Setter - @EqualsAndHashCode - @NoArgsConstructor - @AllArgsConstructor - public static class EpAppFunctionId implements Serializable { - @Valid - private FnApp appId; - @Size(max = 250) - @NotNull - @SafeHtml - private String functionCd; - } + @Valid + private FnApp appId; + @Size(max = 250) + @NotNull + @SafeHtml + private String functionCd; + } }