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.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 }