Example usage for java.lang Float toString

List of usage examples for java.lang Float toString

Introduction

In this page you can find the example usage for java.lang Float toString.

Prototype

public static String toString(float f) 

Source Link

Document

Returns a string representation of the float argument.

Usage

From source file:github.popeen.dsub.fragments.NowPlayingFragment.java

private void updateTitle() {
    DownloadService downloadService = getDownloadService();
    float playbackSpeed = downloadService.getPlaybackSpeed();

    String title = context.getResources().getString(R.string.button_bar_now_playing);
    int stringRes = -1;
    if (playbackSpeed == 0.5f) {
        stringRes = R.string.download_playback_speed_half;
    } else if (playbackSpeed == 1.2f) {
        stringRes = R.string.download_playback_speed_one_p_two;
    } else if (playbackSpeed == 1.5f) {
        stringRes = R.string.download_playback_speed_one_p_five;
    } else if (playbackSpeed == 2.0f) {
        stringRes = R.string.download_playback_speed_two;
    }/*from w  w w. j a va2s .  c  om*/

    String playbackSpeedText = null;
    if (stringRes != -1) {
        playbackSpeedText = context.getResources().getString(stringRes);
    } else if (Math.abs(playbackSpeed - 1.0) > 0.01) {
        playbackSpeedText = Float.toString(playbackSpeed) + "x";
    }

    if (playbackSpeedText != null) {
        title += " (" + playbackSpeedText + ")";
    }
    setTitle(title);
}

From source file:com.moviejukebox.writer.MovieJukeboxXMLWriter.java

/**
 * Create an element with the movie details in it
 *
 * @param doc/*w w  w  .  j ava2s .  c  o m*/
 * @param movie
 * @param library
 * @return
 */
