You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/02/20 23:53:09 UTC
svn commit: r912243 - in /ofbiz/trunk:
applications/content/webapp/content/WEB-INF/actions/content/
framework/webtools/webapp/webtools/WEB-INF/actions/entity/
framework/webtools/webapp/webtools/entity/
Author: lektran
Date: Sat Feb 20 22:53:09 2010
New Revision: 912243
URL: http://svn.apache.org/viewvc?rev=912243&view=rev
Log:
Removed all uses of deprecated method ModelEntity.getField(int)
Modified:
ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewGeneric.groovy
ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp
ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelInduceFromDb.jsp
ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp
Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy?rev=912243&r1=912242&r2=912243&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy Sat Feb 20 22:53:09 2010
@@ -48,8 +48,9 @@
ModelEntity modelEntity = reader.getModelEntity("ContentAssocViewTo");
GenericEntity findByEntity = delegator.makeValue("ContentAssocViewTo");
List errMsgList = FastList.newInstance();
-for (int fnum = 0; fnum < modelEntity.getFieldsSize(); fnum++) {
- ModelField field = modelEntity.getField(fnum);
+Iterator fieldIterator = modelEntity.getFieldsIterator();
+while (fieldIterator.hasNext()) {
+ ModelField field = fieldIterator.next();
String fval = parameters.get(field.getName());
if (fval != null) {
if (fval.length() > 0) {
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy?rev=912243&r1=912242&r2=912243&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy Sat Feb 20 22:53:09 2010
@@ -85,8 +85,9 @@
GenericEntity findByEntity = delegator.makeValue(entityName);
List errMsgList = FastList.newInstance();
-for (int fnum = 0; fnum < modelEntity.getFieldsSize(); fnum++) {
- ModelField field = modelEntity.getField(fnum);
+Iterator fieldIterator = modelEntity.getFieldsIterator();
+while (fieldIterator.hasNext()) {
+ ModelField field = fieldIterator.next();
String fval = parameters.get(field.getName());
if (fval != null) {
if (fval.length() > 0) {
@@ -206,8 +207,9 @@
context.viewIndexLast = viewIndexLast;
List fieldList = FastList.newInstance();
-for (int fnum = 0; fnum < modelEntity.getFieldsSize(); fnum++) {
- ModelField field = modelEntity.getField(fnum);
+fieldIterator = modelEntity.getFieldsIterator();
+while (fieldIterator.hasNext()) {
+ ModelField field = fieldIterator.next();
ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType());
Map fieldMap = FastMap.newInstance();
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewGeneric.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewGeneric.groovy?rev=912243&r1=912242&r2=912243&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewGeneric.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewGeneric.groovy Sat Feb 20 22:53:09 2010
@@ -93,10 +93,11 @@
if (value != null) {
List fieldList = FastList.newInstance();
- for (int fnum = 0; fnum < entity.getFieldsSize(); fnum++) {
+ Iterator fieldIterator = entity.getFieldsIterator();
+ while (fieldIterator.hasNext()) {
Map mapField = FastMap.newInstance();
- ModelField field = entity.getField(fnum);
+ ModelField field = fieldIterator.next();
ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
String fieldValue = "";
@@ -326,9 +327,10 @@
}
List relatedFieldsList = FastList.newInstance();
- for (int fnum = 0; fnum < relatedEntity.getFieldsSize(); fnum++) {
+ Iterator relFieldIterator = relEntity.getFieldsIterator();
+ while (relFieldIterator.hasNext()) {
Map mapRelatedFields = FastMap.newInstance();
- ModelField field = relatedEntity.getField(fnum);
+ ModelField field = relFieldIterator.next();
ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
String fieldValue = "";
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp?rev=912243&r1=912242&r2=912243&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/EditEntity.jsp Sat Feb 20 22:53:09 2010
@@ -334,8 +334,9 @@
<B>FIELDS</B>
<TABLE border='1' cellpadding='2' cellspacing='0'>
<TR><TD>Field Name</TD><TD>Column Name (Length)</TD><TD>Field Type</TD><TD> </TD><TD> </TD></TR>
- <%for (int f = 0; f < entity.getFieldsSize(); f++) {%>
- <%ModelField field = entity.getField(f);%>
+ <%Iterator<ModelField> fieldIterator = entity.getFieldsIterator(); %>
+ <%while (fieldIterator.hasNext()) {%>
+ <%ModelField field = fieldIterator.next();%>
<TR>
<TD><%=field.getIsPk()?"<B>":""%><%=field.getName()%><%=field.getIsPk()?"</B>":""%></TD>
<TD><%=field.getColName()%> (<%=field.getColName().length()%>)</TD>
@@ -465,16 +466,18 @@
<SELECT name='fieldName' class='selectBox'>
<OPTION selected><%=keyMap.getFieldName()%></OPTION>
<OPTION> </OPTION>
- <%for (int fld=0; fld<entity.getFieldsSize(); fld++) {%>
- <OPTION><%=entity.getField(fld).getName()%></OPTION>
+ <%Iterator<ModelField> fieldIterator = entity.getFieldsIterator(); %>
+ <%while (fieldIterator.hasNext()) {%>
+ <OPTION><%=fieldIterator.next().getName()%></OPTION>
<%}%>
</SELECT>
Related:
<SELECT name='relFieldName' class='selectBox'>
<OPTION selected><%=keyMap.getRelFieldName()%></OPTION>
<OPTION> </OPTION>
- <%for (int fld=0; fld<relEntity.getFieldsSize(); fld++) {%>
- <OPTION><%=relEntity.getField(fld).getName()%></OPTION>
+ <%Iterator<ModelField> relFieldIterator = entity.getFieldsIterator(); %>
+ <%while (relFieldIterator.hasNext()) {%>
+ <OPTION><%=relFieldIterator.next().getName()%></OPTION>
<%}%>
</SELECT>
</td>
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelInduceFromDb.jsp
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelInduceFromDb.jsp?rev=912243&r1=912242&r2=912243&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelInduceFromDb.jsp (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelInduceFromDb.jsp Sat Feb 20 22:53:09 2010
@@ -113,8 +113,9 @@
author="<%=entity.getAuthor()%>"<%}%><%if(!version.equals(entity.getVersion())){%>
version="<%=entity.getVersion()%>"<%}%>><%if(!description.equals(entity.getDescription())){%>
<description><%=entity.getDescription()%></description><%}%><%
- for (int y = 0; y < entity.getFieldsSize(); y++) {
- ModelField field = entity.getField(y);%>
+ Iterator<ModelField> fieldIterator = entity.getFieldsIterator();
+ while (fieldIterator.hasNext()) {
+ ModelField field = fieldIterator.next();%>
<field name="<%=field.getName()%>"<%if(!field.getColName().equals(ModelUtil.javaNameToDbName(field.getName()))){
%> col-name="<%=field.getColName()%>"<%}%> type="<%=field.getType()%>"><%
for (int v = 0; v<field.getValidatorsSize(); v++) {
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp?rev=912243&r1=912242&r2=912243&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/ModelWriter.jsp Sat Feb 20 22:53:09 2010
@@ -207,8 +207,9 @@
author="<%=entity.getAuthor()%>"<%}%><%if (!version.equals(entity.getVersion())) {%>
version="<%=entity.getVersion()%>"<%}%>><%if (!description.equals(entity.getDescription())) {%>
<description><%=entity.getDescription()%></description><%}%><%
- for (int y = 0; y < entity.getFieldsSize(); y++) {
- ModelField field = entity.getField(y);
+ Iterator<ModelField> fieldIterator = entity.getFieldsIterator();
+ while (fieldIterator.hasNext()) {
+ ModelField field = fieldIterator.next();
if (!ignoredFields.contains(field.getName())) {%>
<field name="<%=field.getName()%>"<%if (!field.getName().equals(ModelUtil.dbNameToVarName(field.getColName()))){
%> col-name="<%=field.getColName()%>"<%}%> type="<%=field.getType()%>"><%