001/*
002 * (C) Copyright 2014 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-2.1.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 *     <a href="mailto:glefevre@nuxeo.com">Gildas</a>
016 */
017package org.nuxeo.ecm.user.center;
018
019import org.nuxeo.ecm.platform.url.api.DocumentView;
020
021/**
022 * Codec handling a groupname, an optional view and additional request parameters.
023 *
024 * @since 6.0
025 */
026public class GroupCodec extends AbstractUserGroupCodec {
027
028    public static final String PREFIX = "group";
029
030    public static final String DEFAULT_GROUPS_TAB = "USER_CENTER:UsersGroupsHome:GroupsHome";
031
032    @Override
033    public String getPrefix() {
034        if (prefix != null) {
035            return prefix;
036        }
037        return PREFIX;
038    }
039
040    @Override
041    public DocumentView getDocumentViewFromUrl(String url) {
042
043        return getDocumentViewFromUrl(url, DEFAULT_GROUPS_TAB, "groupname", "showGroup");
044    }
045
046    @Override
047    public String getUrlFromDocumentView(DocumentView docView) {
048        return getUrlFromDocumentViewAndID(docView, "groupname");
049    }
050
051}