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.googleapps;
16  
17  import com.liferay.portal.kernel.googleapps.GoogleAppsException;
18  import com.liferay.portal.kernel.xml.Document;
19  import com.liferay.portal.kernel.xml.Element;
20  import com.liferay.portal.kernel.xml.Namespace;
21  import com.liferay.portal.kernel.xml.QName;
22  
23  /**
24   * <a href="GBaseManagerImpl.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Brian Wing Shun Chan
27   */
28  public class GBaseManagerImpl {
29  
30      public static final String APPS_URL = GHelperUtil.APPS_URL;
31  
32      public GBaseManagerImpl(GoogleApps googleApps) {
33          this.googleApps = googleApps;
34      }
35  
36      protected Element addAppsProperty(
37          Element parentElement, String name, String value) {
38  
39          return GHelperUtil.addAppsProperty(parentElement, name, value);
40      }
41  
42      protected Element addAtomCategory(Element parentElement, String type) {
43          return GHelperUtil.addAtomCategory(parentElement, type);
44      }
45  
46      protected Element addAtomEntry(Document document) {
47          return GHelperUtil.addAtomEntry(document);
48      }
49  
50      protected Namespace getAppsNamespace() {
51          return GHelperUtil.getAppsNamespace();
52      }
53  
54      protected QName getAppsQName(String localName) {
55          return GHelperUtil.getAppsQName(localName);
56      }
57  
58      protected Namespace getAtomNamespace() {
59          return GHelperUtil.getAtomNamespace();
60      }
61  
62      protected QName getAtomQName(String localName) {
63          return GHelperUtil.getAtomQName(localName);
64      }
65  
66      protected long getCompanyId() {
67          GAuthenticator gAuthenticator = googleApps.getGAuthenticator();
68  
69          return gAuthenticator.getCompanyId();
70      }
71  
72      protected Document getDocument(String url) throws GoogleAppsException {
73          return GHelperUtil.getDocument(googleApps.getGAuthenticator(), url);
74      }
75  
76      protected String getErrorMessage(Document document) {
77          return GHelperUtil.getErrorMessage(document);
78      }
79  
80      protected boolean hasError(Document document) {
81          return GHelperUtil.hasError(document);
82      }
83  
84      protected void submitAdd(String url, Document document)
85          throws GoogleAppsException {
86  
87          GHelperUtil.submitAdd(googleApps.getGAuthenticator(), url, document);
88      }
89  
90      protected void submitDelete(String url) throws GoogleAppsException {
91          GHelperUtil.submitDelete(googleApps.getGAuthenticator(), url);
92      }
93  
94      protected void submitUpdate(String url, Document document)
95          throws GoogleAppsException {
96  
97          GHelperUtil.submitUpdate(googleApps.getGAuthenticator(), url, document);
98      }
99  
100     protected GoogleApps googleApps;
101 
102 }