Remove some reduntant cast warning in content component (OFBIZ-4102)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1081066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marco Risaliti
2011-03-13 09:53:29 +00:00
parent d0953abc06
commit 2a659162c8
13 changed files with 45 additions and 45 deletions
@@ -237,7 +237,7 @@ public class ContentManagementEvents {
boolean statusIdUpdated = false;
Map<String, Object> results = null;
while (it.hasNext()) {
Object [] arr = (Object [])it.next();
Object [] arr = it.next();
//if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, arr:" + Arrays.asList(arr) , module);
String contentId = (String)arr[0]; // main (2nd level) site id
String origSubContentId = null;
@@ -258,7 +258,7 @@ public class ContentManagementEvents {
}
}
String currentSubContentId = (String)siteIdLookup.get(contentId);
String currentSubContentId = siteIdLookup.get(contentId);
//if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, currentSubContentId:" + currentSubContentId , module);
//if (Debug.infoOn()) Debug.logInfo("in updatePublishLinks, origSubContentId:" + origSubContentId , module);
try {
@@ -332,7 +332,7 @@ public class ContentManagementEvents {
oldActiveValues = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", targContentId, "contentIdTo", contentId, "contentAssocTypeId", "PUBLISH_LINK", "thruDate", null));
iterOldActive = oldActiveValues.iterator();
while (iterOldActive.hasNext()) {
GenericValue cAssoc = (GenericValue)iterOldActive.next();
GenericValue cAssoc = iterOldActive.next();
cAssoc.set("thruDate", nowTimestamp);
cAssoc.store();
}
@@ -970,7 +970,7 @@ public class ContentManagementServices {
if (i > 0) {
// Swap with previous entry
try {
GenericValue prevValue = (GenericValue)listFiltered.get(i-1);
GenericValue prevValue = listFiltered.get(i-1);
Long prevSeqNum = (Long)prevValue.get("sequenceNum");
prevValue.put("sequenceNum", Long.valueOf(seqNum));
prevValue.store();
@@ -983,7 +983,7 @@ public class ContentManagementServices {
} else {
if (i < listFiltered.size()) {
// Swap with next entry
GenericValue nextValue = (GenericValue)listFiltered.get(i+1);
GenericValue nextValue = listFiltered.get(i+1);
nextValue.put("sequenceNum", Long.valueOf(seqNum));
nextValue.store();
seqNum += seqIncrement;
@@ -1510,7 +1510,7 @@ public class ContentManagementServices {
List<GenericValue> listFiltered = EntityUtil.filterByDate(contentRoleList, true);
List<GenericValue> listOrdered = EntityUtil.orderBy(listFiltered, UtilMisc.toList("fromDate DESC"));
if (listOrdered.size() > 0) {
contentRole = (GenericValue) listOrdered.get(0);
contentRole = listOrdered.get(0);
hasExistingContentRole = true;
}
} catch (GenericEntityException e) {
@@ -1592,9 +1592,9 @@ public class ContentManagementServices {
List<GenericValue> listOrdered = EntityUtil.orderBy(listFiltered, UtilMisc.toList("purchaseFromDate", "purchaseThruDate"));
List<GenericValue> listThrusOnly = EntityUtil.filterOutByCondition(listOrdered, EntityCondition.makeCondition("purchaseThruDate", EntityOperator.EQUALS, null));
if (listThrusOnly.size() > 0) {
productContent = (GenericValue) listThrusOnly.get(0);
productContent = listThrusOnly.get(0);
} else if (listOrdered.size() > 0) {
productContent = (GenericValue) listOrdered.get(0);
productContent = listOrdered.get(0);
}
} catch (GenericEntityException e) {
Debug.logError(e.toString(), module);
@@ -1784,7 +1784,7 @@ public class ContentManagementServices {
contentRevisionMap.put("oldDataResourceId", oldDataResourceId);
// need committedByPartyId
for (int i=0; i < parentList.size(); i++) {
String thisContentId = (String)parentList.get(i);
String thisContentId = parentList.get(i);
contentRevisionMap.put("contentId", thisContentId);
result = dispatcher.runSync("persistContentRevisionAndItem", contentRevisionMap);
errorMsg = ServiceUtil.getErrorMessage(result);
@@ -216,7 +216,7 @@ public class ContentManagementWorker {
}
GenericPK cachedPK = null;
if (UtilValidate.isNotEmpty(entityName)) {
cachedPK = (GenericPK)currentEntityMap.get(entityName);
cachedPK = currentEntityMap.get(entityName);
}
getCurrentValueWithCachedPK(request, delegator, cachedPK, entityName);
GenericPK currentPK = (GenericPK)request.getAttribute("currentPK");
@@ -255,7 +255,7 @@ public class ContentManagementWorker {
String sPassed = null;
Object oPassed = null;
Object oCached = null;
String ky = (String)keyIt.next();
String ky = keyIt.next();
oPassed = passedPK.get(ky);
if (oPassed != null) {
sPassed = oPassed.toString();
@@ -355,7 +355,7 @@ public class ContentManagementWorker {
GenericValue contentAssoc = null;
Iterator<GenericValue> it = relatedPubPts.iterator();
while (it.hasNext()) {
contentAssoc = (GenericValue)it.next();
contentAssoc = it.next();
String pub = (String)contentAssoc.get("contentId");
//webSitePublishPoint = delegator.findByPrimaryKeyCache("WebSitePublishPoint", UtilMisc.toMap("contentId", pub));
webSitePublishPoint = getWebSitePublishPoint(delegator, pub, false);
@@ -449,7 +449,7 @@ public class ContentManagementWorker {
public static GenericValue getWebSitePublishPoint(Delegator delegator, String contentId, boolean ignoreCache) throws GenericEntityException {
GenericValue webSitePublishPoint = null;
if (!ignoreCache)
webSitePublishPoint = (GenericValue)cachedWebSitePublishPoints.get(contentId);
webSitePublishPoint = cachedWebSitePublishPoints.get(contentId);
if (webSitePublishPoint == null) {
webSitePublishPoint = delegator.findByPrimaryKey("WebSitePublishPoint", UtilMisc.toMap("contentId", contentId));
@@ -717,7 +717,7 @@ public class ContentManagementWorker {
List<GenericValue> listFiltered = EntityUtil.filterByDate(listAll);
Iterator<GenericValue> iter = listFiltered.iterator();
while (iter.hasNext()) {
GenericValue contentAssoc = (GenericValue)iter.next();
GenericValue contentAssoc = iter.next();
String subContentId = contentAssoc.getString("contentId");
subLeafCount += updateStatsTopDown(delegator, subContentId, typeList);
}
@@ -743,7 +743,7 @@ public class ContentManagementWorker {
List<GenericValue> listFiltered = EntityUtil.filterByDate(listAll);
Iterator<GenericValue> iter = listFiltered.iterator();
while (iter.hasNext()) {
GenericValue contentAssoc = (GenericValue)iter.next();
GenericValue contentAssoc = iter.next();
String contentIdTo = contentAssoc.getString("contentIdTo");
GenericValue contentTo = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentIdTo));
int intLeafCount = 0;
@@ -117,7 +117,7 @@ public class BlogRssServices {
if (contentRecs != null) {
Iterator<GenericValue> i = contentRecs.iterator();
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
GenericValue v = i.next();
String sub = null;
try {
Map<String, Object> dummy = FastMap.newInstance();
@@ -105,7 +105,7 @@ public class ContentServices {
Iterator<GenericValue> it = contentList.iterator();
Map<String, Object> permResults = null;
while (it.hasNext()) {
GenericValue content = (GenericValue) it.next();
GenericValue content = it.next();
serviceInMap.put("currentContent", content);
try {
permResults = dispatcher.runSync("checkContentPermission", serviceInMap);
@@ -284,7 +284,7 @@ public class ContentServices {
try {
List<GenericValue> statusItems = delegator.findByAnd("StatusItem",UtilMisc.toMap("statusTypeId", "CONTENT_STATUS"), UtilMisc.toList("sequenceId"));
if (!UtilValidate.isEmpty(statusItems)) {
content.put("statusId", ((GenericValue) statusItems.get(0)).getString("statusId"));
content.put("statusId", (statusItems.get(0)).getString("statusId"));
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
@@ -845,7 +845,7 @@ public class ContentServices {
Iterator<GenericValue> it = filteredAssocs.iterator();
while (it.hasNext()) {
GenericValue val = (GenericValue) it.next();
GenericValue val = it.next();
val.set("thruDate", nowTimestamp);
val.store();
//if (Debug.infoOn()) Debug.logInfo("in deactivateAssocs, val:" + val, module);
@@ -1070,7 +1070,7 @@ public class ContentServices {
if (mapIn != null) {
Set<Map.Entry<String, Object>> entrySet = mapIn.entrySet();
for (Map.Entry<String, Object> entry : entrySet) {
String key = (String)entry.getKey();
String key = entry.getKey();
if (key.startsWith(prefix)) {
// String keyBase = key.substring(prefix.length());
Object value = entry.getValue();
@@ -1112,7 +1112,7 @@ public class ContentServices {
if (mapIn != null) {
Set<Map.Entry<String, Object>> entrySet = mapIn.entrySet();
for (Map.Entry<String, Object> entry : entrySet) {
String key = (String)entry.getKey();
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof String) {
if (UtilValidate.isNotEmpty(value)) {
@@ -142,7 +142,7 @@ public class ContentServicesComplex {
return ServiceUtil.returnError(e.getMessage());
}
for (int i=0; i < relatedAssocs.size(); i++) {
GenericValue a = (GenericValue)relatedAssocs.get(i);
GenericValue a = relatedAssocs.get(i);
Debug.logVerbose(" contentId:" + a.get("contentId") + " To:" + a.get("caContentIdTo") + " fromDate:" + a.get("caFromDate") + " thruDate:" + a.get("caThruDate") + " AssocTypeId:" + a.get("caContentAssocTypeId"), null);
}
Map<String, Object> results = FastMap.newInstance();
@@ -259,7 +259,7 @@ public class ContentServicesComplex {
if (assocTypes != null && assocTypes.size() > 1) {
Iterator<GenericValue> it = contentAssocsDateFiltered.iterator();
while (it.hasNext()) {
contentAssoc = (GenericValue)it.next();
contentAssoc = it.next();
contentAssocTypeId = (String)contentAssoc.get("contentAssocTypeId");
if (assocTypes.contains(contentAssocTypeId)) {
contentAssocsTypeFiltered.add(contentAssoc);
@@ -283,7 +283,7 @@ public class ContentServicesComplex {
Locale locale = Locale.getDefault(); // TODO: this needs to be passed in
Iterator<GenericValue> it = contentAssocsTypeFiltered.iterator();
while (it.hasNext()) {
contentAssoc = (GenericValue)it.next();
contentAssoc = it.next();
content = contentAssoc.getRelatedOneCache(assocRelationName);
if (UtilValidate.isNotEmpty(contentTypes)) {
String contentTypeId = (String)content.get("contentTypeId");
@@ -613,7 +613,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
try {
List<GenericValue> purposeValueList = content.getRelatedCache("ContentPurpose");
for (int i = 0; i < purposeValueList.size(); i++) {
GenericValue purposeValue = (GenericValue) purposeValueList.get(i);
GenericValue purposeValue = purposeValueList.get(i);
purposes.add(purposeValue.get("contentPurposeTypeId"));
}
} catch (GenericEntityException e) {
@@ -627,7 +627,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
try {
List<GenericValue> sectionValueList = content.getRelatedCache("FromContentAssoc");
for (int i = 0; i < sectionValueList.size(); i++) {
GenericValue sectionValue = (GenericValue) sectionValueList.get(i);
GenericValue sectionValue = sectionValueList.get(i);
String contentAssocPredicateId = (String)sectionValue.get("contentAssocPredicateId");
if (contentAssocPredicateId != null && contentAssocPredicateId.equals("categorizes")) {
sections.add(sectionValue.get("contentIdTo"));
@@ -644,7 +644,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
try {
List<GenericValue> topicValueList = content.getRelatedCache("FromContentAssoc");
for (int i = 0; i < topicValueList.size(); i++) {
GenericValue topicValue = (GenericValue) topicValueList.get(i);
GenericValue topicValue = topicValueList.get(i);
String contentAssocPredicateId = (String)topicValue.get("contentAssocPredicateId");
if (contentAssocPredicateId != null && contentAssocPredicateId.equals("topifies"))
topics.add(topicValue.get("contentIdTo"));
@@ -689,7 +689,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
//if (Debug.infoOn()) Debug.logInfo("traverse, relatedViews:" + relatedViews,null);
Iterator<GenericValue> it = relatedViews.iterator();
while (it.hasNext()) {
GenericValue assocValue = (GenericValue) it.next();
GenericValue assocValue = it.next();
Map<String, Object> thisNode = ContentWorker.makeNode(assocValue);
checkConditions(delegator, thisNode, null, whenMap);
// boolean isReturnBeforePick = booleanDataType(thisNode.get("isReturnBeforePick"));
@@ -852,7 +852,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
List<EntityExpr> exprListOr = FastList.newInstance();
Iterator<String> it = assocTypes.iterator();
while (it.hasNext()) {
String assocType = (String) it.next();
String assocType = it.next();
expr = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.EQUALS, assocType);
exprListOr.add(expr);
}
@@ -934,7 +934,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
List<GenericValue> lst2 = EntityUtil.filterByDate(lst);
//if (Debug.infoOn()) Debug.logInfo("getContentAncestry, lst2:" + lst2, "");
if (lst2.size() > 0) {
GenericValue contentAssoc = (GenericValue)lst2.get(0);
GenericValue contentAssoc = lst2.get(0);
getContentAncestry(delegator, contentAssoc.getString(contentIdOtherField), contentAssocTypeId, direction, contentAncestorList);
contentAncestorList.add(contentAssoc);
}
@@ -964,7 +964,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
//if (Debug.infoOn()) Debug.logInfo("getContentAncestry, lst2:" + lst2, "");
Iterator<GenericValue> iter = lst2.iterator();
while (iter.hasNext()) {
GenericValue contentAssoc = (GenericValue)iter.next();
GenericValue contentAssoc = iter.next();
String contentIdOther = contentAssoc.getString(contentIdOtherField);
if (!contentAncestorList.contains(contentIdOther)) {
getContentAncestryAll(delegator, contentIdOther, passedContentTypeId, direction, contentAncestorList);
@@ -1020,7 +1020,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
List<GenericValue> lst2 = EntityUtil.filterByDate(lst);
//if (Debug.infoOn()) Debug.logInfo("getContentAncestry, lst2:" + lst2, "");
if (lst2.size() > 0) {
GenericValue contentAssoc = (GenericValue)lst2.get(0);
GenericValue contentAssoc = lst2.get(0);
getContentAncestryValues(delegator, contentAssoc.getString(contentIdOtherField), contentAssocTypeId, direction, contentAncestorList);
GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentAssoc.getString(contentIdOtherField)));
@@ -1415,7 +1415,7 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface {
GenericValue val = null;
if (filteredList.size() > 0) {
val = (GenericValue)filteredList.get(0);
val = filteredList.get(0);
}
return val;
}
@@ -101,7 +101,7 @@ public class UploadContentAndImage {
FileItem imageFi = null;
byte[] imageBytes = {};
for (int i = 0; i < lst.size(); i++) {
fi = (FileItem) lst.get(i);
fi = lst.get(i);
//String fn = fi.getName();
String fieldName = fi.getFieldName();
if (fi.isFormField()) {
@@ -368,7 +368,7 @@ public class UploadContentAndImage {
byte[] imageBytes = {};
passedParams.put("userLogin", userLogin);
for (int i = 0; i < lst.size(); i++) {
fi = (FileItem) lst.get(i);
fi = lst.get(i);
//String fn = fi.getName();
String fieldName = fi.getFieldName();
if (fi.isFormField()) {
@@ -467,7 +467,7 @@ public class UploadContentAndImage {
Map<String, Object> ftlContext2 = FastMap.newInstance();
Map<String, Object> ftlContext3 = FastMap.newInstance();
while (iter.hasNext()) {
String keyName = (String)iter.next();
String keyName = iter.next();
Object obj = passedParams.get(keyName + suffix);
ftlContext2.put(keyName, obj);
}
@@ -595,7 +595,7 @@ public class LayoutEvents {
Collection<String> keyColl = passedPK.getAllKeys();
Iterator<String> keyIt = keyColl.iterator();
while (keyIt.hasNext()) {
String attrName = (String)keyIt.next();
String attrName = keyIt.next();
String attrVal = (String)request.getAttribute(attrName);
if (attrVal == null) {
attrVal = (String)paramMap.get(attrName);
@@ -114,7 +114,7 @@ public class LayoutWorker {
}
public static ByteBuffer returnByteBuffer(Map<String, ByteBuffer> map) {
ByteBuffer byteBuff = (ByteBuffer)map.get("imageData");
ByteBuffer byteBuff = map.get("imageData");
return byteBuff;
}
}
@@ -283,7 +283,7 @@ public class PdfSurveyServices {
continue;
}
GenericValue surveyQuestionAndAppl = (GenericValue)questions.get(0);
GenericValue surveyQuestionAndAppl = questions.get(0);
String surveyQuestionId = (String)surveyQuestionAndAppl.get("surveyQuestionId");
String surveyQuestionTypeId = (String)surveyQuestionAndAppl.get("surveyQuestionTypeId");
GenericValue surveyResponseAnswer = delegator.makeValue("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId, "surveyQuestionId", surveyQuestionId));
@@ -379,7 +379,7 @@ public class SurveyWrapper {
if (UtilValidate.isNotEmpty(passThru)) {
Iterator<String> i = passThru.keySet().iterator();
while (i.hasNext()) {
String key = (String) i.next();
String key = i.next();
if (key.toUpperCase().startsWith("ANSWERS_")) {
int splitIndex = key.indexOf('_');
String questionId = key.substring(splitIndex+1);
@@ -486,7 +486,7 @@ public class SurveyWrapper {
Iterator<String> i = thisResult.keySet().iterator();
while (i.hasNext()) {
Map<String, Object> optMap = FastMap.newInstance();
String optId = (String) i.next();
String optId = i.next();
Long optTotal = (Long) thisResult.get(optId);
if (optTotal == null) {
optTotal = Long.valueOf(0);
@@ -553,7 +553,7 @@ public class SurveyWrapper {
if (eli != null) {
GenericValue value;
while (((value = (GenericValue) eli.next()) != null)) {
while (((value = eli.next()) != null)) {
if ("Y".equalsIgnoreCase(value.getString("booleanResponse"))) {
result[1]++;
} else {
@@ -600,7 +600,7 @@ public class SurveyWrapper {
if (eli != null) {
GenericValue value;
while (((value = (GenericValue) eli.next()) != null)) {
while (((value = eli.next()) != null)) {
switch (type) {
case 1:
Long n = value.getLong("numericResponse");
@@ -688,7 +688,7 @@ public class SurveyWrapper {
EntityListIterator eli = this.getEli(question, -1);
if (eli != null) {
GenericValue value;
while (((value = (GenericValue) eli.next()) != null)) {
while (((value = eli.next()) != null)) {
String optionId = value.getString("surveyOptionSeqId");
if (UtilValidate.isNotEmpty(optionId)) {
Long optCount = (Long) result.remove(optionId);
@@ -90,7 +90,7 @@ public class LoopSubContentTransform implements TemplateTransformModel {
} else if (i >= lst.size()) {
return false;
}
GenericValue subContentDataResourceView = (GenericValue) lst.get(i);
GenericValue subContentDataResourceView = lst.get(i);
ctx.put("subContentDataResourceView", subContentDataResourceView);
GenericValue electronicText = null;
try {