//Get the identifier of the webAsset
Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset);
VersionInfo auxVersionInfo = null;
//### Get and delete the webAsset ###
List<Versionable> webAssetList = new ArrayList<Versionable>();
webAssetList.addAll(APILocator.getVersionableAPI().findAllVersions(identifier, APILocator.getUserAPI().getSystemUser(), false));
if(currWebAsset instanceof Container)
{
ContainerServices.unpublishContainerFile((Container)currWebAsset);
CacheLocator.getContainerCache().remove(currWebAsset.getInode());
}
else if(currWebAsset instanceof HTMLPage)
{
PageServices.unpublishPageFile((HTMLPage)currWebAsset);
if(RefreshMenus.shouldRefreshMenus((HTMLPage)currWebAsset)){
RefreshMenus.deleteMenu(currWebAsset);
Identifier ident=APILocator.getIdentifierAPI().find(currWebAsset);
CacheLocator.getNavToolCache().removeNavByPath(ident.getHostId(), ident.getParentPath());
}
CacheLocator.getHTMLPageCache().remove((HTMLPage)currWebAsset);
}
else if(currWebAsset instanceof Template)
{
TemplateServices.unpublishTemplateFile((Template)currWebAsset);
APILocator.getTemplateAPI().associateContainers(new ArrayList<Container>(), (Template)currWebAsset);
CacheLocator.getTemplateCache().remove(currWebAsset.getInode());
}
else if(currWebAsset instanceof Link)
{
VersionInfo vi = APILocator.getVersionableAPI().getVersionInfo(currWebAsset.getIdentifier());
if(!UtilMethods.isSet(vi)) {
auxVersionInfo = getVersionInfo(currWebAsset, identifier,
webAssetList, "links");
}
VirtualLinksCache.removePathFromCache(((Link)currWebAsset).getUrl());
}
else if(currWebAsset instanceof File)
{
VersionInfo vi = APILocator.getVersionableAPI().getVersionInfo(currWebAsset.getIdentifier());
if(!UtilMethods.isSet(vi)) {
auxVersionInfo = getVersionInfo(currWebAsset, identifier,
webAssetList, "file_asset");
}