void setPublications(Publication[] publications) { List<Publication> newPublications = Arrays.asList(publications); List<Publication> oldPublications = Arrays.asList(getPublications()); for (Publication oldp : oldPublications) { if (!newPublications.contains(oldp)) { remove(oldp); } } for (Publication newp : newPublications) { if (!oldPublications.contains(newp)) { add(newp); } } }
void setCatalogs(Catalog[] catalogs) { List<Catalog> newCatalogs = Arrays.asList(catalogs); List<Catalog> oldCatalogs = Arrays.asList(getCatalogs()); // remove any catalogs not in this array for (Catalog existing : oldCatalogs) { if (!newCatalogs.contains(existing)) { remove(existing); } } for (Catalog newCatalog : newCatalogs) { if (!oldCatalogs.contains(newCatalog)) { add(newCatalog); } } }
void setTracks(Track[] tracks) { List<Track> newTracks = Arrays.asList(tracks); List<Track> oldTracks = Arrays.asList(getTracks()); // remove any catalogs not in this array for (Track existing : oldTracks) { if (!newTracks.contains(existing)) { remove(existing); } } for (Track newTrack : newTracks) { if (!oldTracks.contains(newTrack)) { add(newTrack); } } }
void setAttachments(Attachment[] catalogs) { List<Attachment> newAttachments = Arrays.asList(catalogs); List<Attachment> oldAttachments = Arrays.asList(getAttachments()); // remove any catalogs not in this array for (Attachment existing : oldAttachments) { if (!newAttachments.contains(existing)) { remove(existing); } } for (Attachment newAttachment : newAttachments) { if (!oldAttachments.contains(newAttachment)) { add(newAttachment); } } }