001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.lar;
016    
017    import com.liferay.portal.kernel.util.GetterUtil;
018    import com.liferay.portal.kernel.xml.Element;
019    
020    import java.io.Serializable;
021    
022    import java.util.HashMap;
023    import java.util.Map;
024    import java.util.Set;
025    
026    /**
027     * @author Zsolt Berentey
028     */
029    public class MissingReference implements Serializable {
030    
031            public MissingReference(Element element) {
032                    _className = element.attributeValue("class-name");
033                    _classPK = element.attributeValue("class-pk");
034                    _displayName = GetterUtil.getString(
035                            element.attributeValue("display-name"));
036                    _referrerClassName = element.attributeValue("referrer-class-name");
037                    _type = GetterUtil.getString(element.attributeValue("type"));
038    
039                    String referrerDisplayName = GetterUtil.getString(
040                            element.attributeValue("referrer-display-name"));
041    
042                    addReferrer(_referrerClassName, referrerDisplayName);
043            }
044    
045            public void addReferrer(
046                    String referrerClassName, String referrerDisplayName) {
047    
048                    _referrers.put(referrerDisplayName, referrerClassName);
049            }
050    
051            public void addReferrers(Map<String, String> referrers) {
052                    _referrers.putAll(referrers);
053            }
054    
055            public String getClassName() {
056                    return _className;
057            }
058    
059            public String getClassPK() {
060                    return _classPK;
061            }
062    
063            public String getDisplayName() {
064                    return _displayName;
065            }
066    
067            public long getGroupId() {
068                    return _groupId;
069            }
070    
071            public String getReferrerClassName() {
072                    return _referrerClassName;
073            }
074    
075            public Set<String> getReferrerDisplayNames() {
076                    return _referrers.keySet();
077            }
078    
079            public Map<String, String> getReferrers() {
080                    return _referrers;
081            }
082    
083            public String getType() {
084                    return _type;
085            }
086    
087            public void setGroupId(long groupId) {
088                    _groupId = groupId;
089            }
090    
091            private String _className;
092            private String _classPK;
093            private String _displayName;
094            private long _groupId;
095            private String _referrerClassName;
096            private Map<String, String> _referrers = new HashMap<String, String>();
097            private String _type;
098    
099    }