001/*
002 * (C) Copyright 2010-2013 Nuxeo SA (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 *     Olivier Grisel
016 */
017package org.nuxeo.ecm.platform.suggestbox.service;
018
019import java.util.ArrayList;
020import java.util.List;
021
022import org.apache.commons.lang.StringUtils;
023
024/**
025 * Suggest to navigate to a specific group profile.
026 */
027public class GroupSuggestion extends Suggestion {
028
029    private static final long serialVersionUID = 1L;
030
031    private static final String PREFIX = "group";
032
033    protected final String groupId;
034
035    public GroupSuggestion(String groupId, String label, String iconURL) {
036        super(groupId, CommonSuggestionTypes.GROUP, label, iconURL);
037        this.groupId = groupId;
038    }
039
040    public String getGroupId() {
041        return groupId;
042    }
043
044    @Override
045    public String getObjectUrl() {
046        List<String> items = new ArrayList<String>();
047        items.add(PREFIX);
048        items.add(groupId);
049        return StringUtils.join(items, "/");
050    }
051}