/** * Call this method to update provisioning profiles from save action. The provisioning profiles * from save action are merged into current provisioning profiles list. Then this list is * sychnronized with the upload folder. * * @param provisioningProfilesAfterSave */ public void updateProvisioningProfilesFromSave( List<KPPProvisioningProfile> provisioningProfilesFromSave) { List<KPPProvisioningProfile> ppsCurrent = new ArrayList<KPPProvisioningProfile>(getProvisioningProfiles()); List<KPPProvisioningProfile> ppsNew = new ArrayList<KPPProvisioningProfile>(provisioningProfilesFromSave.size()); for (KPPProvisioningProfile ppA : provisioningProfilesFromSave) { for (KPPProvisioningProfile ppC : ppsCurrent) { if (ppC.equals(ppA)) { ppsNew.add(ppA); ppsCurrent.remove(ppC); break; } } } if (!ppsCurrent.isEmpty()) { // delete provisioning profile from filesystem final String folderPath = getUploadDirectoryPath(); File ppFile; for (KPPProvisioningProfile pp : ppsCurrent) { ppFile = new File(folderPath + File.separator + pp.getFileName()); ppFile.delete(); } } setProvisioningProfiles(ppsNew); }
private List<KPPProvisioningProfile> loadProvisioningProfilesFromUploadFolder() { List<KPPProvisioningProfile> pps = new ArrayList<KPPProvisioningProfile>(); File[] ppsFiles = getFilesFromUploadDirectory(FILE_EXTENSION); for (File ppFile : ppsFiles) { KPPProvisioningProfile pp = new KPPProvisioningProfile(ppFile.getName(), null); if (StringUtils.isBlank(pp.getFileName())) { break; } pps.add(pp); } return pps; }