1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.googleapps;
16  
17  import com.liferay.portal.kernel.xml.Document;
18  import com.liferay.portal.kernel.xml.Element;
19  import com.liferay.portal.kernel.xml.Namespace;
20  import com.liferay.portal.kernel.xml.QName;
21  
22  /**
23   * <a href="GBaseManagerImpl.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class GBaseManagerImpl {
28  
29      public static final String APPS_URL = GHelperUtil.APPS_URL;
30  
31      public GBaseManagerImpl(GoogleApps googleApps) {
32          this.googleApps = googleApps;
33      }
34  
35      protected Element addAppsProperty(
36          Element parentElement, String name, String value) {
37  
38          return GHelperUtil.addAppsProperty(parentElement, name, value);
39      }
40  
41      protected Element addAtomCategory(Element parentElement, String type) {
42          return GHelperUtil.addAtomCategory(parentElement, type);
43      }
44  
45      protected Element addAtomEntry(Document document) {
46          return GHelperUtil.addAtomEntry(document);
47      }
48  
49      protected Namespace getAppsNamespace() {
50          return GHelperUtil.getAppsNamespace();
51      }
52  
53      protected QName getAppsQName(String localName) {
54          return GHelperUtil.getAppsQName(localName);
55      }
56  
57      protected Namespace getAtomNamespace() {
58          return GHelperUtil.getAtomNamespace();
59      }
60  
61      protected QName getAtomQName(String localName) {
62          return GHelperUtil.getAtomQName(localName);
63      }
64  
65      protected long getCompanyId() {
66          GAuthenticator gAuthenticator = googleApps.getGAuthenticator();
67  
68          return gAuthenticator.getCompanyId();
69      }
70  
71      protected Document getDocument(String url) throws GoogleAppsException {
72          return GHelperUtil.getDocument(googleApps.getGAuthenticator(), url);
73      }
74  
75      protected String getErrorMessage(Document document) {
76          return GHelperUtil.getErrorMessage(document);
77      }
78  
79      protected boolean hasError(Document document) {
80          return GHelperUtil.hasError(document);
81      }
82  
83      protected void submitAdd(String url, Document document)
84          throws GoogleAppsException {
85  
86          GHelperUtil.submitAdd(googleApps.getGAuthenticator(), url, document);
87      }
88  
89      protected void submitDelete(String url) throws GoogleAppsException {
90          GHelperUtil.submitDelete(googleApps.getGAuthenticator(), url);
91      }
92  
93      protected void submitUpdate(String url, Document document)
94          throws GoogleAppsException {
95  
96          GHelperUtil.submitUpdate(googleApps.getGAuthenticator(), url, document);
97      }
98  
99      protected GoogleApps googleApps;
100 
101 }