1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.cmis.model;
16  
17  import javax.xml.namespace.QName;
18  
19  import org.apache.abdera.factory.Factory;
20  import org.apache.abdera.model.Element;
21  import org.apache.abdera.model.ElementWrapper;
22  
23  /**
24   * <a href="CMISRepositoryInfo.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Alexander Chow
27   */
28  public class CMISRepositoryInfo extends ElementWrapper {
29  
30      public CMISRepositoryInfo(Element element) {
31          super(element);
32  
33          _cmisConstants = CMISConstants.getInstance();
34      }
35  
36      public CMISRepositoryInfo(Factory factory) {
37          super(factory, CMISConstants.getInstance().REPOSITORY_INFO);
38  
39          _cmisConstants = CMISConstants.getInstance();
40      }
41  
42      public String getDescription() {
43          return getFirstChildText(_cmisConstants.REPOSITORY_DESCRIPTION);
44      }
45  
46      public String getId() {
47          return getFirstChildText(_cmisConstants.REPOSITORY_ID);
48      }
49  
50      public String getName() {
51          return getFirstChildText(_cmisConstants.REPOSITORY_NAME);
52      }
53  
54      public String getProductName() {
55          return getFirstChildText(_cmisConstants.REPOSITORY_PRODUCT_NAME);
56      }
57  
58      public String getProductVersion() {
59          return getFirstChildText(_cmisConstants.REPOSITORY_PRODUCT_VERSION);
60      }
61  
62      public String getRelatonship() {
63          return getFirstChildText(_cmisConstants.REPOSITORY_RELATIONSHIP);
64      }
65  
66      public String getRootFolderId() {
67          return getFirstChildText(_cmisConstants.REPOSITORY_ROOT_FOLDER_ID);
68      }
69  
70      public Element getSpecificInfo() {
71          return getFirstChild(_cmisConstants.REPOSITORY_SPECIFIC_INFO);
72      }
73  
74      public String getVendorName() {
75          return getFirstChildText(_cmisConstants.REPOSITORY_VENDOR_NAME);
76      }
77  
78      public String getVersionSupported() {
79          return getFirstChildText(_cmisConstants.REPOSITORY_VERSION_SUPPORTED);
80      }
81  
82      protected String getFirstChildText(QName qName) {
83          String text = null;
84  
85          Element element = getFirstChild(qName);
86  
87          if (element != null) {
88              text = element.getText();
89          }
90  
91          return text;
92      }
93  
94      private CMISConstants _cmisConstants;
95  
96  }