001/* 002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * tdelprat 018 * 019 */ 020package org.nuxeo.wizard.download; 021 022/** 023 * @author Tiry ([email protected]) 024 */ 025public class Preset { 026 027 protected final String id; 028 029 protected final String label; 030 031 protected final String[] pkgs; 032 033 public Preset(String id, String label, String[] pkgs) { 034 this.id = id; 035 this.label = label; 036 this.pkgs = pkgs; 037 } 038 039 public String getId() { 040 return id; 041 } 042 043 public String getLabel() { 044 return label; 045 } 046 047 public String[] getPkgs() { 048 return pkgs; 049 } 050 051 public String getPkgsAsJsonArray() { 052 StringBuffer sb = new StringBuffer(); 053 sb.append("["); 054 for (int i = 0; i < pkgs.length; i++) { 055 if (i > 0) { 056 sb.append(","); 057 } 058 sb.append("'" + pkgs[i] + "'"); 059 } 060 sb.append("]"); 061 return sb.toString(); 062 } 063 064}