r7503 - in dumbhippo/trunk/server/src/com/dumbhippo/server: . impl
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7503 - in dumbhippo/trunk/server/src/com/dumbhippo/server: . impl
- Date: Tue, 2 Sep 2008 17:11:41 -0500 (CDT)
Author: marinaz
Date: 2008-09-02 17:11:40 -0500 (Tue, 02 Sep 2008)
New Revision: 7503
Modified:
dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java
dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
Log:
Make a list of supported online account types available at /xml/supportedOnlineAccountTypes
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java 2008-09-02 20:08:40 UTC (rev 7502)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/ExternalAccountSystem.java 2008-09-02 22:11:40 UTC (rev 7503)
@@ -6,6 +6,7 @@
import javax.ejb.Local;
import com.dumbhippo.Thumbnail;
+import com.dumbhippo.XmlBuilder;
import com.dumbhippo.persistence.ExternalAccount;
import com.dumbhippo.persistence.ExternalAccountType;
import com.dumbhippo.persistence.OnlineAccountType;
@@ -84,6 +85,8 @@
public OnlineAccountType getOnlineAccountType(ExternalAccountType accountType);
public List<OnlineAccountType> getAllOnlineAccountTypes();
+
+ public void writeSupportedOnlineAccountTypesToXml(XmlBuilder xml, String lang);
public OnlineAccountType lookupOnlineAccountTypeForName(String name) throws NotFoundException;
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java 2008-09-02 20:08:40 UTC (rev 7502)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/HttpMethods.java 2008-09-02 22:11:40 UTC (rev 7503)
@@ -443,6 +443,11 @@
@HttpOptions( optionalParams = { "participantOnly" } )
public void getUserRSS(OutputStream out, HttpResponseData contentType, Viewpoint viewpoint, User who, boolean participantOnly) throws IOException, XmlMethodException;
+ @HttpContentTypes(HttpResponseData.XMLMETHOD)
+ @HttpParams({ "lang" })
+ @HttpOptions( optionalParams = { "lang" } )
+ public void getSupportedOnlineAccountTypes(XmlBuilder xml, Viewpoint viewpoint, String lang) throws XmlMethodException;
+
@HttpContentTypes(HttpResponseData.NONE)
@HttpParams( { "email", "enabled" })
public void doSetGoogleServicedEmail(UserViewpoint viewpoint, String email, boolean enabled) throws IOException, RetryException, ValidationException;
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java 2008-09-02 20:08:40 UTC (rev 7502)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/ExternalAccountSystemBean.java 2008-09-02 22:11:40 UTC (rev 7503)
@@ -20,8 +20,10 @@
import com.dumbhippo.GlobalSetup;
import com.dumbhippo.Thumbnail;
import com.dumbhippo.TypeUtils;
+import com.dumbhippo.XmlBuilder;
import com.dumbhippo.dm.ReadWriteSession;
import com.dumbhippo.persistence.Account;
+import com.dumbhippo.persistence.Application;
import com.dumbhippo.persistence.ExternalAccount;
import com.dumbhippo.persistence.ExternalAccountType;
import com.dumbhippo.persistence.OnlineAccountType;
@@ -34,10 +36,12 @@
import com.dumbhippo.server.Notifier;
import com.dumbhippo.server.PicasaUpdater;
import com.dumbhippo.server.YouTubeUpdater;
+import com.dumbhippo.server.applications.ApplicationView;
import com.dumbhippo.server.dm.DataService;
import com.dumbhippo.server.dm.ExternalAccountDMO;
import com.dumbhippo.server.dm.ExternalAccountKey;
import com.dumbhippo.server.views.ExternalAccountView;
+import com.dumbhippo.server.views.OnlineAccountTypeView;
import com.dumbhippo.server.views.UserViewpoint;
import com.dumbhippo.server.views.Viewpoint;
import com.dumbhippo.services.FlickrPhotoSize;
@@ -125,6 +129,16 @@
return TypeUtils.castList(OnlineAccountType.class, q.getResultList());
}
+ public void writeSupportedOnlineAccountTypesToXml(XmlBuilder xml, String lang) {
+ Query q = em.createQuery("SELECT oat FROM OnlineAccountType oat WHERE oat.supported = TRUE");
+ List<OnlineAccountType> supportedTypes = TypeUtils.castList(OnlineAccountType.class,
+ q.getResultList());
+ for (OnlineAccountType supportedType : supportedTypes) {
+ OnlineAccountTypeView supportedTypeView = new OnlineAccountTypeView(supportedType);
+ supportedTypeView.writeToXmlBuilder(xml, lang);
+ }
+ }
+
public OnlineAccountType lookupOnlineAccountTypeForName(String name) throws NotFoundException {
Query q = em.createQuery("SELECT oat FROM OnlineAccountType oat WHERE " +
"LOWER(oat.name) = :name");
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2008-09-02 20:08:40 UTC (rev 7502)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java 2008-09-02 22:11:40 UTC (rev 7503)
@@ -2473,6 +2473,12 @@
xml.closeElement();
}
+ public void getSupportedOnlineAccountTypes(XmlBuilder xml, Viewpoint viewpoint, String lang) throws XmlMethodException {
+ xml.openElement("onlineAccountTypes");
+ externalAccountSystem.writeSupportedOnlineAccountTypesToXml(xml, lang);
+ xml.closeElement();
+ }
+
public void getUserRSS(OutputStream out, HttpResponseData contentType, Viewpoint viewpoint, User who, boolean participantOnly) throws IOException, XmlMethodException {
// anonymize while keeping Site
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]