001/*
002 * (C) Copyright 2011 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     tdelprat
016 *
017 */
018package org.nuxeo.wizard.download;
019
020/**
021 * @author Tiry (tdelprat@nuxeo.com)
022 */
023public class Preset {
024
025    protected final String id;
026
027    protected final String label;
028
029    protected final String[] pkgs;
030
031    public Preset(String id, String label, String[] pkgs) {
032        this.id = id;
033        this.label = label;
034        this.pkgs = pkgs;
035    }
036
037    public String getId() {
038        return id;
039    }
040
041    public String getLabel() {
042        return label;
043    }
044
045    public String[] getPkgs() {
046        return pkgs;
047    }
048
049    public String getPkgsAsJsonArray() {
050        StringBuffer sb = new StringBuffer();
051        sb.append("[");
052        for (int i = 0; i < pkgs.length; i++) {
053            if (i > 0) {
054                sb.append(",");
055            }
056            sb.append("'" + pkgs[i] + "'");
057        }
058        sb.append("]");
059        return sb.toString();
060    }
061
062}