public void addBundle(final Bundle bundle) { if (bundle.getSeqNo() == -1) { // fix sequence number if not set if (this.bundles.size() == 0) { bundle.setSeqNo(1); } else { final int lastIndex = this.bundles.get(bundles.size() - 1).getSeqNo(); bundle.setSeqNo(lastIndex + 1); } } this.bundles.add(bundle); }
/** * Reset bundle's segment number to be highest values (last bundle in loading) * * @param bundleName bundle, which segment number must be highest */ public void pushBundleLast(String bundleName) { final int lastIndex = this.bundles.get(bundles.size() - 1).getSeqNo(); for (Bundle bundle : this.bundles) { if (bundle.getName().equals(bundleName)) { bundle.setSeqNo(lastIndex + 1); } } }
public void removeBundle(final String bundleName) { final Bundle bundle = getBundleByName(bundleName); if (bundle == null) { return; } this.bundles.remove(bundle); int seqNo = 0; for (Bundle b : this.bundles) { b.setSeqNo(seqNo); seqNo++; } }