001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.cmis.model;
016    
017    import javax.xml.namespace.QName;
018    
019    import org.apache.abdera.factory.Factory;
020    import org.apache.abdera.model.Element;
021    import org.apache.abdera.model.ElementWrapper;
022    
023    /**
024     * @author Alexander Chow
025     */
026    public class CMISRepositoryInfo extends ElementWrapper {
027    
028            public CMISRepositoryInfo(Element element) {
029                    super(element);
030    
031                    _cmisConstants = CMISConstants.getInstance();
032            }
033    
034            public CMISRepositoryInfo(Factory factory) {
035                    super(factory, CMISConstants.getInstance().REPOSITORY_INFO);
036    
037                    _cmisConstants = CMISConstants.getInstance();
038            }
039    
040            public String getDescription() {
041                    return getFirstChildText(_cmisConstants.REPOSITORY_DESCRIPTION);
042            }
043    
044            public String getId() {
045                    return getFirstChildText(_cmisConstants.REPOSITORY_ID);
046            }
047    
048            public String getName() {
049                    return getFirstChildText(_cmisConstants.REPOSITORY_NAME);
050            }
051    
052            public String getProductName() {
053                    return getFirstChildText(_cmisConstants.REPOSITORY_PRODUCT_NAME);
054            }
055    
056            public String getProductVersion() {
057                    return getFirstChildText(_cmisConstants.REPOSITORY_PRODUCT_VERSION);
058            }
059    
060            public String getRelatonship() {
061                    return getFirstChildText(_cmisConstants.REPOSITORY_RELATIONSHIP);
062            }
063    
064            public String getRootFolderId() {
065                    return getFirstChildText(_cmisConstants.REPOSITORY_ROOT_FOLDER_ID);
066            }
067    
068            public Element getSpecificInfo() {
069                    return getFirstChild(_cmisConstants.REPOSITORY_SPECIFIC_INFO);
070            }
071    
072            public String getVendorName() {
073                    return getFirstChildText(_cmisConstants.REPOSITORY_VENDOR_NAME);
074            }
075    
076            public String getVersionSupported() {
077                    return getFirstChildText(_cmisConstants.REPOSITORY_VERSION_SUPPORTED);
078            }
079    
080            protected String getFirstChildText(QName qName) {
081                    String text = null;
082    
083                    Element element = getFirstChild(qName);
084    
085                    if (element != null) {
086                            text = element.getText();
087                    }
088    
089                    return text;
090            }
091    
092            private CMISConstants _cmisConstants;
093    
094    }