Signed-off-by: Christian Berendt <bere...@b1-systems.de>
---
 .../common/db/datasource/xml/General_queries.xml   |    2 +-
 .../rhn/domain/kickstart/KickstartScript.hbm.xml   |    1 +
 .../rhn/domain/kickstart/KickstartScript.java      |   18 ++++++++++++++++++
 .../domain/kickstart/builder/KickstartBuilder.java |    2 +-
 .../kickstart/BaseKickstartScriptAction.java       |    6 +++++-
 .../rhn/frontend/dto/kickstart/ScriptDto.java      |   17 +++++++++++++++++
 .../frontend/strings/jsp/StringResource_en_US.xml  |   14 ++++++++++++++
 .../kickstart/BaseKickstartScriptCommand.java      |   20 +++++++++++++++++++-
 .../kickstart/test/KickstartScriptCommandTest.java |    4 ++--
 .../WEB-INF/pages/kickstart/script-form.jspf       |    8 ++++++++
 .../WEB-INF/pages/kickstart/scriptdelete.jsp       |    8 ++++++++
 .../webapp/WEB-INF/pages/kickstart/scripts.jsp     |    3 +++
 java/code/webapp/WEB-INF/struts-config.xml         |    1 +
 .../spacewalk/common/tables/rhnKickstartScript.sql |    3 ++-
 ...01-add_rhnKickstartScript_scriptname.sql.oracle |    1 +
 ...dd_rhnKickstartScript_scriptname.sql.postgresql |    2 ++
 16 files changed, 103 insertions(+), 7 deletions(-)
 create mode 100644 
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.oracle
 create mode 100644 
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.postgresql

diff --git 
a/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml 
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml
index 6f6be26..4af6f3d 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml
@@ -64,7 +64,7 @@ ORDER BY KS.label, KS.id
 
 <mode name="scripts_for_kickstart" 
class="com.redhat.rhn.frontend.dto.kickstart.ScriptDto">
   <query params="kickstart_id">
-  SELECT KS.id, KS.script_type, KS.chroot, KS.interpreter
+  SELECT KS.id, KS.script_type, KS.chroot, KS.interpreter, KS.scriptname
     FROM rhnKickstartScript KS
   WHERE KS.kickstart_id = :kickstart_id
   </query>
diff --git 
a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.hbm.xml 
b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.hbm.xml
index 9e495c5..2b144db 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.hbm.xml
@@ -16,6 +16,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
         <property name="chroot" column="chroot" not-null="true" type="string" 
length="1" />
         <property name="raw" column="raw_script" not-null="true" type="yes_no" 
/>
         <property name="interpreter" column="interpreter"  type="string" 
