Much improved Entity Reference Chart in Webtools. Cleaned up HTML, added indexes to chart. Once the patch in OFBIZ-1389 is committed, then the commented lines in EntityRefMain.bsh can be uncommented and the chart will have even more info.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@593351 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -167,6 +167,8 @@ WebtoolsImportFile=Import File
|
||||
WebtoolsImportText=Import Text
|
||||
WebtoolsImportToDataSource=XML Import to DataSource(s)
|
||||
WebtoolsImportUpdateToDB=Import/Update to DB?
|
||||
WebtoolsIndexName=Index Name
|
||||
WebtoolsIndexFieldList=Index Field List
|
||||
WebtoolsInduceModelXMLFromDatabase=Induce Model XML from Database
|
||||
WebtoolsInfoLogLevel=Info
|
||||
WebtoolsInfoLogLevelTooltip=The Info level designates informational messages that highlight the progress of the application at coarse-grained level.
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.ofbiz.entity.model.ModelReader;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
import org.ofbiz.entity.model.ModelField;
|
||||
import org.ofbiz.entity.model.ModelFieldType;
|
||||
import org.ofbiz.entity.model.ModelIndex;
|
||||
import org.ofbiz.entity.model.ModelRelation;
|
||||
import org.ofbiz.entity.model.ModelKeyMap;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
@@ -97,9 +98,10 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
ModelField field = entity.getField(y);
|
||||
ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
|
||||
String javaName = null;
|
||||
javaName = field.getIsPk() ? "<span style=\"color: red;\">" + field.getName() + "</span>" : field.getName();
|
||||
javaNameMap.put("name", javaName);
|
||||
javaNameMap.put("isPk", new Boolean(field.getIsPk()));
|
||||
javaNameMap.put("name", field.getName());
|
||||
javaNameMap.put("colName", field.getColName());
|
||||
javaNameMap.put("description", field.getDescription());
|
||||
javaNameMap.put("type", (field.getType()) != null ? field.getType() : null);
|
||||
javaNameMap.put("javaType", (field.getType() != null && type != null) ? type.getJavaType() : "Undefined");
|
||||
javaNameMap.put("sqlType", (type != null && type.getSqlType() != null) ? type.getSqlType() : "Undefined");
|
||||
@@ -108,7 +110,6 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
}
|
||||
|
||||
List relationsList = new ArrayList();
|
||||
TreeSet relations = new TreeSet();
|
||||
for (int r = 0; r < entity.getRelationsSize(); r++) {
|
||||
Map relationMap = new HashMap();
|
||||
|
||||
@@ -133,6 +134,7 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
keysList.add(keysMap);
|
||||
}
|
||||
relationMap.put("title", relation.getTitle());
|
||||
//relationMap.put("description", relation.getDescription());
|
||||
relationMap.put("relEntity", relation.getRelEntityName());
|
||||
relationMap.put("fkName", relation.getFkName());
|
||||
relationMap.put("type", relation.getType());
|
||||
@@ -142,14 +144,32 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
relationsList.add(relationMap);
|
||||
}
|
||||
|
||||
List indexList = new ArrayList();
|
||||
for (int i = 0; i < entity.getIndexesSize(); i++) {
|
||||
List fieldNameList = new ArrayList();
|
||||
|
||||
ModelIndex index = entity.getIndex(i);
|
||||
for (Iterator fieldIterator = index.getIndexFieldsIterator(); fieldIterator.hasNext();) {
|
||||
fieldNameList.add((String)fieldIterator.next());
|
||||
}
|
||||
|
||||
Map indexMap = new HashMap();
|
||||
indexMap.put("name", index.getName());
|
||||
//indexMap.put("description", index.getDescription());
|
||||
indexMap.put("fieldNameList", fieldNameList);
|
||||
indexList.add(indexMap);
|
||||
}
|
||||
|
||||
entityMap.put("entityName", entityName);
|
||||
entityMap.put("helperName", helperName);
|
||||
entityMap.put("groupName", groupName);
|
||||
entityMap.put("plainTableName", entity.getPlainTableName());
|
||||
entityMap.put("title", entity.getTitle());
|
||||
entityMap.put("description", entity.getDescription());
|
||||
//entityMap.put("location", entity.getLocation());
|
||||
entityMap.put("javaNameList", javaNameList);
|
||||
entityMap.put("relationsList", relationsList);
|
||||
entityMap.put("indexList", indexList);
|
||||
entitiesList.add(entityMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,37 +16,49 @@ KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<html>
|
||||
<#assign docLangAttr = locale.toString()?replace("_", "-")>
|
||||
<#assign langDir = "ltr">
|
||||
<#if "ar.iw"?contains(docLangAttr?substring(0, 2))>
|
||||
<#assign langDir = "rtl">
|
||||
</#if>
|
||||
|
||||
<html lang="${docLangAttr}" dir="${langDir}" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>${uiLabelMap.WebtoolsEntityReference}</title>
|
||||
<style>
|
||||
.packagetext {font-family: Helvetica,sans-serif; font-size: 18pt; font-weight: bold; text-decoration: none; color: black;}
|
||||
.toptext {font-family: Helvetica,sans-serif; font-size: 16pt; font-weight: bold; text-decoration: none; color: black;}
|
||||
.titletext {font-family: Helvetica,sans-serif; font-size: 12pt; font-weight: bold; text-decoration: none; color: blue;}
|
||||
.headertext {font-family: Helvetica,sans-serif; font-size: 8pt; font-weight: bold; text-decoration: none; background-color: blue; color: white;}
|
||||
.enametext {font-family: Helvetica,sans-serif; font-size: 8pt; font-weight: bold; text-decoration: none; color: black;}
|
||||
.entitytext {font-family: Helvetica,sans-serif; font-size: 8pt; text-decoration: none; color: black;}
|
||||
.relationtext {font-family: Helvetica,sans-serif; font-size: 8pt; text-decoration: none; color: black;}
|
||||
A.rlinktext {font-family: Helvetica,sans-serif; font-size: 8pt; font-weight: bold; text-decoration: none; color: blue;}
|
||||
A.rlinktext:hover {color:red;}
|
||||
body, textarea, input, select {font-family: Helvetica, sans-serif; background-color: #ffffff;}
|
||||
.packagetext {font-size: 18pt; font-weight: bold; text-align: center}
|
||||
.toptext {font-size: 16pt; font-weight: bold; text-align: center}
|
||||
.titletext {font-size: 12pt; font-weight: bold; color: blue;}
|
||||
.headertext {font-size: 8pt; font-weight: bold; background-color: blue; color: white;}
|
||||
.enametext {font-size: 8pt; font-weight: bold;}
|
||||
.entityheader {font-size: 8pt; font-weight: bold; background-color: #cccccc; text-align: center}
|
||||
.entityheader a {font-weight: normal;}
|
||||
.entityheader a:hover {color:red;}
|
||||
.entitytext {font-size: 8pt; background-color: #efffff;}
|
||||
.relationtext {font-size: 8pt; background-color: #feeeee;}
|
||||
.relationtext a {font-weight: bold; color: blue;}
|
||||
.relationtext a:hover {color:red;}
|
||||
.pktext {color:red;}
|
||||
.descriptiontext {font-size: 8pt;}
|
||||
</style>
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<div align="center">
|
||||
<body>
|
||||
<div class='toptext'>${uiLabelMap.WebtoolsEntityReferenceChart}<br/>
|
||||
${numberOfEntities} ${uiLabelMap.WebtoolsTotalEntities}
|
||||
</div>
|
||||
<#assign numberShowed = 0>
|
||||
<#list packagesList as package>
|
||||
<a name='${package.packageName}'></a><hr/>
|
||||
<div class='packagetext'>${package.packageName}</div><hr/>
|
||||
<hr/><div id='${package.packageName}' class='packagetext'>${package.packageName}</div><hr/>
|
||||
<#list package.entitiesList as entity>
|
||||
<a name="${entity.entityName}"></a>
|
||||
<table width="95%" border="1" cellpadding='2' cellspacing='0'>
|
||||
<tr bgcolor="#CCCCCC">
|
||||
<td colspan="5">
|
||||
<div align="center" class="titletext">${uiLabelMap.WebtoolsEntity}: ${entity.entityName} | ${uiLabelMap.WebtoolsTable}: ${entity.plainTableName?if_exists}</div>
|
||||
<div align="center" class="entitytext"><b>${entity.title}</b>
|
||||
<tr class='entityheader'>
|
||||
<td colspan="5">
|
||||
<div id='${entity.entityName}' class="titletext">
|
||||
${uiLabelMap.WebtoolsEntity}: ${entity.entityName}
|
||||
<#if entity.plainTableName?has_content> | ${uiLabelMap.WebtoolsTable}: ${entity.plainTableName}</#if>
|
||||
</div>
|
||||
<div>${entity.title}
|
||||
<#if !forstatic>
|
||||
<#assign encodeURL = response.encodeURL(controlPath + "/FindGeneric?entityName=" + entity.entityName + "&find=true&VIEW_SIZE=50&VIEW_INDEX=0")>
|
||||
<a target='main' href="${encodeURL}">[${uiLabelMap.WebtoolsViewData}]</a>
|
||||
@@ -55,56 +67,64 @@ under the License.
|
||||
<#if entity.description?has_content &&
|
||||
!entity.description.equalsIgnoreCase("NONE") &&
|
||||
!entity.description.equalsIgnoreCase("")>
|
||||
<div align="center" class="entitytext">${entity.description}</div>
|
||||
<div>${entity.description}</div>
|
||||
</#if>
|
||||
<#if entity.location?has_content>
|
||||
<div class='description'>${entity.location}</div>
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='headertext'>
|
||||
<td width="30%" align="center">${uiLabelMap.WebtoolsJavaName}</td>
|
||||
<td width="30%" align="center">${uiLabelMap.WebtoolsDbName}</td>
|
||||
<td width="10%" align="center">${uiLabelMap.WebtoolsFieldType}</td>
|
||||
<td width="15%" align="center">${uiLabelMap.WebtoolsJavaType}</td>
|
||||
<td width="15%" align="center" nowrap>${uiLabelMap.WebtoolsSqlType}</td>
|
||||
<th width="30%">${uiLabelMap.WebtoolsJavaName}</th>
|
||||
<th width="30%">${uiLabelMap.WebtoolsDbName}</th>
|
||||
<th width="10%">${uiLabelMap.WebtoolsFieldType}</th>
|
||||
<th width="15%">${uiLabelMap.WebtoolsJavaType}</th>
|
||||
<th width="15%" nowrap>${uiLabelMap.WebtoolsSqlType}</th>
|
||||
</tr>
|
||||
<#list entity.javaNameList as javaName>
|
||||
<tr bgcolor="#EFFFFF">
|
||||
<td><div align="left" class='enametext'>${javaName.name}</div></td>
|
||||
<td><div align="left" class='entitytext'>${javaName.colName}</div></td>
|
||||
<td><div align="left" class='entitytext'>${javaName.type}</div></td>
|
||||
<tr class='entitytext'>
|
||||
<td>
|
||||
<div class='enametext<#if javaName.isPk> pktext</#if>'>${javaName.name}</div>
|
||||
<#if javaName.description?has_content>
|
||||
<div class="descriptiontext">${javaName.description}</div>
|
||||
</#if>
|
||||
</td>
|
||||
<td>${javaName.colName}</td>
|
||||
<td>${javaName.type}</td>
|
||||
<#if javaName.javaType?has_content>
|
||||
<td><div align="left" class='entitytext'>${javaName.javaType}</div></td>
|
||||
<td><div align="left" class='entitytext'>${javaName.sqlType}</div></td>
|
||||
<td>${javaName.javaType}</td>
|
||||
<td>${javaName.sqlType}</td>
|
||||
<#else>
|
||||
<td><div align="left" class='entitytext'>${uiLabelMap.WebtoolsNotFound}</div></td>
|
||||
<td><div align="left" class='entitytext'>${uiLabelMap.WebtoolsNotFound}</div></td>
|
||||
<td>${uiLabelMap.WebtoolsNotFound}</td>
|
||||
<td>${uiLabelMap.WebtoolsNotFound}</td>
|
||||
</#if>
|
||||
</tr>
|
||||
</#list>
|
||||
<tr bgcolor="#FFCCCC">
|
||||
<td colspan="5"><hr/></td>
|
||||
</tr>
|
||||
<tr class='headertext'>
|
||||
<td align="center">${uiLabelMap.WebtoolsRelation}</td>
|
||||
<td align="center" colspan='4'>${uiLabelMap.WebtoolsRelationType}</td>
|
||||
</tr>
|
||||
<#if entity.relationsList?has_content>
|
||||
<tr class='entityheader'>
|
||||
<td colspan="5"><hr/></td>
|
||||
</tr>
|
||||
<tr class='headertext'>
|
||||
<th>${uiLabelMap.WebtoolsRelation}</th>
|
||||
<th colspan='4'>${uiLabelMap.WebtoolsRelationType}</th>
|
||||
</tr>
|
||||
<#list entity.relationsList as relation>
|
||||
<tr bgcolor="#FEEEEE">
|
||||
<tr class='relationtext'>
|
||||
<td>
|
||||
<div align="left" class='relationtext'>
|
||||
<b>${relation.title}</b><A href='#${relation.relEntity}' class='rlinktext'>${relation.relEntity}</A>
|
||||
</div>
|
||||
<#if relation.title?has_content><b>${relation.title}</b> </#if><a href='#${relation.relEntity}'>${relation.relEntity}</a>
|
||||
<#if relation.fkName?has_content>
|
||||
<div class='relationtext'>${uiLabelMap.WebtoolsFKName}: ${relation.fkName}</div>
|
||||
<br/>${uiLabelMap.WebtoolsFKName}: ${relation.fkName}
|
||||
</#if>
|
||||
<#if relation.description?has_content>
|
||||
<br/><span class='descriptiontext'>${relation.description}</span>
|
||||
</#if>
|
||||
</td>
|
||||
<td width="60%" colspan='4'>
|
||||
<div align="left" class='relationtext'>
|
||||
${relation.type}:
|
||||
<#if relation.length == 3>
|
||||
|
||||
</#if>
|
||||
<#if relation.keysList?has_content>
|
||||
${relation.type}:
|
||||
<#if relation.length == 3>
|
||||
|
||||
</#if>
|
||||
<#if relation.keysList?has_content>
|
||||
<#list relation.keysList as keyList>
|
||||
<br/> ${keyList.row})
|
||||
<#if keyList.fieldName == keyList.relFieldName>
|
||||
@@ -113,8 +133,26 @@ under the License.
|
||||
${keyList.fieldName} : ${keyList.relFieldName}
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</div>
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
<#if entity.indexList?has_content>
|
||||
<tr class='entityheader'>
|
||||
<td colspan="5"><hr/></td>
|
||||
</tr>
|
||||
<tr class='headertext'>
|
||||
<th>${uiLabelMap.WebtoolsIndexName}</th>
|
||||
<th colspan='4'>${uiLabelMap.WebtoolsIndexFieldList}</th>
|
||||
</tr>
|
||||
<#list entity.indexList as index>
|
||||
<tr class='relationtext'>
|
||||
<td>${index.name}</td>
|
||||
<td width="60%" colspan='4'>
|
||||
<#list index.fieldNameList as fieldName>
|
||||
${fieldName}
|
||||
</#list>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
||||
Reference in New Issue
Block a user