@SuppressWarnings("deprecation")
private Element writeMovie(Document doc, Movie movie, Library library) {
    Element eMovie = doc.createElement(MOVIE);

    // holds the child attributes for reuse
    Map<String, String> childAttributes = new LinkedHashMap<>();

    eMovie.setAttribute("isExtra", Boolean.toString(movie.isExtra()));
    eMovie.setAttribute("isSet", Boolean.toString(movie.isSetMaster()));
    if (movie.isSetMaster()) {
        eMovie.setAttribute("setSize", Integer.toString(movie.getSetSize()));
    }
    eMovie.setAttribute("isTV", Boolean.toString(movie.isTVShow()));

    for (Map.Entry<String, String> e : movie.getIdMap().entrySet()) {
        DOMHelper.appendChild(doc, eMovie, "id", e.getValue(), MOVIEDB, e.getKey());
    }

    DOMHelper.appendChild(doc, eMovie, "mjbVersion", GitRepositoryState.getVersion());
    DOMHelper.appendChild(doc, eMovie, "mjbGitSHA", GIT.getCommitId());
    DOMHelper.appendChild(doc, eMovie, "xmlGenerationDate",
            DateTimeTools.convertDateToString(new Date(), DateTimeTools.getDateFormatLongString()));
    DOMHelper.appendChild(doc, eMovie, "baseFilenameBase", movie.getBaseFilename());
    DOMHelper.appendChild(doc, eMovie, BASE_FILENAME, movie.getBaseName());
    if ((TITLE_SORT_TYPE == TitleSortType.ADOPT_ORIGINAL)
            && (StringTools.isValidString(movie.getOriginalTitle()))) {
        DOMHelper.appendChild(doc, eMovie, TITLE, movie.getOriginalTitle(), SOURCE,
                movie.getOverrideSource(OverrideFlag.TITLE));
    } else {
        DOMHelper.appendChild(doc, eMovie, TITLE, movie.getTitle(), SOURCE,
                movie.getOverrideSource(OverrideFlag.TITLE));
    }
    DOMHelper.appendChild(doc, eMovie, SORT_TITLE, movie.getTitleSort());
    DOMHelper.appendChild(doc, eMovie, ORIGINAL_TITLE, movie.getOriginalTitle(), SOURCE,
            movie.getOverrideSource(OverrideFlag.ORIGINALTITLE));

    childAttributes.clear();
    childAttributes.put("Year", Library.getYearCategory(movie.getYear()));
    childAttributes.put(SOURCE, movie.getOverrideSource(OverrideFlag.YEAR));
    DOMHelper.appendChild(doc, eMovie, YEAR, movie.getYear(), childAttributes);

    DOMHelper.appendChild(doc, eMovie, "releaseDate", movie.getReleaseDate(), SOURCE,
            movie.getOverrideSource(OverrideFlag.RELEASEDATE));
    DOMHelper.appendChild(doc, eMovie, "showStatus", movie.getShowStatus());

    // This is the main rating
    DOMHelper.appendChild(doc, eMovie, RATING, Integer.toString(movie.getRating()));

    // This is the list of ratings
    Element eRatings = doc.createElement("ratings");
    for (String site : movie.getRatings().keySet()) {
        DOMHelper.appendChild(doc, eRatings, RATING, Integer.toString(movie.getRating(site)), MOVIEDB, site);
    }
    eMovie.appendChild(eRatings);

    DOMHelper.appendChild(doc, eMovie, "watched", Boolean.toString(movie.isWatched()));
    DOMHelper.appendChild(doc, eMovie, "watchedNFO", Boolean.toString(movie.isWatchedNFO()));
    DOMHelper.appendChild(doc, eMovie, "watchedFile", Boolean.toString(movie.isWatchedFile()));
    if (movie.isWatched()) {
        DOMHelper.appendChild(doc, eMovie, "watchedDate", getWatchedDateString(movie.getWatchedDate()));
    }
    DOMHelper.appendChild(doc, eMovie, "top250", Integer.toString(movie.getTop250()), SOURCE,
            movie.getOverrideSource(OverrideFlag.TOP250));
    DOMHelper.appendChild(doc, eMovie, DETAILS, HTMLTools.encodeUrl(movie.getBaseName()) + EXT_HTML);
    DOMHelper.appendChild(doc, eMovie, "posterURL", HTMLTools.encodeUrl(movie.getPosterURL()));
    DOMHelper.appendChild(doc, eMovie, "posterFile", HTMLTools.encodeUrl(movie.getPosterFilename()));
    DOMHelper.appendChild(doc, eMovie, "fanartURL", HTMLTools.encodeUrl(movie.getFanartURL()));
    DOMHelper.appendChild(doc, eMovie, "fanartFile", HTMLTools.encodeUrl(movie.getFanartFilename()));
    DOMHelper.appendChild(doc, eMovie, "detailPosterFile",
            HTMLTools.encodeUrl(movie.getDetailPosterFilename()));
    DOMHelper.appendChild(doc, eMovie, "thumbnail", HTMLTools.encodeUrl(movie.getThumbnailFilename()));
    DOMHelper.appendChild(doc, eMovie, "bannerURL", HTMLTools.encodeUrl(movie.getBannerURL()));
    DOMHelper.appendChild(doc, eMovie, "bannerFile", HTMLTools.encodeUrl(movie.getBannerFilename()));
    DOMHelper.appendChild(doc, eMovie, "wideBannerFile", HTMLTools.encodeUrl(movie.getWideBannerFilename()));
    DOMHelper.appendChild(doc, eMovie, "clearLogoURL", HTMLTools.encodeUrl(movie.getClearLogoURL()));
    DOMHelper.appendChild(doc, eMovie, "clearLogoFile", HTMLTools.encodeUrl(movie.getClearLogoFilename()));
    DOMHelper.appendChild(doc, eMovie, "clearArtURL", HTMLTools.encodeUrl(movie.getClearArtURL()));
    DOMHelper.appendChild(doc, eMovie, "clearArtFile", HTMLTools.encodeUrl(movie.getClearArtFilename()));
    DOMHelper.appendChild(doc, eMovie, "tvThumbURL", HTMLTools.encodeUrl(movie.getTvThumbURL()));
    DOMHelper.appendChild(doc, eMovie, "tvThumbFile", HTMLTools.encodeUrl(movie.getTvThumbFilename()));
    DOMHelper.appendChild(doc, eMovie, "seasonThumbURL", HTMLTools.encodeUrl(movie.getSeasonThumbURL()));
    DOMHelper.appendChild(doc, eMovie, "seasonThumbFile", HTMLTools.encodeUrl(movie.getSeasonThumbFilename()));
    DOMHelper.appendChild(doc, eMovie, "movieDiscURL", HTMLTools.encodeUrl(movie.getMovieDiscURL()));
    DOMHelper.appendChild(doc, eMovie, "movieDiscFile", HTMLTools.encodeUrl(movie.getMovieDiscFilename()));
    DOMHelper.appendChild(doc, eMovie, "plot", movie.getPlot(), SOURCE,
            movie.getOverrideSource(OverrideFlag.PLOT));
    DOMHelper.appendChild(doc, eMovie, "outline", movie.getOutline(), SOURCE,
            movie.getOverrideSource(OverrideFlag.OUTLINE));
    DOMHelper.appendChild(doc, eMovie, "quote", movie.getQuote(), SOURCE,
            movie.getOverrideSource(OverrideFlag.QUOTE));
    DOMHelper.appendChild(doc, eMovie, "tagline", movie.getTagline(), SOURCE,
            movie.getOverrideSource(OverrideFlag.TAGLINE));

    childAttributes.clear();
    String countryIndex = createIndexAttribute(library, Library.INDEX_COUNTRY, movie.getCountriesAsString());
    if (countryIndex != null) {
        childAttributes.put(INDEX, countryIndex);
    }
    childAttributes.put(SOURCE, movie.getOverrideSource(OverrideFlag.COUNTRY));
    DOMHelper.appendChild(doc, eMovie, COUNTRY, movie.getCountriesAsString(), childAttributes);
    if (XML_COMPATIBLE) {
        Element eCountry = doc.createElement("countries");
        int cnt = 0;
        for (String country : movie.getCountries()) {
            writeIndexedElement(doc, eCountry, "land", country,
                    createIndexAttribute(library, Library.INDEX_COUNTRY, country));
            cnt++;
        }
        eCountry.setAttribute(COUNT, String.valueOf(cnt));
        eMovie.appendChild(eCountry);
    }

    DOMHelper.appendChild(doc, eMovie, "company", movie.getCompany(), SOURCE,
            movie.getOverrideSource(OverrideFlag.COMPANY));
    if (XML_COMPATIBLE) {
        Element eCompany = doc.createElement("companies");
        int cnt = 0;
        for (String company : movie.getCompany().split(Movie.SPACE_SLASH_SPACE)) {
            DOMHelper.appendChild(doc, eCompany, "credit", company);
            cnt++;
        }
        eCompany.setAttribute(COUNT, String.valueOf(cnt));
        eMovie.appendChild(eCompany);
    }

    DOMHelper.appendChild(doc, eMovie, "runtime", movie.getRuntime(), SOURCE,
            movie.getOverrideSource(OverrideFlag.RUNTIME));
    DOMHelper.appendChild(doc, eMovie, "certification",
            Library.getIndexingCertification(movie.getCertification()), SOURCE,
            movie.getOverrideSource(OverrideFlag.CERTIFICATION));
    DOMHelper.appendChild(doc, eMovie, SEASON, Integer.toString(movie.getSeason()));

    DOMHelper.appendChild(doc, eMovie, LANGUAGE, movie.getLanguage(), SOURCE,
            movie.getOverrideSource(OverrideFlag.LANGUAGE));
    if (XML_COMPATIBLE) {
        Element eLanguage = doc.createElement("languages");
        int cnt = 0;
        for (String language : movie.getLanguage().split(Movie.SPACE_SLASH_SPACE)) {
            DOMHelper.appendChild(doc, eLanguage, "lang", language);
            cnt++;
        }
        eLanguage.setAttribute(COUNT, String.valueOf(cnt));
        eMovie.appendChild(eLanguage);
    }

    DOMHelper.appendChild(doc, eMovie, "subtitles", movie.getSubtitles());
    if (XML_COMPATIBLE) {
        Element eSubtitle = doc.createElement("subs");
        int cnt = 0;
        for (String subtitle : SubtitleTools.getSubtitles(movie)) {
            DOMHelper.appendChild(doc, eSubtitle, "subtitle", subtitle);
            cnt++;
        }
        eSubtitle.setAttribute(COUNT, String.valueOf(cnt));
        eMovie.appendChild(eSubtitle);
    }

    DOMHelper.appendChild(doc, eMovie, "trailerExchange", movie.isTrailerExchange() ? YES : "NO");

    if (movie.getTrailerLastScan() == 0) {
        DOMHelper.appendChild(doc, eMovie, TRAILER_LAST_SCAN, Movie.UNKNOWN);
    } else {
        try {
            DateTime dt = new DateTime(movie.getTrailerLastScan());
            DOMHelper.appendChild(doc, eMovie, TRAILER_LAST_SCAN, DateTimeTools.convertDateToString(dt));
        } catch (Exception error) {
            DOMHelper.appendChild(doc, eMovie, TRAILER_LAST_SCAN, Movie.UNKNOWN);
        }
    }

    DOMHelper.appendChild(doc, eMovie, "container", movie.getContainer(), SOURCE,
            movie.getOverrideSource(OverrideFlag.CONTAINER));
    DOMHelper.appendChild(doc, eMovie, "videoCodec", movie.getVideoCodec());
    DOMHelper.appendChild(doc, eMovie, "audioCodec", movie.getAudioCodec());

    // Write codec information
    eMovie.appendChild(createCodecsElement(doc, movie.getCodecs()));
    DOMHelper.appendChild(doc, eMovie, "audioChannels", movie.getAudioChannels());
    DOMHelper.appendChild(doc, eMovie, "resolution", movie.getResolution(), SOURCE,
            movie.getOverrideSource(OverrideFlag.RESOLUTION));

    // If the source is unknown, use the default source
    if (StringTools.isNotValidString(movie.getVideoSource())) {
        DOMHelper.appendChild(doc, eMovie, "videoSource", DEFAULT_SOURCE, SOURCE, Movie.UNKNOWN);
    } else {
        DOMHelper.appendChild(doc, eMovie, "videoSource", movie.getVideoSource(), SOURCE,
                movie.getOverrideSource(OverrideFlag.VIDEOSOURCE));
    }

    DOMHelper.appendChild(doc, eMovie, "videoOutput", movie.getVideoOutput(), SOURCE,
            movie.getOverrideSource(OverrideFlag.VIDEOOUTPUT));
    DOMHelper.appendChild(doc, eMovie, "aspect", movie.getAspectRatio(), SOURCE,
            movie.getOverrideSource(OverrideFlag.ASPECTRATIO));
    DOMHelper.appendChild(doc, eMovie, "fps", Float.toString(movie.getFps()), SOURCE,
            movie.getOverrideSource(OverrideFlag.FPS));

    if (movie.getFileDate() == null) {
        DOMHelper.appendChild(doc, eMovie, "fileDate", Movie.UNKNOWN);
    } else {
        // Try to catch any date re-formatting errors
        try {
            DOMHelper.appendChild(doc, eMovie, "fileDate",
                    DateTimeTools.convertDateToString(movie.getFileDate()));
        } catch (ArrayIndexOutOfBoundsException error) {
            DOMHelper.appendChild(doc, eMovie, "fileDate", Movie.UNKNOWN);
        }
    }
    DOMHelper.appendChild(doc, eMovie, "fileSize", movie.getFileSizeString());
    DOMHelper.appendChild(doc, eMovie, "first", HTMLTools.encodeUrl(movie.getFirst()));
    DOMHelper.appendChild(doc, eMovie, "previous", HTMLTools.encodeUrl(movie.getPrevious()));
    DOMHelper.appendChild(doc, eMovie, "next", HTMLTools.encodeUrl(movie.getNext()));
    DOMHelper.appendChild(doc, eMovie, "last", HTMLTools.encodeUrl(movie.getLast()));
    DOMHelper.appendChild(doc, eMovie, "libraryDescription", movie.getLibraryDescription());
    DOMHelper.appendChild(doc, eMovie, "prebuf", Long.toString(movie.getPrebuf()));

    if (!movie.getGenres().isEmpty()) {
        Element eGenres = doc.createElement("genres");
        eGenres.setAttribute(COUNT, String.valueOf(movie.getGenres().size()));
        eGenres.setAttribute(SOURCE, movie.getOverrideSource(OverrideFlag.GENRES));
        for (String genre : movie.getGenres()) {
            writeIndexedElement(doc, eGenres, "genre", genre,
                    createIndexAttribute(library, Library.INDEX_GENRES, Library.getIndexingGenre(genre)));
        }
        eMovie.appendChild(eGenres);
    }

    Collection<String> items = movie.getSetsKeys();
    if (!items.isEmpty()) {
        Element eSets = doc.createElement("sets");
        eSets.setAttribute(COUNT, String.valueOf(items.size()));
        for (String item : items) {
            Element eSetItem = doc.createElement("set");
            Integer order = movie.getSetOrder(item);
            if (null != order) {
                eSetItem.setAttribute(ORDER, String.valueOf(order));
            }
            String index = createIndexAttribute(library, Library.INDEX_SET, item);
            if (null != index) {
                eSetItem.setAttribute(INDEX, index);
            }

            eSetItem.setTextContent(item);
            eSets.appendChild(eSetItem);
        }
        eMovie.appendChild(eSets);
    }

    writeIndexedElement(doc, eMovie, "director", movie.getDirector(),
            createIndexAttribute(library, Library.INDEX_DIRECTOR, movie.getDirector()));

    Element eSet;
    eSet = generateElementSet(doc, "directors", "director", movie.getDirectors(), library,
            Library.INDEX_DIRECTOR, movie.getOverrideSource(OverrideFlag.DIRECTORS));
    if (eSet != null) {
        eMovie.appendChild(eSet);
    }

    eSet = generateElementSet(doc, "writers", "writer", movie.getWriters(), library, Library.INDEX_WRITER,
            movie.getOverrideSource(OverrideFlag.WRITERS));
    if (eSet != null) {
        eMovie.appendChild(eSet);
    }

    eSet = generateElementSet(doc, "cast", "actor", movie.getCast(), library, Library.INDEX_CAST,
            movie.getOverrideSource(OverrideFlag.ACTORS));
    if (eSet != null) {
        eMovie.appendChild(eSet);
    }

    // Issue 1901: Awards
    if (ENABLE_AWARDS) {
        Collection<AwardEvent> awards = movie.getAwards();
        if (awards != null && !awards.isEmpty()) {
            Element eAwards = doc.createElement("awards");
            eAwards.setAttribute(COUNT, String.valueOf(awards.size()));
            for (AwardEvent event : awards) {
                Element eEvent = doc.createElement("event");
                eEvent.setAttribute(NAME, event.getName());
                eEvent.setAttribute(COUNT, String.valueOf(event.getAwards().size()));
                for (Award award : event.getAwards()) {
                    Element eAwardItem = doc.createElement("award");
                    eAwardItem.setAttribute(NAME, award.getName());
                    eAwardItem.setAttribute(WON, Integer.toString(award.getWon()));
                    eAwardItem.setAttribute("nominated", Integer.toString(award.getNominated()));
                    eAwardItem.setAttribute(YEAR, Integer.toString(award.getYear()));
                    if (award.getWons() != null && !award.getWons().isEmpty()) {
                        eAwardItem.setAttribute("wons",
                                StringUtils.join(award.getWons(), Movie.SPACE_SLASH_SPACE));
                        if (XML_COMPATIBLE) {
                            for (String won : award.getWons()) {
                                DOMHelper.appendChild(doc, eAwardItem, WON, won);
                            }
                        }
                    }
                    if (award.getNominations() != null && !award.getNominations().isEmpty()) {
                        eAwardItem.setAttribute("nominations",
                                StringUtils.join(award.getNominations(), Movie.SPACE_SLASH_SPACE));
                        if (XML_COMPATIBLE) {
                            for (String nomination : award.getNominations()) {
                                DOMHelper.appendChild(doc, eAwardItem, "nomination", nomination);
                            }
                        }
                    }
                    if (!XML_COMPATIBLE) {
                        eAwardItem.setTextContent(award.getName());
                    }
                    eEvent.appendChild(eAwardItem);
                }
                eAwards.appendChild(eEvent);
            }
            eMovie.appendChild(eAwards);
        }
    }

    // Issue 1897: Cast enhancement
    if (ENABLE_PEOPLE) {
        Collection<Filmography> people = movie.getPeople();
        if (people != null && !people.isEmpty()) {
            Element ePeople = doc.createElement("people");
            ePeople.setAttribute(COUNT, String.valueOf(people.size()));
            for (Filmography person : people) {
                Element ePerson = doc.createElement("person");

                ePerson.setAttribute(NAME, person.getName());
                ePerson.setAttribute("doublage", person.getDoublage());
                ePerson.setAttribute(TITLE, person.getTitle());
                ePerson.setAttribute(CHARACTER, person.getCharacter());
                ePerson.setAttribute(JOB, person.getJob());
                ePerson.setAttribute("id", person.getId());
                for (Map.Entry<String, String> personID : person.getIdMap().entrySet()) {
                    if (!personID.getKey().equals(ImdbPlugin.IMDB_PLUGIN_ID)) {
                        ePerson.setAttribute(ID + personID.getKey(), personID.getValue());
                    }
                }
                ePerson.setAttribute(DEPARTMENT, person.getDepartment());
                ePerson.setAttribute(URL, person.getUrl());
                ePerson.setAttribute(ORDER, Integer.toString(person.getOrder()));
                ePerson.setAttribute("cast_id", Integer.toString(person.getCastId()));
                ePerson.setAttribute("photoFile", person.getPhotoFilename());
                String inx = createIndexAttribute(library, Library.INDEX_PERSON, person.getName());
                if (inx != null) {
                    ePerson.setAttribute(INDEX, inx);
                }
                ePerson.setAttribute(SOURCE, person.getSource());
                ePerson.setTextContent(person.getFilename());
                ePeople.appendChild(ePerson);
            }
            eMovie.appendChild(ePeople);
        }
    }

    // Issue 2012: Financial information about movie
    if (ENABLE_BUSINESS) {
        Element eBusiness = doc.createElement("business");
        eBusiness.setAttribute("budget", movie.getBudget());

        for (Map.Entry<String, String> gross : movie.getGross().entrySet()) {
            DOMHelper.appendChild(doc, eBusiness, "gross", gross.getValue(), COUNTRY, gross.getKey());
        }

        for (Map.Entry<String, String> openweek : movie.getOpenWeek().entrySet()) {
            DOMHelper.appendChild(doc, eBusiness, "openweek", openweek.getValue(), COUNTRY, openweek.getKey());
        }

        eMovie.appendChild(eBusiness);
    }

    // Issue 2013: Add trivia
    if (ENABLE_TRIVIA) {
        Element eTrivia = doc.createElement("didyouknow");
        eTrivia.setAttribute(COUNT, String.valueOf(movie.getDidYouKnow().size()));

        for (String trivia : movie.getDidYouKnow()) {
            DOMHelper.appendChild(doc, eTrivia, "trivia", trivia);
        }

        eMovie.appendChild(eTrivia);
    }

    // Write the indexes that the movie belongs to
    Element eIndexes = doc.createElement("indexes");
    String originalName;
    for (Entry<String, String> index : movie.getIndexes().entrySet()) {
        Element eIndexEntry = doc.createElement(INDEX);
        eIndexEntry.setAttribute("type", index.getKey());
        originalName = Library.getOriginalCategory(index.getKey(), Boolean.TRUE);
        eIndexEntry.setAttribute(ORIGINAL_NAME, originalName);
        eIndexEntry.setAttribute("encoded", FileTools.makeSafeFilename(index.getValue()));
        eIndexEntry.setTextContent(index.getValue());
        eIndexes.appendChild(eIndexEntry);
    }
    eMovie.appendChild(eIndexes);

    // Write details about the files
    Element eFiles = doc.createElement("files");
    for (MovieFile mf : movie.getFiles()) {
        Element eFileItem = doc.createElement("file");
        eFileItem.setAttribute(SEASON, Integer.toString(mf.getSeason()));
        eFileItem.setAttribute("firstPart", Integer.toString(mf.getFirstPart()));
        eFileItem.setAttribute("lastPart", Integer.toString(mf.getLastPart()));
        eFileItem.setAttribute(TITLE, mf.getTitle());
        eFileItem.setAttribute("subtitlesExchange", mf.isSubtitlesExchange() ? YES : "NO");

        // Fixes an issue with null file lengths
        try {
            if (mf.getFile() == null) {
                eFileItem.setAttribute("size", "0");
            } else {
                eFileItem.setAttribute("size", Long.toString(mf.getSize()));
            }
        } catch (DOMException ex) {
            LOG.debug("File length error for file {}", mf.getFilename(), ex);
            eFileItem.setAttribute("size", "0");
        }

        // Playlink values; can be empty, but not null
        for (Map.Entry<String, String> e : mf.getPlayLink().entrySet()) {
            eFileItem.setAttribute(e.getKey().toLowerCase(), e.getValue());
        }

        eFileItem.setAttribute("watched", mf.isWatched() ? TRUE : FALSE);

        if (mf.getFile() != null) {
            DOMHelper.appendChild(doc, eFileItem, "fileLocation", mf.getFile().getAbsolutePath());
        }

        // Write the fileURL
        String filename = mf.getFilename();
        // Issue 1237: Add "VIDEO_TS.IFO" for PlayOnHD VIDEO_TS path names
        if (IS_PLAYON_HD && filename.toUpperCase().endsWith("VIDEO_TS")) {
            filename = filename + "/VIDEO_TS.IFO";
        }

        // If attribute was set, save it back out.
        String archiveName = mf.getArchiveName();
        if (StringTools.isValidString(archiveName)) {
            LOG.debug("getArchivename is '{}' for {} length {}", archiveName, mf.getFilename(),
                    archiveName.length());
        }

        if (StringTools.isValidString(archiveName)) {
            DOMHelper.appendChild(doc, eFileItem, "fileArchiveName", archiveName);

            // If they want full URL, do so
            if (IS_EXTENDED_URL && !filename.endsWith(archiveName)) {
                filename = filename + "/" + archiveName;
            }
        }

        DOMHelper.appendChild(doc, eFileItem, "fileURL", filename);

        for (int part = mf.getFirstPart(); part <= mf.getLastPart(); ++part) {

            childAttributes.clear();
            childAttributes.put(PART, Integer.toString(part));
            childAttributes.put(SOURCE, mf.getOverrideSource(OverrideFlag.EPISODE_TITLE));
            DOMHelper.appendChild(doc, eFileItem, "fileTitle", mf.getTitle(part), childAttributes);

            // Only write out these for TV Shows
            if (movie.isTVShow()) {
                childAttributes.clear();
                childAttributes.put(PART, Integer.toString(part));
                childAttributes.put("afterSeason", mf.getAirsAfterSeason(part));
                childAttributes.put("beforeSeason", mf.getAirsBeforeSeason(part));
                childAttributes.put("beforeEpisode", mf.getAirsBeforeEpisode(part));
                DOMHelper.appendChild(doc, eFileItem, "airsInfo", String.valueOf(part), childAttributes);

                childAttributes.clear();
                childAttributes.put(PART, Integer.toString(part));
                childAttributes.put(SOURCE, mf.getOverrideSource(OverrideFlag.EPISODE_FIRST_AIRED));
                DOMHelper.appendChild(doc, eFileItem, "firstAired", mf.getFirstAired(part), childAttributes);
            }

            if (mf.getWatchedDate() > 0) {
                DOMHelper.appendChild(doc, eFileItem, "watchedDate", getWatchedDateString(mf.getWatchedDate()));
            }

            if (includeEpisodePlots) {
                childAttributes.clear();
                childAttributes.put(PART, Integer.toString(part));

                // use file title if plot is invalid
                String filePlot = mf.getPlot(part);
                final String filePlotSource;
                if (movie.isTVShow() && StringTools.isNotValidString(filePlot)) {
                    filePlot = mf.getTitle(part);
                    filePlotSource = Movie.UNKNOWN;
                } else {
                    filePlotSource = mf.getOverrideSource(OverrideFlag.EPISODE_PLOT);
                }

                if (episodePlotSize > 0) {
                    filePlot = StringTools.trimToLength(filePlot, episodePlotSize);
                }

                childAttributes.put(SOURCE, filePlotSource);
                DOMHelper.appendChild(doc, eFileItem, "filePlot", filePlot, childAttributes);
            }

            if (includeEpisodeRating) {
                childAttributes.clear();
                childAttributes.put(PART, Integer.toString(part));
                childAttributes.put(SOURCE, mf.getOverrideSource(OverrideFlag.EPISODE_RATING));
                DOMHelper.appendChild(doc, eFileItem, "fileRating", mf.getRating(part), childAttributes);
            }

            if (includeVideoImages) {
                DOMHelper.appendChild(doc, eFileItem, "fileImageURL",
                        HTMLTools.encodeUrl(mf.getVideoImageURL(part)), PART, String.valueOf(part));
                DOMHelper.appendChild(doc, eFileItem, "fileImageFile",
                        HTMLTools.encodeUrl(mf.getVideoImageFilename(part)), PART, String.valueOf(part));
            }

            // Episode IDs
            if (mf.getIds(part) != null && !mf.getIds(part).isEmpty()) {
                for (Entry<String, String> entry : mf.getIds(part).entrySet()) {
                    childAttributes.clear();
                    childAttributes.put(PART, Integer.toString(part));
                    childAttributes.put(SOURCE, entry.getKey());
                    DOMHelper.appendChild(doc, eFileItem, "fileId", entry.getValue(), childAttributes);
                }
            }
        }

        if (mf.getAttachments() != null && !mf.getAttachments().isEmpty()) {
            Element eAttachments = doc.createElement("attachments");
            for (Attachment att : mf.getAttachments()) {
                Element eAttachment = doc.createElement("attachment");
                eAttachment.setAttribute("type", att.getType().toString());
                DOMHelper.appendChild(doc, eAttachment, "attachmentId", String.valueOf(att.getAttachmentId()));
                DOMHelper.appendChild(doc, eAttachment, "contentType", att.getContentType().toString());
                DOMHelper.appendChild(doc, eAttachment, "mimeType", att.getMimeType());
                DOMHelper.appendChild(doc, eAttachment, "part", String.valueOf(att.getPart()));
                eAttachments.appendChild(eAttachment);
            }
            eFileItem.appendChild(eAttachments);
        }

        eFiles.appendChild(eFileItem);
    }
    eMovie.appendChild(eFiles);

    Collection<ExtraFile> extraFiles = movie.getExtraFiles();
    if (extraFiles != null && !extraFiles.isEmpty()) {
        Element eExtras = doc.createElement("extras");
        for (ExtraFile ef : extraFiles) {
            Element eExtraItem = doc.createElement("extra");
            eExtraItem.setAttribute(TITLE, ef.getTitle());
            if (ef.getPlayLink() != null) {
                // Playlink values
                for (Map.Entry<String, String> e : ef.getPlayLink().entrySet()) {
                    eExtraItem.setAttribute(e.getKey().toLowerCase(), e.getValue());
                }
            }
            eExtraItem.setTextContent(ef.getFilename()); // should already be URL-encoded
            eExtras.appendChild(eExtraItem);
        }
        eMovie.appendChild(eExtras);
    }

    return eMovie;
}

From source file:net.minecraftforge.common.config.Configuration.java

/**
 * Creates a float property.//from   w w w  .j  av  a 2  s .co m
 *
 * @param name Name of the property.
 * @param category Category of the property.
 * @param defaultValue Default value of the property.
 * @param minValue Minimum value of the property.
 * @param maxValue Maximum value of the property.
 * @param comment A brief description what the property does.
 * @param langKey A language key used for localization of GUIs
 * @return The value of the new float property.
 */
public float getFloat(String name, String category, float defaultValue, float minValue, float maxValue,
        String comment, String langKey) {
    Property prop = this.get(category, name, Float.toString(defaultValue), name);
    prop.setLanguageKey(langKey);
    prop.setComment(comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + defaultValue + "]");
    prop.setMinValue(minValue);
    prop.setMaxValue(maxValue);
    try {
        return Float.parseFloat(prop.getString()) < minValue ? minValue
                : (Float.parseFloat(prop.getString()) > maxValue ? maxValue
                        : Float.parseFloat(prop.getString()));
    } catch (Exception e) {
        e.printStackTrace();
    }
    return defaultValue;
}

From source file:gskproject.Analyze.java

