Somes cleanups and fixes, wasn't working before; also added forms to create/remove a single primary key
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@501221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -72,6 +72,7 @@ WebtoolsCreateRemoveAllDeclaredIndices=Create/Remove All Declared Indices
|
||||
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.
|
||||
|
||||
@@ -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 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
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 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
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 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
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 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
}
|
||||
context.put("encodeURLCheckDb", response.encodeURL(controlPath + "/view/checkdb"));
|
||||
context.put("groupName", (groupName != null) ? groupName : "org.ofbiz");
|
||||
context.put("entityName", (entityName != null) ? entityName : "");
|
||||
}
|
||||
|
||||
@@ -54,6 +54,19 @@ under the License.
|
||||
${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"/>
|
||||
|
||||
Reference in New Issue
Block a user