Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.drools.guvnor.server.contenthandler;
 
 
 import  org.drools.guvnor.client.rpc.RuleAsset;
 import  org.drools.guvnor.client.rpc.RuleContentText;
import  com.google.gwt.user.client.rpc.SerializableException;

public class XmlFileHandler extends PlainTextContentHandler {
    public void retrieveAssetContent(RuleAsset assetPackageItem pkgAssetItem item)
            throws SerializableException {
        if (item.getContent() != null) {
            RuleContentText text = new RuleContentText();
            text.content = item.getContent();
            asset.content = text;
        }
    }
    public void storeAssetContent(RuleAsset assetAssetItem repoAssetthrows SerializableException {
        RuleContentText text = (RuleContentText) asset.content;
        try {
            InputStream input = new ByteArrayInputStream(text.content.getBytes("UTF-8"));
            repoAsset.updateBinaryContentAttachment(input);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            throw new RuntimeException(e);     
        }
    }
New to GrepCode? Check out our FAQ X