private BuilderResult buildPackage(PackageItem item, boolean force, String buildMode, String statusOperator, String statusDescriptionValue, boolean enableStatusSelector, String categoryOperator, String category, boolean enableCategorySelector, String selectorConfigName) throws DetailedSerializationException {
if ( !force && item.isBinaryUpToDate() ) {
// we can just return all OK if its up to date.
return null;
}
ContentPackageAssembler asm = new ContentPackageAssembler( item, true, buildMode, statusOperator, statusDescriptionValue, enableStatusSelector, categoryOperator, category, enableCategorySelector, selectorConfigName );
if ( asm.hasErrors() ) {
BuilderResult result = new BuilderResult();
result.setLines( generateBuilderResults( asm ) );
return result;
}
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutput out = new DroolsObjectOutputStream( bout );
out.writeObject( asm.getBinaryPackage() );
item.updateCompiledPackage( new ByteArrayInputStream( bout.toByteArray() ) );
out.flush();
out.close();