/**
* This will build the package - preparePackage would have been called first.
* This will always prioritise DRL before other assets.
*/
private void buildPackage() {
AssetSelector selector = null;
if("customSelector".equals(buildMode)) {
selector = SelectorManager.getInstance().getSelector(customSelectorName);
} else if ("builtInSelector".equals(buildMode)) {
selector = (BuiltInSelector)SelectorManager.getInstance().getSelector(
"BuiltInSelector");
((BuiltInSelector)selector).setStatusOperator(statusOperator);
((BuiltInSelector)selector).setStatus(statusDescriptionValue);
((BuiltInSelector)selector).setEnableStatusSelector(enableStatusSelector);
((BuiltInSelector)selector).setCategory(categoryValue);
((BuiltInSelector)selector).setCategoryOperator(categoryOperator);
((BuiltInSelector)selector).setEnableCategorySelector(enableCategorySelector);
} else {
//return the NilSelector, i.e., allows everything
selector = SelectorManager.getInstance().getSelector(null);
}
if (selector == null) {
this.errors.add(new ContentAssemblyError(this.pkg,
"The selector named " + customSelectorName
+ " is not available."));
return;
}
StringBuffer includedAssets = new StringBuffer("Following assets have been included in package build: ");
Iterator<AssetItem> drls = pkg.listAssetsByFormat(new String[]{AssetFormats.DRL});
while (drls.hasNext()) {
AssetItem asset = (AssetItem) drls.next();
if (!asset.isArchived() && (selector.isAssetAllowed(asset))) {
buildAsset(asset);
includedAssets.append(asset.getName() + ", ");
}
}
Iterator<AssetItem> it = pkg.getAssets();
while (it.hasNext()) {
AssetItem asset = (AssetItem) it.next();
if (!asset.getFormat().equals(AssetFormats.DRL) && !asset.isArchived() && (selector.isAssetAllowed(asset))) {
buildAsset(asset);
includedAssets.append(asset.getName() + ", ");
}
}
log.info(includedAssets.toString());