001/*
002 * (C) Copyright 2006-2015 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 *     dmetzler
018 */
019package org.nuxeo.ecm.user.center.notification;
020
021/**
022 * Simple bean to store subscription the way it used to
023 * be when JPA was used for persistence.
024 *
025 * @since 7.3
026 */
027public class UserSubscription {
028
029    private final String docid;
030    private final String notification;
031    private final String username;
032
033    public UserSubscription(String id, String notification, String prefixedUserName) {
034        this.docid = id;
035        this.notification = notification;
036        this.username = prefixedUserName;
037    }
038
039    public String getDocId() {
040        return docid;
041    }
042
043    public String getNotification() {
044        return notification;
045    }
046
047    /**
048     * Returns a prefixed principal id. It means it can be a group.
049     * <ul>
050     *   <li>user:myusername</li>
051     *   <li>group:mygroupname</li>
052     * </ul>
053     * @return
054     */
055    public String getUserId() {
056        return username;
057    }
058
059}