diff --git a/framework/webtools/config/WebtoolsUiLabels.properties b/framework/webtools/config/WebtoolsUiLabels.properties index 42409b1916..5f1950fe39 100644 --- a/framework/webtools/config/WebtoolsUiLabels.properties +++ b/framework/webtools/config/WebtoolsUiLabels.properties @@ -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. diff --git a/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh b/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh index 341393fd22..26ed0b7035 100644 --- a/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh +++ b/framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh @@ -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 : ""); } diff --git a/framework/webtools/webapp/webtools/entity/CheckDb.ftl b/framework/webtools/webapp/webtools/entity/CheckDb.ftl index 366d0acaa5..c1814de776 100644 --- a/framework/webtools/webapp/webtools/entity/CheckDb.ftl +++ b/framework/webtools/webapp/webtools/entity/CheckDb.ftl @@ -54,6 +54,19 @@ under the License. ${uiLabelMap.WebtoolsGroupName}: +

${uiLabelMap.WebtoolsCreateRemovePrimaryKey}

+
+ + ${uiLabelMap.WebtoolsGroupName}: + ${uiLabelMap.WebtoolsEntityName}: + +
+
+ + ${uiLabelMap.WebtoolsGroupName}: + ${uiLabelMap.WebtoolsEntityName}: + +

${uiLabelMap.WebtoolsCreateRemoveAllDeclaredIndices}