length="80" />
+        <property name="scriptname" column="scriptname" not-null="true" 
type="string" length="40" />
         <property name="data" column="data"  type="binary" />
         <property name="created" column="created" not-null="true"
                type="timestamp" insert="false" update="false"/>
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.java 
b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.java
index 9bee435..e6c9e53 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.java
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartScript.java
@@ -32,6 +32,7 @@ public class KickstartScript implements 
Comparable<KickstartScript> {
     private String scriptType;
     private String chroot;
     private String interpreter;
+    private String scriptname;
     private byte[] data;
     private Date created;
     private Date modified;
@@ -48,6 +49,22 @@ public class KickstartScript implements 
Comparable<KickstartScript> {
     }
 
     /**
+     * Getter for scriptname
+     * @return String to get
+    */
+    public String getScriptname() {
+        return this.scriptname;
+    }
+
+    /**
+     * Setter for scriptname
+     * @param scriptnameIn to set
+    */
+    public void setScriptname(String scriptnameIn) {
+        this.scriptname = scriptnameIn;
+    }
+
+    /**
      * Getter for id
      * @return Long to get
     */
@@ -214,6 +231,7 @@ public class KickstartScript implements 
Comparable<KickstartScript> {
     public KickstartScript deepCopy(KickstartData ksDataIn) {
         KickstartScript cloned = new KickstartScript();
         cloned.setChroot(this.getChroot());
+        cloned.setScriptname(this.getScriptname());
         cloned.setData(this.getData());
         cloned.setInterpreter(this.getInterpreter());
         cloned.setKsdata(ksDataIn);
diff --git 
a/java/code/src/com/redhat/rhn/domain/kickstart/builder/KickstartBuilder.java 
b/java/code/src/com/redhat/rhn/domain/kickstart/builder/KickstartBuilder.java
index b92155e..b5f7721 100644
--- 
a/java/code/src/com/redhat/rhn/domain/kickstart/builder/KickstartBuilder.java
+++ 
b/java/code/src/com/redhat/rhn/domain/kickstart/builder/KickstartBuilder.java
@@ -328,7 +328,7 @@ public class KickstartBuilder {
             type = KickstartScript.TYPE_POST;
         }
 
-        scriptCommand.setScript(interpreter, buf.toString(), type, chroot, 
false);
+        scriptCommand.setScript(interpreter, buf.toString(), type, chroot, 
false, null);
         scriptCommand.store();
 
     }
diff --git 
a/java/code/src/com/redhat/rhn/frontend/action/kickstart/BaseKickstartScriptAction.java
 
b/java/code/src/com/redhat/rhn/frontend/action/kickstart/BaseKickstartScriptAction.java
index ba54031..fca01ac 100644
--- 
a/java/code/src/com/redhat/rhn/frontend/action/kickstart/BaseKickstartScriptAction.java
+++ 
b/java/code/src/com/redhat/rhn/frontend/action/kickstart/BaseKickstartScriptAction.java
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
  */
 public abstract class BaseKickstartScriptAction extends 
BaseKickstartEditAction {
 
+    public static final String SCRIPTNAME = "scriptname";
     public static final String CONTENTS = "contents";
     public static final String LANGUAGE = "language";
     public static final String TYPE = "type";
@@ -73,11 +74,13 @@ public abstract class BaseKickstartScriptAction extends 
BaseKickstartEditAction
             return new ValidatorError("kickstart.script.toolarge",
                     LocalizationService.getInstance().formatNumber(new 
Long(maxLength)));
         }
+
         kssc.setScript(form.getString(LANGUAGE),
                 scriptValue,
                 form.getString(TYPE),
                 chroot,
-                template);
+                template,
+                form.getString(SCRIPTNAME));
         return null;
     }
 
@@ -100,6 +103,7 @@ public abstract class BaseKickstartScriptAction extends 
BaseKickstartEditAction
 
         BaseKickstartScriptCommand kssc = (BaseKickstartScriptCommand) cmd;
         form.set(CONTENTS, kssc.getContents());
