return assets.toArray(new Asset[assets.size()]);
}
private void archiveOrUnarchiveAsset(String uuid,
boolean archive) {
AssetItem item = rulesRepository.loadAssetByUUID(uuid);
serviceSecurity.checkIsPackageDeveloperOrAnalyst(item);
if (item.getModule().isArchived()) {
throw new RulesRepositoryException("The package [" + item.getModuleName() + "] that asset [" + item.getName() + "] belongs to is archived. You need to unarchive it first.");
}
log.info("USER:" + getCurrentUserName() + " ARCHIVING asset: [" + item.getName() + "] UUID: [" + item.getUUID() + "] ");
try {
ContentHandler handler = getContentHandler(item);
if (handler instanceof ICanHasAttachment) {
((ICanHasAttachment) handler).onAttachmentRemoved(item);
}
} catch (IOException e) {
log.error("Unable to remove asset attachment",
e);
}
item.archiveItem(archive);
ModuleItem pkg = item.getModule();
pkg.updateBinaryUpToDate(false);
RuleBaseCache.getInstance().remove(pkg.getUUID());
if (archive) {
item.checkin("archived");
} else {
item.checkin("unarchived");
}
push("packageChange",
pkg.getName());
}