Fix several generics warnings.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@898090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -33,6 +33,7 @@ import javolution.util.FastMap;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.ObjectType;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.base.util.collections.LRUMap;
|
||||
import org.ofbiz.base.util.collections.ReadOnlyMapEntry;
|
||||
@@ -224,11 +225,11 @@ public class CacheLineTable<K, V> implements Serializable {
|
||||
jdbm.helper.FastIterator iter = fileTable.keys();
|
||||
Object key = iter.next();
|
||||
while (key != null) {
|
||||
CacheLine<V> value = (CacheLine<V>) fileTable.get(key);
|
||||
CacheLine<V> value = UtilGenerics.cast(fileTable.get(key));
|
||||
if (key instanceof ObjectType.NullObject) {
|
||||
key = null;
|
||||
}
|
||||
list.add(new ReadOnlyMapEntry<K, CacheLine<V>>((K) key, value));
|
||||
list.add(new ReadOnlyMapEntry<K, CacheLine<V>>(UtilGenerics.<K>cast(key), value));
|
||||
key = iter.next();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.eclipse.birt.report.engine.api.PDFRenderOption;
|
||||
import org.eclipse.birt.report.engine.api.RenderOption;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.GeneralException;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.birt.container.BirtContainer;
|
||||
import org.ofbiz.entity.Delegator;
|
||||
import org.ofbiz.entity.jdbc.ConnectionFactory;
|
||||
@@ -62,7 +63,7 @@ public class BirtWorker {
|
||||
* @throws GeneralException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static void exportReport(IReportRunnable design, Map context, String contentType, OutputStream output)
|
||||
public static void exportReport(IReportRunnable design, Map<String, ? extends Object> context, String contentType, OutputStream output)
|
||||
throws EngineException, GeneralException, SQLException {
|
||||
|
||||
Locale birtLocale = (Locale)context.get(BIRT_LOCALE);
|
||||
@@ -95,7 +96,7 @@ public class BirtWorker {
|
||||
}
|
||||
|
||||
// set parameters if exists
|
||||
Map parameters = (Map)context.get(BirtWorker.BIRT_PARAMETERS);
|
||||
Map<String, Object> parameters = UtilGenerics.cast(context.get(BirtWorker.BIRT_PARAMETERS));
|
||||
if (parameters != null) {
|
||||
Debug.logInfo("Set birt parameters:" + parameters, module);
|
||||
task.setParameterValues(parameters);
|
||||
@@ -126,7 +127,7 @@ public class BirtWorker {
|
||||
} else if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_PDF)) {
|
||||
// set pdf render options
|
||||
PDFRenderOption pdfOptions = new PDFRenderOption(options);
|
||||
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, new Boolean(true) );
|
||||
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE );
|
||||
} else if (options.getOutputFormat().equalsIgnoreCase("xls")) {
|
||||
// set excel render options
|
||||
EXCELRenderOption excelOptions = new EXCELRenderOption(options);
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.ofbiz.base.container.ContainerConfig;
|
||||
import org.ofbiz.base.container.ContainerException;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.FileUtil;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilObject;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
import org.ofbiz.entity.Delegator;
|
||||
@@ -93,7 +94,7 @@ public class BirtContainer implements Container {
|
||||
osgiConfig.put("osgi.configuration.area", new File(System.getProperty("ofbiz.home"), "runtime" + File.separator + "tempfiles").getPath());
|
||||
config.setOSGiConfig(osgiConfig);
|
||||
|
||||
HashMap context = config.getAppContext();
|
||||
HashMap<String, Object> context = UtilGenerics.cast(config.getAppContext());
|
||||
|
||||
// set delegator, dispatcher and security objects to report
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.eclipse.birt.report.engine.api.IReportEngine;
|
||||
import org.eclipse.birt.report.engine.api.IReportRunnable;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.GeneralException;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.base.util.collections.MapStack;
|
||||
@@ -75,9 +76,9 @@ public class BirtEmailServices {
|
||||
String birtReportLocation = (String) serviceContext.remove("birtReportLocation");
|
||||
String attachmentName = (String) serviceContext.remove("attachmentName");
|
||||
Locale locale = (Locale) serviceContext.get("locale");
|
||||
Map bodyParameters = (Map) serviceContext.remove("bodyParameters");
|
||||
Map<String, Object> bodyParameters = UtilGenerics.cast(serviceContext.remove("bodyParameters"));
|
||||
Locale birtLocale = (Locale) serviceContext.remove(BirtWorker.BIRT_LOCALE);
|
||||
Map birtParameters = (Map) serviceContext.remove(BirtWorker.BIRT_PARAMETERS);
|
||||
Map<String, Object> birtParameters = UtilGenerics.cast(serviceContext.remove(BirtWorker.BIRT_PARAMETERS));
|
||||
String birtImageDirectory = (String) serviceContext.remove(BirtWorker.BIRT_IMAGE_DIRECTORY);
|
||||
String birtContentType = (String) serviceContext.remove(BirtWorker.BIRT_CONTENT_TYPE);
|
||||
if (bodyParameters == null) {
|
||||
@@ -99,7 +100,7 @@ public class BirtEmailServices {
|
||||
}
|
||||
StringWriter bodyWriter = new StringWriter();
|
||||
|
||||
MapStack screenContext = MapStack.create();
|
||||
MapStack<String> screenContext = MapStack.create();
|
||||
screenContext.put("locale", locale);
|
||||
ScreenRenderer screens = new ScreenRenderer(bodyWriter, screenContext, htmlScreenRenderer);
|
||||
screens.populateContextForService(ctx, bodyParameters);
|
||||
@@ -137,7 +138,7 @@ public class BirtEmailServices {
|
||||
// create the output stream for the generation
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
Map birtContext = FastMap.newInstance();
|
||||
Map<String, Object> birtContext = FastMap.newInstance();
|
||||
if (birtLocale == null) {
|
||||
birtLocale = locale;
|
||||
}
|
||||
@@ -161,7 +162,7 @@ public class BirtEmailServices {
|
||||
baos.close();
|
||||
|
||||
// store in the list of maps for sendmail....
|
||||
List bodyParts = FastList.newInstance();
|
||||
List<Map<String, ? extends Object>> bodyParts = FastList.newInstance();
|
||||
if (bodyText != null) {
|
||||
bodyText = FlexibleStringExpander.expandString(bodyText, screenContext, locale);
|
||||
bodyParts.add(UtilMisc.toMap("content", bodyText, "type", "text/html"));
|
||||
@@ -226,7 +227,7 @@ public class BirtEmailServices {
|
||||
|
||||
if (Debug.verboseOn()) Debug.logVerbose("sendMailFromScreen sendMail context: " + serviceContext, module);
|
||||
|
||||
Map result = ServiceUtil.returnSuccess();
|
||||
Map<String, Object> result = ServiceUtil.returnSuccess();
|
||||
try {
|
||||
if (isMultiPart) {
|
||||
dispatcher.runSync("sendMailMultiPart", serviceContext);
|
||||
|
||||
@@ -49,6 +49,7 @@ import org.eclipse.birt.report.utility.BirtUtility;
|
||||
import org.eclipse.birt.report.utility.DataUtil;
|
||||
import org.eclipse.birt.report.utility.ParameterAccessor;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.birt.container.BirtContainer;
|
||||
import org.ofbiz.entity.Delegator;
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
@@ -228,7 +229,7 @@ public class OFBizBirtViewerReportService extends BirtViewerReportService {
|
||||
runTask.close( );
|
||||
|
||||
// check for non-fatal errors
|
||||
List<Exception> errors = (List<Exception>) runTask.getErrors( );
|
||||
List<Exception> errors = UtilGenerics.cast(runTask.getErrors( ));
|
||||
if ( !errors.isEmpty( ) )
|
||||
{
|
||||
return errors;
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.eclipse.birt.report.engine.api.IReportEngine;
|
||||
import org.eclipse.birt.report.engine.api.IReportRunnable;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.GeneralException;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilHttp;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
import org.ofbiz.birt.BirtWorker;
|
||||
@@ -84,9 +85,9 @@ public class BirtViewHandler implements ViewHandler {
|
||||
design = engine.openReportDesign(servletContext.getRealPath(page));
|
||||
}
|
||||
|
||||
Map context = FastMap.newInstance();
|
||||
Map<String, Object> context = FastMap.newInstance();
|
||||
// set parameters from request
|
||||
Map parameters = (Map)request.getAttribute(BirtWorker.BIRT_PARAMETERS);
|
||||
Map<String, Object> parameters = UtilGenerics.cast(request.getAttribute(BirtWorker.BIRT_PARAMETERS));
|
||||
if (parameters != null) {
|
||||
context.put(BirtWorker.BIRT_PARAMETERS, parameters);
|
||||
}
|
||||
|
||||
@@ -66,11 +66,10 @@ public class FindServices {
|
||||
|
||||
public static final String module = FindServices.class.getName();
|
||||
|
||||
public static Map<String, EntityOperator> entityOperators;
|
||||
public static Map<String, EntityComparisonOperator<?, ?>> entityOperators;
|
||||
|
||||
static {
|
||||
entityOperators = FastMap.newInstance();
|
||||
entityOperators.put("and", EntityOperator.AND);
|
||||
entityOperators.put("between", EntityOperator.BETWEEN);
|
||||
entityOperators.put("equals", EntityOperator.EQUALS);
|
||||
entityOperators.put("greaterThan", EntityOperator.GREATER_THAN);
|
||||
@@ -81,7 +80,6 @@ public class FindServices {
|
||||
entityOperators.put("like", EntityOperator.LIKE);
|
||||
entityOperators.put("not", EntityOperator.NOT);
|
||||
entityOperators.put("notEqual", EntityOperator.NOT_EQUAL);
|
||||
entityOperators.put("or", EntityOperator.OR);
|
||||
}
|
||||
|
||||
public FindServices() {}
|
||||
@@ -214,7 +212,7 @@ public class FindServices {
|
||||
public static List<EntityCondition> createCondition(ModelEntity modelEntity, Map<String, Map<String, Map<String, Object>>> normalizedFields, Map<String, Object> queryStringMap, Map<String, List<Object[]>> origValueMap, Delegator delegator, Map<String, ?> context) {
|
||||
Map<String, Map<String, Object>> subMap = null;
|
||||
Map<String, Object> subMap2 = null;
|
||||
EntityOperator fieldOp = null;
|
||||
EntityComparisonOperator<?, ?> fieldOp = null;
|
||||
Object fieldValue = null; // If it is a "value" field, it will be the value to be used in the query.
|
||||
// If it is an "op" field, it will be "equals", "greaterThan", etc.
|
||||
EntityExpr cond = null;
|
||||
@@ -298,12 +296,12 @@ public class FindServices {
|
||||
}
|
||||
|
||||
if (ignoreCase != null && ignoreCase.equals("Y") && "java.lang.String".equals(fieldObject.getClass().getName())) {
|
||||
cond = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), (EntityComparisonOperator) fieldOp, EntityFunction.UPPER(((String)fieldValue).toUpperCase()));
|
||||
cond = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), fieldOp, EntityFunction.UPPER(((String)fieldValue).toUpperCase()));
|
||||
} else {
|
||||
if (fieldObject.equals(GenericEntity.NULL_FIELD.toString())) {
|
||||
fieldObject = null;
|
||||
}
|
||||
cond = EntityCondition.makeCondition(fieldName, (EntityComparisonOperator) fieldOp, fieldObject);
|
||||
cond = EntityCondition.makeCondition(fieldName, fieldOp, fieldObject);
|
||||
}
|
||||
|
||||
if (EntityOperator.NOT_EQUAL.equals(fieldOp) && fieldObject != null) {
|
||||
@@ -357,7 +355,7 @@ public class FindServices {
|
||||
}
|
||||
// String rhs = fieldValue.toString();
|
||||
fieldObject = modelEntity.convertFieldValue(modelField, fieldValue, delegator, context);
|
||||
cond = EntityCondition.makeCondition(fieldName, (EntityComparisonOperator) fieldOp, fieldObject);
|
||||
cond = EntityCondition.makeCondition(fieldName, fieldOp, fieldObject);
|
||||
tmpList.add(cond);
|
||||
|
||||
// add to queryStringMap
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.apache.axis2.addressing.EndpointReference;
|
||||
import org.apache.axis2.client.Options;
|
||||
import org.apache.axis2.client.ServiceClient;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.entity.Delegator;
|
||||
import org.ofbiz.entity.serialize.XmlSerializer;
|
||||
@@ -135,7 +136,7 @@ public final class SOAPClientEngine extends GenericAsyncEngine {
|
||||
OMElement payload = factory.createOMElement(serviceName);
|
||||
payload.addChild(parameterSer.getFirstElement());
|
||||
OMElement respOMElement = client.sendReceive(payload);
|
||||
results = (Map<String, Object>) XmlSerializer.deserialize(respOMElement.toString(), delegator);
|
||||
results = UtilGenerics.cast(XmlSerializer.deserialize(respOMElement.toString(), delegator));
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, module);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Map;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
import org.ofbiz.base.util.UtilDateTime;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.service.testtools.OFBizTestCase;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class ServiceSOAPTests extends OFBizTestCase {
|
||||
testing.put("createdStamp", UtilDateTime.nowTimestamp());
|
||||
serviceContext.put("testing", testing);
|
||||
Map<String, Object> results = dispatcher.runSync("testSoap", serviceContext);
|
||||
List<GenericValue> testingNodes = (List<GenericValue>) results.get("testingNodes");
|
||||
List<GenericValue> testingNodes = UtilGenerics.cast(results.get("testingNodes"));
|
||||
assertNotNull(testingNodes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SQLTest extends GenericTestCaseBase {
|
||||
assertTrue("has first field all", fieldAllIt.hasNext());
|
||||
FieldAll fieldAll = fieldAllIt.next();
|
||||
assertEquals("first fieldAll.alias", "a", fieldAll.getAlias());
|
||||
assertEquals("no excludes", set(), set(fieldAll));
|
||||
assertEquals("no excludes", GenericTestCaseBase.<FieldAll>set(), set(fieldAll));
|
||||
|
||||
assertTrue("has second field all", fieldAllIt.hasNext());
|
||||
fieldAll = fieldAllIt.next();
|
||||
|
||||
@@ -226,7 +226,7 @@ public class SeleniumXml {
|
||||
|
||||
public void runCommands() throws TestCaseException {
|
||||
Element root = this.doc.getRootElement();
|
||||
List<Element> nodes = root.getChildren();
|
||||
List<Element> nodes = UtilGenerics.cast(root.getChildren());
|
||||
runCommands(nodes);
|
||||
}
|
||||
|
||||
@@ -502,11 +502,11 @@ public class SeleniumXml {
|
||||
public void ifCmd(Element elem) throws TestCaseException {
|
||||
String isRun = replaceParam(elem.getAttributeValue("condition"));
|
||||
if (isRun != null && !isRun.equals("") && Boolean.valueOf(isRun)) {
|
||||
List <Element> children = elem.getChildren();
|
||||
List <Element> children = UtilGenerics.cast(elem.getChildren());
|
||||
this.runCommands(children);
|
||||
}else{
|
||||
Element child = elem.getChild("else");
|
||||
List <Element> children = child.getChildren();
|
||||
List <Element> children = UtilGenerics.cast(child.getChildren());
|
||||
this.runCommands(children);
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,7 @@ public class SeleniumXml {
|
||||
public void partialRunDependency(Element elem) throws TestCaseException {
|
||||
String isRun = replaceParam(elem.getAttributeValue("isRun"));
|
||||
if (isRun != null && Boolean.valueOf(isRun)) {
|
||||
List <Element> children = elem.getChildren();
|
||||
List <Element> children = UtilGenerics.cast(elem.getChildren());
|
||||
this.runCommands(children);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.apache.axiom.soap.SOAPEnvelope;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilXml;
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.entity.serialize.XmlSerializer;
|
||||
@@ -175,7 +176,7 @@ public class SOAPEventHandler implements EventHandler {
|
||||
if (serviceObj instanceof OMElement) {
|
||||
OMElement serviceElement = (OMElement) serviceObj;
|
||||
String serviceName = serviceElement.getLocalName();
|
||||
Map<String, Object> parameters = (Map<String, Object>) XmlSerializer.deserialize(serviceElement.toString(), delegator);
|
||||
Map<String, Object> parameters = UtilGenerics.cast(XmlSerializer.deserialize(serviceElement.toString(), delegator));
|
||||
try {
|
||||
// verify the service is exported for remote execution and invoke it
|
||||
ModelService model = dispatcher.getDispatchContext().getModelService(serviceName);
|
||||
|
||||
Reference in New Issue
Block a user