}
private String createIOSIconUrl(ApplicationVersion version) {
// Attempt to create icon URL if Version is not null
if (version != null) {
Application application = version.getApplication();
// If application is not null then search for application icon
if (application != null) {
// If Application icon is not null then build url
if (application.getIcon() != null) {
// Create Application icon URL based on icon StorageType
StorageService storageService = storageServiceFactory.getStorageService(application.getIcon().getStorageType());
if (storageService instanceof RemoteStorageService) {
return ((RemoteStorageService) storageService).getUrl(application.getIcon(), 120);
} else if (storageService instanceof LocalStorageService) {
return WebRequest.getInstance().generateURL("/image/" + application.getIcon().getId());
}
} else {
// Create default icon URL since no icon is set on the application
return createDefaultIOSIconUrl(application.getStorageConfiguration().getStorageType());
}
} else {
// Create default icon URL since the application for the version is null
return createDefaultIOSIconUrl(version.getStorageConfiguration().getStorageType());
}