public long getUUID() { CrawledPackage lpkg = pkg; if (lpkg != null) return lpkg.getUniqueID().getID(); return 0; }
@Override protected void setStringValue(final String value, final AbstractNode object) { if (StringUtils.isEmpty(value) || object == null) { return; } File oldPath = LinkTreeUtils.getDownloadDirectory(object); File newPath = LinkTreeUtils.getDownloadDirectory(value, null, object); if (oldPath.equals(newPath)) { /* both paths are same, so nothing to do */ return; } if (object instanceof CrawledPackage) { LinkCollector.getInstance() .getQueue() .add( new QueueAction<Object, RuntimeException>( org.appwork.utils.event.queue.Queue.QueuePriority.HIGH) { @Override protected Object run() { ((CrawledPackage) object).setDownloadFolder(value); return null; } }); return; } else if (object instanceof CrawledLink) { final CrawledPackage p = ((CrawledLink) object).getParentNode(); try { Dialog.getInstance() .showConfirmDialog( Dialog.LOGIC_DONOTSHOW_BASED_ON_TITLE_ONLY | Dialog.STYLE_SHOW_DO_NOT_DISPLAY_AGAIN, _JDT.T.SetDownloadFolderAction_actionPerformed_(p.getName()), _JDT.T.SetDownloadFolderAction_msg(p.getName(), 1), null, _JDT.T.SetDownloadFolderAction_yes(), _JDT.T.SetDownloadFolderAction_no()); LinkCollector.getInstance() .getQueue() .add( new QueueAction<Object, RuntimeException>( org.appwork.utils.event.queue.Queue.QueuePriority.HIGH) { @Override protected Object run() { p.setDownloadFolder(value); return null; } }); return; } catch (DialogClosedException e) { return; } catch (DialogCanceledException e) { /* user clicked no */ } final CrawledPackage pkg = new CrawledPackage(); pkg.setExpanded(CFG_LINKCOLLECTOR.CFG.isPackageAutoExpanded()); if (TYPE.NORMAL != p.getType()) { final String pkgName; if (object instanceof AbstractPackageNode) { pkgName = LinknameCleaner.cleanFileName( object.getName(), false, true, LinknameCleaner.EXTENSION_SETTINGS.REMOVE_KNOWN, true); } else { pkgName = LinknameCleaner.cleanFileName( object.getName(), false, true, LinknameCleaner.EXTENSION_SETTINGS.REMOVE_ALL, true); } pkg.setName(pkgName); } else { pkg.setName(p.getName()); } pkg.setComment(p.getComment()); pkg.setDownloadFolder(value); final java.util.List<CrawledLink> links = new ArrayList<CrawledLink>(); links.add((CrawledLink) object); LinkCollector.getInstance() .getQueue() .add( new QueueAction<Object, RuntimeException>( org.appwork.utils.event.queue.Queue.QueuePriority.HIGH) { @Override protected Object run() { LinkCollector.getInstance().moveOrAddAt(pkg, links, -1); return null; } }); } }
public String getName() { CrawledPackage lpkg = pkg; if (lpkg != null) return lpkg.getName(); return null; }