private void btnReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReportActionPerformed
    try {//from   ww w .ja va 2  s .  com
        String accidentType1 = null, accidentType2 = null, accidentType3 = null, close_p_lti = null,
                close_p_firstaid = null, close_p_nearmiss = null;
        String duration_variable_from = null, duration_variable_to = null;

        //Calculate_Duration d =new Calculate_Duration();
        if (ddDTimePeriod.getSelectedItem() == "ALL") {
            //duration_variable_from= "2005-01-01";
        } else if (ddDTimePeriod.getSelectedItem() == "Last Week") {
            Date[] array = getLastWeek();
            duration_variable_from = new SimpleDateFormat("yyyy-MM-dd").format(array[0]);
            duration_variable_to = new SimpleDateFormat("yyyy-MM-dd").format(array[1]);
        } else if (ddDTimePeriod.getSelectedItem() == "Last Month") {
            Date[] array = getLastMonth();
            duration_variable_from = new SimpleDateFormat("yyyy-MM-dd").format(array[0]);
            duration_variable_to = new SimpleDateFormat("yyyy-MM-dd").format(array[1]);
        } else if (ddDTimePeriod.getSelectedItem() == "Last Year") {
            Date[] array = getLastYear();
            duration_variable_from = new SimpleDateFormat("yyyy-MM-dd").format(array[0]);
            duration_variable_to = new SimpleDateFormat("yyyy-MM-dd").format(array[1]);
        }
        //test2.setText(duration_variable_to);
        else if (ddDTimePeriod.getSelectedItem() == "This Week") {

            duration_variable_from = new SimpleDateFormat("yyyy-MM-dd").format(getThisWeek());
            duration_variable_to = new SimpleDateFormat("yyyy-MM-dd").format(new Date());

        } else if (ddDTimePeriod.getSelectedItem() == "This Month") {
            duration_variable_from = new SimpleDateFormat("yyyy-MM-dd").format(getThisMonth());
            duration_variable_to = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        } else if (ddDTimePeriod.getSelectedItem() == "This Year") {
            duration_variable_from = new SimpleDateFormat("yyyy-MM-dd").format(getThisYear());
            duration_variable_to = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        } else {
            // duration_variable=advanece_duration_variable;
        }

        System.out.println(duration_variable_from = new SimpleDateFormat("yyyy-MM-dd").format(getThisYear()));
        //departmentID =((Integer)department1.getSelectedIndex()).toString();                                                    CAST(dates AS date) BETWEEN '1/1/2013' and '1/2/2013'
        //Integer.toString(department1.getSelectedIndex()+1);
        String departmentName = tableDepartmentAccident.get(tblDepartmentAccident.getSelectedRow()).get(0)
                .toString();
        String departmentID = null;
        System.out.println(departmentName + "%%%%%%%%%%%%%%%%%%%%%%%%%");
        //if(departmentName=="EHS")
        if ("EHS".equals(departmentName)) {
            departmentID = "1";
        } else if ("IT".equals(departmentName)) {
            departmentID = "3";
        } else if ("Engineering".equals(departmentName)) {
            departmentID = "2";
        }

        //String query ="select observation.date, observation.departmentID, department.departmentName, observation.observationID, observation.responsiblePartyID, observation.accidentType, observation.zapStatus from observation INNER JOIN department ON (observation.departmentID=department.departmentID) where (observation.accidentType =" + "'" + accidentType1 + "'" + "or observation.accidentType = " + "'" + accidentType2 + "'" + "or observation.accidentType =" + "'" + accidentType3 + "'" + ") and (observation.departmentID =" + "'" + departmentID1+ "'" + "or observation.departmentID = " + "'" + departmentID2 + "'" + "or observation.departmentID =" + "'" + departmentID3 + "'" + ") order by departmentID";
        String quary_total_LTI = "select count(*) as x from observation where (observation.departmentID =" + "'"
                + departmentID + "'" + " )and (accidentType= " + "'" + "LTI" + "'"
                + ")and (observation.date between " + "'" + duration_variable_from + "'" + "and" + "'"
                + duration_variable_to + "'" + " )";
        String quary_Open_LTI = "select count(*) as x from observation  where (observation.departmentID =" + "'"
                + departmentID + "'" + " ) and (accidentType= " + "'" + "LTI" + "'" + ") and (zapStatus = "
                + "'" + "Open" + "'" + ") and (observation.date between " + "'" + duration_variable_from + "'"
                + "and" + "'" + duration_variable_to + "'" + " )";
        String quary_close_LTI = "select count(*) as x from observation where (observation.departmentID =" + "'"
                + departmentID + "'" + " ) and (accidentType= " + "'" + "LTI" + "'" + ") and (zapStatus = "
                + "'" + "Close" + "'" + ")and (observation.date between " + "'" + duration_variable_from + "'"
                + "and" + "'" + duration_variable_to + "'" + " )";
        //txt1.setText(quary_total_LTI);
        String quary_total_FirstAid = "select count(*) as x from observation where (observation.departmentID ="
                + "'" + departmentID + "'" + " )and (accidentType= " + "'" + "First Aid" + "'"
                + ")and (observation.date between " + "'" + duration_variable_from + "'" + "and" + "'"
                + duration_variable_to + "'" + " )";
        String quary_Open_FirstAid = "select count(*) as x from observation where (observation.departmentID ="
                + "'" + departmentID + "'" + " ) and (accidentType= " + "'" + "First Aid" + "'"
                + ") and (zapStatus = " + "'" + "Open" + "'" + ")and (observation.date between " + "'"
                + duration_variable_from + "'" + "and" + "'" + duration_variable_to + "'" + " )";
        String quary_close_FirstAid = "select count(*) as x from observation where (observation.departmentID ="
                + "'" + departmentID + "'" + " ) and (accidentType= " + "'" + "First Aid" + "'"
                + ") and (zapStatus = " + "'" + "Close" + "'" + ")and (observation.date between " + "'"
                + duration_variable_from + "'" + "and" + "'" + duration_variable_to + "'" + " )";

        String quary_total_NearMiss = "select count(*) as x from observation  where (observation.departmentID ="
                + "'" + departmentID + "'" + " )and (accidentType= " + "'" + "Near Miss" + "'"
                + ")and (observation.date between " + "'" + duration_variable_from + "'" + "and" + "'"
                + duration_variable_to + "'" + " )";
        String quary_Open_NearMiss = "select count(*) as x from observation where (observation.departmentID ="
                + "'" + departmentID + "'" + " ) and (accidentType= " + "'" + "Near Miss" + "'"
                + ") and (zapStatus = " + "'" + "Open" + "'" + ")and  (observation.date between " + "'"
                + duration_variable_from + "'" + "and" + "'" + duration_variable_to + "'" + " )";
        String quary_close_NearMiss = "select count(*) as x from observation where (observation.departmentID ="
                + "'" + departmentID + "'" + " ) and (accidentType= " + "'" + "Near Miss" + "'"
                + ") and (zapStatus = " + "'" + "Close" + "'" + ")and (observation.date between " + "'"
                + duration_variable_from + "'" + "and" + "'" + duration_variable_to + "'" + " )";
        System.out.println("2");
        test2.setText(quary_total_NearMiss);
        Case_Summary count1 = new Case_Summary();

        String total_lti = count1.getData(quary_total_LTI);
        String open_lti = count1.getData(quary_Open_LTI);
        String close_lti = count1.getData(quary_close_LTI);
        if (Float.parseFloat(total_lti) == 0) {
            //float close_precentage_lti = (Float.parseFloat(close_lti)/1)*100;
            close_p_lti = "0.0 %";//Float.toString(close_precentage_lti).concat(" %");
        } else {
            float close_precentage_lti = (Float.parseFloat(close_lti) / Float.parseFloat(total_lti)) * 100;
            close_p_lti = Float.toString(close_precentage_lti).concat(" %");
        }

        //view.setText(total_lti);
        //view2.setText(close_lti);
        //view3.setText(close_p_lti);
        String total_firstaid = count1.getData(quary_total_FirstAid);
        String open_firstaid = count1.getData(quary_Open_FirstAid);
        String close_firstaid = count1.getData(quary_close_FirstAid);
        if (Float.parseFloat(total_firstaid) == 0) {
            //float close_precentage_lti = (Float.parseFloat(close_lti)/1)*100;
            close_p_firstaid = "0.0 %";//Float.toString(close_precentage_lti).concat(" %");
        } else {
            float close_precentage_firstaid = (Float.parseFloat(close_firstaid)
                    / Float.parseFloat(total_firstaid)) * 100;
            close_p_firstaid = Float.toString(close_precentage_firstaid).concat(" %");
        }
        System.out.println("4");
        String total_nearmiss = count1.getData(quary_total_NearMiss);
        String open_nearmiss = count1.getData(quary_Open_NearMiss);
        String close_nearmiss = count1.getData(quary_close_NearMiss);
        System.out.println("5");
        if (Float.parseFloat(total_nearmiss) == 0) {
            //float close_precentage_lti = (Float.parseFloat(close_lti)/1)*100;
            close_p_nearmiss = "0.0 %";//Float.toString(close_precentage_lti).concat(" %");
        } else {
            float close_precentage_nearmiss = (Float.parseFloat(close_nearmiss)
                    / Float.parseFloat(total_nearmiss)) * 100;
            close_p_nearmiss = Float.toString(close_precentage_nearmiss).concat(" %");
        }

        /*view2.setText(open);
        view3.setText(close);
        view.setText(quary_total);*/

        departmentID = "3";
        HashMap param = new HashMap();
        param.put("total_nearmiss", total_nearmiss);
        param.put("open_nearmiss", open_nearmiss);
        param.put("close_nearmiss", close_nearmiss);
        param.put("close_p_nearmiss", close_p_nearmiss);

        param.put("total_lti", total_lti);
        param.put("open_lti", open_lti);
        param.put("close_lti", close_lti);
        param.put("close_p_lti", close_p_lti);

        param.put("total_firstaid", total_firstaid);
        param.put("open_firstaid", open_firstaid);
        param.put("close_firstaid", close_firstaid);
        param.put("close_p_firstaid", close_p_firstaid);
        param.put("departmentID", departmentID);
        param.put("departmentName", departmentName);

        param.put("duration_variable_from", duration_variable_from);
        param.put("duration_variable_to", duration_variable_to);
        Ireport_connection dep = new Ireport_connection(
                "C:\\Users\\chamod\\Documents\\NetBeansProjects\\GskProject\\src\\report\\Department_vice_Analyse.jasper",
                param);
        dep.setVisible(true);
    }

    catch (SQLException ex) {
        //Logger.getLogger(Department_Vice_Analyse.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:act.reports.dao.AllInvoicesDAO.java

public String roundUp(float d, int decimalPlace) {
    BigDecimal bd = new BigDecimal(Float.toString(d));
    bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP);
    return bd.toString();
}

From source file:edu.stanford.muse.util.Util.java

/**
 * converts an object to a string->string map by converting all its fields
 * (fields may be non-public/*  w  w  w .  java2s .  c o m*/
 * if running without security manager). expand=true expands collections
 * (array, list, map)
 */
public static Map<String, String> convertObjectToMap(Object o, boolean expand) {
    Map<String, String> map = new LinkedHashMap<String, String>();
    if (o == null)
        return map;

    Class c = o.getClass();

    try {
        // generate a string to string map of the fields
        Field f[] = c.getDeclaredFields();
        for (int i = 0; i < f.length; i++) {
            boolean acc = f[i].isAccessible();
            if (!acc)
                f[i].setAccessible(true); // ok to do in absence of a security manager

            Class t = f[i].getType();
            String name = f[i].getName();
            if (name.indexOf("$") >= 0) // outer class, skip" +
                continue;
            if (t == double.class)
                map.put(name, Double.toString(f[i].getDouble(o)));
            else if (t == float.class)
                map.put(name, Float.toString(f[i].getFloat(o)));
            else if (t == int.class)
                map.put(name, Integer.toString(f[i].getInt(o)));
            else if (t == long.class)
                map.put(name, Long.toString(f[i].getLong(o)));
            else if (t == char.class)
                map.put(name, f[i].getChar(o) + "(" + Integer.toString(f[i].getChar(o)) + ")");
            else if (t == short.class)
                map.put(name, Short.toString(f[i].getShort(o)));
            else if (t == byte.class)
                map.put(name, Byte.toString(f[i].getByte(o)));
            else if (t == boolean.class)
                map.put(name, Boolean.toString(f[i].getBoolean(o)));
            else {
                // field is of object type
                Object val = f[i].get(o); // o.f[i]'s type is t, value is
                // val
                if (val == null)
                    map.put(name, "null");
                else {
                    Class valClass = val.getClass();
                    if (valClass.isArray()) {
                        if (expand)
                            for (int x = 0; x < Array.getLength(val); x++)
                                map.put(name + "[" + x + "]", Array.get(val, x) + "");
                    } else if (java.util.Map.class.isAssignableFrom(valClass)) // could
                    // also
                    // check
                    // t,
                    // but
                    // val.getClass
                    // is
                    // more
                    // specific
                    {
                        Map m = (Map) f[i].get(o);
                        if (expand)
                            for (Object x : m.keySet())
                                map.put(name + "." + x, m.get(x) + "");
                    }
                    // could also check t, but val.getClass is more specific
                    else if (java.util.Collection.class.isAssignableFrom(valClass)) {
                        Collection c1 = (Collection) f[i].get(o);
                        if (expand) {
                            int count = 0;
                            for (Object o1 : c1)
                                map.put(name + "(" + count++ + ")", o1 + ""); // use
                            // ()
                            // instead
                            // of
                            // []
                            // to
                            // distinguish
                            // from
                            // arrays
                        }
                    } else
                        map.put(name, "[" + val.toString() + "]");
                }
            }
            if (!acc)
                f[i].setAccessible(false);
        }

    } catch (Throwable e) {
        Util.print_exception(e);
    }
    return map;
}

From source file:ru.spbspu.viewer.DataView.java

@Override
public void setFrameWidthInSeconds(float width) {
    frameWidthInSecondsTextField.setText(Float.toString(width) + " ?");
}

From source file:lob.VisualisationGUI.java

public void updatePriceChart(GUIUpdatePackage GUP) {
    float currMid = GUP.getMidpriceHistory().getLast();

    int t = GUP.getTime();

    jLabel13.setText(Float.toString(currMid));
    series1.add(t, currMid);/*from  w  w w . j a v a  2 s .  c  o  m*/
    this.midPriceHistory.add(currMid);
    JFreeChart chart = createChart(series1, "Price-Time", "Time", "Price");
    ChartPanel chPanel = new ChartPanel(chart);
    chPanel.setPreferredSize(new Dimension(785, 440));
    chPanel.setMouseWheelEnabled(true);
    jPanel4.setLayout(new java.awt.BorderLayout());
    jPanel4.add(chPanel, BorderLayout.CENTER);
    jPanel4.validate();
}

From source file:it.infn.ct.nuclemd.Nuclemd.java

