You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2007/01/30 00:02:54 UTC

svn commit: r501221 - in /ofbiz/trunk/framework/webtools: config/WebtoolsUiLabels.properties webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh webapp/webtools/entity/CheckDb.ftl

Author: jonesde
Date: Mon Jan 29 15:02:52 2007
New Revision: 501221

URL: http://svn.apache.org/viewvc?view=rev&rev=501221
Log:
Somes cleanups and fixes, wasn't working before; also added forms to create/remove a single primary key

Modified:
    ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/CheckDb.ftl

Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties?view=diff&rev=501221&r1=501220&r2=501221
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties Mon Jan 29 15:02:52 2007
@@ -72,6 +72,7 @@
 WebtoolsCreateRemoveAllForeignKeys=Create/Remove All Foreign Keys
 WebtoolsCreateRemoveAllForeignKeyIndices=Create/Remove All Foreign Key Indices
 WebtoolsCreateRemoveAllPrimaryKeys=Create/Remove All Primary Keys
+WebtoolsCreateRemovePrimaryKey=Create/Remove Primary Key
 WebtoolsDataFileTools=Data File Tools
 WebtoolsDbName=DB Name
 WebtoolsDebuggingLevelFormDescription=This form allows you to change application debugging levels.

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh?view=diff&rev=501221&r1=501220&r2=501221
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh Mon Jan 29 15:02:52 2007
@@ -19,6 +19,7 @@
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.security.Security;
 import org.ofbiz.entity.jdbc.DatabaseUtil;
+import org.ofbiz.entity.model.ModelEntity;
 
 delegator = request.getAttribute("delegator");
 security = request.getAttribute("security");
@@ -33,9 +34,10 @@
     boolean repair = "true".equals(request.getParameter("repair"));
     String option = request.getParameter("option");
     String groupName = request.getParameter("groupName");    
+    String entityName = request.getParameter("entityName");    
     
     Iterator miter = null;
-      if (groupName != null && groupName.length() > 0) {
+    if (groupName != null && groupName.length() > 0) {
         String helperName = delegator.getGroupHelperName(groupName);
 
         List messages = new LinkedList();
@@ -67,6 +69,9 @@
                 ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
                 dbUtil.deletePrimaryKey(modelEntity, messages);
             }
+        } else if ("removepk".equals(option)) {
+            ModelEntity modelEntity = (ModelEntity) modelEntities.get(entityName);
+            dbUtil.deletePrimaryKey(modelEntity, messages);
         } else if ("createpks".equals(option)) {
             Iterator modelEntityNameIter = modelEntityNames.iterator();
             while (modelEntityNameIter.hasNext()) {
@@ -74,6 +79,9 @@
                 ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
                 dbUtil.createPrimaryKey(modelEntity, messages);
             }
+        } else if ("createpk".equals(option)) {
+            ModelEntity modelEntity = (ModelEntity) modelEntities.get(entityName);
+            dbUtil.createPrimaryKey(modelEntity, messages);
         } else if ("createfkidxs".equals(option)) {
             Iterator modelEntityNameIter = modelEntityNames.iterator();
             while (modelEntityNameIter.hasNext()) {
@@ -129,4 +137,5 @@
     }
     context.put("encodeURLCheckDb", response.encodeURL(controlPath + "/view/checkdb"));
     context.put("groupName", (groupName != null) ? groupName : "org.ofbiz");
+    context.put("entityName", (entityName != null) ? entityName : "");
 }

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/CheckDb.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/CheckDb.ftl?view=diff&rev=501221&r1=501220&r2=501221
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/CheckDb.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/CheckDb.ftl Mon Jan 29 15:02:52 2007
@@ -54,6 +54,19 @@
         ${uiLabelMap.WebtoolsGroupName}: <input type="text" class="inputBox" name="groupName" value="${groupName}" size="40"/>
         <input type="submit" value="${uiLabelMap.CommonRemove}"/>
     </form>
+    <h3>${uiLabelMap.WebtoolsCreateRemovePrimaryKey}</h3>
+    <form method="post" action="${encodeURLCheckDb}">
+        <input type="hidden" name="option" value="createpk"/>
+        ${uiLabelMap.WebtoolsGroupName}: <input type="text" class="inputBox" name="groupName" value="${groupName}" size="20"/>
+        ${uiLabelMap.WebtoolsEntityName}: <input type="text" class="inputBox" name="entityName" value="${entityName}" size="20"/>
+        <input type="submit" value="${uiLabelMap.CommonCreate}"/>
+    </form>
+    <form method="post" action="${encodeURLCheckDb}">
+        <input type="hidden" name="option" value="removepk"/>
+        ${uiLabelMap.WebtoolsGroupName}: <input type="text" class="inputBox" name="groupName" value="${groupName}" size="20"/>
+        ${uiLabelMap.WebtoolsEntityName}: <input type="text" class="inputBox" name="entityName" value="${entityName}" size="20"/>
+        <input type="submit" value="${uiLabelMap.CommonRemove}"/>
+    </form>
     <h3>${uiLabelMap.WebtoolsCreateRemoveAllDeclaredIndices}</h3>
     <form method="post" action="${encodeURLCheckDb}">
         <input type="hidden" name="option" value="createidx"/>