Remove java compilation warnings from OutputServices (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1061483 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -47,8 +47,13 @@ import javax.print.attribute.PrintServiceAttributeSet;
|
||||
import javax.print.attribute.standard.PrinterName;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import javolution.util.FastMap;
|
||||
|
||||
import org.apache.fop.apps.Fop;
|
||||
import org.apache.fop.apps.MimeConstants;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilDateTime;
|
||||
import org.ofbiz.base.util.UtilGenerics;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
@@ -60,10 +65,6 @@ import org.ofbiz.widget.fo.FoFormRenderer;
|
||||
import org.ofbiz.widget.fo.FoScreenRenderer;
|
||||
import org.ofbiz.widget.screen.ScreenRenderer;
|
||||
|
||||
import javolution.util.FastMap;
|
||||
import org.apache.fop.apps.Fop;
|
||||
import org.apache.fop.apps.MimeConstants;
|
||||
|
||||
|
||||
/**
|
||||
* Output Services
|
||||
@@ -77,10 +78,9 @@ public class OutputServices {
|
||||
public static final String resource = "ContentUiLabels";
|
||||
|
||||
public static Map<String, Object> sendPrintFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) {
|
||||
|
||||
Locale locale = (Locale) serviceContext.get("locale");
|
||||
String screenLocation = (String) serviceContext.remove("screenLocation");
|
||||
Map screenContext = (Map) serviceContext.remove("screenContext");
|
||||
Map<String, Object> screenContext = UtilGenerics.checkMap(serviceContext.remove("screenContext"));
|
||||
String contentType = (String) serviceContext.remove("contentType");
|
||||
String printerContentType = (String) serviceContext.remove("printerContentType");
|
||||
|
||||
@@ -97,7 +97,7 @@ public class OutputServices {
|
||||
|
||||
try {
|
||||
|
||||
MapStack screenContextTmp = MapStack.create();
|
||||
MapStack<String> screenContextTmp = MapStack.create();
|
||||
screenContextTmp.put("locale", locale);
|
||||
|
||||
Writer writer = new StringWriter();
|
||||
@@ -125,7 +125,7 @@ public class OutputServices {
|
||||
InputStream bais = new ByteArrayInputStream(baos.toByteArray());
|
||||
|
||||
DocAttributeSet docAttributeSet = new HashDocAttributeSet();
|
||||
List docAttributes = (List) serviceContext.remove("docAttributes");
|
||||
List<Object> docAttributes = UtilGenerics.checkList(serviceContext.remove("docAttributes"));
|
||||
if (UtilValidate.isNotEmpty(docAttributes)) {
|
||||
for (Object da : docAttributes) {
|
||||
Debug.logInfo("Adding DocAttribute: " + da, module);
|
||||
@@ -149,14 +149,11 @@ public class OutputServices {
|
||||
printer = printServices[0];
|
||||
Debug.logInfo("Using printer: " + printer.getName(), module);
|
||||
if (!printer.isDocFlavorSupported(psInFormat)) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
|
||||
"ContentPrinterNotSupportDocFlavorFormat",
|
||||
UtilMisc.toMap("psInFormat", psInFormat, "printerName", printer.getName()), locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPrinterNotSupportDocFlavorFormat", UtilMisc.toMap("psInFormat", psInFormat, "printerName", printer.getName()), locale));
|
||||
}
|
||||
}
|
||||
if (printer == null) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
|
||||
"ContentPrinterNotFound", UtilMisc.toMap("printerName", printerName), locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPrinterNotFound", UtilMisc.toMap("printerName", printerName), locale));
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -169,13 +166,12 @@ public class OutputServices {
|
||||
}
|
||||
|
||||
if (printer == null) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
|
||||
"ContentPrinterNotAvailable", locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPrinterNotAvailable", locale));
|
||||
}
|
||||
|
||||
|
||||
PrintRequestAttributeSet praset = new HashPrintRequestAttributeSet();
|
||||
List printRequestAttributes = (List) serviceContext.remove("printRequestAttributes");
|
||||
List<Object> printRequestAttributes = UtilGenerics.checkList(serviceContext.remove("printRequestAttributes"));
|
||||
if (UtilValidate.isNotEmpty(printRequestAttributes)) {
|
||||
for (Object pra : printRequestAttributes) {
|
||||
Debug.logInfo("Adding PrintRequestAttribute: " + pra, module);
|
||||
@@ -184,23 +180,18 @@ public class OutputServices {
|
||||
}
|
||||
DocPrintJob job = printer.createPrintJob();
|
||||
job.print(myDoc, praset);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, "Error rendering [" + contentType + "]: " + e.toString(), module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
|
||||
"ContentRenderingError",
|
||||
UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentRenderingError", UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale));
|
||||
}
|
||||
|
||||
return ServiceUtil.returnSuccess();
|
||||
}
|
||||
|
||||
public static Map<String, Object> createFileFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) {
|
||||
|
||||
Locale locale = (Locale) serviceContext.get("locale");
|
||||
String screenLocation = (String) serviceContext.remove("screenLocation");
|
||||
Map screenContext = (Map) serviceContext.remove("screenContext");
|
||||
Map<String, Object> screenContext = UtilGenerics.checkMap(serviceContext.remove("screenContext"));
|
||||
String contentType = (String) serviceContext.remove("contentType");
|
||||
String filePath = (String) serviceContext.remove("filePath");
|
||||
String fileName = (String) serviceContext.remove("fileName");
|
||||
@@ -214,7 +205,7 @@ public class OutputServices {
|
||||
}
|
||||
|
||||
try {
|
||||
MapStack screenContextTmp = MapStack.create();
|
||||
MapStack<String> screenContextTmp = MapStack.create();
|
||||
screenContextTmp.put("locale", locale);
|
||||
|
||||
Writer writer = new StringWriter();
|
||||
@@ -256,9 +247,7 @@ public class OutputServices {
|
||||
|
||||
} catch (Exception e) {
|
||||
Debug.logError(e, "Error rendering [" + contentType + "]: " + e.toString(), module);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
|
||||
"ContentRenderingError",
|
||||
UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentRenderingError", UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale));
|
||||
}
|
||||
|
||||
return ServiceUtil.returnSuccess();
|
||||
|
||||
Reference in New Issue
Block a user