//Delete the menu's file in the directory
if(directory.isDirectory())
{
String folderInode = folder.getInode();
Folder auxFolder = null;
while(InodeUtils.isSet(folderInode))
{
//get all files for the menu directory
java.io.File[] files = directory.listFiles();
//String folderInodeString = Long.toString(folderInode);
for (int i = 0; i < files.length; i++)
{
File file = files[i];
String fileName = file.getName();
if(fileName.startsWith(folderInode))
{
file.delete();
}
}
auxFolder = folder;
try {
folder = APILocator.getFolderAPI().findParentFolder(folder, APILocator.getUserAPI().getSystemUser(), false);
} catch (Exception e) {
Logger.error(RefreshMenus.class,e.getMessage(), e);
throw new DotRuntimeException(e.getMessage(),e);
}
if(folder==null) folderInode=null;
else folderInode = folder.getInode();
}
if(auxFolder != null)
{
HostAPI hostAPI = APILocator.getHostAPI();
Host host;
try {
host = (Host) hostAPI.findParentHost(auxFolder, APILocator.getUserAPI().getSystemUser(), false);
} catch (DotDataException e) {
Logger.error(RefreshMenus.class, e.getMessage(), e);
throw new DotRuntimeException(e.getMessage(), e);
} catch (DotSecurityException e) {
Logger.error(RefreshMenus.class, e.getMessage(), e);
throw new DotRuntimeException(e.getMessage(), e);
}
java.io.File[] files = directory.listFiles();
if(files.length > 0){
if(host == null){
Logger.error(RefreshMenus.class, "Folder id :" + auxFolder.getInode() + " has no host");
return;
}
for (int i = 0; i < files.length; i++)
{
File file = files[i];