You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-commits@incubator.apache.org by lr...@apache.org on 2011/08/11 20:34:54 UTC
svn commit: r1156812 [1/2] - in /incubator/photark/branches/photark-rest: ./
photark-jcr/src/test/resources/ photark-social-ui/ photark-social-ui/src/
photark-social-ui/src/main/ photark-social-ui/src/main/webapp/
photark-social-ui/src/main/webapp/META...
Author: lresende
Date: Thu Aug 11 20:34:53 2011
New Revision: 1156812
URL: http://svn.apache.org/viewvc?rev=1156812&view=rev
Log:
PHOTARK-72 - Applying patch from Umashanthi Pavalanathan to provide initial ui for the new social capabilities
Added:
incubator/photark/branches/photark-rest/photark-social-ui/
incubator/photark/branches/photark-rest/photark-social-ui/build-dojo.xml
incubator/photark/branches/photark-rest/photark-social-ui/pom.xml
incubator/photark/branches/photark-rest/photark-social-ui/src/
incubator/photark/branches/photark-rest/photark-social-ui/src/main/
incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/
incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/META-INF/
incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/META-INF/sca-contribution.xml
incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/WEB-INF/
incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/WEB-INF/web.xml
incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/home/
incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/home/profile.html
incubator/photark/branches/photark-rest/photark-social/src/main/resources/
incubator/photark/branches/photark-rest/photark-social/src/main/resources/personservice.composite
- copied, changed from r1155342, incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite
Modified:
incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/ActivityService.java
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/AppDataService.java
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/PersonService.java
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/RelationshipService.java
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRActivityServiceImpl.java
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRAppDataServiceImpl.java
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRPersonServiceImpl.java
incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRRelationshipServiceImpl.java
incubator/photark/branches/photark-rest/pom.xml
Modified: incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite?rev=1156812&r1=1156811&r2=1156812&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite (original)
+++ incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite Thu Aug 11 20:34:53 2011
@@ -46,7 +46,7 @@
<component name="ImageUploadComponent">
<implementation.java class="org.apache.photark.services.jcr.JCRImageUploadService"/>
<service name="ImageUploadService">
- <tuscany:binding.rest uri="http://localhost:8085/upload">
+ <tuscany:binding.rest uri="/upload">
<tuscany:operationSelector.jaxrs />
</tuscany:binding.rest>
</service>
Added: incubator/photark/branches/photark-rest/photark-social-ui/build-dojo.xml
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social-ui/build-dojo.xml?rev=1156812&view=auto
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social-ui/build-dojo.xml (added)
+++ incubator/photark/branches/photark-rest/photark-social-ui/build-dojo.xml Thu Aug 11 20:34:53 2011
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="DojoZipInstaller">
+
+ <property name="dojo.version" value="1.5.0"/>
+ <property name="dojo.zip" value="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
+ <property name="unpack.location" value="${basedir}/target/${artifactId}"/>
+
+ <target name="check-dojo-installed">
+ <condition property="already.installed" >
+ <available file="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
+ </condition>
+ </target>
+
+ <target name="check-dojo-unpacked">
+ <condition property="already.unpacked" >
+ <available file="${unpack.location}"/>
+ </condition>
+ </target>
+
+ <target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ tofile="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
+ </target>
+
+ <target name="unpack-dojo-files-nomaven" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
+ <fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false"
+ encoding="native-encoding">
+ <patternset>
+
+ <include name="dojo-${dojo.version}/dojo/**"/>
+ <exclude name="dojo-${dojo.version}/dojo/tests/**"/>
+ <include name="dojo-${dojo.version}/dijit/**"/>
+ <include name="dojo-${dojo.version}/dojox/**"/>
+ <exclude name="dojo-${dojo.version}/util/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-${dojo.version}"
+ tofile="${unpack.location}"
+ verbose="true"/>
+ <delete dir="${basedir}/target/dojo-unpack-temp/"/>
+ </target>
+
+ <target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
+ <fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false"
+ encoding="native-encoding">
+ <patternset>
+ <include name="dojo-${dojo.version}/dojo/**"/>
+ <include name="dojo-${dojo.version}/dojo/tests/**"/>
+ <include name="dojo-${dojo.version}/dijit/**"/>
+ <include name="dojo-${dojo.version}/dojox/**"/>
+ <exclude name="dojo-${dojo.version}/util/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-${dojo.version}"
+ tofile="${unpack.location}"
+ verbose="true"/>
+ <delete dir="${basedir}/target/dojo-unpack-temp/"/>
+ </target>
+
+ <target name="clean-dojo-files">
+ <delete dir="${unpack.location}"/>
+ </target>
+</project>
Added: incubator/photark/branches/photark-rest/photark-social-ui/pom.xml
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social-ui/pom.xml?rev=1156812&view=auto
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social-ui/pom.xml (added)
+++ incubator/photark/branches/photark-rest/photark-social-ui/pom.xml Thu Aug 11 20:34:53 2011
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- * Licensed to the Apache Software Foundation (ASF) under one * or more
+ contributor license agreements. See the NOTICE file * distributed with this
+ work for additional information * regarding copyright ownership. The ASF
+ licenses this file * to you under the Apache License, Version 2.0 (the *
+ "License"); you may not use this file except in compliance * with the License.
+ You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0
+ * * Unless required by applicable law or agreed to in writing, * software
+ distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the
+ License for the * specific language governing permissions and limitations
+ * under the License. -->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.photark</groupId>
+ <artifactId>photark-rest</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>photark-social-ui</artifactId>
+ <packaging>war</packaging>
+ <name>Apache PhotArk Social UI</name>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.photark</groupId>
+ <artifactId>photark</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.photark</groupId>
+ <artifactId>photark-jcr</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.photark</groupId>
+ <artifactId>photark-social</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.photark</groupId>
+ <artifactId>photark-picasa</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.photark</groupId>
+ <artifactId>photark-flickr</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${tuscany.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rest-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.11</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.11</version>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.dojotoolkit</groupId>
+ <artifactId>dojo</artifactId>
+ <version>1.5.0</version>
+ <type>zip</type>
+ </dependency>
+</dependencies>
+
+ <build>
+ <finalName>photark</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install-dojo</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
+ <property name="localRepository" value="${settings.localRepository}" />
+ <property name="artifactId" value="photark" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-dojo-files</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" target="unpack-dojo-files-nomaven">
+ <property name="localRepository" value="${settings.localRepository}" />
+ <property name="artifactId" value="photark" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>clean-dojo-files</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" target="clean-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}" />
+ <property name="artifactId" value="photark" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <!-- Key used for configuring access to server in settings.xml -->
+ <server>tomcat</server>
+ <!-- context for the webapp, as finalName is not being honored -->
+ <path>/photark</path>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <dependentWarExcludes>WEB-INF/web.xml</dependentWarExcludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
Added: incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/META-INF/sca-contribution.xml?rev=1156812&view=auto
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/META-INF/sca-contribution.xml (added)
+++ incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/META-INF/sca-contribution.xml Thu Aug 11 20:34:53 2011
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:photark="http://org.apache.photoark">
+ <deployable composite="photark:people"/>
+
+</contribution>
Added: incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/WEB-INF/web.xml?rev=1156812&view=auto
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/WEB-INF/web.xml Thu Aug 11 20:34:53 2011
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- * Licensed to the Apache Software Foundation (ASF) under one * or more
+ contributor license agreements. See the NOTICE file * distributed with this
+ work for additional information * regarding copyright ownership. The ASF
+ licenses this file * to you under the Apache License, Version 2.0 (the *
+ "License"); you may not use this file except in compliance * with the License.
+ You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0
+ * * Unless required by applicable law or agreed to in writing, * software
+ distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the
+ License for the * specific language governing permissions and limitations
+ * under the License. -->
+
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <display-name>PhotArk photo gallery web application</display-name>
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+</web-app>
+
Added: incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/home/profile.html
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/home/profile.html?rev=1156812&view=auto
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/home/profile.html (added)
+++ incubator/photark/branches/photark-rest/photark-social-ui/src/main/webapp/home/profile.html Thu Aug 11 20:34:53 2011
@@ -0,0 +1,273 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>User Profile</title>
+<script type="text/javascript" src="../dojo/dojo.js"></script>
+
+<script type="text/javascript">
+ function init() {
+
+ var getPersonCallback = function(person) {
+ document.getElementById('userId').innerHTML = person
+ .getDisplayName();
+ document.getElementById('displayName').innerHTML = "Test User"; //for tetsing purpose
+ document.getElementById('u_displayName').value = 'Test User'; //for tetsing purpose
+ document.getElementById('u_firstName').value = 'XXX'; //for tetsing purpose
+ }
+ userId = "admin"; // need to retrieve the userId of the loggen in user
+ var xhrArgs = {
+ url : "/photark/people/" + userId + "/@self",
+ handleAs : "json",
+ headers : {
+ "Accept" : "application/json"
+ }
+ };
+
+ //Call the asynchronous xhrGet
+ var deferred = dojo.xhrGet(xhrArgs);
+
+ deferred.addCallback(getPersonCallback);
+
+ deferred.addErrback(function(error) {
+ alert("An unexpected error occurred: " + error);
+ });
+ }
+
+ function switchToView(toView) {
+ currentView = toView;
+ if ('ShowProfile' == toView) {
+ dojo.byId("updateProfileDiv").style.display = "none";
+ dojo.byId("showProfileDiv").style.display = "";
+
+ } else if ('UpdateProfile' == toView) {
+ dojo.byId("showProfileDiv").style.display = "none";
+ dojo.byId("updateProfileDiv").style.display = "";
+
+ } else {
+
+ }
+ }
+</script>
+<style type="text/css">
+#container {
+ padding: 1em;
+}
+
+#container p {
+ font-size: 1.2em;
+ font-family: Tahoma, Verdana;
+}
+
+.switchView {
+ border: 1px solid #333333;
+ background: url(images/buttonEnabled.png) #d0d0d0 repeat-x scroll 0px
+ top;
+ font-size: 14px;
+ width: 201px;
+ height: 30px;
+ vertical-align: middle; /* emulates a <button> if node is not */
+ text-align: center;
+ text-shadow: green;
+ text-indent: 1.2 em;
+}
+</style>
+
+</head>
+
+<body onload="init()">
+
+ <div id="container" style="margin-left: 5px">
+ <div id="menuDiv" style="margin-left: 5px">
+ <div style="float: right; margin-right: 20px;"
+ onclick="switchToView('ShowProfile');" class="switchView"
+ id="switchToShowProfile">Show Profile</div>
+ <div style="float: right; margin-right: 20px;"
+ onclick="switchToView('UpdateProfile');" class="switchView"
+ id="switchToUpdateProfile">Update Profile</div>
+ </div>
+ <div id="showProfileDiv">
+ <p>
+ <span style="color: orange">User Profile</span>
+ </p>
+
+ <table border="0">
+ <tr>
+ <td>User ID :</td>
+ <td>
+ <div id="userId" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>First Name :</td>
+ <td>
+ <div id="firstName" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Last Name :</td>
+ <td>
+ <div id="lastName" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Display Name :</td>
+ <td>
+ <div id="displayName" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>E-mail :</td>
+ <td>
+ <div id="emails" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Nickname :</td>
+ <td>
+ <div id="nickname" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Gender :</td>
+ <td>
+ <div id="gender" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>About Me :</td>
+ <td>
+ <div id="aboutme" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Address :</td>
+ <td>
+ <div id="address" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Activities :</td>
+ <td>
+ <div id="activities" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Birthday :</td>
+ <td>
+ <div id="birthday" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ <td>Organization :</td>
+ <td>
+ <div id="organization" style="color: blue;"></div></td>
+ </tr>
+ <tr>
+ </tr>
+ </table>
+ </div>
+ <div id="updateProfileDiv" style="display: none;">
+ <p>
+ <span style="color: orange"> Update User Profile</span>
+ </p>
+
+ <table border="0">
+ <tr>
+ <td>User ID :</td>
+ <td>
+ <div id="u_userId" style="color: green;"></div></td>
+ </tr>
+ <tr>
+ <td>First Name :</td>
+ <td><label> <input id="u_firstName" type="text"
+ name="u_firstName" size="20" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>Last Name :</td>
+ <td><label> <input id="u_lastName" type="text"
+ name="u_lastName" size="20" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td><span>Display Name </span><span style="color: red">*</span><span>
+ : </span>
+ </td>
+ <td><label> <input id="u_displayName" type="text"
+ name="u_displayName" size="20" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>E-mail :</td>
+ <td><label> <input id="emails" type="text"
+ name="emails" size="35" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>Nickname :</td>
+ <td><label> <input id="u_nickname" type="text"
+ name="u_nickname" size="20" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>Gender :</td>
+ <td><label> <select id="u_gender" name="u_gender">
+ <option>Female</option>
+ <option>Male</option>
+ </select> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>About Me :</td>
+ <td><label> <input id="u_aboutme" type="text"
+ name="u_aboutme" size="35" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>Address :</td>
+ <td><label> <input id="u_address" type="text"
+ name="u_address" size="35" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>Activities :</td>
+ <td><label> <input id="u_activities" type="text"
+ name="u_activities" size="35" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>Birthday :</td>
+ <td><label> <input id="u_birthday" type="text"
+ name="u_birthday" size="35" /> </label>
+ </td>
+ </tr>
+ <tr>
+ <td>Organization :</td>
+ <td><label> <input id="u_organization" type="text"
+ name="u_organization" size="35" /> </label>
+ </td>
+ </tr>
+ <tr>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <button id="submit" type="button" onclick=""
+ style="margin-right: 5px">Update</button>
+ <button id="cancel" type="button" onclick="">Cancel</button>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+</body>
+
+</html>
Modified: incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/ActivityService.java
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/ActivityService.java?rev=1156812&r1=1156811&r2=1156812&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/ActivityService.java (original)
+++ incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/ActivityService.java Thu Aug 11 20:34:53 2011
@@ -21,105 +21,158 @@ package org.apache.photark.social.servic
import java.util.Set;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
import org.apache.photark.social.Activity;
import org.apache.photark.social.PhotArkSocialException;
import org.apache.photark.social.util.FilterOptions;
+import org.oasisopen.sca.annotation.Remotable;
+@Remotable
public interface ActivityService {
- /**
- * creates an Activity data object with the given fields
- *
- * @param userId ID of the user to whom the activity belongs to
- * @param groupId optional; ID of the group if this activity belongs to a
- * group
- * @param fields attributes of the activity
- * @return an Activity data object
- * @throws PhotArkSocialException
- */
- Activity createActivity(String userId, String groupId, Set<String> fields) throws PhotArkSocialException;
-
- /**
- * persists the given Activity data object for the given user
- *
- * @param userId ID of the user to whom the activity belongs to
- * @param activity the Activity data object to persists
- * @throws PhotArkSocialException
- */
- void saveActivity(String userId, Activity activity) throws PhotArkSocialException;
-
- /**
- * updates a persisted Activity data object
- *
- * @param userId ID of the user to whom the activity belongs to
- * @param activity the Activity data object to update
- * @throws PhotArkSocialException
- */
- void updateActivity(String userId, Activity activity) throws PhotArkSocialException;
-
- /**
- * removes a persisted Activity data object
- *
- * @param userId ID of the user to whom the activity belongs to
- * @param activityId ID of the activity to be removed
- * @throws PhotArkSocialException
- */
- void deleteActivity(String userId, String activityId) throws PhotArkSocialException;
-
- /**
- * removes a persisted Activity data objects for given activityIds
- *
- * @param userId ID of the user to whom the activities belongs to
- * @param groupId optional; ID of the group if this activity belongs to a
- * group
- * @param activityIds Set of activityIds to be deleted
- * @throws PhotArkSocialException
- */
- void deleteActivities(String userId, String groupId, Set<String> activityIds) throws PhotArkSocialException;
-
- /**
- * Retrieves array of Activity data objects matching the given input
- * parameters
- *
- * @param userIds IDs of the users the activities belongs to
- * @param groupId optional; ID of the group, the activities belongs to
- * @param fields optional; fields of the activities to be returned
- * @param filters optional; any filter options
- * @return array of Activity data objects
- * @throws PhotArkSocialException
- */
- Activity[] getActivities(String[] userIds, String groupId, Set<String> fields, FilterOptions filters)
- throws PhotArkSocialException;
-
- /**
- * Retrieves array of Activity data objects matching the given input
- * parameters
- *
- * @param userIds IDs of the users the activities belongs to
- * @param groupId optional; ID of the group, the activities belongs to
- * @param fields optional; fields of the activities to be returned
- * @param filters optional; any filter options
- * @param activityIds array of activityIds
- * @return array of Activity data objects
- * @throws PhotArkSocialException
- */
- Activity[] getActivities(String userId,
- String groupId,
- Set<String> fields,
- FilterOptions filters,
- String[] activityIds) throws PhotArkSocialException;
-
- /**
- * Retrieves an Activity data object matching the given input parameters
- *
- * @param userIds IDs of the users the activities belongs to
- * @param groupId optional; ID of the group, the activities belongs to
- * @param fields optional; fields of the activities to be returned
- * @param activityId ID of the Activity data object to be retrieved
- * @return an Activity data object matching the given input parameters
- * @throws PhotArkSocialException
- */
- public Activity getActivity(String userId, String groupId, Set<String> fields, String activityId)
- throws PhotArkSocialException;
+ /**
+ * creates an Activity data object with the given fields
+ *
+ * @param userId
+ * ID of the user to whom the activity belongs to
+ * @param groupId
+ * optional; ID of the group if this activity belongs to a group
+ * @param fields
+ * attributes of the activity
+ * @return an Activity data object
+ * @throws PhotArkSocialException
+ */
+ Activity createActivity(String userId, String groupId, Set<String> fields)
+ throws PhotArkSocialException;
+
+ /**
+ * persists the given Activity data object for the given user
+ *
+ * @param userId
+ * ID of the user to whom the activity belongs to
+ * @param activity
+ * the Activity data object to persists
+ * @throws PhotArkSocialException
+ */
+ @POST
+ @Path("/people/{userId}/activities")
+ @Consumes(MediaType.APPLICATION_JSON)
+ void saveActivity(@PathParam("userId") String userId, Activity activity)
+ throws PhotArkSocialException;
+
+ /**
+ * updates a persisted Activity data object
+ *
+ * @param userId
+ * ID of the user to whom the activity belongs to
+ * @param activity
+ * the Activity data object to update
+ * @throws PhotArkSocialException
+ */
+ @PUT
+ @Path("/people/{userId}/activities")
+ @Consumes(MediaType.APPLICATION_JSON)
+ void updateActivity(@PathParam("userId") String userId, Activity activity)
+ throws PhotArkSocialException;
+
+ /**
+ * removes a persisted Activity data object
+ *
+ * @param userId
+ * ID of the user to whom the activity belongs to
+ * @param activityId
+ * ID of the activity to be removed
+ * @throws PhotArkSocialException
+ */
+ @DELETE
+ @Path("people/{userId}/activities/{activityId}")
+ void deleteActivity(@PathParam("userId") String userId,
+ @PathParam("activityId") String activityId)
+ throws PhotArkSocialException;
+
+ /**
+ * removes a persisted Activity data objects for given activityIds
+ *
+ * @param userId
+ * ID of the user to whom the activities belongs to
+ * @param groupId
+ * optional; ID of the group if this activity belongs to a group
+ * @param activityIds
+ * Set of activityIds to be deleted
+ * @throws PhotArkSocialException
+ */
+ void deleteActivities(String userId, String groupId, Set<String> activityIds)
+ throws PhotArkSocialException;
+
+ /**
+ * Retrieves array of Activity data objects matching the given input
+ * parameters
+ *
+ * @param userIds
+ * IDs of the users the activities belongs to
+ * @param groupId
+ * optional; ID of the group, the activities belongs to
+ * @param fields
+ * optional; fields of the activities to be returned
+ * @param filters
+ * optional; any filter options
+ * @return array of Activity data objects
+ * @throws PhotArkSocialException
+ */
+ Activity[] getActivities(String[] userIds, String groupId,
+ Set<String> fields, FilterOptions filters)
+ throws PhotArkSocialException;
+
+ /**
+ * Retrieves array of Activity data objects matching the given input
+ * parameters
+ *
+ * @param userIds
+ * IDs of the users the activities belongs to
+ * @param groupId
+ * optional; ID of the group, the activities belongs to
+ * @param fields
+ * optional; fields of the activities to be returned
+ * @param filters
+ * optional; any filter options
+ * @param activityIds
+ * array of activityIds
+ * @return array of Activity data objects
+ * @throws PhotArkSocialException
+ */
+ Activity[] getActivities(String userId, String groupId, Set<String> fields,
+ FilterOptions filters, String[] activityIds)
+ throws PhotArkSocialException;
+
+ /**
+ * Retrieves an Activity data object matching the given input parameters
+ *
+ * @param userIds
+ * IDs of the users the activities belongs to
+ * @param groupId
+ * optional; ID of the group, the activities belongs to
+ * @param fields
+ * optional; fields of the activities to be returned
+ * @param activityId
+ * ID of the Activity data object to be retrieved
+ * @return an Activity data object matching the given input parameters
+ * @throws PhotArkSocialException
+ */
+ @GET
+ @Path("/people/{userId}/activities/{activityId}")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Activity getActivity(@PathParam("userId") String userId,
+ String groupId, Set<String> fields,
+ @PathParam("activityId") String activityId)
+ throws PhotArkSocialException;
}
Modified: incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/AppDataService.java
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/AppDataService.java?rev=1156812&r1=1156811&r2=1156812&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/AppDataService.java (original)
+++ incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/AppDataService.java Thu Aug 11 20:34:53 2011
@@ -22,50 +22,83 @@ package org.apache.photark.social.servic
import java.util.Map;
import java.util.Set;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
import org.apache.photark.social.PhotArkSocialException;
+import org.oasisopen.sca.annotation.Remotable;
+@Remotable
public interface AppDataService {
- /**
- * Retrieve person data
- *
- * @param userId ID of the user the data belongs to
- * @param groupId optional; ID of the group the data belongs to
- * @return map of name-value pairs
- * @throws PhotArkSocialException
- */
- Map<String, String> getPersonData(String userId, String groupId) throws PhotArkSocialException;
-
- /**
- * @param userIds IDs of the users the data belong to
- * @param groupId optional; ID of the group the data belongs to
- * @return map of name-value pairs for each user
- * @throws PhotArkSocialException
- */
- Map<String, Map<String, String>> getPeopleData(String[] userIds, String groupId) throws PhotArkSocialException;
-
- /**
- * @param userId ID of the user the data belongs to
- * @param values map of name-value pairs
- * @throws PhotArkSocialException
- */
- void savePersonData(String userId, Map<String, String> values) throws PhotArkSocialException;
-
- /**
- * @param userId
- * @param groupId
- * @param fields
- * @throws PhotArkSocialException
- */
-
- void deletePersonData(String userId, String groupId, Set<String> fields) throws PhotArkSocialException;
-
- /**
- * @param userId
- * @param groupId
- * @param values
- * @throws PhotArkSocialException
- */
- void updatePersonData(String userId, String groupId, String appId, Set<String> fields, Map<String, String> values)
- throws PhotArkSocialException;
+ /**
+ * Retrieve person data
+ *
+ * @param userId
+ * ID of the user the data belongs to
+ * @param groupId
+ * optional; ID of the group the data belongs to
+ * @return map of name-value pairs
+ * @throws PhotArkSocialException
+ */
+ @GET
+ @Path("/people/{userId}/appData/{appId}")
+ @Produces(MediaType.APPLICATION_JSON)
+ Map<String, String> getPersonData(@PathParam("userId") String userId,
+ String groupId) throws PhotArkSocialException;
+
+ /**
+ * @param userIds
+ * IDs of the users the data belong to
+ * @param groupId
+ * optional; ID of the group the data belongs to
+ * @return map of name-value pairs for each user
+ * @throws PhotArkSocialException
+ */
+ Map<String, Map<String, String>> getPeopleData(String[] userIds,
+ String groupId) throws PhotArkSocialException;
+
+ /**
+ * @param userId
+ * ID of the user the data belongs to
+ * @param values
+ * map of name-value pairs
+ * @throws PhotArkSocialException
+ */
+ @POST
+ @Path("/people/{userId}/appData/{appId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ void savePersonData(@PathParam("userId") String userId,
+ Map<String, String> values) throws PhotArkSocialException;
+
+ /**
+ * @param userId
+ * @param groupId
+ * @param fields
+ * @throws PhotArkSocialException
+ */
+ @DELETE
+ @Path("/people/{userId}/appdata/{appId}")
+ void deletePersonData(@PathParam("userId") String userId, String groupId,
+ Set<String> fields) throws PhotArkSocialException;
+
+ /**
+ * @param userId
+ * @param groupId
+ * @param values
+ * @throws PhotArkSocialException
+ */
+ @PUT
+ @Path("/people/{userId}/appData/{appId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ void updatePersonData(@PathParam("userId") String userId, String groupId,
+ String appId, Set<String> fields, Map<String, String> values)
+ throws PhotArkSocialException;
}
Modified: incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/PersonService.java
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/PersonService.java?rev=1156812&r1=1156811&r2=1156812&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/PersonService.java (original)
+++ incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/PersonService.java Thu Aug 11 20:34:53 2011
@@ -19,67 +19,112 @@
package org.apache.photark.social.services;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
import org.apache.photark.social.Person;
import org.apache.photark.social.PhotArkSocialException;
+import org.oasisopen.sca.annotation.Remotable;
+@Remotable
public interface PersonService {
- /**
- * Persists the Person data object
- *
- * @param personId ID of the Person data object
- * @param person Person data object
- * @throws PhotArkSocialException
- */
- void savePerson(String personId, Person person) throws PhotArkSocialException;
-
- /**
- * Updates the Person data object with updated fields
- *
- * @param personId ID of the Person data object
- * @param person Person data object with filed to update
- * @throws PhotArkSocialException
- */
-
- void updatePerson(String personId, Person person) throws PhotArkSocialException;
-
- /**
- * Removes a Person data object from persistence
- *
- * @param personId ID of the Person data object to be removed
- * @throws PhotArkSocialException
- */
- void removePerson(String personId) throws PhotArkSocialException;
-
- /**
- * Retrieves the Person data object for the given ID
- *
- * @param personId ID of the Person data object to be retrieved
- * @return the Person data object for the given ID
- * @throws PhotArkSocialException
- */
-
- Person getPerson(String personId) throws PhotArkSocialException;
-
- /**
- * Retrieves the Person data object for the given ID with specified fields
- *
- * @param personId personId ID of the Person data object to be retrieved
- * @param fields the fields of the Person data object to be retrieved
- * @return the Person data object for the given ID with the specified fields
- * @throws PhotArkSocialException
- */
-
- Person getPerson(String personId, String[] fields) throws PhotArkSocialException;
-
- /**
- * Retrieves array of Person data objects for the given person IDs and group
- *
- * @param personIds String array of IDs of the persons
- * @param groupId the ID of the group the persons belongs to; optional
- * @param fields the fields of the Person data object to be retrieved
- * @return an array of Person data objects
- * @throws PhotArkSocialException
- */
- Person[] getPeople(String[] personIds, String groupId, String[] fields) throws PhotArkSocialException;
+ /**
+ * Persists the Person data object
+ *
+ * @param personId
+ * ID of the Person data object
+ * @param person
+ * Person data object
+ * @throws PhotArkSocialException
+ */
+ @POST
+ @Path("/people/{userId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ void savePerson(@PathParam("userId") String personId, Person person)
+ throws PhotArkSocialException;
+
+ /**
+ * Updates the Person data object with updated fields
+ *
+ * @param personId
+ * ID of the Person data object
+ * @param person
+ * Person data object with filed to update
+ * @throws PhotArkSocialException
+ */
+ @PUT
+ @Path("/people/{userId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ void updatePerson(@PathParam("userId") String personId, Person person)
+ throws PhotArkSocialException;
+
+ /**
+ * Removes a Person data object from persistence
+ *
+ * @param personId
+ * ID of the Person data object to be removed
+ * @throws PhotArkSocialException
+ */
+
+ @DELETE
+ @Path("/people/{userId}")
+ void removePerson(@PathParam("userId") String personId)
+ throws PhotArkSocialException;
+
+ /**
+ * Retrieves the Person data object for the given ID
+ *
+ * @param personId
+ * ID of the Person data object to be retrieved
+ * @return the Person data object for the given ID
+ * @throws PhotArkSocialException
+ */
+
+ /*@GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/people/{userId}/@self")
+ Person getPerson(@PathParam("userId") String personId)
+ throws PhotArkSocialException;*/
+
+ /**
+ * Retrieves the Person data object for the given ID with specified fields
+ *
+ * @param personId
+ * personId ID of the Person data object to be retrieved
+ * @param fields
+ * the fields of the Person data object to be retrieved
+ * @return the Person data object for the given ID with the specified fields
+ * @throws PhotArkSocialException
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/people/{userId}/@self")
+ Person getPerson(@PathParam("userId") String personId, String[] fields)
+ throws PhotArkSocialException;
+
+ /**
+ * Retrieves array of Person data objects for the given person IDs and group
+ *
+ * @param personIds
+ * String array of IDs of the persons
+ * @param groupId
+ * the ID of the group the persons belongs to; optional
+ * @param fields
+ * the fields of the Person data object to be retrieved
+ * @return an array of Person data objects
+ * @throws PhotArkSocialException
+ */
+ /*@GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/people/{userId}/@friends")
+ Person[] getPeople(String[] personIds, String groupId, String[] fields)
+ throws PhotArkSocialException;*/
}
Modified: incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/RelationshipService.java
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/RelationshipService.java?rev=1156812&r1=1156811&r2=1156812&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/RelationshipService.java (original)
+++ incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/RelationshipService.java Thu Aug 11 20:34:53 2011
@@ -19,90 +19,135 @@
package org.apache.photark.social.services;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
import org.apache.photark.social.PhotArkSocialException;
+import org.oasisopen.sca.annotation.Remotable;
+@Remotable
public interface RelationshipService {
- public static final String RELATIONSHIP_FRIEND = "friend";
- public static final String RELATIONHIP_FRIEND_REQUEST_PENDING = "friend request pending";
- public static final String RELATIONHIP_FRIEND_REQUEST_RECEIVED = "friend request received";
- public static final String RELATIONHIP_NONE = "none";
-
- /**
- * Returns the relationship status between two users
- *
- * @param veiwer ID of the person who views owner's pages
- * @param owner ID of the person whom the pages/resources belongs to
- * @return one of {RELATIONSHIP_FRIEND,RELATIONHIP_FRIEND_REQUEST_PENDING,
- * RELATIONHIP_FRIEND_REQUEST_RECEIVED ,RELATIONHIP_NONE}
- * @throws PhotArkSocialException
- */
-
- String getRelationshipStatus(String veiwer, String owner) throws PhotArkSocialException;
-
- /**
- * Sends/creates a friend request from viewer to owner
- *
- * @param viewer ID of the person who requests for the relationship
- * @param owner ID of the person for whom viewer sends the relationship
- * request
- * @return true if the request was successful; else false
- * @throws PhotArkSocialException
- */
- boolean requestRelationship(String viewer, String owner) throws PhotArkSocialException;
-
- /**
- * Accepts a relationship request from owner
- *
- * @param viewer ID of the person who has sent the relationship request
- * @param owner ID of the person who has received the relationship request
- * from viewer
- * @return true if a relationship was created between viewer and owner;
- * otherwise false
- * @throws PhotArkSocialException
- */
- boolean acceptRelationshipRequest(String viewer, String owner) throws PhotArkSocialException;
-
- /**
- * Ignores a relationship request
- *
- * @param viewer ID of the person who has sent the relationship request
- * @param owner ID of the person who has received the relationship request
- * from viewer
- * @return true if the operation was successful
- * @throws PhotArkSocialException
- */
- boolean ignoreRelationship(String viewer, String owner) throws PhotArkSocialException;
-
- /**
- * Removing the relationship - i.e: un-friending
- *
- * @param owner ID of the person with whom the viewer wants to remove the
- * relationship
- * @param viewer ID of the person who wants to remove the relationship with
- * owner
- * @return true if the operation was successful
- * @throws PhotArkSocialException
- */
- boolean removeRelationship(String owner, String viewer) throws PhotArkSocialException;
-
- /**
- * Retrieves the list relationships the user has
- *
- * @param loggedUser ID of the user logged in
- * @return array of Strings with the IDs of the persons who has relationship
- * with loggedUser
- * @throws PhotArkSocialException
- */
- String[] getRelationshipList(String loggedUser) throws PhotArkSocialException;
-
- /**
- * Retrieves the list of relationship requests
- *
- * @param owner ID of the person who has received the relationship requests
- * @return array of Strings with the IDs of the persons who has sent
- * relationship requests to the owner
- * @throws PhotArkSocialException
- */
- String[] getPendingRelationshipRequests(String owner) throws PhotArkSocialException;
+ public static final String RELATIONSHIP_FRIEND = "friend";
+ public static final String RELATIONHIP_FRIEND_REQUEST_PENDING = "friend request pending";
+ public static final String RELATIONHIP_FRIEND_REQUEST_RECEIVED = "friend request received";
+ public static final String RELATIONHIP_NONE = "none";
+
+ /**
+ * Returns the relationship status between two users
+ *
+ * @param veiwer
+ * ID of the person who views owner's pages
+ * @param owner
+ * ID of the person whom the pages/resources belongs to
+ * @return one of {RELATIONSHIP_FRIEND,RELATIONHIP_FRIEND_REQUEST_PENDING,
+ * RELATIONHIP_FRIEND_REQUEST_RECEIVED ,RELATIONHIP_NONE}
+ * @throws PhotArkSocialException
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/people/relationship/{ownerId}/{viewerId}")
+ String getRelationshipStatus(@PathParam("viewerId") String veiwer,
+ @PathParam("ownerId") String owner) throws PhotArkSocialException;
+
+ /**
+ * Sends/creates a friend request from viewer to owner
+ *
+ * @param viewer
+ * ID of the person who requests for the relationship
+ * @param owner
+ * ID of the person for whom viewer sends the relationship
+ * request
+ * @return true if the request was successful; else false
+ * @throws PhotArkSocialException
+ */
+ @POST
+ @Path("/people/relationship/{ownerId}/{viewerId}/request")
+ boolean requestRelationship(@PathParam("viewerId") String viewer,
+ @PathParam("ownerId") String owner) throws PhotArkSocialException;
+
+ /**
+ * Accepts a relationship request from owner
+ *
+ * @param viewer
+ * ID of the person who has sent the relationship request
+ * @param owner
+ * ID of the person who has received the relationship request
+ * from viewer
+ * @return true if a relationship was created between viewer and owner;
+ * otherwise false
+ * @throws PhotArkSocialException
+ */
+ @POST
+ @Path("/people/relationship/{ownerId}/{viewerId}/accept")
+ boolean acceptRelationshipRequest(@PathParam("viewerId") String viewer,
+ @PathParam("ownerId") String owner) throws PhotArkSocialException;
+
+ /**
+ * Ignores a relationship request
+ *
+ * @param viewer
+ * ID of the person who has sent the relationship request
+ * @param owner
+ * ID of the person who has received the relationship request
+ * from viewer
+ * @return true if the operation was successful
+ * @throws PhotArkSocialException
+ */
+ @POST
+ @Path("/people/relationship/{ownerId}/{viewerId}/ignore")
+ boolean ignoreRelationship(@PathParam("viewerId") String viewer,
+ @PathParam("ownerId") String owner) throws PhotArkSocialException;
+
+ /**
+ * Removing the relationship - i.e: un-friending
+ *
+ * @param owner
+ * ID of the person with whom the viewer wants to remove the
+ * relationship
+ * @param viewer
+ * ID of the person who wants to remove the relationship with
+ * owner
+ * @return true if the operation was successful
+ * @throws PhotArkSocialException
+ */
+ @DELETE
+ @Path("/people/realtionship/{ownerId}/{viewerId}")
+ boolean removeRelationship(@PathParam("ownerId") String owner,
+ @PathParam("viewerId") String viewer) throws PhotArkSocialException;
+
+ /**
+ * Retrieves the list relationships the user has
+ *
+ * @param loggedUser
+ * ID of the user logged in
+ * @return array of Strings with the IDs of the persons who has relationship
+ * with loggedUser
+ * @throws PhotArkSocialException
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/people/relationship/{ownerId}/list")
+ String[] getRelationshipList(@PathParam("ownerId") String loggedUser)
+ throws PhotArkSocialException;
+
+ /**
+ * Retrieves the list of relationship requests
+ *
+ * @param owner
+ * ID of the person who has received the relationship requests
+ * @return array of Strings with the IDs of the persons who has sent
+ * relationship requests to the owner
+ * @throws PhotArkSocialException
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("/people/relationship/{ownerId}/pending")
+ String[] getPendingRelationshipRequests(@PathParam("ownerId") String owner)
+ throws PhotArkSocialException;
}
Modified: incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRActivityServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRActivityServiceImpl.java?rev=1156812&r1=1156811&r2=1156812&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRActivityServiceImpl.java (original)
+++ incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRActivityServiceImpl.java Thu Aug 11 20:34:53 2011
@@ -41,7 +41,10 @@ import org.apache.photark.social.PhotArk
import org.apache.photark.social.services.ActivityService;
import org.apache.photark.social.util.FilterOptions;
import org.apache.photark.social.util.PhotArkSocialUtil;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+@Scope("COMPOSITE")
public class JCRActivityServiceImpl implements ActivityService {
private JCRRepositoryManager repositoryManager;
private static final Logger logger = Logger.getLogger(JCRActivityServiceImpl.class.getName());
@@ -52,13 +55,13 @@ public class JCRActivityServiceImpl impl
repositoryManager = new JCRRepositoryManager();
}
- public JCRActivityServiceImpl(JCRRepositoryManager repositoryManager) {
+ public JCRActivityServiceImpl(@Reference(name="repositoryManager") JCRRepositoryManager repositoryManager) {
this.repositoryManager = repositoryManager;
}
public Activity createActivity(String userId, String groupId, Set<String> fields) throws PhotArkSocialException {
// TODO Auto-generated method stub
- return null;
+ return null;
}
public void saveActivity(String userId, Activity activity) throws PhotArkSocialException {
Modified: incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRAppDataServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRAppDataServiceImpl.java?rev=1156812&r1=1156811&r2=1156812&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRAppDataServiceImpl.java (original)
+++ incubator/photark/branches/photark-rest/photark-social/src/main/java/org/apache/photark/social/services/impl/JCRAppDataServiceImpl.java Thu Aug 11 20:34:53 2011
@@ -37,170 +37,181 @@ import org.apache.photark.services.jcr.J
import org.apache.photark.social.PhotArkSocialException;
import org.apache.photark.social.services.AppDataService;
import org.apache.photark.social.util.PhotArkSocialUtil;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+@Scope("COMPOSITE")
public class JCRAppDataServiceImpl implements AppDataService {
- private JCRRepositoryManager repositoryManager;
- private static final Logger logger = Logger.getLogger(JCRAppDataServiceImpl.class.getName());
- private static final String JCR_APPDATA_ROOT_NODE = "appdata";
-
- public JCRAppDataServiceImpl(JCRRepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
- }
-
- public JCRAppDataServiceImpl() {
-
- }
-
- public Map<String, String> getPersonData(String userId, String groupId) throws PhotArkSocialException {
- Map<String, String> personDataMap = new HashMap<String, String>();
- Node appDataRootNode = null;
- appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
-
- try {
- PropertyIterator props = appDataRootNode.getProperties();
- Property prop = props.nextProperty();
- while (props.hasNext()) {
- personDataMap.put(prop.getName(), prop.getValue().getString());
- prop = props.nextProperty();
- }
- } catch (RepositoryException e) {
- logger.log(Level.SEVERE, "Error retrieving app data for user ID: " + userId
- + " to photark repository: "
- + e.getMessage(), e);
- throw new PhotArkSocialException("Error retrieving app data for user ID: " + userId
- + " to photark repository: "
- + e.getMessage(), e);
-
- }
- return personDataMap;
- }
-
- public Map<String, Map<String, String>> getPeopleData(String[] userIds, String groupId)
- throws PhotArkSocialException {
- Map<String, Map<String, String>> peopleDataMap = new HashMap<String, Map<String, String>>();
- for (String userId : userIds) {
- peopleDataMap.put(userId, getPersonData(userId, null));
- }
- return peopleDataMap;
-
- }
-
- public void savePersonData(String userId, Map<String, String> values) throws PhotArkSocialException {
- if (values == null) {
- throw new PhotArkSocialException("Unable to save appdata. Given appdata map is null");
- }
- Node appDataRootNode = null;
- appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
-
- try {
- for (String key : values.keySet()) {
- appDataRootNode.setProperty(key, values.get(key));
- }
- repositoryManager.getSession().save();
- } catch (RepositoryException e) {
- logger.log(Level.SEVERE,
- "Error saving app data for user ID: " + userId + " to photark repository: " + e.getMessage(),
- e);
- throw new PhotArkSocialException("Error saving app data for user ID: " + userId
- + " to photark repository: "
- + e.getMessage(), e);
-
- }
-
- }
-
- public void deletePersonData(String userId, String groupId, Set<String> fields) throws PhotArkSocialException {
- Node appDataRootNode = null;
- appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
-
- try {
- for (String key : fields) {
- if (appDataRootNode.hasProperty(key)) {
- // deletes only if the key already exists
- // sets the property value to null, to remove the property
- appDataRootNode.setProperty(key, (String)null);
- }
- }
- repositoryManager.getSession().save();
- } catch (RepositoryException e) {
- logger.log(Level.SEVERE,
- "Error removing app data for user ID: " + userId + " to photark repository: " + e.getMessage(),
- e);
- throw new PhotArkSocialException("Error removing app data for user ID: " + userId
- + " to photark repository: "
- + e.getMessage(), e);
-
- }
- }
-
- public void updatePersonData(String userId,
- String groupId,
- String appId,
- Set<String> fields,
- Map<String, String> values) throws PhotArkSocialException {
- Node appDataRootNode = null;
- appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
-
- try {
- for (String key : fields) {
- if (appDataRootNode.hasProperty(key)) {
- // updates only if the key already exists
- appDataRootNode.setProperty(key, values.get(key));
- }
- }
- repositoryManager.getSession().save();
- } catch (RepositoryException e) {
- logger.log(Level.SEVERE,
- "Error updating app data for user ID: " + userId + " to photark repository: " + e.getMessage(),
- e);
- throw new PhotArkSocialException("Error updating app data for user ID: " + userId
- + " to photark repository: "
- + e.getMessage(), e);
-
- }
-
- }
-
- /**
- * Retrieves the "appdata" node for the given user
- *
- * @param repositoryManager JCRRepositoryManager object
- * @param username UserId of the Person to whom the apdpata belongs to
- * @param create If true, creates the node when it doesn't exist; If false,
- * return null if the node doesn't exist
- * @return the root node of "appdata" for given user
- * @throws PhotarkRuntimeException
- */
-
- private Node getAppDataRootNode(JCRRepositoryManager repositoryManager, String username, boolean create)
- throws PhotarkRuntimeException {
- Session session = null;
- Node personRootNode = null;
- Node appDataRootNode = null;
- try {
- session = repositoryManager.getSession();
- personRootNode = PhotArkSocialUtil.getPersonRootNode(repositoryManager, username, create);
- if (personRootNode.hasNode(JCR_APPDATA_ROOT_NODE)) {
- appDataRootNode = personRootNode.getNode(JCR_APPDATA_ROOT_NODE);
- } else {
- if (create) {
- appDataRootNode = personRootNode.addNode(JCR_APPDATA_ROOT_NODE);
- session.save();
- }
- }
- } catch (LoginException e) {
- logger.log(Level.SEVERE, "Error loging in to photark repository :" + e.getMessage(), e);
- throw new PhotarkRuntimeException("Error loging in to photark repository :" + e.getMessage(), e);
- } catch (RepositoryException e) {
- logger.log(Level.SEVERE, "Error retrieving appdata root node for user: " + username
- + " from the repository :"
- + e.getMessage(), e);
- throw new PhotarkRuntimeException("Error retrieving appdata root node for user: " + username
- + " from the repository :"
- + e.getMessage(), e);
- }
+ private JCRRepositoryManager repositoryManager;
+ private static final Logger logger = Logger
+ .getLogger(JCRAppDataServiceImpl.class.getName());
+ private static final String JCR_APPDATA_ROOT_NODE = "appdata";
+
+ public JCRAppDataServiceImpl(
+ @Reference(name = "repositoryManager") JCRRepositoryManager repositoryManager) {
+ this.repositoryManager = repositoryManager;
+ }
+
+ public JCRAppDataServiceImpl() {
+
+ }
+
+ public Map<String, String> getPersonData(String userId, String groupId)
+ throws PhotArkSocialException {
+ Map<String, String> personDataMap = new HashMap<String, String>();
+ Node appDataRootNode = null;
+ appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
+
+ try {
+ PropertyIterator props = appDataRootNode.getProperties();
+ Property prop = props.nextProperty();
+ while (props.hasNext()) {
+ personDataMap.put(prop.getName(), prop.getValue().getString());
+ prop = props.nextProperty();
+ }
+ } catch (RepositoryException e) {
+ logger.log(Level.SEVERE, "Error retrieving app data for user ID: "
+ + userId + " to photark repository: " + e.getMessage(), e);
+ throw new PhotArkSocialException(
+ "Error retrieving app data for user ID: " + userId
+ + " to photark repository: " + e.getMessage(), e);
+
+ }
+ return personDataMap;
+ }
+
+ public Map<String, Map<String, String>> getPeopleData(String[] userIds,
+ String groupId) throws PhotArkSocialException {
+ Map<String, Map<String, String>> peopleDataMap = new HashMap<String, Map<String, String>>();
+ for (String userId : userIds) {
+ peopleDataMap.put(userId, getPersonData(userId, null));
+ }
+ return peopleDataMap;
+
+ }
+
+ public void savePersonData(String userId, Map<String, String> values)
+ throws PhotArkSocialException {
+ if (values == null) {
+ throw new PhotArkSocialException(
+ "Unable to save appdata. Given appdata map is null");
+ }
+ Node appDataRootNode = null;
+ appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
+
+ try {
+ for (String key : values.keySet()) {
+ appDataRootNode.setProperty(key, values.get(key));
+ }
+ repositoryManager.getSession().save();
+ } catch (RepositoryException e) {
+ logger.log(Level.SEVERE, "Error saving app data for user ID: "
+ + userId + " to photark repository: " + e.getMessage(), e);
+ throw new PhotArkSocialException(
+ "Error saving app data for user ID: " + userId
+ + " to photark repository: " + e.getMessage(), e);
+
+ }
+
+ }
+
+ public void deletePersonData(String userId, String groupId,
+ Set<String> fields) throws PhotArkSocialException {
+ Node appDataRootNode = null;
+ appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
+
+ try {
+ for (String key : fields) {
+ if (appDataRootNode.hasProperty(key)) {
+ // deletes only if the key already exists
+ // sets the property value to null, to remove the property
+ appDataRootNode.setProperty(key, (String) null);
+ }
+ }
+ repositoryManager.getSession().save();
+ } catch (RepositoryException e) {
+ logger.log(Level.SEVERE, "Error removing app data for user ID: "
+ + userId + " to photark repository: " + e.getMessage(), e);
+ throw new PhotArkSocialException(
+ "Error removing app data for user ID: " + userId
+ + " to photark repository: " + e.getMessage(), e);
+
+ }
+ }
+
+ public void updatePersonData(String userId, String groupId, String appId,
+ Set<String> fields, Map<String, String> values)
+ throws PhotArkSocialException {
+ Node appDataRootNode = null;
+ appDataRootNode = getAppDataRootNode(repositoryManager, userId, true);
+
+ try {
+ for (String key : fields) {
+ if (appDataRootNode.hasProperty(key)) {
+ // updates only if the key already exists
+ appDataRootNode.setProperty(key, values.get(key));
+ }
+ }
+ repositoryManager.getSession().save();
+ } catch (RepositoryException e) {
+ logger.log(Level.SEVERE, "Error updating app data for user ID: "
+ + userId + " to photark repository: " + e.getMessage(), e);
+ throw new PhotArkSocialException(
+ "Error updating app data for user ID: " + userId
+ + " to photark repository: " + e.getMessage(), e);
+
+ }
+
+ }
+
+ /**
+ * Retrieves the "appdata" node for the given user
+ *
+ * @param repositoryManager
+ * JCRRepositoryManager object
+ * @param username
+ * UserId of the Person to whom the apdpata belongs to
+ * @param create
+ * If true, creates the node when it doesn't exist; If false,
+ * return null if the node doesn't exist
+ * @return the root node of "appdata" for given user
+ * @throws PhotarkRuntimeException
+ */
+
+ private Node getAppDataRootNode(JCRRepositoryManager repositoryManager,
+ String username, boolean create) throws PhotarkRuntimeException {
+ Session session = null;
+ Node personRootNode = null;
+ Node appDataRootNode = null;
+ try {
+ session = repositoryManager.getSession();
+ personRootNode = PhotArkSocialUtil.getPersonRootNode(
+ repositoryManager, username, create);
+ if (personRootNode.hasNode(JCR_APPDATA_ROOT_NODE)) {
+ appDataRootNode = personRootNode.getNode(JCR_APPDATA_ROOT_NODE);
+ } else {
+ if (create) {
+ appDataRootNode = personRootNode
+ .addNode(JCR_APPDATA_ROOT_NODE);
+ session.save();
+ }
+ }
+ } catch (LoginException e) {
+ logger.log(Level.SEVERE, "Error loging in to photark repository :"
+ + e.getMessage(), e);
+ throw new PhotarkRuntimeException(
+ "Error loging in to photark repository :" + e.getMessage(),
+ e);
+ } catch (RepositoryException e) {
+ logger.log(Level.SEVERE,
+ "Error retrieving appdata root node for user: " + username
+ + " from the repository :" + e.getMessage(), e);
+ throw new PhotarkRuntimeException(
+ "Error retrieving appdata root node for user: " + username
+ + " from the repository :" + e.getMessage(), e);
+ }
- return appDataRootNode;
- }
+ return appDataRootNode;
+ }
}