public static Subscription findSubscriptionByNameForOldPublishData( String subscriptionName, List<PublishData> PUBLISHS) { for (PublishData pd : PUBLISHS) { List<Subscription> subscriptions = pd.getPublishProfile().getSubscriptions(); for (Subscription sub : subscriptions) { if (sub.getName().equals(subscriptionName)) return sub; } } return null; }
public static String extractSubIdFromOldPublishData(String subscriptionName) { String subId = ""; PublishData[] publishDatas = loadOldPreferences(); if (publishDatas != null) { Subscription sub = findSubscriptionByNameForOldPublishData(subscriptionName, Arrays.asList(publishDatas)); if (sub != null) { subId = sub.getSubscriptionID(); } } return subId; }