@Override
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {

    PortletPreferences portletPreferences = (PortletPreferences) request.getPreferences();

    response.setContentType("text/html");

    //java.util.Enumeration listPreferences = portletPreferences.getNames();
    PortletRequestDispatcher dispatcher = null;

    String lato_nuclemd_PASSWD = "";
    String lato_nuclemd_LOGIN = "";
    String garuda_nuclemd_TOPBDII = "";
    String garuda_nuclemd_VONAME = "";
    String eumed_nuclemd_TOPBDII = "";
    String eumed_nuclemd_VONAME = "";
    String sagrid_nuclemd_TOPBDII = "";
    String sagrid_nuclemd_VONAME = "";
    String see_nuclemd_TOPBDII = "";
    String see_nuclemd_VONAME = "";
    String gridit_nuclemd_TOPBDII = "";
    String gridit_nuclemd_VONAME = "";

    String lato_nuclemd_ENABLEINFRASTRUCTURE = "";
    String garuda_nuclemd_ENABLEINFRASTRUCTURE = "";
    String eumed_nuclemd_ENABLEINFRASTRUCTURE = "";
    String sagrid_nuclemd_ENABLEINFRASTRUCTURE = "";
    String see_nuclemd_ENABLEINFRASTRUCTURE = "";
    String gridit_nuclemd_ENABLEINFRASTRUCTURE = "";
    String[] infras = new String[6];

    String[] lato_nuclemd_WMS = new String[5];

    String[] nuclemd_INFRASTRUCTURES = portletPreferences.getValues("nuclemd_ENABLEINFRASTRUCTURE",
            new String[5]);

    for (int i = 0; i < nuclemd_INFRASTRUCTURES.length; i++) {
        if (nuclemd_INFRASTRUCTURES[i] != null && nuclemd_INFRASTRUCTURES[i].equals("lato")) {
            lato_nuclemd_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n LATO!");
        }//from  w  w w  .  j  av a2  s.  c  o  m
        if (nuclemd_INFRASTRUCTURES[i] != null && nuclemd_INFRASTRUCTURES[i].equals("garuda")) {
            garuda_nuclemd_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n GARUDA!");
        }
        if (nuclemd_INFRASTRUCTURES[i] != null && nuclemd_INFRASTRUCTURES[i].equals("eumed")) {
            eumed_nuclemd_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n EUMED!");
        }
        if (nuclemd_INFRASTRUCTURES[i] != null && nuclemd_INFRASTRUCTURES[i].equals("sagrid")) {
            sagrid_nuclemd_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n SAGRID!");
        }
        if (nuclemd_INFRASTRUCTURES[i] != null && nuclemd_INFRASTRUCTURES[i].equals("see")) {
            see_nuclemd_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n SEE!");
        }
        if (nuclemd_INFRASTRUCTURES[i] != null && nuclemd_INFRASTRUCTURES[i].equals("gridit")) {
            gridit_nuclemd_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n GRIDIT!");
        }
    }

    // Getting the NUCLEMD ENABLEINFRASTRUCTURE from the portlet preferences
    //nuclemd_ENABLEINFRASTRUCTURE = portletPreferences.getValue("nuclemd_ENABLEINFRASTRUCTURE", "NULL");
    // Getting the NUCLEMD APPID from the portlet preferences
    String nuclemd_APPID = portletPreferences.getValue("nuclemd_APPID", "N/A");
    // Getting the LOGLEVEL from the portlet preferences
    String nuclemd_LOGLEVEL = portletPreferences.getValue("nuclemd_LOGLEVEL", "INFO");
    // Getting the METADATA METADATA_HOST from the portlet preferences
    String nuclemd_METADATA_HOST = portletPreferences.getValue("nuclemd_METADATA_HOST", "N/A");
    // Getting the NUCLEMD OUTPUT_PATH from the portlet preferences
    String nuclemd_OUTPUT_PATH = portletPreferences.getValue("nuclemd_OUTPUT_PATH", "/tmp");
    // Getting the NUCLEMD SOFTWARE from the portlet preferences
    String nuclemd_SOFTWARE = portletPreferences.getValue("nuclemd_SOFTWARE", "N/A");
    // Getting the TRACKING_DB_HOSTNAME from the portlet preferences
    String TRACKING_DB_HOSTNAME = portletPreferences.getValue("TRACKING_DB_HOSTNAME", "N/A");
    // Getting the TRACKING_DB_USERNAME from the portlet preferences
    String TRACKING_DB_USERNAME = portletPreferences.getValue("TRACKING_DB_USERNAME", "N/A");
    // Getting the TRACKING_DB_PASSWORD from the portlet preferences
    String TRACKING_DB_PASSWORD = portletPreferences.getValue("TRACKING_DB_PASSWORD", "N/A");
    // Getting the SMTP_HOST from the portlet preferences
    String SMTP_HOST = portletPreferences.getValue("SMTP_HOST", "N/A");
    // Getting the SENDER_MAIL from the portlet preferences
    String SENDER_MAIL = portletPreferences.getValue("SENDER_MAIL", "N/A");

    if (lato_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[0] = "lato";
        // Getting the NUCLEMD INFRASTRUCTURE from the portlet preferences for LATO
        String lato_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("lato_nuclemd_INFRASTRUCTURE", "N/A");
        // Getting the NUCLEMD VONAME from the portlet preferences for LATO
        lato_nuclemd_LOGIN = portletPreferences.getValue("lato_nuclemd_LOGIN", "N/A");
        // Getting the NUCLEMD TOPPBDII from the portlet preferences for LATO
        lato_nuclemd_PASSWD = portletPreferences.getValue("lato_nuclemd_PASSWD", "N/A");
        // Getting the NUCLEMD WMS from the portlet preferences for LATO
        lato_nuclemd_WMS = portletPreferences.getValues("lato_nuclemd_WMS", new String[5]);
        // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for LATO
        String lato_nuclemd_ETOKENSERVER = portletPreferences.getValue("lato_nuclemd_ETOKENSERVER", "N/A");
        // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for LATO
        String lato_nuclemd_MYPROXYSERVER = portletPreferences.getValue("lato_nuclemd_MYPROXYSERVER", "N/A");
        // Getting the NUCLEMD PORT from the portlet preferences for LATO
        String lato_nuclemd_PORT = portletPreferences.getValue("lato_nuclemd_PORT", "N/A");
        // Getting the NUCLEMD ROBOTID from the portlet preferences for LATO
        String lato_nuclemd_ROBOTID = portletPreferences.getValue("lato_nuclemd_ROBOTID", "N/A");
        // Getting the NUCLEMD WEBDAV from the portlet preferences for LATO
        String lato_nuclemd_WEBDAV = portletPreferences.getValue("lato_nuclemd_WEBDAV", "N/A");
        // Getting the NUCLEMD ROLE from the portlet preferences for LATO
        String lato_nuclemd_ROLE = portletPreferences.getValue("lato_nuclemd_ROLE", "N/A");
        // Getting the NUCLEMD RENEWAL from the portlet preferences for LATO
        String lato_nuclemd_RENEWAL = portletPreferences.getValue("lato_nuclemd_RENEWAL", "checked");
        // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for LATO
        String lato_nuclemd_DISABLEVOMS = portletPreferences.getValue("lato_nuclemd_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for LATO
        String lato_WMS = "";
        if (lato_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (lato_nuclemd_WMS != null) {
                //log.info("length="+lato_nuclemd_WMS.length);
                for (int i = 0; i < lato_nuclemd_WMS.length; i++)
                    if (!(lato_nuclemd_WMS[i].trim().equals("N/A")))
                        lato_WMS += lato_nuclemd_WMS[i] + " ";
            } else {
                log.info("WMS not set for LATO!");
                lato_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("lato_nuclemd_INFRASTRUCTURE", lato_nuclemd_INFRASTRUCTURE.trim());
        request.setAttribute("lato_nuclemd_LOGIN", lato_nuclemd_LOGIN.trim());
        request.setAttribute("lato_nuclemd_PASSWD", lato_nuclemd_PASSWD.trim());
        request.setAttribute("lato_nuclemd_WMS", lato_WMS);
        request.setAttribute("lato_nuclemd_ETOKENSERVER", lato_nuclemd_ETOKENSERVER.trim());
        request.setAttribute("lato_nuclemd_MYPROXYSERVER", lato_nuclemd_MYPROXYSERVER.trim());
        request.setAttribute("lato_nuclemd_PORT", lato_nuclemd_PORT.trim());
        request.setAttribute("lato_nuclemd_ROBOTID", lato_nuclemd_ROBOTID.trim());
        request.setAttribute("lato_nuclemd_WEBDAV", lato_nuclemd_WEBDAV.trim());
        request.setAttribute("lato_nuclemd_ROLE", lato_nuclemd_ROLE.trim());
        request.setAttribute("lato_nuclemd_RENEWAL", lato_nuclemd_RENEWAL);
        request.setAttribute("lato_nuclemd_DISABLEVOMS", lato_nuclemd_DISABLEVOMS);

        //request.setAttribute("nuclemd_ENABLEINFRASTRUCTURE", nuclemd_ENABLEINFRASTRUCTURE);
        request.setAttribute("nuclemd_APPID", nuclemd_APPID.trim());
        request.setAttribute("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
        request.setAttribute("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
        request.setAttribute("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (garuda_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[1] = "garuda";
        // Getting the NUCLEMD INFRASTRUCTURE from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("garuda_nuclemd_INFRASTRUCTURE",
                "N/A");
        // Getting the NUCLEMD VONAME from the portlet preferences for the GARUDA VO
        garuda_nuclemd_VONAME = portletPreferences.getValue("garuda_nuclemd_VONAME", "N/A");
        // Getting the NUCLEMD TOPPBDII from the portlet preferences for the GARUDA VO
        garuda_nuclemd_TOPBDII = portletPreferences.getValue("garuda_nuclemd_TOPBDII", "N/A");
        // Getting the NUCLEMD WMS from the portlet preferences for the GARUDA VO
        String[] garuda_nuclemd_WMS = portletPreferences.getValues("garuda_nuclemd_WMS", new String[5]);
        // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_ETOKENSERVER = portletPreferences.getValue("garuda_nuclemd_ETOKENSERVER", "N/A");
        // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_MYPROXYSERVER = portletPreferences.getValue("garuda_nuclemd_MYPROXYSERVER",
                "N/A");
        // Getting the NUCLEMD PORT from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_PORT = portletPreferences.getValue("garuda_nuclemd_PORT", "N/A");
        // Getting the NUCLEMD ROBOTID from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_ROBOTID = portletPreferences.getValue("garuda_nuclemd_ROBOTID", "N/A");
        // Getting the NUCLEMD WEBDAV from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_WEBDAV = portletPreferences.getValue("garuda_nuclemd_WEBDAV", "N/A");
        // Getting the NUCLEMD ROLE from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_ROLE = portletPreferences.getValue("garuda_nuclemd_ROLE", "N/A");
        // Getting the NUCLEMD RENEWAL from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_RENEWAL = portletPreferences.getValue("garuda_nuclemd_RENEWAL", "checked");
        // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the GARUDA VO
        String garuda_nuclemd_DISABLEVOMS = portletPreferences.getValue("garuda_nuclemd_DISABLEVOMS",
                "unchecked");

        // Fetching all the WMS Endpoints for the GARUDA VO
        String garuda_WMS = "";
        if (garuda_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (garuda_nuclemd_WMS != null) {
                //log.info("length="+garuda_nuclemd_WMS.length);
                for (int i = 0; i < garuda_nuclemd_WMS.length; i++)
                    if (!(garuda_nuclemd_WMS[i].trim().equals("N/A")))
                        garuda_WMS += garuda_nuclemd_WMS[i] + " ";
            } else {
                log.info("WMS not set for GARUDA!");
                garuda_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("garuda_nuclemd_INFRASTRUCTURE", garuda_nuclemd_INFRASTRUCTURE.trim());
        request.setAttribute("garuda_nuclemd_VONAME", garuda_nuclemd_VONAME.trim());
        request.setAttribute("garuda_nuclemd_TOPBDII", garuda_nuclemd_TOPBDII.trim());
        request.setAttribute("garuda_nuclemd_WMS", garuda_WMS);
        request.setAttribute("garuda_nuclemd_ETOKENSERVER", garuda_nuclemd_ETOKENSERVER.trim());
        request.setAttribute("garuda_nuclemd_MYPROXYSERVER", garuda_nuclemd_MYPROXYSERVER.trim());
        request.setAttribute("garuda_nuclemd_PORT", garuda_nuclemd_PORT.trim());
        request.setAttribute("garuda_nuclemd_ROBOTID", garuda_nuclemd_ROBOTID.trim());
        request.setAttribute("garuda_nuclemd_WEBDAV", garuda_nuclemd_WEBDAV.trim());
        request.setAttribute("garuda_nuclemd_ROLE", garuda_nuclemd_ROLE.trim());
        request.setAttribute("garuda_nuclemd_RENEWAL", garuda_nuclemd_RENEWAL);
        request.setAttribute("garuda_nuclemd_DISABLEVOMS", garuda_nuclemd_DISABLEVOMS);

        //request.setAttribute("nuclemd_ENABLEINFRASTRUCTURE", nuclemd_ENABLEINFRASTRUCTURE);
        request.setAttribute("nuclemd_APPID", nuclemd_APPID.trim());
        request.setAttribute("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
        request.setAttribute("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
        request.setAttribute("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
        request.setAttribute("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (eumed_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[2] = "eumed";
        // Getting the NUCLEMD INFRASTRUCTURE from the portlet preferences for the EUMED VO
        String eumed_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("eumed_nuclemd_INFRASTRUCTURE",
                "N/A");
        // Getting the NUCLEMD VONAME from the portlet preferences for the EUMED VO
        eumed_nuclemd_VONAME = portletPreferences.getValue("eumed_nuclemd_VONAME", "N/A");
        // Getting the NUCLEMD TOPPBDII from the portlet preferences for the EUMED VO
        eumed_nuclemd_TOPBDII = portletPreferences.getValue("eumed_nuclemd_TOPBDII", "N/A");
        // Getting the NUCLEMD WMS from the portlet preferences for the EUMED VO
        String[] eumed_nuclemd_WMS = portletPreferences.getValues("eumed_nuclemd_WMS", new String[5]);
        // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the EUMED VO
        String eumed_nuclemd_ETOKENSERVER = portletPreferences.getValue("eumed_nuclemd_ETOKENSERVER", "N/A");
        // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the EUMED VO
        String eumed_nuclemd_MYPROXYSERVER = portletPreferences.getValue("eumed_nuclemd_MYPROXYSERVER", "N/A");
        // Getting the NUCLEMD PORT from the portlet preferences for the EUMED VO
        String eumed_nuclemd_PORT = portletPreferences.getValue("eumed_nuclemd_PORT", "N/A");
        // Getting the NUCLEMD ROBOTID from the portlet preferences for the EUMED VO
        String eumed_nuclemd_ROBOTID = portletPreferences.getValue("eumed_nuclemd_ROBOTID", "N/A");
        // Getting the NUCLEMD WEBDAV from the portlet preferences for the EUMED VO
        String eumed_nuclemd_WEBDAV = portletPreferences.getValue("eumed_nuclemd_WEBDAV", "N/A");
        // Getting the NUCLEMD ROLE from the portlet preferences for the EUMED VO
        String eumed_nuclemd_ROLE = portletPreferences.getValue("eumed_nuclemd_ROLE", "N/A");
        // Getting the NUCLEMD RENEWAL from the portlet preferences for the EUMED VO
        String eumed_nuclemd_RENEWAL = portletPreferences.getValue("eumed_nuclemd_RENEWAL", "checked");
        // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the EUMED VO
        String eumed_nuclemd_DISABLEVOMS = portletPreferences.getValue("eumed_nuclemd_DISABLEVOMS",
                "unchecked");

        // Fetching all the WMS Endpoints for the EUMED VO
        String eumed_WMS = "";
        if (eumed_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (eumed_nuclemd_WMS != null) {
                //log.info("length="+eumed_nuclemd_WMS.length);
                for (int i = 0; i < eumed_nuclemd_WMS.length; i++)
                    if (!(eumed_nuclemd_WMS[i].trim().equals("N/A")))
                        eumed_WMS += eumed_nuclemd_WMS[i] + " ";
            } else {
                log.info("WMS not set for EUMED!");
                eumed_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("eumed_nuclemd_INFRASTRUCTURE", eumed_nuclemd_INFRASTRUCTURE.trim());
        request.setAttribute("eumed_nuclemd_VONAME", eumed_nuclemd_VONAME.trim());
        request.setAttribute("eumed_nuclemd_TOPBDII", eumed_nuclemd_TOPBDII.trim());
        request.setAttribute("eumed_nuclemd_WMS", eumed_WMS);
        request.setAttribute("eumed_nuclemd_ETOKENSERVER", eumed_nuclemd_ETOKENSERVER.trim());
        request.setAttribute("eumed_nuclemd_MYPROXYSERVER", eumed_nuclemd_MYPROXYSERVER.trim());
        request.setAttribute("eumed_nuclemd_PORT", eumed_nuclemd_PORT.trim());
        request.setAttribute("eumed_nuclemd_ROBOTID", eumed_nuclemd_ROBOTID.trim());
        request.setAttribute("eumed_nuclemd_WEBDAV", eumed_nuclemd_WEBDAV.trim());
        request.setAttribute("eumed_nuclemd_ROLE", eumed_nuclemd_ROLE.trim());
        request.setAttribute("eumed_nuclemd_RENEWAL", eumed_nuclemd_RENEWAL);
        request.setAttribute("eumed_nuclemd_DISABLEVOMS", eumed_nuclemd_DISABLEVOMS);

        //request.setAttribute("nuclemd_ENABLEINFRASTRUCTURE", nuclemd_ENABLEINFRASTRUCTURE);
        request.setAttribute("nuclemd_APPID", nuclemd_APPID.trim());
        request.setAttribute("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
        request.setAttribute("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
        request.setAttribute("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
        request.setAttribute("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (sagrid_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[3] = "sagrid";
        // Getting the NUCLEMD INFRASTRUCTURE from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("sagrid_nuclemd_INFRASTRUCTURE",
                "N/A");
        // Getting the NUCLEMD VONAME from the portlet preferences for the SAGRID VO
        sagrid_nuclemd_VONAME = portletPreferences.getValue("sagrid_nuclemd_VONAME", "N/A");
        // Getting the NUCLEMD TOPPBDII from the portlet preferences for the SAGRID VO
        sagrid_nuclemd_TOPBDII = portletPreferences.getValue("sagrid_nuclemd_TOPBDII", "N/A");
        // Getting the NUCLEMD WMS from the portlet preferences for the SAGRID VO
        String[] sagrid_nuclemd_WMS = portletPreferences.getValues("sagrid_nuclemd_WMS", new String[5]);
        // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_ETOKENSERVER = portletPreferences.getValue("sagrid_nuclemd_ETOKENSERVER", "N/A");
        // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_MYPROXYSERVER = portletPreferences.getValue("sagrid_nuclemd_MYPROXYSERVER",
                "N/A");
        // Getting the NUCLEMD PORT from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_PORT = portletPreferences.getValue("sagrid_nuclemd_PORT", "N/A");
        // Getting the NUCLEMD ROBOTID from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_ROBOTID = portletPreferences.getValue("sagrid_nuclemd_ROBOTID", "N/A");
        // Getting the NUCLEMD WEBDAV from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_WEBDAV = portletPreferences.getValue("sagrid_nuclemd_WEBDAV", "N/A");
        // Getting the NUCLEMD ROLE from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_ROLE = portletPreferences.getValue("sagrid_nuclemd_ROLE", "N/A");
        // Getting the NUCLEMD RENEWAL from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_RENEWAL = portletPreferences.getValue("sagrid_nuclemd_RENEWAL", "checked");
        // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the SAGRID VO
        String sagrid_nuclemd_DISABLEVOMS = portletPreferences.getValue("sagrid_nuclemd_DISABLEVOMS",
                "unchecked");

        // Fetching all the WMS Endpoints for the EUMED VO
        String sagrid_WMS = "";
        if (sagrid_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (sagrid_nuclemd_WMS != null) {
                //log.info("length="+sagrid_nuclemd_WMS.length);
                for (int i = 0; i < sagrid_nuclemd_WMS.length; i++)
                    if (!(sagrid_nuclemd_WMS[i].trim().equals("N/A")))
                        sagrid_WMS += sagrid_nuclemd_WMS[i] + " ";
            } else {
                log.info("WMS not set for SAGRID!");
                sagrid_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("sagrid_nuclemd_INFRASTRUCTURE", sagrid_nuclemd_INFRASTRUCTURE.trim());
        request.setAttribute("sagrid_nuclemd_VONAME", sagrid_nuclemd_VONAME.trim());
        request.setAttribute("sagrid_nuclemd_TOPBDII", sagrid_nuclemd_TOPBDII.trim());
        request.setAttribute("sagrid_nuclemd_WMS", sagrid_WMS);
        request.setAttribute("sagrid_nuclemd_ETOKENSERVER", sagrid_nuclemd_ETOKENSERVER.trim());
        request.setAttribute("sagrid_nuclemd_MYPROXYSERVER", sagrid_nuclemd_MYPROXYSERVER.trim());
        request.setAttribute("sagrid_nuclemd_PORT", sagrid_nuclemd_PORT.trim());
        request.setAttribute("sagrid_nuclemd_ROBOTID", sagrid_nuclemd_ROBOTID.trim());
        request.setAttribute("sagrid_nuclemd_WEBDAV", sagrid_nuclemd_WEBDAV.trim());
        request.setAttribute("sagrid_nuclemd_ROLE", sagrid_nuclemd_ROLE.trim());
        request.setAttribute("sagrid_nuclemd_RENEWAL", sagrid_nuclemd_RENEWAL);
        request.setAttribute("sagrid_nuclemd_DISABLEVOMS", sagrid_nuclemd_DISABLEVOMS);

        //request.setAttribute("nuclemd_ENABLEINFRASTRUCTURE", nuclemd_ENABLEINFRASTRUCTURE);
        request.setAttribute("nuclemd_APPID", nuclemd_APPID.trim());
        request.setAttribute("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
        request.setAttribute("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
        request.setAttribute("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
        request.setAttribute("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (see_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[4] = "see";
        // Getting the NUCLEMD INFRASTRUCTURE from the portlet preferences for the SEE VO
        String see_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("see_nuclemd_INFRASTRUCTURE", "N/A");
        // Getting the NUCLEMD VONAME from the portlet preferences for the see VO
        see_nuclemd_VONAME = portletPreferences.getValue("see_nuclemd_VONAME", "N/A");
        // Getting the NUCLEMD TOPPBDII from the portlet preferences for the SEE VO
        see_nuclemd_TOPBDII = portletPreferences.getValue("see_nuclemd_TOPBDII", "N/A");
        // Getting the NUCLEMD WMS from the portlet preferences for the SEE VO
        String[] see_nuclemd_WMS = portletPreferences.getValues("see_nuclemd_WMS", new String[5]);
        // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the SEE VO
        String see_nuclemd_ETOKENSERVER = portletPreferences.getValue("see_nuclemd_ETOKENSERVER", "N/A");
        // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the SEE VO
        String see_nuclemd_MYPROXYSERVER = portletPreferences.getValue("see_nuclemd_MYPROXYSERVER", "N/A");
        // Getting the NUCLEMD PORT from the portlet preferences for the SEE VO
        String see_nuclemd_PORT = portletPreferences.getValue("see_nuclemd_PORT", "N/A");
        // Getting the NUCLEMD ROBOTID from the portlet preferences for the SEE VO
        String see_nuclemd_ROBOTID = portletPreferences.getValue("see_nuclemd_ROBOTID", "N/A");
        // Getting the NUCLEMD WEBDAV from the portlet preferences for the SEE VO
        String see_nuclemd_WEBDAV = portletPreferences.getValue("see_nuclemd_WEBDAV", "N/A");
        // Getting the NUCLEMD ROLE from the portlet preferences for the SEE VO
        String see_nuclemd_ROLE = portletPreferences.getValue("see_nuclemd_ROLE", "N/A");
        // Getting the NUCLEMD RENEWAL from the portlet preferences for the SEE VO
        String see_nuclemd_RENEWAL = portletPreferences.getValue("see_nuclemd_RENEWAL", "checked");
        // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the SEE VO
        String see_nuclemd_DISABLEVOMS = portletPreferences.getValue("see_nuclemd_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for the SEE VO
        String see_WMS = "";
        if (see_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (see_nuclemd_WMS != null) {
                //log.info("length="+see_nuclemd_WMS.length);
                for (int i = 0; i < see_nuclemd_WMS.length; i++)
                    if (!(see_nuclemd_WMS[i].trim().equals("N/A")))
                        see_WMS += see_nuclemd_WMS[i] + " ";
            } else {
                log.info("WMS not set for SEE!");
                see_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("see_nuclemd_INFRASTRUCTURE", see_nuclemd_INFRASTRUCTURE.trim());
        request.setAttribute("see_nuclemd_VONAME", see_nuclemd_VONAME.trim());
        request.setAttribute("see_nuclemd_TOPBDII", see_nuclemd_TOPBDII.trim());
        request.setAttribute("see_nuclemd_WMS", see_WMS);
        request.setAttribute("see_nuclemd_ETOKENSERVER", see_nuclemd_ETOKENSERVER.trim());
        request.setAttribute("see_nuclemd_MYPROXYSERVER", see_nuclemd_MYPROXYSERVER.trim());
        request.setAttribute("see_nuclemd_PORT", see_nuclemd_PORT.trim());
        request.setAttribute("see_nuclemd_ROBOTID", see_nuclemd_ROBOTID.trim());
        request.setAttribute("see_nuclemd_WEBDAV", see_nuclemd_WEBDAV.trim());
        request.setAttribute("see_nuclemd_ROLE", see_nuclemd_ROLE.trim());
        request.setAttribute("see_nuclemd_RENEWAL", see_nuclemd_RENEWAL);
        request.setAttribute("see_nuclemd_DISABLEVOMS", see_nuclemd_DISABLEVOMS);

        //request.setAttribute("nuclemd_ENABLEINFRASTRUCTURE", nuclemd_ENABLEINFRASTRUCTURE);
        request.setAttribute("nuclemd_APPID", nuclemd_APPID.trim());
        request.setAttribute("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
        request.setAttribute("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
        request.setAttribute("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
        request.setAttribute("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (gridit_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[5] = "gridit";
        // Getting the NUCLEMD INFRASTRUCTURE from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("gridit_nuclemd_INFRASTRUCTURE",
                "N/A");
        // Getting the NUCLEMD VONAME from the portlet preferences for the GRIDIT VO
        gridit_nuclemd_VONAME = portletPreferences.getValue("gridit_nuclemd_VONAME", "N/A");
        // Getting the NUCLEMD TOPPBDII from the portlet preferences for the GRIDIT VO
        gridit_nuclemd_TOPBDII = portletPreferences.getValue("gridit_nuclemd_TOPBDII", "N/A");
        // Getting the NUCLEMD WMS from the portlet preferences for the GRIDIT VO
        String[] gridit_nuclemd_WMS = portletPreferences.getValues("gridit_nuclemd_WMS", new String[5]);
        // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_ETOKENSERVER = portletPreferences.getValue("gridit_nuclemd_ETOKENSERVER", "N/A");
        // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_MYPROXYSERVER = portletPreferences.getValue("gridit_nuclemd_MYPROXYSERVER",
                "N/A");
        // Getting the NUCLEMD PORT from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_PORT = portletPreferences.getValue("gridit_nuclemd_PORT", "N/A");
        // Getting the NUCLEMD ROBOTID from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_ROBOTID = portletPreferences.getValue("gridit_nuclemd_ROBOTID", "N/A");
        // Getting the NUCLEMD WEBDAV from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_WEBDAV = portletPreferences.getValue("gridit_nuclemd_WEBDAV", "N/A");
        // Getting the NUCLEMD ROLE from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_ROLE = portletPreferences.getValue("gridit_nuclemd_ROLE", "N/A");
        // Getting the NUCLEMD RENEWAL from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_RENEWAL = portletPreferences.getValue("gridit_nuclemd_RENEWAL", "checked");
        // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the GRIDIT VO
        String gridit_nuclemd_DISABLEVOMS = portletPreferences.getValue("gridit_nuclemd_DISABLEVOMS",
                "unchecked");

        // Fetching all the WMS Endpoints for the GRIDIT VO
        String gridit_WMS = "";
        if (gridit_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (gridit_nuclemd_WMS != null) {
                //log.info("length="+gridit_nuclemd_WMS.length);
                for (int i = 0; i < gridit_nuclemd_WMS.length; i++)
                    if (!(gridit_nuclemd_WMS[i].trim().equals("N/A")))
                        gridit_WMS += gridit_nuclemd_WMS[i] + " ";
            } else {
                log.info("WMS not set for GRIDIT!");
                gridit_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("gridit_nuclemd_INFRASTRUCTURE", gridit_nuclemd_INFRASTRUCTURE.trim());
        request.setAttribute("gridit_nuclemd_VONAME", gridit_nuclemd_VONAME.trim());
        request.setAttribute("gridit_nuclemd_TOPBDII", gridit_nuclemd_TOPBDII.trim());
        request.setAttribute("gridit_nuclemd_WMS", gridit_WMS);
        request.setAttribute("gridit_nuclemd_ETOKENSERVER", gridit_nuclemd_ETOKENSERVER.trim());
        request.setAttribute("gridit_nuclemd_MYPROXYSERVER", gridit_nuclemd_MYPROXYSERVER.trim());
        request.setAttribute("gridit_nuclemd_PORT", gridit_nuclemd_PORT.trim());
        request.setAttribute("gridit_nuclemd_ROBOTID", gridit_nuclemd_ROBOTID.trim());
        request.setAttribute("gridit_nuclemd_WEBDAV", gridit_nuclemd_WEBDAV.trim());
        request.setAttribute("gridit_nuclemd_ROLE", gridit_nuclemd_ROLE.trim());
        request.setAttribute("gridit_nuclemd_RENEWAL", gridit_nuclemd_RENEWAL);
        request.setAttribute("gridit_nuclemd_DISABLEVOMS", gridit_nuclemd_DISABLEVOMS);

        //request.setAttribute("nuclemd_ENABLEINFRASTRUCTURE", nuclemd_ENABLEINFRASTRUCTURE);
        request.setAttribute("nuclemd_APPID", nuclemd_APPID.trim());
        request.setAttribute("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
        request.setAttribute("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
        request.setAttribute("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
        request.setAttribute("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    // Save in the preferences the list of supported infrastructures 
    request.setAttribute("nuclemd_ENABLEINFRASTRUCTURE", infras);

    HashMap<String, Properties> GPS_table = new HashMap<String, Properties>();
    HashMap<String, Properties> GPS_queue = new HashMap<String, Properties>();

    // ********************************************************
    List<String> CEqueues_lato = null;
    List<String> CEqueues_garuda = null;
    List<String> CEqueues_eumed = null;
    List<String> CEqueues_sagrid = null;
    List<String> CEqueues_see = null;
    List<String> CEqueues_gridit = null;

    List<String> CEs_list_lato = null;
    List<String> CEs_list_garuda = null;
    List<String> CEs_list_eumed = null;
    List<String> CEs_list_sagrid = null;
    List<String> CEs_list_see = null;
    List<String> CEs_list_gridit = null;

    List<String> CEs_list_TOT = new ArrayList<String>();
    List<String> CEs_queue_TOT = new ArrayList<String>();

    BDII bdii = null;

    String[] SOFTWARE_LIST = nuclemd_SOFTWARE.split(",");

    // Scanning the list of resources publishing the SW TAG(s)
    for (String SOFTWARE : SOFTWARE_LIST) {

        try {
            if (lato_nuclemd_ENABLEINFRASTRUCTURE.equals("checked") && (!lato_nuclemd_PASSWD.equals("N/A"))) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("-----*FETCHING*THE*<LATO>*RESOURCES*-----");

                CEs_list_lato = new ArrayList();
                CEqueues_lato = new ArrayList();

                // Fetching all the WMS Endpoints for LATO                    
                if (lato_nuclemd_WMS != null) {
                    for (int i = 0; i < lato_nuclemd_WMS.length; i++)
                        if (!(lato_nuclemd_WMS[i].trim().equals("N/A"))) {
                            CEqueues_lato.add(lato_nuclemd_WMS[i].trim());
                            CEs_list_lato.add(lato_nuclemd_WMS[i].trim().replace("ssh://", ""));
                        }
                }
            }

            //=========================================================
            // IMPORTANT: THIS FIX IS ONLY TO SHOW GARUDA SITES 
            //            IN THE GOOGLE MAP                
            //=========================================================
            if (garuda_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")
                    && (!garuda_nuclemd_TOPBDII.equals("N/A"))) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("-----*FETCHING*THE*<GARUDA>*RESOURCES*-----");

                CEs_list_garuda = new ArrayList();
                CEs_list_garuda.add("xn03.ctsf.cdacb.in");

                CEqueues_garuda = new ArrayList();
                CEqueues_garuda.add("gatekeeper://xn03.ctsf.cdacb.in:8443/GW");
            }

            if (eumed_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")
                    && (!eumed_nuclemd_TOPBDII.equals("N/A"))) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("-----*FETCHING*THE*<EUMED>*RESOURCES*-----");

                bdii = new BDII(new URI(eumed_nuclemd_TOPBDII));
                CEs_list_eumed = getListofCEForSoftwareTag(eumed_nuclemd_VONAME, eumed_nuclemd_TOPBDII,
                        SOFTWARE);

                CEqueues_eumed = bdii.queryCEQueues(eumed_nuclemd_VONAME);
            }

            if (sagrid_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")
                    && (!sagrid_nuclemd_TOPBDII.equals("N/A"))) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("-----*FETCHING*THE*<SAGRID>*RESOURCES*-----");

                bdii = new BDII(new URI(sagrid_nuclemd_TOPBDII));
                CEs_list_sagrid = getListofCEForSoftwareTag(sagrid_nuclemd_VONAME, sagrid_nuclemd_TOPBDII,
                        SOFTWARE);

                CEqueues_sagrid = bdii.queryCEQueues(sagrid_nuclemd_VONAME);
            }

            if (see_nuclemd_ENABLEINFRASTRUCTURE.equals("checked") && (!see_nuclemd_TOPBDII.equals("N/A"))) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("-----*FETCHING*THE*<SEE>*RESOURCES*-----");

                bdii = new BDII(new URI(see_nuclemd_TOPBDII));
                CEs_list_see = getListofCEForSoftwareTag(see_nuclemd_VONAME, see_nuclemd_TOPBDII, SOFTWARE);

                CEqueues_see = bdii.queryCEQueues(see_nuclemd_VONAME);
            }

            if (gridit_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")
                    && (!gridit_nuclemd_TOPBDII.equals("N/A"))) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("-----*FETCHING*THE*<GRIDIT>*RESOURCES*-----");

                bdii = new BDII(new URI(gridit_nuclemd_TOPBDII));
                CEs_list_gridit = getListofCEForSoftwareTag(gridit_nuclemd_VONAME, gridit_nuclemd_TOPBDII,
                        SOFTWARE);

                CEqueues_gridit = bdii.queryCEQueues(gridit_nuclemd_VONAME);
            }

            // Merging the list of CEs and queues                
            if (lato_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_list_TOT.addAll(CEs_list_lato);
            if (garuda_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_list_TOT.addAll(CEs_list_garuda);
            if (eumed_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_list_TOT.addAll(CEs_list_eumed);
            if (sagrid_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_list_TOT.addAll(CEs_list_sagrid);
            if (see_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_list_TOT.addAll(CEs_list_see);
            if (gridit_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_list_TOT.addAll(CEs_list_gridit);

            if (lato_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_queue_TOT.addAll(CEqueues_lato);
            if (garuda_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_queue_TOT.addAll(CEqueues_garuda);
            if (eumed_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_queue_TOT.addAll(CEqueues_eumed);
            if (sagrid_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_queue_TOT.addAll(CEqueues_sagrid);
            if (see_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_queue_TOT.addAll(CEqueues_see);
            if (gridit_nuclemd_ENABLEINFRASTRUCTURE.equals("checked"))
                CEs_queue_TOT.addAll(CEqueues_gridit);

        } catch (URISyntaxException ex) {
            Logger.getLogger(Nuclemd.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NamingException e) {
        }
    } // fine list SW tag

    //=========================================================
    // IMPORTANT: INSTANCIATE THE UsersTrackingDBInterface
    //            CLASS USING THE EMPTY CONSTRUCTOR WHEN
    //            WHEN THE PORTLET IS DEPLOYED IN PRODUCTION!!!
    //=========================================================
    /*UsersTrackingDBInterface DBInterface =
    new UsersTrackingDBInterface(
        TRACKING_DB_HOSTNAME.trim(),
        TRACKING_DB_USERNAME.trim(),
        TRACKING_DB_PASSWORD.trim());*/

    UsersTrackingDBInterface DBInterface = new UsersTrackingDBInterface();

    if ((CEs_list_TOT != null) && (!CEs_list_TOT.isEmpty())) {
        log.info("NOT EMPTY LIST!");
        // Fetching the list of CEs publushing the SW
        for (String CE : CEs_list_TOT) {
            log.info("Fetching the CE=" + CE);
            Properties coordinates = new Properties();
            Properties queue = new Properties();

            float coords[] = DBInterface.getCECoordinate(CE);

            String GPS_LAT = Float.toString(coords[0]);
            String GPS_LNG = Float.toString(coords[1]);

            coordinates.setProperty("LAT", GPS_LAT);
            coordinates.setProperty("LNG", GPS_LNG);

            // Fetching the Queues
            for (String CEqueue : CEs_queue_TOT)
                if (CEqueue.contains(CE))
                    queue.setProperty("QUEUE", CEqueue);

            // Saving the GPS location in a Java HashMap
            GPS_table.put(CE, coordinates);

            // Saving the queue in a Java HashMap
            GPS_queue.put(CE, queue);
        }
    } else
        log.info("EMPTY LIST!");

    // Checking the HashMap
    Set set = GPS_table.entrySet();
    Iterator iter = set.iterator();

    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        log.info(" - GPS location of the CE " + entry.getKey() + " => " + entry.getValue());
    }

    // Checking the HashMap
    set = GPS_queue.entrySet();
    iter = set.iterator();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        log.info(" - Queue " + entry.getKey() + " => " + entry.getValue());
    }

    Gson gson = new GsonBuilder().create();
    request.setAttribute("GPS_table", gson.toJson(GPS_table));
    request.setAttribute("GPS_queue", gson.toJson(GPS_queue));

    // ********************************************************
    dispatcher = getPortletContext().getRequestDispatcher("/view.jsp");
    dispatcher.include(request, response);
}

From source file:it.infn.ct.wrf.Wrf.java

@Override
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {

    PortletPreferences portletPreferences = (PortletPreferences) request.getPreferences();

    response.setContentType("text/html");

    //java.util.Enumeration listPreferences = portletPreferences.getNames();
    PortletRequestDispatcher dispatcher = null;

    String dit_wrf_PASSWD = "";
    String dit_wrf_LOGIN = "";
    String garuda_wrf_TOPBDII = "";
    String garuda_wrf_VONAME = "";
    String chain_wrf_TOPBDII = "";
    String chain_wrf_VONAME = "";
    String fedcloud_wrf_TOPBDII = "";
    String fedcloud_wrf_VONAME = "";
    String eumed_wrf_TOPBDII = "";
    String eumed_wrf_VONAME = "";
    String gisela_wrf_TOPBDII = "";
    String gisela_wrf_VONAME = "";
    String sagrid_wrf_TOPBDII = "";
    String sagrid_wrf_VONAME = "";

    String dit_wrf_ENABLEINFRASTRUCTURE = "";
    String garuda_wrf_ENABLEINFRASTRUCTURE = "";
    String chain_wrf_ENABLEINFRASTRUCTURE = "";
    String fedcloud_wrf_ENABLEINFRASTRUCTURE = "";
    String eumed_wrf_ENABLEINFRASTRUCTURE = "";
    String gisela_wrf_ENABLEINFRASTRUCTURE = "";
    String sagrid_wrf_ENABLEINFRASTRUCTURE = "";
    String[] infras = new String[7];

    String[] wrf_INFRASTRUCTURES = portletPreferences.getValues("wrf_ENABLEINFRASTRUCTURE", new String[7]);

    for (int i = 0; i < wrf_INFRASTRUCTURES.length; i++) {
        if (wrf_INFRASTRUCTURES[i] != null && wrf_INFRASTRUCTURES[i].equals("dit")) {
            dit_wrf_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n DIT!");
        }// w w w .  j a v a2s  .com
        if (wrf_INFRASTRUCTURES[i] != null && wrf_INFRASTRUCTURES[i].equals("garuda")) {
            garuda_wrf_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n GARUDA!");
        }
        if (wrf_INFRASTRUCTURES[i] != null && wrf_INFRASTRUCTURES[i].equals("chain")) {
            chain_wrf_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n CHAIN!");
        }
        if (wrf_INFRASTRUCTURES[i] != null && wrf_INFRASTRUCTURES[i].equals("fedcloud")) {
            fedcloud_wrf_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n FEDCLOUD!");
        }
        if (wrf_INFRASTRUCTURES[i] != null && wrf_INFRASTRUCTURES[i].equals("eumed")) {
            eumed_wrf_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n EUMED!");
        }
        if (wrf_INFRASTRUCTURES[i] != null && wrf_INFRASTRUCTURES[i].equals("gisela")) {
            gisela_wrf_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n GISELA!");
        }
        if (wrf_INFRASTRUCTURES[i] != null && wrf_INFRASTRUCTURES[i].equals("sagrid")) {
            sagrid_wrf_ENABLEINFRASTRUCTURE = "checked";
            log.info("\n SAGRID!");
        }
    }

    // Get the APPID from the portlet preferences
    String wrf_APPID = portletPreferences.getValue("wrf_APPID", "N/A");
    // Get the LOGLEVEL from the portlet preferences
    String wrf_LOGLEVEL = portletPreferences.getValue("wrf_LOGLEVEL", "INFO");
    // Get the  APPID from the portlet preferences
    String wrf_OUTPUT_PATH = portletPreferences.getValue("wrf_OUTPUT_PATH", "N/A");
    // Get the  SOFTWARE from the portlet preferences
    String wrf_SOFTWARE = portletPreferences.getValue("wrf_SOFTWARE", "N/A");
    // Get the TRACKING_DB_HOSTNAME from the portlet preferences
    String TRACKING_DB_HOSTNAME = portletPreferences.getValue("TRACKING_DB_HOSTNAME", "N/A");
    // Get the TRACKING_DB_USERNAME from the portlet preferences
    String TRACKING_DB_USERNAME = portletPreferences.getValue("TRACKING_DB_USERNAME", "N/A");
    // Get the TRACKING_DB_PASSWORD from the portlet preferences
    String TRACKING_DB_PASSWORD = portletPreferences.getValue("TRACKING_DB_PASSWORD", "N/A");
    // Get the SMTP_HOST from the portlet preferences
    String SMTP_HOST = portletPreferences.getValue("SMTP_HOST", "N/A");
    // Get the SENDER_MAIL from the portlet preferences
    String SENDER_MAIL = portletPreferences.getValue("SENDER_MAIL", "N/A");

    if (dit_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[0] = "dit";
        // Get the INFRASTRUCTURE from the portlet preferences for the DIT VO
        String dit_wrf_INFRASTRUCTURE = portletPreferences.getValue("dit_wrf_INFRASTRUCTURE", "N/A");
        // Get the VONAME from the portlet preferences for the DIT VO
        dit_wrf_LOGIN = portletPreferences.getValue("dit_wrf_LOGIN", "N/A");
        // Get the TOPPBDII from the portlet preferences for the DIT VO
        dit_wrf_PASSWD = portletPreferences.getValue("dit_wrf_PASSWD", "N/A");
        // Get the WMS from the portlet preferences for the DIT VO
        String[] dit_wrf_WMS = portletPreferences.getValues("dit_wrf_WMS", new String[5]);
        // Get the ETOKENSERVER from the portlet preferences for the DIT VO
        String dit_wrf_ETOKENSERVER = portletPreferences.getValue("dit_wrf_ETOKENSERVER", "N/A");
        // Get the MYPROXYSERVER from the portlet preferences for the DIT VO
        String dit_wrf_MYPROXYSERVER = portletPreferences.getValue("dit_wrf_MYPROXYSERVER", "N/A");
        // Get the PORT from the portlet preferences for the DIT VO
        String dit_wrf_PORT = portletPreferences.getValue("dit_wrf_PORT", "N/A");
        // Get the ROBOTID from the portlet preferences for the DIT VO
        String dit_wrf_ROBOTID = portletPreferences.getValue("chain_wrf_ROBOTID", "N/A");
        // Get the ROLE from the portlet preferences for the DIT VO
        String dit_wrf_ROLE = portletPreferences.getValue("dit_wrf_ROLE", "N/A");
        // Get the RENEWAL from the portlet preferences for the DIT VO
        String dit_wrf_RENEWAL = portletPreferences.getValue("dit_wrf_RENEWAL", "checked");
        // Get the DISABLEVOMS from the portlet preferences for the DIT VO
        String dit_wrf_DISABLEVOMS = portletPreferences.getValue("dit_wrf_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for the DIT VO
        String dit_WMS = "";
        if (dit_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (dit_wrf_WMS != null) {
                //log.info("length="+dit_wrf_WMS.length);
                for (int i = 0; i < dit_wrf_WMS.length; i++)
                    if (!(dit_wrf_WMS[i].trim().equals("N/A")))
                        dit_WMS += dit_wrf_WMS[i] + " ";
            } else {
                log.info("WMS not set for DIT!");
                dit_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("dit_wrf_INFRASTRUCTURE", dit_wrf_INFRASTRUCTURE.trim());
        request.setAttribute("dit_wrf_LOGIN", dit_wrf_LOGIN.trim());
        request.setAttribute("dit_wrf_PASSWD", dit_wrf_PASSWD.trim());
        request.setAttribute("dit_wrf_WMS", dit_WMS);
        request.setAttribute("dit_wrf_ETOKENSERVER", dit_wrf_ETOKENSERVER.trim());
        request.setAttribute("dit_wrf_MYPROXYSERVER", dit_wrf_MYPROXYSERVER.trim());
        request.setAttribute("dit_wrf_PORT", dit_wrf_PORT.trim());
        request.setAttribute("dit_wrf_ROBOTID", dit_wrf_ROBOTID.trim());
        request.setAttribute("dit_wrf_ROLE", dit_wrf_ROLE.trim());
        request.setAttribute("dit_wrf_RENEWAL", dit_wrf_RENEWAL);
        request.setAttribute("dit_wrf_DISABLEVOMS", dit_wrf_DISABLEVOMS);

        //request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);
        request.setAttribute("wrf_APPID", wrf_APPID.trim());
        request.setAttribute("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
        request.setAttribute("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
        request.setAttribute("wrf_SOFTWARE", wrf_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (garuda_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[1] = "garuda";
        // Get the INFRASTRUCTURE from the portlet preferences for the GARUDA VO
        String garuda_wrf_INFRASTRUCTURE = portletPreferences.getValue("garuda_wrf_INFRASTRUCTURE", "N/A");
        // Get the VONAME from the portlet preferences for the GARUDA VO
        garuda_wrf_VONAME = portletPreferences.getValue("garuda_wrf_VONAME", "N/A");
        // Get the TOPPBDII from the portlet preferences for the GARUDA VO
        garuda_wrf_TOPBDII = portletPreferences.getValue("garuda_wrf_TOPBDII", "N/A");
        // Get the WMS from the portlet preferences for the GARUDA VO
        String[] garuda_wrf_WMS = portletPreferences.getValues("garuda_wrf_WMS", new String[5]);
        // Get the ETOKENSERVER from the portlet preferences for the GARUDA VO
        String garuda_wrf_ETOKENSERVER = portletPreferences.getValue("garuda_wrf_ETOKENSERVER", "N/A");
        // Get the MYPROXYSERVER from the portlet preferences for the GARUDA VO
        String garuda_wrf_MYPROXYSERVER = portletPreferences.getValue("garuda_wrf_MYPROXYSERVER", "N/A");
        // Get the PORT from the portlet preferences for the GARUDA VO
        String garuda_wrf_PORT = portletPreferences.getValue("garuda_wrf_PORT", "N/A");
        // Get the ROBOTID from the portlet preferences for the GARUDA VO
        String garuda_wrf_ROBOTID = portletPreferences.getValue("garuda_wrf_ROBOTID", "N/A");
        // Get the ROLE from the portlet preferences for the GARUDA VO
        String garuda_wrf_ROLE = portletPreferences.getValue("garuda_wrf_ROLE", "N/A");
        // Get the RENEWAL from the portlet preferences for the GARUDA VO
        String garuda_wrf_RENEWAL = portletPreferences.getValue("garuda_wrf_RENEWAL", "checked");
        // Get the DISABLEVOMS from the portlet preferences for the GARUDA VO
        String garuda_wrf_DISABLEVOMS = portletPreferences.getValue("garuda_wrf_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for the GARUDA VO
        String garuda_WMS = "";
        if (garuda_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (garuda_wrf_WMS != null) {
                //log.info("length="+garuda_wrf_WMS.length);
                for (int i = 0; i < garuda_wrf_WMS.length; i++)
                    if (!(garuda_wrf_WMS[i].trim().equals("N/A")))
                        garuda_WMS += garuda_wrf_WMS[i] + " ";
            } else {
                log.info("WSGRAM not set for GARUDA!");
                garuda_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("garuda_wrf_INFRASTRUCTURE", garuda_wrf_INFRASTRUCTURE.trim());
        request.setAttribute("garuda_wrf_VONAME", garuda_wrf_VONAME.trim());
        request.setAttribute("garuda_wrf_TOPBDII", garuda_wrf_TOPBDII.trim());
        request.setAttribute("garuda_wrf_WMS", garuda_WMS);
        request.setAttribute("garuda_wrf_ETOKENSERVER", garuda_wrf_ETOKENSERVER.trim());
        request.setAttribute("garuda_wrf_MYPROXYSERVER", garuda_wrf_MYPROXYSERVER.trim());
        request.setAttribute("garuda_wrf_PORT", garuda_wrf_PORT.trim());
        request.setAttribute("garuda_wrf_ROBOTID", garuda_wrf_ROBOTID.trim());
        request.setAttribute("garuda_wrf_ROLE", garuda_wrf_ROLE.trim());
        request.setAttribute("garuda_wrf_RENEWAL", garuda_wrf_RENEWAL);
        request.setAttribute("garuda_wrf_DISABLEVOMS", garuda_wrf_DISABLEVOMS);

        //request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);
        request.setAttribute("wrf_APPID", wrf_APPID.trim());
        request.setAttribute("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
        request.setAttribute("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
        request.setAttribute("wrf_SOFTWARE", wrf_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (chain_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[2] = "chain";
        // Get the INFRASTRUCTURE from the portlet preferences for the CHAIN VO
        String chain_wrf_INFRASTRUCTURE = portletPreferences.getValue("chain_wrf_INFRASTRUCTURE", "N/A");
        // Get the VONAME from the portlet preferences for the CHAIN VO
        chain_wrf_VONAME = portletPreferences.getValue("chain_wrf_VONAME", "N/A");
        // Get the TOPPBDII from the portlet preferences for the CHAIN VO
        chain_wrf_TOPBDII = portletPreferences.getValue("chain_wrf_TOPBDII", "N/A");
        // Get the WMS from the portlet preferences for the CHAIN VO
        String[] chain_wrf_WMS = portletPreferences.getValues("chain_wrf_WMS", new String[5]);
        // Get the ETOKENSERVER from the portlet preferences for the CHAIN VO
        String chain_wrf_ETOKENSERVER = portletPreferences.getValue("chain_wrf_ETOKENSERVER", "N/A");
        // Get the MYPROXYSERVER from the portlet preferences for the CHAIN VO
        String chain_wrf_MYPROXYSERVER = portletPreferences.getValue("chain_wrf_MYPROXYSERVER", "N/A");
        // Get the PORT from the portlet preferences for the CHAIN VO
        String chain_wrf_PORT = portletPreferences.getValue("chain_wrf_PORT", "N/A");
        // Get the ROBOTID from the portlet preferences for the CHAIN VO
        String chain_wrf_ROBOTID = portletPreferences.getValue("chain_wrf_ROBOTID", "N/A");
        // Get the ROLE from the portlet preferences for the CHAIN VO
        String chain_wrf_ROLE = portletPreferences.getValue("chain_wrf_ROLE", "N/A");
        // Get the RENEWAL from the portlet preferences for the CHAIN VO
        String chain_wrf_RENEWAL = portletPreferences.getValue("chain_wrf_RENEWAL", "checked");
        // Get the DISABLEVOMS from the portlet preferences for the CHAIN VO
        String chain_wrf_DISABLEVOMS = portletPreferences.getValue("chain_wrf_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for the CHAIN VO
        String chain_WMS = "";
        if (chain_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (chain_wrf_WMS != null) {
                //log.info("length="+chain_wrf_WMS.length);
                for (int i = 0; i < chain_wrf_WMS.length; i++)
                    if (!(chain_wrf_WMS[i].trim().equals("N/A")))
                        chain_WMS += chain_wrf_WMS[i] + " ";
            } else {
                log.info("WMS not set for CHAIN!");
                chain_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("chain_wrf_INFRASTRUCTURE", chain_wrf_INFRASTRUCTURE.trim());
        request.setAttribute("chain_wrf_VONAME", chain_wrf_VONAME.trim());
        request.setAttribute("chain_wrf_TOPBDII", chain_wrf_TOPBDII.trim());
        request.setAttribute("chain_wrf_WMS", chain_WMS);
        request.setAttribute("chain_wrf_ETOKENSERVER", chain_wrf_ETOKENSERVER.trim());
        request.setAttribute("chain_wrf_MYPROXYSERVER", chain_wrf_MYPROXYSERVER.trim());
        request.setAttribute("chain_wrf_PORT", chain_wrf_PORT.trim());
        request.setAttribute("chain_wrf_ROBOTID", chain_wrf_ROBOTID.trim());
        request.setAttribute("chain_wrf_ROLE", chain_wrf_ROLE.trim());
        request.setAttribute("chain_wrf_RENEWAL", chain_wrf_RENEWAL);
        request.setAttribute("chain_wrf_DISABLEVOMS", chain_wrf_DISABLEVOMS);

        //request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);
        request.setAttribute("wrf_APPID", wrf_APPID.trim());
        request.setAttribute("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
        request.setAttribute("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
        request.setAttribute("wrf_SOFTWARE", wrf_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (fedcloud_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[3] = "fedcloud";
        // Get the INFRASTRUCTURE from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_INFRASTRUCTURE = portletPreferences.getValue("fedcloud_wrf_INFRASTRUCTURE", "N/A");
        // Get the VONAME from the portlet preferences for the FEDCLOUD VO
        fedcloud_wrf_VONAME = portletPreferences.getValue("fedcloud_wrf_VONAME", "N/A");
        // Get the TOPPBDII from the portlet preferences for the FEDCLOUD VO
        fedcloud_wrf_TOPBDII = portletPreferences.getValue("fedcloud_wrf_TOPBDII", "N/A");
        // Get the WMS from the portlet preferences for the FEDCLOUD VO
        String[] fedcloud_wrf_WMS = portletPreferences.getValues("fedcloud_wrf_WMS", new String[10]);
        // Get the ETOKENSERVER from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_ETOKENSERVER = portletPreferences.getValue("fedcloud_wrf_ETOKENSERVER", "N/A");
        // Get the MYPROXYSERVER from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_MYPROXYSERVER = portletPreferences.getValue("fedcloud_wrf_MYPROXYSERVER", "N/A");
        // Get the PORT from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_PORT = portletPreferences.getValue("fedcloud_wrf_PORT", "N/A");
        // Get the ROBOTID from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_ROBOTID = portletPreferences.getValue("fedcloud_wrf_ROBOTID", "N/A");
        // Get the ROLE from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_ROLE = portletPreferences.getValue("fedcloud_wrf_ROLE", "N/A");
        // Get the RENEWAL from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_RENEWAL = portletPreferences.getValue("fedcloud_wrf_RENEWAL", "checked");
        // Get the DISABLEVOMS from the portlet preferences for the FEDCLOUD VO
        String fedcloud_wrf_DISABLEVOMS = portletPreferences.getValue("fedcloud_wrf_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for the FEDCLOUD VO
        String fedcloud_WMS = "";
        if (fedcloud_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (fedcloud_wrf_WMS != null) {
                //log.info("length="+fedcloud_wrf_WMS.length);
                for (int i = 0; i < fedcloud_wrf_WMS.length; i++)
                    if (!(fedcloud_wrf_WMS[i].trim().equals("N/A")))
                        fedcloud_WMS += fedcloud_wrf_WMS[i] + " ";
            } else {
                log.info("WMS not set for FEDCLOUD!");
                fedcloud_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("fedcloud_wrf_INFRASTRUCTURE", fedcloud_wrf_INFRASTRUCTURE.trim());
        request.setAttribute("fedcloud_wrf_VONAME", fedcloud_wrf_VONAME.trim());
        request.setAttribute("fedcloud_wrf_TOPBDII", fedcloud_wrf_TOPBDII.trim());
        request.setAttribute("fedcloud_wrf_WMS", fedcloud_WMS);
        request.setAttribute("fedcloud_wrf_ETOKENSERVER", fedcloud_wrf_ETOKENSERVER.trim());
        request.setAttribute("fedcloud_wrf_MYPROXYSERVER", fedcloud_wrf_MYPROXYSERVER.trim());
        request.setAttribute("fedcloud_wrf_PORT", fedcloud_wrf_PORT.trim());
        request.setAttribute("fedcloud_wrf_ROBOTID", fedcloud_wrf_ROBOTID.trim());
        request.setAttribute("fedcloud_wrf_ROLE", fedcloud_wrf_ROLE.trim());
        request.setAttribute("fedcloud_wrf_RENEWAL", fedcloud_wrf_RENEWAL);
        request.setAttribute("fedcloud_wrf_DISABLEVOMS", fedcloud_wrf_DISABLEVOMS);

        //request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);
        request.setAttribute("wrf_APPID", wrf_APPID.trim());
        request.setAttribute("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
        request.setAttribute("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
        request.setAttribute("wrf_SOFTWARE", wrf_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (eumed_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[4] = "eumed";
        // Get the INFRASTRUCTURE from the portlet preferences for the EUMED VO
        String eumed_wrf_INFRASTRUCTURE = portletPreferences.getValue("eumed_wrf_INFRASTRUCTURE", "N/A");
        // Get the VONAME from the portlet preferences for the EUMED VO
        eumed_wrf_VONAME = portletPreferences.getValue("eumed_wrf_VONAME", "N/A");
        // Get the TOPPBDII from the portlet preferences for the EUMED VO
        eumed_wrf_TOPBDII = portletPreferences.getValue("eumed_wrf_TOPBDII", "N/A");
        // Get the WMS from the portlet preferences for the EUMED VO
        String[] eumed_wrf_WMS = portletPreferences.getValues("eumed_wrf_WMS", new String[5]);
        // Get the ETOKENSERVER from the portlet preferences for the EUMED VO
        String eumed_wrf_ETOKENSERVER = portletPreferences.getValue("eumed_wrf_ETOKENSERVER", "N/A");
        // Get the MYPROXYSERVER from the portlet preferences for the EUMED VO
        String eumed_wrf_MYPROXYSERVER = portletPreferences.getValue("eumed_wrf_MYPROXYSERVER", "N/A");
        // Get the PORT from the portlet preferences for the EUMED VO
        String eumed_wrf_PORT = portletPreferences.getValue("eumed_wrf_PORT", "N/A");
        // Get the ROBOTID from the portlet preferences for the EUMED VO
        String eumed_wrf_ROBOTID = portletPreferences.getValue("eumed_wrf_ROBOTID", "N/A");
        // Get the ROLE from the portlet preferences for the EUMED VO
        String eumed_wrf_ROLE = portletPreferences.getValue("eumed_wrf_ROLE", "N/A");
        // Get the RENEWAL from the portlet preferences for the EUMED VO
        String eumed_wrf_RENEWAL = portletPreferences.getValue("eumed_wrf_RENEWAL", "checked");
        // Get the DISABLEVOMS from the portlet preferences for the EUMED VO
        String eumed_wrf_DISABLEVOMS = portletPreferences.getValue("eumed_wrf_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for the EUMED VO
        String eumed_WMS = "";
        if (eumed_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (eumed_wrf_WMS != null) {
                //log.info("length="+eumed_wrf_WMS.length);
                for (int i = 0; i < eumed_wrf_WMS.length; i++)
                    if (!(eumed_wrf_WMS[i].trim().equals("N/A")))
                        eumed_WMS += eumed_wrf_WMS[i] + " ";
            } else {
                log.info("WMS not set for EUMED!");
                eumed_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("eumed_wrf_INFRASTRUCTURE", eumed_wrf_INFRASTRUCTURE.trim());
        request.setAttribute("eumed_wrf_VONAME", eumed_wrf_VONAME.trim());
        request.setAttribute("eumed_wrf_TOPBDII", eumed_wrf_TOPBDII.trim());
        request.setAttribute("eumed_wrf_WMS", eumed_WMS);
        request.setAttribute("eumed_wrf_ETOKENSERVER", eumed_wrf_ETOKENSERVER.trim());
        request.setAttribute("eumed_wrf_MYPROXYSERVER", eumed_wrf_MYPROXYSERVER.trim());
        request.setAttribute("eumed_wrf_PORT", eumed_wrf_PORT.trim());
        request.setAttribute("eumed_wrf_ROBOTID", eumed_wrf_ROBOTID.trim());
        request.setAttribute("eumed_wrf_ROLE", eumed_wrf_ROLE.trim());
        request.setAttribute("eumed_wrf_RENEWAL", eumed_wrf_RENEWAL);
        request.setAttribute("eumed_wrf_DISABLEVOMS", eumed_wrf_DISABLEVOMS);

        //request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);
        request.setAttribute("wrf_APPID", wrf_APPID.trim());
        request.setAttribute("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
        request.setAttribute("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
        request.setAttribute("wrf_SOFTWARE", wrf_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (gisela_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[5] = "gisela";
        // Get the INFRASTRUCTURE from the portlet preferences for the GISELA VO
        String gisela_wrf_INFRASTRUCTURE = portletPreferences.getValue("gisela_wrf_INFRASTRUCTURE", "N/A");
        // Get the VONAME from the portlet preferences for the GISELA VO
        gisela_wrf_VONAME = portletPreferences.getValue("gisela_wrf_VONAME", "N/A");
        // Get the TOPPBDII from the portlet preferences for the GISELA VO
        gisela_wrf_TOPBDII = portletPreferences.getValue("gisela_wrf_TOPBDII", "N/A");
        // Get the WMS from the portlet preferences for the GISELA VO
        String[] gisela_wrf_WMS = portletPreferences.getValues("gisela_wrf_WMS", new String[5]);
        // Get the ETOKENSERVER from the portlet preferences for the GISELA VO
        String gisela_wrf_ETOKENSERVER = portletPreferences.getValue("gisela_wrf_ETOKENSERVER", "N/A");
        // Get the MYPROXYSERVER from the portlet preferences for the GISELA VO
        String gisela_wrf_MYPROXYSERVER = portletPreferences.getValue("gisela_wrf_MYPROXYSERVER", "N/A");
        // Get the PORT from the portlet preferences for the GISELA VO
        String gisela_wrf_PORT = portletPreferences.getValue("gisela_wrf_PORT", "N/A");
        // Get the ROBOTID from the portlet preferences for the GISELA VO
        String gisela_wrf_ROBOTID = portletPreferences.getValue("gisela_wrf_ROBOTID", "N/A");
        // Get the ROLE from the portlet preferences for the GISELA VO
        String gisela_wrf_ROLE = portletPreferences.getValue("gisela_wrf_ROLE", "N/A");
        // Get the RENEWAL from the portlet preferences for the GISELA VO
        String gisela_wrf_RENEWAL = portletPreferences.getValue("gisela_wrf_RENEWAL", "checked");
        // Get the DISABLEVOMS from the portlet preferences for the GISELA VO
        String gisela_wrf_DISABLEVOMS = portletPreferences.getValue("gisela_wrf_DISABLEVOMS", "unchecked");

        // Fetching all the WMS Endpoints for the GISELA VO
        String gisela_WMS = "";
        if (gisela_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (gisela_wrf_WMS != null) {
                //log.info("length="+gisela_wrf_WMS.length);
                for (int i = 0; i < gisela_wrf_WMS.length; i++)
                    if (!(gisela_wrf_WMS[i].trim().equals("N/A")))
                        gisela_WMS += gisela_wrf_WMS[i] + " ";
            } else {
                log.info("WMS not set for GISELA!");
                gisela_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("gisela_wrf_INFRASTRUCTURE", gisela_wrf_INFRASTRUCTURE.trim());
        request.setAttribute("gisela_wrf_VONAME", gisela_wrf_VONAME.trim());
        request.setAttribute("gisela_wrf_TOPBDII", gisela_wrf_TOPBDII.trim());
        request.setAttribute("gisela_wrf_WMS", gisela_WMS);
        request.setAttribute("gisela_wrf_ETOKENSERVER", gisela_wrf_ETOKENSERVER.trim());
        request.setAttribute("gisela_wrf_MYPROXYSERVER", gisela_wrf_MYPROXYSERVER.trim());
        request.setAttribute("gisela_wrf_PORT", gisela_wrf_PORT.trim());
        request.setAttribute("gisela_wrf_ROBOTID", gisela_wrf_ROBOTID.trim());
        request.setAttribute("gisela_wrf_ROLE", gisela_wrf_ROLE.trim());
        request.setAttribute("gisela_wrf_RENEWAL", gisela_wrf_RENEWAL);
        request.setAttribute("gisela_wrf_DISABLEVOMS", gisela_wrf_DISABLEVOMS);

        //request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);
        request.setAttribute("wrf_APPID", wrf_APPID.trim());
        request.setAttribute("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
        request.setAttribute("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
        request.setAttribute("wrf_SOFTWARE", wrf_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    if (sagrid_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
        infras[6] = "sagrid";
        // Get the INFRASTRUCTURE from the portlet preferences for the SAGRID VO
        String sagrid_wrf_INFRASTRUCTURE = portletPreferences.getValue("sagrid_wrf_INFRASTRUCTURE", "N/A");
        // Get the VONAME from the portlet preferences for the SAGRID VO
        sagrid_wrf_VONAME = portletPreferences.getValue("sagrid_wrf_VONAME", "N/A");
        // Get the TOPPBDII from the portlet preferences for the SAGRID VO
        sagrid_wrf_TOPBDII = portletPreferences.getValue("sagrid_wrf_TOPBDII", "N/A");
        // Get the WMS from the portlet preferences for the SAGRID VO
        String[] sagrid_wrf_WMS = portletPreferences.getValues("sagrid_wrf_WMS", new String[5]);
        // Get the ETOKENSERVER from the portlet preferences for the SAGRID VO
        String sagrid_wrf_ETOKENSERVER = portletPreferences.getValue("sagrid_wrf_ETOKENSERVER", "N/A");
        // Get the MYPROXYSERVER from the portlet preferences for the SAGRID VO
        String sagrid_wrf_MYPROXYSERVER = portletPreferences.getValue("sagrid_wrf_MYPROXYSERVER", "N/A");
        // Get the PORT from the portlet preferences for the SAGRID VO
        String sagrid_wrf_PORT = portletPreferences.getValue("sagrid_wrf_PORT", "N/A");
        // Get the ROBOTID from the portlet preferences for the SAGRID VO
        String sagrid_wrf_ROBOTID = portletPreferences.getValue("sagrid_wrf_ROBOTID", "N/A");
        // Get the ROLE from the portlet preferences for the SAGRID VO
        String sagrid_wrf_ROLE = portletPreferences.getValue("sagrid_wrf_ROLE", "N/A");
        // Get the RENEWAL from the portlet preferences for the SAGRID VO
        String sagrid_wrf_RENEWAL = portletPreferences.getValue("sagrid_wrf_RENEWAL", "checked");
        // Get the DISABLEVOMS from the portlet preferences for the SAGRID VO
        String sagrid_wrf_DISABLEVOMS = portletPreferences.getValue("sagrid_wrf_DISABLEVOMS", "unchecked");
        // Fetching all the WMS Endpoints for the SAGRID VO
        String sagrid_WMS = "";
        if (sagrid_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
            if (sagrid_wrf_WMS != null) {
                //log.info("length="+sagrid_wrf_WMS.length);
                for (int i = 0; i < sagrid_wrf_WMS.length; i++)
                    if (!(sagrid_wrf_WMS[i].trim().equals("N/A")))
                        sagrid_WMS += sagrid_wrf_WMS[i] + " ";
            } else {
                log.info("WMS not set for SAGRID!");
                sagrid_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            }
        }

        // Save the portlet preferences
        request.setAttribute("sagrid_wrf_INFRASTRUCTURE", sagrid_wrf_INFRASTRUCTURE.trim());
        request.setAttribute("sagrid_wrf_VONAME", sagrid_wrf_VONAME.trim());
        request.setAttribute("sagrid_wrf_TOPBDII", sagrid_wrf_TOPBDII.trim());
        request.setAttribute("sagrid_wrf_WMS", sagrid_WMS);
        request.setAttribute("sagrid_wrf_ETOKENSERVER", sagrid_wrf_ETOKENSERVER.trim());
        request.setAttribute("sagrid_wrf_MYPROXYSERVER", sagrid_wrf_MYPROXYSERVER.trim());
        request.setAttribute("sagrid_wrf_PORT", sagrid_wrf_PORT.trim());
        request.setAttribute("sagrid_wrf_ROBOTID", sagrid_wrf_ROBOTID.trim());
        request.setAttribute("sagrid_wrf_ROLE", sagrid_wrf_ROLE.trim());
        request.setAttribute("sagrid_wrf_RENEWAL", sagrid_wrf_RENEWAL);
        request.setAttribute("sagrid_wrf_DISABLEVOMS", sagrid_wrf_DISABLEVOMS);

        //request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);
        request.setAttribute("wrf_APPID", wrf_APPID.trim());
        request.setAttribute("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
        request.setAttribute("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
        request.setAttribute("wrf_SOFTWARE", wrf_SOFTWARE.trim());
        request.setAttribute("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
        request.setAttribute("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
        request.setAttribute("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
        request.setAttribute("SMTP_HOST", SMTP_HOST.trim());
        request.setAttribute("SENDER_MAIL", SENDER_MAIL.trim());
    }

    // Save in the preferences the list of supported infrastructures 
    request.setAttribute("wrf_ENABLEINFRASTRUCTURE", infras);

    HashMap<String, Properties> GPS_table = new HashMap<String, Properties>();
    HashMap<String, Properties> GPS_queue = new HashMap<String, Properties>();

    // ********************************************************
    List<String> CEqueues_dit = null;
    List<String> CEqueues_garuda = null;
    List<String> CEqueues_chain = null;
    List<String> CEqueues_fedcloud = null;
    List<String> CEqueues_eumed = null;
    List<String> CEqueues_gisela = null;
    List<String> CEqueues_sagrid = null;

    List<String> CEs_list_dit = null;
    List<String> CEs_list_garuda = null;
    List<String> CEs_list_chain = null;
    List<String> CEs_list_fedcloud = null;
    List<String> CEs_list_eumed = null;
    List<String> CEs_list_gisela = null;
    List<String> CEs_list_sagrid = null;

    BDII bdii = null;

    if (dit_wrf_ENABLEINFRASTRUCTURE.equals("checked") && (!dit_wrf_PASSWD.equals("N/A"))) {
        log.info("-----*FETCHING*THE*<DIT>*CLUSTER*RESOURCES*-----");
        CEs_list_dit = new ArrayList();
        CEs_list_dit.add("41.93.32.21");

        CEqueues_dit = new ArrayList();
        CEqueues_dit.add("ssh://41.93.32.21");
    }

    //=========================================================
    // IMPORTANT: THIS FIX IS ONLY FOR INSTANCIATE THE 
    //            CHAIN INTEROPERABILITY DEMO                
    //=========================================================
    // ===== ONLY FOR THE CHAIN INTEROPERABILITY DEMO =====
    if (garuda_wrf_ENABLEINFRASTRUCTURE.equals("checked") && (!garuda_wrf_TOPBDII.equals("N/A"))) {
        log.info("-----*FETCHING*THE*<GARUDA>*CLOUD*RESOURCES*-----");
        CEs_list_garuda = new ArrayList();
        CEs_list_garuda.add("xn03.ctsf.cdacb.in");

        CEqueues_garuda = new ArrayList();
        CEqueues_garuda.add("wsgram://xn03.ctsf.cdacb.in:8443/GW");
    }
    // ===== ONLY FOR THE CHAIN INTEROPERABILITY DEMO =====

    if (chain_wrf_ENABLEINFRASTRUCTURE.equals("checked") && (!chain_wrf_TOPBDII.equals("N/A"))) {
        log.info("-----*FETCHING*THE*<CHAIN>*CLOUD*RESOURCES*-----");

        CEs_list_chain = new ArrayList();
        CEqueues_chain = new ArrayList();

        // Get the CR from the portlet preferences for the CHAIN VO
        String[] chain_wrf_WMS = portletPreferences.getValues("chain_wrf_WMS", new String[5]);

        if (chain_wrf_WMS != null) {
            for (int i = 0; i < chain_wrf_WMS.length; i++)
                if (!(chain_wrf_WMS[i].trim().equals("N/A"))) {
                    CEqueues_chain.add(chain_wrf_WMS[i].trim());

                    // Removing "rocci://" prefix from string
                    chain_wrf_WMS[i] = chain_wrf_WMS[i].replace("rocci://", "");

                    // Removing port from string
                    CEs_list_chain.add(chain_wrf_WMS[i].substring(0, chain_wrf_WMS[i].indexOf(":")));

                    log.info(
                            "Cloud Resource = " + chain_wrf_WMS[i].substring(0, chain_wrf_WMS[i].indexOf(":")));

                } else {
                    log.info("Cloud Resource not set for the CHAIN VO!");
                    dit_wrf_ENABLEINFRASTRUCTURE = "unchecked";
                }
        }
    }

    if (fedcloud_wrf_ENABLEINFRASTRUCTURE.equals("checked") && (!fedcloud_wrf_TOPBDII.equals("N/A"))) {
        log.info("-----*FETCHING*THE*<FEDCLOUD>*CLOUD*RESOURCES*-----");

        CEs_list_fedcloud = new ArrayList();
        CEqueues_fedcloud = new ArrayList();

        // Get the CR from the portlet preferences for the FEDCLOUD VO
        String[] fedcloud_wrf_WMS = portletPreferences.getValues("fedcloud_wrf_WMS", new String[10]);

        log.info("TOT Cloud Resource = " + fedcloud_wrf_WMS.length);

        if (fedcloud_wrf_WMS != null) {
            for (int i = 0; i < fedcloud_wrf_WMS.length; i++)
                if (!(fedcloud_wrf_WMS[i].trim().equals("N/A"))) {
                    CEqueues_fedcloud.add(fedcloud_wrf_WMS[i].trim());

                    // Removing "rocci://" prefix from string
                    fedcloud_wrf_WMS[i] = fedcloud_wrf_WMS[i].replace("rocci://", "");

                    // Removing port from string
                    CEs_list_fedcloud.add(fedcloud_wrf_WMS[i].substring(0, fedcloud_wrf_WMS[i].indexOf(":")));

                    log.info("Cloud Resource = "
                            + fedcloud_wrf_WMS[i].substring(0, fedcloud_wrf_WMS[i].indexOf(":")));

                } else {
                    log.info("Cloud Resource not set for the FEDCLOUD VO!");
                    fedcloud_wrf_ENABLEINFRASTRUCTURE = "unchecked";
                }
        }
    }

    if (eumed_wrf_ENABLEINFRASTRUCTURE.equals("checked") && (!eumed_wrf_TOPBDII.equals("N/A"))) {
        try {
            log.info("-----*FETCHING*THE*<EUMED>*RESOURCES*-----");

            CEs_list_eumed = new ArrayList();
            CEqueues_eumed = new ArrayList();

            bdii = new BDII(new URI(eumed_wrf_TOPBDII));
            CEs_list_eumed = getListofCEForSoftwareTag(eumed_wrf_VONAME, eumed_wrf_TOPBDII, wrf_SOFTWARE);

            CEqueues_eumed = bdii.queryCEQueues(eumed_wrf_VONAME);
        } catch (NamingException ex) {
            Logger.getLogger(Wrf.class.getName()).log(Level.SEVERE, null, ex);
        } catch (URISyntaxException ex) {
            Logger.getLogger(Wrf.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    if (gisela_wrf_ENABLEINFRASTRUCTURE.equals("checked") && (!gisela_wrf_TOPBDII.equals("N/A"))) {
        log.info("-----*FETCHING*THE*<GISELA>*CLOUD*RESOURCES*-----");

        CEs_list_gisela = new ArrayList();
        CEqueues_gisela = new ArrayList();

        // Get the CR from the portlet preferences for the GISELA VO
        String[] gisela_wrf_WMS = portletPreferences.getValues("gisela_wrf_WMS", new String[5]);

        if (gisela_wrf_WMS != null) {
            for (int i = 0; i < gisela_wrf_WMS.length; i++)
                if (!(gisela_wrf_WMS[i].trim().equals("N/A"))) {
                    CEqueues_gisela.add(gisela_wrf_WMS[i].trim());

                    // Removing "rocci://" prefix from string
                    gisela_wrf_WMS[i] = gisela_wrf_WMS[i].replace("rocci://", "");

                    // Removing port from string
                    CEs_list_gisela.add(gisela_wrf_WMS[i].substring(0, gisela_wrf_WMS[i].indexOf(":")));

                    log.info("Cloud Resource = "
                            + gisela_wrf_WMS[i].substring(0, gisela_wrf_WMS[i].indexOf(":")));

                } else {
                    log.info("Cloud Resource not set for the GISELA VO!");
                    fedcloud_wrf_ENABLEINFRASTRUCTURE = "unchecked";
                }
        }
    }

    if (sagrid_wrf_ENABLEINFRASTRUCTURE.equals("checked") && (!sagrid_wrf_TOPBDII.equals("N/A"))) {
        log.info("-----*FETCHING*THE*<SAGRID>*CLOUD*RESOURCES*-----");

        CEs_list_sagrid = new ArrayList();
        CEqueues_sagrid = new ArrayList();

        // Get the CR from the portlet preferences for the SAGRID VO
        String[] sagrid_wrf_WMS = portletPreferences.getValues("sagrid_wrf_WMS", new String[5]);

        if (sagrid_wrf_WMS != null) {
            for (int i = 0; i < sagrid_wrf_WMS.length; i++)
                if (!(sagrid_wrf_WMS[i].trim().equals("N/A"))) {
                    CEqueues_sagrid.add(sagrid_wrf_WMS[i].trim());

                    // Removing "rocci://" prefix from string
                    sagrid_wrf_WMS[i] = sagrid_wrf_WMS[i].replace("rocci://", "");

                    // Removing port from string
                    CEs_list_sagrid.add(sagrid_wrf_WMS[i].substring(0, sagrid_wrf_WMS[i].indexOf(":")));

                    log.info("Cloud Resource = "
                            + sagrid_wrf_WMS[i].substring(0, sagrid_wrf_WMS[i].indexOf(":")));

                } else {
                    log.info("Cloud Resource not set for the SAGRID VO!");
                    fedcloud_wrf_ENABLEINFRASTRUCTURE = "unchecked";
                }
        }
    }

    // Merging the list of CEs and queues
    List<String> CEs_list_TOT = new ArrayList<String>();

    if (dit_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_list_TOT.addAll(CEs_list_dit);
    if (chain_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_list_TOT.addAll(CEs_list_chain);
    // ===== ONLY FOR THE CHAIN INTEROPERABILITY DEMO =====
    if (garuda_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_list_TOT.addAll(CEs_list_garuda);
    // ===== ONLY FOR THE CHAIN INTEROPERABILITY DEMO =====
    if (fedcloud_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_list_TOT.addAll(CEs_list_fedcloud);
    if (eumed_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_list_TOT.addAll(CEs_list_eumed);
    if (gisela_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_list_TOT.addAll(CEs_list_gisela);
    if (sagrid_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_list_TOT.addAll(CEs_list_sagrid);

    List<String> CEs_queue_TOT = new ArrayList<String>();

    if (dit_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_queue_TOT.addAll(CEqueues_dit);
    if (chain_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_queue_TOT.addAll(CEqueues_chain);
    if (fedcloud_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_queue_TOT.addAll(CEqueues_fedcloud);
    if (eumed_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_queue_TOT.addAll(CEqueues_eumed);
    if (gisela_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_queue_TOT.addAll(CEqueues_gisela);
    if (sagrid_wrf_ENABLEINFRASTRUCTURE.equals("checked"))
        CEs_queue_TOT.addAll(CEqueues_sagrid);

    //=========================================================
    // IMPORTANT: INSTANCIATE THE UsersTrackingDBInterface
    //            CLASS USING THE EMPTY CONSTRUCTOR WHEN
    //            WHEN THE PORTLET IS DEPLOYED IN PRODUCTION!!!
    //=========================================================
    /*UsersTrackingDBInterface DBInterface =
    new UsersTrackingDBInterface(
        TRACKING_DB_HOSTNAME.trim(),
        TRACKING_DB_USERNAME.trim(),
        TRACKING_DB_PASSWORD.trim());*/

    UsersTrackingDBInterface DBInterface = new UsersTrackingDBInterface();

    if ((CEs_list_TOT != null) && (!CEs_queue_TOT.isEmpty())) {
        log.info("NOT EMPTY LIST!");
        // Fetching the list of CEs publushing the SW
        for (String CE : CEs_list_TOT) {
            //log.info("Fetching the CE="+CE);
            Properties coordinates = new Properties();
            Properties queue = new Properties();

            float coords[] = DBInterface.getCECoordinate(CE);

            String GPS_LAT = Float.toString(coords[0]);
            String GPS_LNG = Float.toString(coords[1]);

            coordinates.setProperty("LAT", GPS_LAT);
            coordinates.setProperty("LNG", GPS_LNG);
            log.info(
                    "Fetching CE settings for [ " + CE + " ] Coordinates [ " + GPS_LAT + ", " + GPS_LNG + " ]");

            // Fetching the Queues
            for (String CEqueue : CEs_queue_TOT) {
                if (CEqueue.contains(CE))
                    queue.setProperty("QUEUE", CEqueue);
            }

            // Saving the GPS location in a Java HashMap
            GPS_table.put(CE, coordinates);

            // Saving the queue in a Java HashMap
            GPS_queue.put(CE, queue);
        }
    } else
        log.info("EMPTY LIST!");

    // Checking the HashMap
    Set set = GPS_table.entrySet();
    Iterator iter = set.iterator();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        log.info(" - GPS location of the CE " + entry.getKey() + " => " + entry.getValue());
    }

    // Checking the HashMap
    set = GPS_queue.entrySet();
    iter = set.iterator();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        log.info(" - Queue " + entry.getKey() + " => " + entry.getValue());
    }

    Gson gson = new GsonBuilder().create();
    request.setAttribute("GPS_table", gson.toJson(GPS_table));
    request.setAttribute("GPS_queue", gson.toJson(GPS_queue));

    // ********************************************************
    dispatcher = getPortletContext().getRequestDispatcher("/view.jsp");
    dispatcher.include(request, response);
}