com.businessobjects.rebean.wi
Interface ResourceManager


public interface ResourceManager

The ResourceManager interface provides functionalities to add a resource into a WebI document. An embedded resource could be an image coming from desktop file.

Example:Add an image into a webi document.

 ResourceManager resourceMgr = wiDoc.getResourceManager();
 File file = new File("E:\\image.jpg");
 FileInputStream resourceStream = new FileInputStream (file);
 String resourceDescription = "Resource of mime type : image/jpg";
 String resourceName = "Start planning your migration today";
 String resourceID = resourceMgr.addResource("image/jpg",(int)file.length (),resourceName,resourceDescription,resourceStream);
 ReportStructure reportStructure = wiDoc.getStructure();
 ReportElement reportElement = reportStructure.getReportElement("1");
 if(reportElement instanceof Decoration)
 {
        Decoration deco = (Decoration)reportElement;
        Alignment alignment = deco.getAlignment();
        alignment.setHorizontal(HAlignmentType.LEFT);
        alignment.setVertical(VAlignmentType.BOTTOM);
        Attributes attributes = deco.getAttributes();
        // create new skin
        attributes.setBackgroundImageResource(resourceID);
 }
 wiDoc.applyFormat();
 wiDoc.save();
 Reports reps = wiDoc.getReports();
 Report rep = reps.getItem(0);
 HTMLView htmlView = (HTMLView) rep.getView(OutputFormatType.DHTML);
 PrintWriter writer = response.getWriter();
 htmlView.getContent(writer, "", "");
 writer.close();
 

Since:
12.0
See Also:
DocumentInstance.getResourceManager()

Method Summary
 java.lang.String addResource(java.lang.String contentType, int contentLength, java.lang.String resourceName, java.lang.String resourceDescription, java.io.InputStream resourceContent)
          Embeds a resource into the WebI document.
 

Method Detail

addResource

java.lang.String addResource(java.lang.String contentType,
                             int contentLength,
                             java.lang.String resourceName,
                             java.lang.String resourceDescription,
                             java.io.InputStream resourceContent)
Embeds a resource into the WebI document.

Parameters:
contentType - The Multipurpose Internet Mail Extension (MIME) type, (as defined in RFC 2045 and 2046 type) of the resource to add to the WebI document as embedded resource.
contentLength - The resource size in bytes of the resourceContent parameter.
resourceName - Optional name to add to the curent resource.
resourceDescription - Optional description to add to the current resource.
resourceContent - The stream to read containing the embedded resource to add into the document.
Returns:
The associated resource identifier used for the newly uploaded resource.
Throws:
java.lang.NullPointerException - When contentType == null or resourceName == null.
java.lang.IllegalArgumentException - When contentType length is negative or equal 0.