Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2010 JBoss Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.drools.guvnor.server.contenthandler;
  * Copyright 2005 JBoss Inc
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
 import  org.drools.guvnor.client.rpc.RuleAsset;

For guided decision tables.

Michael Neale
 public class GuidedDTContentHandler extends ContentHandler
     IRuleAsset {
     public void retrieveAssetContent(RuleAsset asset,
                                      PackageItem pkg,
                                      AssetItem itemthrows SerializationException {
         GuidedDecisionTable model = GuidedDTXMLPersistence.getInstance().unmarshal( item.getContent() );
         asset.content = model;
     public void storeAssetContent(RuleAsset asset,
                                   AssetItem repoAssetthrows SerializationException {
         GuidedDecisionTable data = (GuidedDecisionTable) asset.content;
         if ( data.tableName == null ) {
             data.tableName = repoAsset.getName();
         // Change the row numbers so they are in the same order as the rows.
         for ( int i = 0; i <; i++ ) {
   [i][0] = String.valueOf( i + 1 );
         repoAsset.updateContent( GuidedDTXMLPersistence.getInstance().marshal( data ) );
     public void compile(BRMSPackageBuilder builder,
                         AssetItem asset,
                         ContentPackageAssembler.ErrorLogger loggerthrows DroolsParserException,
                                                                    IOException {
         String drl = getRawDRL( asset );
         if ( drl.equals( "" ) ) return;
         builder.addPackageFromDrl( new StringReader( drl ) );
     public void assembleDRL(BRMSPackageBuilder builder,
                             AssetItem asset,
                             StringBuffer buf) {
         String drl = getRawDRL( asset );
         buf.append( drl );
    public String getRawDRL(AssetItem asset) {
        GuidedDecisionTable model = GuidedDTXMLPersistence.getInstance().unmarshal( asset.getContent() );
        model.tableName = asset.getName();
        model.parentName = this.parentNameFromCategory( asset,
                                                        model.parentName );
        return GuidedDTDRLPersistence.getInstance().marshal( model );
New to GrepCode? Check out our FAQ X