/** * Only for use in the StorageEventManager, for passing the fromRepo * parameter * * returns the string contents of the asset node. If this is a binary asset, * this will return null (use getBinaryContent instead). */ //REVISIT: This return the binary data as a byte array if its binary asset. //Return null is better? public String getContent(Boolean fromRepo) throws RulesRepositoryException { try { if ( StorageEventManager.hasLoadEvent() && !fromRepo ) { return IOUtils.toString( StorageEventManager.getLoadEvent().loadContent( this ) ); } if ( isBinary() ) { return new String( this.getBinaryContentAsBytes() ); } Node ruleNode = getVersionContentNode(); if ( ruleNode.hasProperty( CONTENT_PROPERTY_NAME ) ) { Property data = ruleNode.getProperty( CONTENT_PROPERTY_NAME ); return data.getValue().getString(); } else { return ""; } } catch ( Exception e ) { log.error( "Caught Exception", e ); throw new RulesRepositoryException( e ); } }
/** * Only for use in the StorageEventManager, for passing the fromRepo * parameter * * returns the string contents of the asset node. If this is a binary asset, * this will return null (use getBinaryContent instead). */ //REVISIT: This return the binary data as a byte array if its binary asset. //Return null is better? public String getContent(Boolean fromRepo) throws RulesRepositoryException { try { if ( StorageEventManager.hasLoadEvent() && !fromRepo ) { return IOUtils.toString( StorageEventManager.getLoadEvent().loadContent( this ) ); } if ( isBinary() ) { return new String( this.getBinaryContentAsBytes() ); } Node ruleNode = getVersionContentNode(); if ( ruleNode.hasProperty( CONTENT_PROPERTY_NAME ) ) { Property data = ruleNode.getProperty( CONTENT_PROPERTY_NAME ); return data.getValue().getString(); } else { return ""; } } catch ( Exception e ) { log.error( "Caught Exception", e ); throw new RulesRepositoryException( e ); } }