diff --git a/container/oracle/initdb.d/02_ddl.sql b/container/oracle/initdb.d/02_ddl.sql index c9a093d..c433f1f 100644 --- a/container/oracle/initdb.d/02_ddl.sql +++ b/container/oracle/initdb.d/02_ddl.sql @@ -103,6 +103,7 @@ CREATE TABLE SRM_OWNER.SYSTEM_AUD REV INTEGER NOT NULL , REVTYPE INTEGER NOT NULL , NAME VARCHAR2(128 CHAR) NOT NULL , + DESCRIPTION VARCHAR2(2048 CHAR) NULL , CATEGORY_ID INTEGER NOT NULL , WEIGHT INTEGER NULL , CONSTRAINT SYSTEM_AUD_PK PRIMARY KEY (SYSTEM_ID,REV), @@ -132,6 +133,7 @@ CREATE TABLE SRM_OWNER.SYSTEM ( SYSTEM_ID INTEGER NOT NULL , NAME VARCHAR2(128 CHAR) NOT NULL , + DESCRIPTION VARCHAR2(2048 CHAR) NULL , CATEGORY_ID INTEGER NOT NULL , WEIGHT INTEGER NULL , CONSTRAINT SYSTEM_PK PRIMARY KEY (SYSTEM_ID), diff --git a/src/main/java/org/jlab/srm/business/session/SystemFacade.java b/src/main/java/org/jlab/srm/business/session/SystemFacade.java index 337d797..755531b 100644 --- a/src/main/java/org/jlab/srm/business/session/SystemFacade.java +++ b/src/main/java/org/jlab/srm/business/session/SystemFacade.java @@ -281,7 +281,8 @@ public List gatherDescendents(Category category, BigInteger applic } @PermitAll - public void addNew(BigInteger parentId, String name) throws UserFriendlyException { + public void addNew(BigInteger parentId, String name, String description) + throws UserFriendlyException { String username = checkAuthenticated(); if (parentId == null) { @@ -305,6 +306,7 @@ public void addNew(BigInteger parentId, String name) throws UserFriendlyExceptio SystemEntity s = new SystemEntity(); s.setCategory(parent); s.setName(name); + s.setDescription(description); s.setWeight(BigInteger.valueOf(1000)); create(s); @@ -332,7 +334,7 @@ public void remove(BigInteger systemId) throws UserFriendlyException { } @PermitAll - public void edit(BigInteger systemId, BigInteger parentId, String name) + public void edit(BigInteger systemId, BigInteger parentId, String name, String description) throws UserFriendlyException { String username = checkAuthenticated(); @@ -362,5 +364,6 @@ public void edit(BigInteger systemId, BigInteger parentId, String name) s.setCategory(parent); s.setName(name); + s.setDescription(description); } } diff --git a/src/main/java/org/jlab/srm/persistence/entity/SystemEntity.java b/src/main/java/org/jlab/srm/persistence/entity/SystemEntity.java index d001a91..edc48bb 100644 --- a/src/main/java/org/jlab/srm/persistence/entity/SystemEntity.java +++ b/src/main/java/org/jlab/srm/persistence/entity/SystemEntity.java @@ -39,6 +39,9 @@ public class SystemEntity implements Serializable, Comparable { @Column(nullable = false, length = 128) private String name; + @Column(nullable = true, length = 2048) + private String description; + private BigInteger weight; @JoinColumn(name = "CATEGORY_ID", referencedColumnName = "CATEGORY_ID", nullable = false) @@ -84,6 +87,14 @@ public void setName(String name) { this.name = name; } + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public BigInteger getWeight() { return weight; } diff --git a/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/AddSystem.java b/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/AddSystem.java index a8c4896..cc14bd6 100644 --- a/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/AddSystem.java +++ b/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/AddSystem.java @@ -45,7 +45,8 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) try { BigInteger parentId = ParamConverter.convertBigInteger(request, "parentId"); String name = request.getParameter("name"); - systemFacade.addNew(parentId, name); + String description = request.getParameter("description"); + systemFacade.addNew(parentId, name, description); } catch (EJBAccessException e) { logger.log(Level.WARNING, "Not authorized", e); errorReason = "Not authorized"; diff --git a/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/EditSystem.java b/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/EditSystem.java index 1d20ea9..9610d0d 100644 --- a/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/EditSystem.java +++ b/src/main/java/org/jlab/srm/presentation/controller/setup/ajax/EditSystem.java @@ -46,7 +46,8 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) BigInteger systemId = ParamConverter.convertBigInteger(request, "systemId"); BigInteger parentId = ParamConverter.convertBigInteger(request, "parentId"); String name = request.getParameter("name"); - systemFacade.edit(systemId, parentId, name); + String description = request.getParameter("description"); + systemFacade.edit(systemId, parentId, name, description); } catch (EJBAccessException e) { logger.log(Level.WARNING, "Not authorized", e); errorReason = "Not authorized"; diff --git a/src/main/webapp/WEB-INF/views/setup/category-tree.jsp b/src/main/webapp/WEB-INF/views/setup/category-tree.jsp index af283c8..1852710 100644 --- a/src/main/webapp/WEB-INF/views/setup/category-tree.jsp +++ b/src/main/webapp/WEB-INF/views/setup/category-tree.jsp @@ -41,6 +41,11 @@ #open-edit-root-dialog-button { float: right; } + #node-description { + resize: none; + height: 100px; + width: 370px; + } @@ -136,7 +141,7 @@ @@ -169,6 +174,14 @@ +
  • +
    + +
    +
    + +
    +
  • diff --git a/src/main/webapp/WEB-INF/views/system-detail.jsp b/src/main/webapp/WEB-INF/views/system-detail.jsp index 3c1b965..009e018 100644 --- a/src/main/webapp/WEB-INF/views/system-detail.jsp +++ b/src/main/webapp/WEB-INF/views/system-detail.jsp @@ -17,6 +17,10 @@

    System ${system.name}

    +
    Description:
    +
    + +
    Group Responsibilities:
    diff --git a/src/main/webapp/resources/js/category-tree.js b/src/main/webapp/resources/js/category-tree.js index 9dcff43..75f0a6f 100644 --- a/src/main/webapp/resources/js/category-tree.js +++ b/src/main/webapp/resources/js/category-tree.js @@ -211,7 +211,8 @@ jlab.srm.addSystem = function () { $("#SaveButton").attr("disabled", "disabled"); var parentId = $("#category-parent").val(), - name = $("#node-name").val(); + name = $("#node-name").val(), + description = $("#node-description").val(); var leaveSpinning = false; @@ -220,7 +221,8 @@ jlab.srm.addSystem = function () { type: "POST", data: { parentId: parentId, - name: name + name: name, + description: description }, dataType: "html" }); @@ -274,7 +276,8 @@ jlab.srm.editSystem = function () { $("#SaveButton").attr("disabled", "disabled"); var parentId = $("#category-parent").val(), - name = $("#node-name").val(); + name = $("#node-name").val(), + description = $("#node-description").val(); var leaveSpinning = false; @@ -284,7 +287,8 @@ jlab.srm.editSystem = function () { data: { systemId: systemId, parentId: parentId, - name: name + name: name, + description: description }, dataType: "html" }); @@ -454,6 +458,7 @@ $(document).on("click", "#open-add-category-dialog-button", function () { $("#node-dialog").dialog("option", "title", "Add Category"); $("#select-node-fieldset").hide(); $("#new-value-fieldset").show(); + $("#node-description").prop("disabled", true); jlab.srm.clearAndOpenNodeDialog(); }); @@ -463,6 +468,7 @@ $(document).on("click", "#open-edit-category-dialog-button", function () { $("#category-node-select").show(); $("#system-node-select").hide(); $("#new-value-fieldset").show(); + $("#node-description").prop("disabled", true); jlab.srm.clearAndOpenNodeDialog(); }); @@ -479,6 +485,7 @@ $(document).on("click", "#open-add-system-dialog-button", function () { $("#node-dialog").dialog("option", "title", "Add System"); $("#select-node-fieldset").hide(); $("#new-value-fieldset").show(); + $("#node-description").prop("disabled", false); jlab.srm.clearAndOpenNodeDialog(); }); @@ -488,6 +495,7 @@ $(document).on("click", "#open-edit-system-dialog-button", function () { $("#category-node-select").hide(); $("#system-node-select").show(); $("#new-value-fieldset").show(); + $("#node-description").prop("disabled", false); jlab.srm.clearAndOpenNodeDialog(); }); @@ -521,6 +529,7 @@ $(document).on("change", "#system", function () { return $(this).text().trim() === currentParentCategoryName; }).prop("selected", true); $("#node-name").val($("#system option:selected").text().trim()); + $("#node-description").val($("#system option:selected").attr("data-description")); }); $(document).on("click", "#open-edit-root-dialog-button", function () { @@ -536,7 +545,9 @@ $(function () { $(".dialog").dialog({ autoOpen: false, width: 600, - height: 400, + height: 500, + minHeight: 500, + minWidth: 600, modal: true });