+        form.set(SCRIPTNAME, kssc.getScriptname());
         form.set(LANGUAGE, kssc.getLanguage());
         form.set(TYPE, kssc.getType());
         form.set(NOCHROOT, kssc.getNoChrootVal());
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/kickstart/ScriptDto.java 
b/java/code/src/com/redhat/rhn/frontend/dto/kickstart/ScriptDto.java
index ca86155..d9c1626 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/kickstart/ScriptDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/kickstart/ScriptDto.java
@@ -30,6 +30,7 @@ public class ScriptDto extends BaseDto {
     private String chroot;
     private String interpreter;
     private int position;
+    private String scriptname;
     private static final String BASH = "bash";
     private static final String PRE = "Pre";
     private static final String POST = "Post";
@@ -37,6 +38,22 @@ public class ScriptDto extends BaseDto {
 
     /**
      *
+     * @return scriptname
+     */
+    public String getScriptname() {
+        return scriptname;
+    }
+
+    /**
+     *
+     * @param scriptnameIn to set
+     */
+    public void setScriptname(String scriptnameIn) {
+        this.scriptname = scriptnameIn;
+    }
+
+    /**
+     *
      * @return chroot
      */
     public String getChroot() {
diff --git 
a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml 
b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 3ff73ba..d1c7227 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -10571,6 +10571,13 @@ Please note that some manual configuration of these 
scripts may still be require
         </context-group>
     </trans-unit>
 
+    <trans-unit id="kickstartscript.jsp.scriptname">
+        <source>Script Name</source>
+        <context-group name="ctx">
+            <context context-type="sourcefile">/rhn/kickstart/Scripts</context>
+        </context-group>
+    </trans-unit>
+
     <trans-unit id="kickstartscript.jsp.language">
         <source>Scripting Language</source>
         <context-group name="ctx">
@@ -11646,6 +11653,13 @@ Please note that some manual configuration of these 
scripts may still be require
         </context-group>
       </trans-unit>
 
+      <trans-unit id="kickstart.script.scriptname">
+        <source>Script Name</source>
+        <context-group name="ctx">
+          <context 
context-type="sourcefile">/rhn/kickstart/KickstartScriptEdit.do</context>
+        </context-group>
+      </trans-unit>
+
       <trans-unit id="kickstart.script.contents">
         <source>Script Contents</source>
         <context-group name="ctx">
diff --git 
a/java/code/src/com/redhat/rhn/manager/kickstart/BaseKickstartScriptCommand.java
 
b/java/code/src/com/redhat/rhn/manager/kickstart/BaseKickstartScriptCommand.java
index 0ae0ba6..000efdd 100644
--- 
a/java/code/src/com/redhat/rhn/manager/kickstart/BaseKickstartScriptCommand.java
+++ 
b/java/code/src/com/redhat/rhn/manager/kickstart/BaseKickstartScriptCommand.java
@@ -61,9 +61,11 @@ public class BaseKickstartScriptCommand extends 
BaseKickstartCommand {
      * @param typeIn of script (KickstartScript.TYPE_POST or 
KickstartScript.TYPE_PRE)
      * @param chrootIn value of chroot ("Y" or "N")
      * @param templatize whether to templatize the script or not
+     * @param scriptname name of the script
      */
     public void setScript(String language, String contentsIn,
-                               String typeIn, String chrootIn, boolean 
templatize) {
+                               String typeIn, String chrootIn, boolean 
templatize,
+                               String scriptname) {
         if (!typeIn.equals(KickstartScript.TYPE_POST) &&
                 !typeIn.equals(KickstartScript.TYPE_PRE)) {
             throw new IllegalArgumentException("Unknown script type: " + 
typeIn);
@@ -86,10 +88,18 @@ public class BaseKickstartScriptCommand extends 
BaseKickstartCommand {
             language = language.trim();
         }
 
+        if (StringUtils.isBlank(scriptname)) {
+            scriptname = null;
+        }
+        else {
+            scriptname = scriptname.trim();
+        }
+
         this.script.setInterpreter(language);
         this.script.setScriptType(typeIn);
         this.script.setChroot(chrootIn);
         this.script.setRaw(!templatize); //template is the ! of raw
+        this.script.setScriptname(scriptname);
     }
 
     /**
@@ -110,6 +120,14 @@ public class BaseKickstartScriptCommand extends 
BaseKickstartCommand {
     }
 
     /**
+     * Get the name of this script
+     * @return String
+     */
+    public String getScriptname() {
+        return this.script.getScriptname();
+    }
+
+    /**
      * Get the type of Script this is.  See KickstartScript.TYPE_PRE, 
TYPE_POST.
      * Defaults to KickstartScript.TYPE_PRE
      *
diff --git 
a/java/code/src/com/redhat/rhn/manager/kickstart/test/KickstartScriptCommandTest.java
 
b/java/code/src/com/redhat/rhn/manager/kickstart/test/KickstartScriptCommandTest.java
index 7b9d363..e8a1fcf 100644
--- 
a/java/code/src/com/redhat/rhn/manager/kickstart/test/KickstartScriptCommandTest.java
+++ 
b/java/code/src/com/redhat/rhn/manager/kickstart/test/KickstartScriptCommandTest.java
@@ -52,7 +52,7 @@ public class KickstartScriptCommandTest extends 
BaseKickstartCommandTestCase {
         assertNotNull(cmd.getKickstartData().getScripts());
         KickstartScript kss = cmd.getScript();
         assertNotNull(kss.getScriptType());
-        cmd.setScript(language, contents, KickstartScript.TYPE_PRE, chroot, 
false);
+        cmd.setScript(language, contents, KickstartScript.TYPE_PRE, chroot, 
false, null);
         cmd.store();
         ksdata = (KickstartData) reload(ksdata);
         assertEquals(contents, cmd.getContents());
@@ -67,7 +67,7 @@ public class KickstartScriptCommandTest extends 
BaseKickstartCommandTestCase {
         String chroot = "Y";
         KickstartScriptEditCommand cmd =
             new KickstartScriptEditCommand(ksdata.getId(), kss.getId(), user);
-        cmd.setScript(language, contents, KickstartScript.TYPE_PRE, chroot, 
true);
+        cmd.setScript(language, contents, KickstartScript.TYPE_PRE, chroot, 
true, null);
         cmd.store();
         ksdata = (KickstartData) reload(ksdata);
         assertEquals(contents, cmd.getContents());
diff --git a/java/code/webapp/WEB-INF/pages/kickstart/script-form.jspf 
b/java/code/webapp/WEB-INF/pages/kickstart/script-form.jspf
index 15ea3e3..8552e5e 100644
--- a/java/code/webapp/WEB-INF/pages/kickstart/script-form.jspf
+++ b/java/code/webapp/WEB-INF/pages/kickstart/script-form.jspf
@@ -21,6 +21,14 @@
           </tr>
           <tr>
               <th>
+                  <bean:message key="kickstart.script.scriptname"/>
+              </th>
+              <td>
+                  <html:text property="scriptname" maxlength="40" size="20" 
/><br/>
+              </td>
+          </tr>
+          <tr>
+              <th>
                   <rhn:required-field key="kickstart.script.contents"/>
               </th>
               <td>
diff --git a/java/code/webapp/WEB-INF/pages/kickstart/scriptdelete.jsp 
b/java/code/webapp/WEB-INF/pages/kickstart/scriptdelete.jsp
index 6f54e05..6f42a68 100644
--- a/java/code/webapp/WEB-INF/pages/kickstart/scriptdelete.jsp
+++ b/java/code/webapp/WEB-INF/pages/kickstart/scriptdelete.jsp
@@ -30,6 +30,14 @@
           </tr>
           <tr>
               <th>
+                  <bean:message key="kickstart.script.scriptname"/>
+              </th>
+              <td>
+                  ${ksscript.scriptname}
+              </td>
+          </tr>
+          <tr>
+              <th>
                   <bean:message key="kickstart.script.language"/>
               </th>
               <td>
diff --git a/java/code/webapp/WEB-INF/pages/kickstart/scripts.jsp 
b/java/code/webapp/WEB-INF/pages/kickstart/scripts.jsp
index 3f1158f..d36c2d0 100644
--- a/java/code/webapp/WEB-INF/pages/kickstart/scripts.jsp
+++ b/java/code/webapp/WEB-INF/pages/kickstart/scripts.jsp
@@ -41,6 +41,9 @@
         <rhn:column header="kickstartscript.jsp.scriptnum">
           <a 
href="/rhn/kickstart/KickstartScriptEdit.do?kssid=${current.id}&amp;ksid=${ksdata.id}"><bean:message
 key="kickstartscript.jsp.script"/> ${current.position}</a>
         </rhn:column>
+        <rhn:column header="kickstartscript.jsp.scriptname">
+          <a 
href="/rhn/kickstart/KickstartScriptEdit.do?kssid=${current.id}&amp;ksid=${ksdata.id}">${current.scriptname}</a>
+        </rhn:column>
         <rhn:column header="kickstartscript.jsp.language">
         ${current.interpreter}
         </rhn:column>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml 
b/java/code/webapp/WEB-INF/struts-config.xml
index f991165..2496628 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -680,6 +680,7 @@
         <form-bean name="kickstartScriptForm"
                    
type="com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm">
             <form-property name="language" type="java.lang.String" />
+            <form-property name="scriptname" type="java.lang.String" />
             <form-property name="contents" type="java.lang.String" />
             <form-property name="type" type="java.lang.String" />
             <form-property name="nochroot" type="java.lang.Boolean" />
diff --git a/schema/spacewalk/common/tables/rhnKickstartScript.sql 
b/schema/spacewalk/common/tables/rhnKickstartScript.sql
index 1be4bc8..181763f 100644
--- a/schema/spacewalk/common/tables/rhnKickstartScript.sql
+++ b/schema/spacewalk/common/tables/rhnKickstartScript.sql
@@ -38,7 +38,8 @@ CREATE TABLE rhnKickstartScript
     created       DATE
                       DEFAULT (sysdate) NOT NULL,
     modified      DATE
-                      DEFAULT (sysdate) NOT NULL
+                      DEFAULT (sysdate) NOT NULL,
+    scriptname          VARCHAR2(40)
 )
 ENABLE ROW MOVEMENT
 ;
diff --git 
a/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.oracle
 
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.oracle
new file mode 100644
index 0000000..296b616
--- /dev/null
+++ 
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.oracle
@@ -0,0 +1 @@
+alter table rhnKickstartScript add scriptname varchar2(40);
diff --git 
a/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.postgresql
 
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.postgresql
new file mode 100644
index 0000000..3511e24
--- /dev/null
+++ 
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/101-add_rhnKickstartScript_scriptname.sql.postgresql
@@ -0,0 +1,2 @@
+-- oracle equivalent source sha1 ebfe8df38b1935e67ea3ddd3d5937cef6de9ae91
+alter table rhnKickstartScript add column scriptname varchar2(40);
-- 
1.7.1

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to