You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2016/03/28 14:57:30 UTC
svn commit: r1736884 [1/2] - in /sling/trunk/samples/slingshot: ./
src/main/java/org/apache/sling/sample/slingshot/
src/main/java/org/apache/sling/sample/slingshot/comments/
src/main/java/org/apache/sling/sample/slingshot/comments/impl/
src/main/java/o...
Author: cziegeler
Date: Mon Mar 28 12:57:29 2016
New Revision: 1736884
URL: http://svn.apache.org/viewvc?rev=1736884&view=rev
Log:
Update content model
Added:
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/Stream.java (with props)
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java (with props)
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamInfo.java (with props)
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/User.java
- copied, changed from r1736875, sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/User.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/UserInfo.java
- copied, changed from r1736875, sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/UserInfo.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/package-info.java (with props)
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/menu.html.jsp
- copied, changed from r1736875, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/trail.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/
- copied from r1736883, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Category/
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream.json
- copied unchanged from r1736167, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Category.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/
- copied from r1736883, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Item/
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry.json
- copied unchanged from r1736875, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Item.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/stream.html.jsp
- copied unchanged from r1736875, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Item/main.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/settings.json
- copied, changed from r1736875, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/profile.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/info.json (with props)
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/info.json (with props)
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/info.json (with props)
Removed:
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/StreamInfo.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/User.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/UserInfo.java
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Category/
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Category.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/trail.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Content/
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Content.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Item/
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Item.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/main.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/docs/content-model2.html
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/profile.json
Modified:
sling/trunk/samples/slingshot/pom.xml
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotConstants.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotUtil.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/CommentsService.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentsServiceImpl.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/package-info.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/impl/SetupService.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/package-info.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/RatingsService.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingPostServlet.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingsServiceImpl.java
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/package-info.java
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/itemlist.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/user.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/itemlist.html.jsp
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/docs/content-model.html
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/info.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/home.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/pet.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/sea.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/view.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/strange.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/underwater.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/welcome.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/flight.json
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/landing.json
sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/SlingshotUtilTest.java
sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/impl/SetupServiceTest.java
sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/ratings/impl/RatingPostServletTest.java
sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/ratings/impl/RatingServiceImplTest.java
sling/trunk/samples/slingshot/src/test/resources/slingshot.json
Modified: sling/trunk/samples/slingshot/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/pom.xml?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/pom.xml (original)
+++ sling/trunk/samples/slingshot/pom.xml Mon Mar 28 12:57:29 2016
@@ -42,11 +42,6 @@
<build>
<plugins>
- <!-- Generation of SCR descriptors -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
<!-- Bundling the sample project -->
<plugin>
<groupId>org.apache.felix</groupId>
@@ -131,6 +126,18 @@
</profiles>
<dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.annotation</artifactId>
+ <version>6.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ <version>1.3.0</version>
+ <scope>provided</scope>
+ </dependency>
<!-- Put sling-mock-oak dependency to top to get latest jcr-resource dependencies for running it -->
<dependency>
@@ -202,13 +209,13 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.osgi-mock</artifactId>
- <version>1.6.0</version>
+ <version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock</artifactId>
- <version>1.6.0</version>
+ <version>1.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotConstants.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotConstants.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotConstants.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotConstants.java Mon Mar 28 12:57:29 2016
@@ -22,18 +22,6 @@ public abstract class SlingshotConstants
/** This is the resource path for the root of our application. */
public static final String APP_ROOT_PATH = "/slingshot";
- /** The resource type for a user. */
- public static final String RESOURCETYPE_USER = "slingshot/User";
-
- /** The resource type for the content. */
- public static final String RESOURCETYPE_CONTENT = "slingshot/Content";
-
- /** The resource type for a category. */
- public static final String RESOURCETYPE_CATEGORY = "slingshot/Category";
-
- /** The resource type for an item. */
- public static final String RESOURCETYPE_ITEM = "slingshot/Item";
-
public static final String PROPERTY_TITLE = "title";
public static final String PROPERTY_DESCRIPTION = "description";
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotUtil.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotUtil.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/SlingshotUtil.java Mon Mar 28 12:57:29 2016
@@ -16,6 +16,7 @@
*/
package org.apache.sling.sample.slingshot;
+import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
public abstract class SlingshotUtil {
@@ -39,9 +40,18 @@ public abstract class SlingshotUtil {
}
public static String getContentPath(final Resource resource) {
+ final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/";
+
final String path = resource.getPath();
- final int i = path.indexOf("/content/");
+ if ( path != null && path.startsWith(prefix) ) {
+ return path.substring(prefix.length() - 1);
+ }
+ return null;
+ }
- return (i == -1 ? null : path.substring(i + 8));
+ public static boolean isUser(final SlingHttpServletRequest request) {
+ final boolean isUser = request.getRemoteUser() != null && !request.getRemoteUser().equals("anonymous");
+ return isUser;
}
+
}
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/CommentsService.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/CommentsService.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/CommentsService.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/CommentsService.java Mon Mar 28 12:57:29 2016
@@ -26,7 +26,7 @@ public interface CommentsService {
/**
* Return the path to the comments resource for a resource.
- * @param resource The content resource, this is usually an item.
+ * @param resource The content resource, this is usually an entry.
* @return The path to the comments resource or {@code null} if
* the passed in content resource is not part of
* Slingshot.
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentPostServlet.java Mon Mar 28 12:57:29 2016
@@ -18,10 +18,9 @@ package org.apache.sling.sample.slingsho
import java.io.IOException;
+import javax.servlet.Servlet;
import javax.servlet.ServletException;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.LoginException;
@@ -29,14 +28,21 @@ import org.apache.sling.api.resource.Res
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.sample.slingshot.SlingshotConstants;
import org.apache.sling.sample.slingshot.comments.Comment;
import org.apache.sling.sample.slingshot.comments.CommentsService;
import org.apache.sling.sample.slingshot.comments.CommentsUtil;
+import org.apache.sling.sample.slingshot.model.StreamEntry;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@SlingServlet(methods="POST", extensions="comments", resourceTypes=SlingshotConstants.RESOURCETYPE_ITEM)
+@Component(service = Servlet.class,
+ property={
+ "sling.servlet.methods=POST",
+ "sling.servlet.extensions=comments",
+ "sling.servlet.resourceTypes=" + StreamEntry.RESOURCETYPE
+ })
public class CommentPostServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = 1L;
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentsServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentsServiceImpl.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentsServiceImpl.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/impl/CommentsServiceImpl.java Mon Mar 28 12:57:29 2016
@@ -22,8 +22,6 @@ import java.util.Map;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
@@ -34,14 +32,14 @@ import org.apache.sling.sample.slingshot
import org.apache.sling.sample.slingshot.comments.CommentsService;
import org.apache.sling.sample.slingshot.comments.CommentsUtil;
import org.apache.sling.sample.slingshot.impl.Util;
+import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Implementation of the comments service
*/
-@Component
-@Service(value=CommentsService.class)
+@Component(service = CommentsService.class)
public class CommentsServiceImpl implements CommentsService {
/** The resource type for the comments holder. */
@@ -52,6 +50,7 @@ public class CommentsServiceImpl impleme
/**
* @see org.apache.sling.sample.slingshot.comments.CommentsService#getCommentsResourcePath(org.apache.sling.api.resource.Resource)
*/
+ @Override
public String getCommentsResourcePath(final Resource resource) {
final String contentPath = SlingshotUtil.getContentPath(resource);
if ( contentPath != null ) {
@@ -66,6 +65,7 @@ public class CommentsServiceImpl impleme
/**
* @see org.apache.sling.sample.slingshot.comments.CommentsService#addComment(org.apache.sling.api.resource.Resource, org.apache.sling.sample.slingshot.comments.Comment)
*/
+ @Override
public void addComment(final Resource resource, final Comment c)
throws PersistenceException {
final String commentsPath = this.getCommentsResourcePath(resource);
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/package-info.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/package-info.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/package-info.java Mon Mar 28 12:57:29 2016
@@ -16,9 +16,5 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-@Version("1.0")
+@org.osgi.annotation.versioning.Version("1.0")
package org.apache.sling.sample.slingshot.comments;
-
-import aQute.bnd.annotation.Version;
-
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/impl/SetupService.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/impl/SetupService.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/impl/SetupService.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/impl/SetupService.java Mon Mar 28 12:57:29 2016
@@ -27,9 +27,6 @@ import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.security.Privilege;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
import org.apache.jackrabbit.api.security.principal.PrincipalManager;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.UserManager;
@@ -41,10 +38,14 @@ import org.apache.sling.api.resource.Res
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.jcr.base.util.AccessControlUtil;
import org.apache.sling.sample.slingshot.SlingshotConstants;
+import org.apache.sling.sample.slingshot.model.User;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,9 +66,8 @@ public class SetupService {
private static final String[] USERS = new String[] {"slingshot1", "slingshot2"};
private static final String[] FOLDERS = new String[] {
- "content:" + SlingshotConstants.RESOURCETYPE_CONTENT,
"info",
- "profile",
+ "settings",
"ugc"};
@Activate
@@ -189,7 +189,7 @@ public class SetupService {
Resource homeResource = resolver.getResource(usersResource, userName);
if ( homeResource == null ) {
final Map<String, Object> props = new HashMap<String, Object>();
- props.put(ResourceResolver.PROPERTY_RESOURCE_TYPE, SlingshotConstants.RESOURCETYPE_USER);
+ props.put(ResourceResolver.PROPERTY_RESOURCE_TYPE, User.RESOURCETYPE);
homeResource = resolver.create(usersResource, userName, props);
resolver.commit();
}
Added: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/Stream.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/Stream.java?rev=1736884&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/Stream.java (added)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/Stream.java Mon Mar 28 12:57:29 2016
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package org.apache.sling.sample.slingshot.model;
+
+import org.apache.sling.api.resource.Resource;
+
+public class Stream {
+
+ /** The resource type for a stream. */
+ public static final String RESOURCETYPE = "slingshot/Stream";
+
+ private final Resource resource;
+
+ private volatile StreamInfo info;
+
+ public Stream(final Resource resource) {
+ this.resource = resource;
+ }
+
+ public StreamInfo getInfo() {
+ if ( info == null ) {
+ info = new StreamInfo(this.resource.getChild("info"));
+ }
+ return info;
+ }
+}
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/Stream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/Stream.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Added: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java?rev=1736884&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java (added)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java Mon Mar 28 12:57:29 2016
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+package org.apache.sling.sample.slingshot.model;
+
+import org.apache.sling.api.resource.Resource;
+
+public class StreamEntry {
+
+ /** The resource type for a stream entry. */
+ public static final String RESOURCETYPE = "slingshot/Streamentry";
+
+ private final Resource resource;
+
+ public StreamEntry(final Resource resource) {
+ this.resource = resource;
+ }
+}
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Added: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamInfo.java?rev=1736884&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamInfo.java (added)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamInfo.java Mon Mar 28 12:57:29 2016
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+package org.apache.sling.sample.slingshot.model;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ValueMap;
+
+public class StreamInfo {
+
+ /** The resource type for a stream info. */
+ public static final String RESOURCETYPE = "slingshot/Streaminfo";
+
+ public static final String PROPERTY_TITLE = "title";
+
+ public static final String PROPERTY_DESCRIPTION = "description";
+
+ public static final String PATH_PHOTO = "photo";
+
+ private final Resource resource;
+
+ private volatile ValueMap properties;
+
+ private volatile long entryCount = -1;
+
+ public StreamInfo(final Resource resource) {
+ this.resource = resource;
+ }
+
+ private ValueMap getProperties() {
+ if ( this.properties == null ) {
+ this.properties = resource.getValueMap();
+ }
+ return this.properties;
+ }
+
+ public String getTitle() {
+ String value = this.getProperties().get(PROPERTY_TITLE, String.class);
+ if ( value == null ) {
+ if ( resource != null ) {
+ value = resource.getParent().getName();
+ } else {
+ value = "No Title";
+ }
+ }
+ return value;
+ }
+
+ public String getDescription() {
+ final String value = this.getProperties().get(PROPERTY_DESCRIPTION, "");
+ return value;
+ }
+
+ public long getEntryCount() {
+ if ( entryCount == -1 ) {
+ entryCount = 0;
+ if ( this.resource != null ) {
+ for(final Resource rsrc : this.resource.getParent().getChildren()) {
+ if ( rsrc.isResourceType(StreamEntry.RESOURCETYPE) ) {
+ entryCount++;
+ }
+ }
+ }
+ }
+ return entryCount;
+ }
+}
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamInfo.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Copied: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/User.java (from r1736875, sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/User.java)
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/User.java?p2=sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/User.java&p1=sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/User.java&r1=1736875&r2=1736884&rev=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/User.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/User.java Mon Mar 28 12:57:29 2016
@@ -14,12 +14,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.sample.slingshot;
+package org.apache.sling.sample.slingshot.model;
+import org.apache.sling.api.resource.Resource;
-public abstract class User {
+public class User {
/** The resource type for a user. */
public static final String RESOURCETYPE = "slingshot/User";
+ private final Resource resource;
+
+ private volatile UserInfo info;
+
+ public User(final Resource resource) {
+ this.resource = resource;
+ }
+
+ public UserInfo getInfo() {
+ if ( info == null ) {
+ info = new UserInfo(this.resource.getChild("info"));
+ }
+ return info;
+ }
}
Copied: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/UserInfo.java (from r1736875, sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/UserInfo.java)
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/UserInfo.java?p2=sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/UserInfo.java&p1=sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/UserInfo.java&r1=1736875&r2=1736884&rev=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/UserInfo.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/UserInfo.java Mon Mar 28 12:57:29 2016
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.sample.slingshot;
+package org.apache.sling.sample.slingshot.model;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ValueMap;
-public abstract class UserInfo {
+public class UserInfo {
/** The resource type for a user info. */
public static final String RESOURCETYPE = "slingshot/Userinfo";
@@ -27,4 +29,36 @@ public abstract class UserInfo {
public static final String PROPERTY_ABOUT = "about";
public static final String PATH_PHOTO = "photo";
+
+ private final Resource resource;
+
+ private volatile ValueMap properties;
+
+ public UserInfo(final Resource resource) {
+ this.resource = resource;
+ }
+
+ private ValueMap getProperties() {
+ if ( this.properties == null ) {
+ this.properties = resource.getValueMap();
+ }
+ return this.properties;
+ }
+
+ public String getName() {
+ String value = this.getProperties().get(PROPERTY_NAME, String.class);
+ if ( value == null ) {
+ if ( resource != null ) {
+ value = resource.getParent().getName();
+ } else {
+ value = "No Title";
+ }
+ }
+ return value;
+ }
+
+ public String getAbout() {
+ final String value = this.getProperties().get(PROPERTY_ABOUT, "About...");
+ return value;
+ }
}
Added: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/package-info.java?rev=1736884&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/package-info.java (added)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/package-info.java Mon Mar 28 12:57:29 2016
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+@org.osgi.annotation.versioning.Version("1.0")
+package org.apache.sling.sample.slingshot.model;
+
+
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/package-info.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/package-info.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/package-info.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/package-info.java Mon Mar 28 12:57:29 2016
@@ -16,9 +16,5 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-@Version("1.0")
+@org.osgi.annotation.versioning.Version("1.0")
package org.apache.sling.sample.slingshot;
-
-import aQute.bnd.annotation.Version;
-
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/RatingsService.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/RatingsService.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/RatingsService.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/RatingsService.java Mon Mar 28 12:57:29 2016
@@ -26,7 +26,7 @@ public interface RatingsService {
/**
* Return the path to the ratings resource for a resource.
- * @param resource The content resource, this is usually an item.
+ * @param resource The content resource, this is usually an entry.
* @return The path to the ratings resource or {@code null} if
* the passed in content resource is not part of
* Slingshot.
@@ -36,7 +36,7 @@ public interface RatingsService {
/**
* Get the overall rating for a resource.
- * @param resource The content resource, this is usually an item.
+ * @param resource The content resource, this is usually an entry.
* @return The rating or {@code 0} if
* the passed in content resource is not part of
* Slingshot.
@@ -45,7 +45,7 @@ public interface RatingsService {
/**
* Get the rating of a user for a resource.
- * @param resource The content resource, this is usually an item.
+ * @param resource The content resource, this is usually an entry.
* @param userId The user id
* @return The rating or {@code 0} if
* the passed in content resource is not part of
@@ -55,7 +55,7 @@ public interface RatingsService {
/**
* Set the rating of a user for a resource.
- * @param resource The content resource, this is usually an item.
+ * @param resource The content resource, this is usually an entry.
* @param userId The user id
* @return The rating or {@code 0} if
* the passed in content resource is not part of
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingPostServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingPostServlet.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingPostServlet.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingPostServlet.java Mon Mar 28 12:57:29 2016
@@ -19,10 +19,9 @@ package org.apache.sling.sample.slingsho
import java.io.IOException;
import java.io.PrintWriter;
+import javax.servlet.Servlet;
import javax.servlet.ServletException;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.LoginException;
@@ -30,17 +29,24 @@ import org.apache.sling.api.resource.Res
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.sample.slingshot.SlingshotConstants;
+import org.apache.sling.sample.slingshot.model.StreamEntry;
import org.apache.sling.sample.slingshot.ratings.RatingsService;
import org.apache.sling.sample.slingshot.ratings.RatingsUtil;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * The ratings post servlet is registered for a POST to an item with
+ * The ratings post servlet is registered for a POST to an entry with
* the selector "rating".
*/
-@SlingServlet(methods="POST", extensions="ratings", resourceTypes=SlingshotConstants.RESOURCETYPE_ITEM)
+@Component(service = Servlet.class,
+property={
+ "sling.servlet.methods=POST",
+ "sling.servlet.extensions=ratings",
+ "sling.servlet.resourceTypes=" + StreamEntry.RESOURCETYPE
+})
public class RatingPostServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = 1L;
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingsServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingsServiceImpl.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingsServiceImpl.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/impl/RatingsServiceImpl.java Mon Mar 28 12:57:29 2016
@@ -19,8 +19,6 @@ package org.apache.sling.sample.slingsho
import java.util.HashMap;
import java.util.Map;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.resource.ModifiableValueMap;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
@@ -31,12 +29,12 @@ import org.apache.sling.sample.slingshot
import org.apache.sling.sample.slingshot.SlingshotUtil;
import org.apache.sling.sample.slingshot.ratings.RatingsService;
import org.apache.sling.sample.slingshot.ratings.RatingsUtil;
+import org.osgi.service.component.annotations.Component;
/**
* Implementation of the ratings service
*/
-@Component
-@Service(value=RatingsService.class)
+@Component(service=RatingsService.class)
public class RatingsServiceImpl implements RatingsService {
/** The resource type for the rating holder. */
Modified: sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/package-info.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/package-info.java (original)
+++ sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/ratings/package-info.java Mon Mar 28 12:57:29 2016
@@ -16,9 +16,5 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-@Version("1.0")
+@org.osgi.annotation.versioning.Version("1.0")
package org.apache.sling.sample.slingshot.ratings;
-
-import aQute.bnd.annotation.Version;
-
Copied: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/menu.html.jsp (from r1736875, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/trail.html.jsp)
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/menu.html.jsp?p2=sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/menu.html.jsp&p1=sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/trail.html.jsp&r1=1736875&r2=1736884&rev=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/trail.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Component/menu.html.jsp Mon Mar 28 12:57:29 2016
@@ -26,29 +26,6 @@
org.apache.sling.api.request.ResponseUtil" %><%
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
%><sling:defineObjects/><%
- final boolean isUser = request.getRemoteUser() != null && !request.getRemoteUser().equals("anonymous");
-
- final ValueMap attributes = resource.getValueMap();
- // let's create the trail
- final List<Object[]> parents = new ArrayList<Object[]>();
- if ( resource.getPath().startsWith(SlingshotConstants.APP_ROOT_PATH) && !resource.isResourceType(SlingshotConstants.RESOURCETYPE_USER)) {
- Resource parent = resource.getParent();
- String prefix = "../";
- boolean continueProcessing = true;
- do {
- if ( !parent.isResourceType(SlingshotConstants.RESOURCETYPE_CONTENT) ) {
- final ValueMap parentAttr = parent.getValueMap();
- final String parentName = parent.getName();
- parents.add(new Object[] {prefix + parentName, ResponseUtil.escapeXml(parentAttr.get(SlingshotConstants.PROPERTY_TITLE, parentName))});
- }
- if ( parent.isResourceType(SlingshotConstants.RESOURCETYPE_USER) ) {
- continueProcessing = false;
- } else {
- parent = parent.getParent();
- prefix = prefix + "../";
- }
- } while ( continueProcessing);
- }
%><nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
@@ -61,16 +38,11 @@
<a class="navbar-brand" href="#">Slingshot</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
- <ul class="nav navbar-nav"><%
- for(int k=parents.size()-1;k>=0;k--) {
- %>
- <li><a href="<%= parents.get(k)[0] %>.html"><%= parents.get(k)[1] %></a></li>
- <%
- }
- %>
+ <ul class="nav navbar-nav">
+ <li><a href="timelinenotimplemented.html">Timeline</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
- <% if ( isUser ) {
+ <% if ( SlingshotUtil.isUser(slingRequest) ) {
%>
<li><a href="<%= request.getContextPath() %><%= SlingshotConstants.APP_ROOT_PATH %>/users/<%= request.getRemoteUser() %>.html"><span class="glyphicon glyphicon-home" aria-hidden="true"></span></a></li>
<li><a href="<%= request.getContextPath() %><%= SlingshotConstants.APP_ROOT_PATH %>/users/<%= request.getRemoteUser() %>.html"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></a></li>
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/html.jsp?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/html.jsp Mon Mar 28 12:57:29 2016
@@ -19,23 +19,22 @@
%><%@page import="org.apache.sling.api.resource.ResourceUtil,
org.apache.sling.api.resource.ValueMap,
org.apache.sling.api.request.ResponseUtil,
- org.apache.sling.sample.slingshot.SlingshotConstants" %><%
+ org.apache.sling.sample.slingshot.model.Stream" %><%
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
%><sling:defineObjects/><%
- final ValueMap attributes = resource.getValueMap();
- final String title = ResponseUtil.escapeXml(attributes.get(SlingshotConstants.PROPERTY_TITLE, resource.getName()));
+ final Stream stream = new Stream(resource);
%><html>
<head>
- <title><%= title %></title>
+ <title><%= ResponseUtil.escapeXml(stream.getInfo().getTitle()) %></title>
<sling:include resource="<%= resource %>" replaceSelectors="head"/>
</head>
<body>
- <sling:include resource="<%= resource %>" replaceSelectors="trail"/>
+ <sling:include resource="<%= resource %>" replaceSelectors="menu"/>
<div class="jumbotron">
<div class="container">
- <h1><%= title %></h1>
- <p>Explore the world of bla....</p>
+ <h1><%= ResponseUtil.escapeXml(stream.getInfo().getTitle()) %></h1>
+ <p><%= ResponseUtil.escapeXml(stream.getInfo().getDescription()) %></p>
</div>
</div>
<sling:include resource="<%= resource %>" replaceSelectors="itemlist"/>
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/itemlist.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/itemlist.html.jsp?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/itemlist.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/itemlist.html.jsp Mon Mar 28 12:57:29 2016
@@ -19,7 +19,7 @@
%><%@page import="java.util.Iterator,
java.util.List,
org.apache.sling.api.resource.Resource,
- org.apache.sling.sample.slingshot.SlingshotConstants" %><%
+ org.apache.sling.sample.slingshot.model.StreamEntry" %><%
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
%><sling:defineObjects/><%
%><div class="container">
@@ -29,13 +29,13 @@
final Iterator<Resource> fi = resource.listChildren();
while ( fi.hasNext()) {
final Resource current = fi.next();
- if ( current.isResourceType(SlingshotConstants.RESOURCETYPE_ITEM)) {
+ if ( current.isResourceType(StreamEntry.RESOURCETYPE)) {
if ( !openedRow ) {
openedRow = true;
%><div class="row"><%
}
%>
- <sling:include resource="<%= current %>" replaceSelectors="main"/>
+ <sling:include resource="<%= current %>" replaceSelectors="stream"/>
<%
i++;
if ( i % 3 == 0 ) {
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/user.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/user.html.jsp?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/user.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Stream/user.html.jsp Mon Mar 28 12:57:29 2016
@@ -19,21 +19,15 @@
%><%@page import="org.apache.sling.api.resource.Resource,
org.apache.sling.api.resource.ResourceUtil,
org.apache.sling.api.resource.ValueMap,
- org.apache.sling.sample.slingshot.SlingshotConstants,
+ org.apache.sling.sample.slingshot.model.Stream,
org.apache.sling.api.request.ResponseUtil" %><%
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
%><sling:defineObjects/><%
%><%
- final ValueMap attr = resource.getValueMap();
- final String itemTitle = attr.get(SlingshotConstants.PROPERTY_TITLE, resource.getName());
-
- int count = 0;
- for(final Resource current : resource.getChildren()) {
- count++;
- }
+ final Stream stream = new Stream(resource);
%>
<div class="col-md-4">
- <h2><%= ResponseUtil.escapeXml(itemTitle) %></h2>
+ <h2><%= ResponseUtil.escapeXml(stream.getInfo().getTitle()) %></h2>
<!-- <img class="img-responsive" style="padding-top: 5px" src="<%= request.getContextPath() %>"/> -->
- <p><a class="btn btn-default" href="<%= request.getContextPath() %><%=resource.getPath()%>.html" role="button">View details »</a> <span class="badge"><%= count %></span></p>
+ <p><a class="btn btn-default" href="<%= request.getContextPath() %><%=resource.getPath()%>.html" role="button">View details »</a> <span class="badge"><%= stream.getInfo().getEntryCount() %></span></p>
</div>
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp Mon Mar 28 12:57:29 2016
@@ -40,7 +40,7 @@
<sling:include resource="<%= resource %>" replaceSelectors="head"/>
</head>
<body class="ui-slingshot-main">
- <sling:include resource="<%= resource %>" replaceSelectors="trail"/>
+ <sling:include resource="<%= resource %>" replaceSelectors="menu"/>
<h1><%= title %></h1>
<img src="<%= request.getContextPath() %><%= imagePath %>"/>
<form method="POST" action="<%= request.getContextPath() %><%=resource.getName() %>">
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp Mon Mar 28 12:57:29 2016
@@ -29,7 +29,7 @@
final RatingsService ratingsService = sling.getService(RatingsService.class);
final ValueMap attributes = resource.getValueMap();
final String title = ResponseUtil.escapeXml(attributes.get(SlingshotConstants.PROPERTY_TITLE, resource.getName()));
- final String categoryName = ResponseUtil.escapeXml(resource.getParent().getValueMap().get(SlingshotConstants.PROPERTY_TITLE, resource.getParent().getName()));
+ final String streamName = ResponseUtil.escapeXml(resource.getParent().getValueMap().get(SlingshotConstants.PROPERTY_TITLE, resource.getParent().getName()));
String imagePath = null;
final Resource imagesResource = resource.getResourceResolver().getResource(resource, "images");
@@ -45,7 +45,7 @@
<sling:include resource="<%= resource %>" replaceSelectors="head"/>
</head>
<body>
- <sling:include resource="<%= resource %>" replaceSelectors="trail"/>
+ <sling:include resource="<%= resource %>" replaceSelectors="menu"/>
<div class="jumbotron">
<div class="container">
<h1><%= title %></h1>
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/html.jsp?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/html.jsp Mon Mar 28 12:57:29 2016
@@ -19,24 +19,22 @@
%><%@page import="org.apache.sling.api.resource.ResourceUtil,
org.apache.sling.api.resource.ValueMap,
org.apache.sling.api.request.ResponseUtil,
- org.apache.sling.sample.slingshot.SlingshotConstants" %><%
+ org.apache.sling.sample.slingshot.model.User" %><%
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
%><sling:defineObjects/><%
- final ValueMap attributes = resource.getValueMap();
- final String title = ResponseUtil.escapeXml(attributes.get(SlingshotConstants.PROPERTY_TITLE, resource.getName()));
+ final User user = new User(resource);
%><html>
<head>
- <title><%= title %></title>
+ <title><%= ResponseUtil.escapeXml(user.getInfo().getName()) %></title>
<sling:include resource="<%= resource %>" replaceSelectors="head"/>
</head>
<body>
- <sling:include resource="<%= resource %>" replaceSelectors="trail"/>
- <!-- Main jumbotron for a primary marketing message or call to action -->
+ <sling:include resource="<%= resource %>" replaceSelectors="menu"/>
<div class="jumbotron">
<div class="container">
- <h1><%= title %></h1>
- <p>Explore the world of bla....</p>
+ <h1><%= ResponseUtil.escapeXml(user.getInfo().getName()) %></h1>
+ <p><%= ResponseUtil.escapeXml(user.getInfo().getAbout()) %></p>
</div>
</div>
<sling:include resource="<%= resource %>" replaceSelectors="itemlist"/>
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/itemlist.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/itemlist.html.jsp?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/itemlist.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/User/itemlist.html.jsp Mon Mar 28 12:57:29 2016
@@ -19,7 +19,7 @@
%><%@page import="java.util.Iterator,
java.util.List,
org.apache.sling.api.resource.Resource,
- org.apache.sling.sample.slingshot.SlingshotConstants" %><%
+ org.apache.sling.sample.slingshot.model.Stream" %><%
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
%><sling:defineObjects/><%
%><div class="container">
@@ -28,7 +28,7 @@
final Iterator<Resource> fi = resource.listChildren();
while ( fi.hasNext()) {
final Resource current = fi.next();
- if ( current.isResourceType(SlingshotConstants.RESOURCETYPE_CATEGORY)) {
+ if ( current.isResourceType(Stream.RESOURCETYPE)) {
%>
<sling:include resource="<%= current %>" replaceSelectors="user"/>
<%
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/docs/content-model.html
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/docs/content-model.html?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/docs/content-model.html (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/docs/content-model.html Mon Mar 28 12:57:29 2016
@@ -29,16 +29,22 @@
<li><ul>
<li>/users</li>
<li><ul>
- <li><username></li>
+ <li><userid></li>
<li><ul>
- <li>content</li>
+ <li><stream></li>
<li><ul>
- <li><category></li>
+ <li><entry></li>
<li><ul>
- <li><item></li>
- <li><ul>
- <li>images</li>
- </ul></li>
+ <li>images</li>
+ </ul></li>
+ </ul></li>
+ <li>info</li>
+ <li>settings</li>
+ <li>ugc</li>
+ <li><ul>
+ <li><stream></li>
+ <li><ul>
+ <li><entry></li>
<li><ul>
<li>ratings</li>
</ul></li>
@@ -47,9 +53,6 @@
</ul></li>
</ul></li>
</ul></li>
- <li>info</li>
- <li>profile</li>
- <li>ugc</li>
</ul></li>
</ul></li>
</ul></li>
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,4 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/User",
- "description":"This is the user space of slingshot1!",
- "title":"Welcome to my World"
+ "sling:resourceType":"slingshot/User"
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/info.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/info.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/info.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/info.json Mon Mar 28 12:57:29 2016
@@ -1,4 +1,5 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Userinfo"
+ "sling:resourceType":"slingshot/Userinfo",
+ "about":"Welcome to the World of SlingShot!"
}
\ No newline at end of file
Copied: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/settings.json (from r1736875, sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/profile.json)
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/settings.json?p2=sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/settings.json&p1=sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/profile.json&r1=1736875&r2=1736884&rev=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/profile.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/settings.json Mon Mar 28 12:57:29 2016
@@ -1,4 +1,4 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Userprofile"
+ "sling:resourceType":"slingshot/Settings"
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,4 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Category",
- "title":"Travel",
- "description":"Stuff related to travel."
+ "sling:resourceType":"slingshot/Stream"
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/home.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/home.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/home.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/home.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"Home Sweet Home",
"description":"This is the place where I live..."
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/pet.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/pet.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/pet.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/pet.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"My Pet",
"description":"Always hungry...but never gets fat"
}
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/sea.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/sea.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/sea.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/sea.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"The Sea",
"description":"You can see my boat in the distance"
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/view.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/view.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/view.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot1/travel/view.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"Nice View",
"description":"A view from the top of my home"
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,4 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/User",
- "description":"This is the user space of slingshot2!",
- "title":"The Truth Is Out There"
+ "sling:resourceType":"slingshot/User"
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,4 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Category",
- "title":"Aliens",
- "description":"Strange creatures from outer space."
+ "sling:resourceType":"slingshot/Stream"
}
\ No newline at end of file
Added: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/info.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/info.json?rev=1736884&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/info.json (added)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/info.json Mon Mar 28 12:57:29 2016
@@ -0,0 +1,6 @@
+{
+ "jcr:primaryType":"sling:Folder",
+ "sling:resourceType":"slingshot/Streaminfo",
+ "title":"Aliens",
+ "description":"Strange creatures from outer space."
+}
\ No newline at end of file
Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/info.json
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/info.json
------------------------------------------------------------------------------
svn:keywords = Id
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/strange.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/strange.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/strange.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/strange.json Mon Mar 28 12:57:29 2016
@@ -1,15 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"Strange",
- "description":"This guy looks really strange...",
-
- comments : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Comments"
- },
- ratings : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Ratings"
- }
+ "description":"This guy looks really strange..."
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/underwater.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/underwater.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/underwater.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/underwater.json Mon Mar 28 12:57:29 2016
@@ -1,15 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"Underwater",
- "description":"Surprise down under...",
-
- comments : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Comments"
- },
- ratings : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Ratings"
- }
+ "description":"Surprise down under..."
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/welcome.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/welcome.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/welcome.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/aliens/welcome.json Mon Mar 28 12:57:29 2016
@@ -1,15 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"Welcome",
- "description":"This guy looks charming",
-
- comments : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Comments"
- },
- ratings : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Ratings"
- }
+ "description":"This guy looks charming"
}
\ No newline at end of file
Added: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/info.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/info.json?rev=1736884&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/info.json (added)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/info.json Mon Mar 28 12:57:29 2016
@@ -0,0 +1,5 @@
+{
+ "jcr:primaryType":"sling:Folder",
+ "sling:resourceType":"slingshot/Userinfo",
+ "about":"The Truth Is Out There"
+}
\ No newline at end of file
Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/info.json
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/info.json
------------------------------------------------------------------------------
svn:keywords = Id
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places.json Mon Mar 28 12:57:29 2016
@@ -1,6 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Category",
+ "sling:resourceType":"slingshot/Stream",
"title":"Places",
"description":"Mysterious places around the globe."
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/flight.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/flight.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/flight.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/flight.json Mon Mar 28 12:57:29 2016
@@ -1,15 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"Flight Route",
- "description":"Looks different from above...",
-
- comments : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Comments"
- },
- ratings : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Ratings"
- }
+ "description":"Looks different from above..."
}
\ No newline at end of file
Added: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/info.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/info.json?rev=1736884&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/info.json (added)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/info.json Mon Mar 28 12:57:29 2016
@@ -0,0 +1,6 @@
+{
+ "jcr:primaryType":"sling:Folder",
+ "sling:resourceType":"slingshot/Streaminfo",
+ "title":"Places",
+ "description":"Mysterious places around the globe."
+}
\ No newline at end of file
Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/info.json
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/info.json
------------------------------------------------------------------------------
svn:keywords = Id
Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/landing.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/landing.json?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/landing.json (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/users/slingshot2/places/landing.json Mon Mar 28 12:57:29 2016
@@ -1,15 +1,6 @@
{
"jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Item",
+ "sling:resourceType":"slingshot/Streamentry",
"title":"Landing Place",
- "description":"Something happened here long time ago!",
-
- comments : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Comments"
- },
- ratings : {
- "jcr:primaryType":"sling:Folder",
- "sling:resourceType":"slingshot/Ratings"
- }
+ "description":"Something happened here long time ago!"
}
\ No newline at end of file
Modified: sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/SlingshotUtilTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/SlingshotUtilTest.java?rev=1736884&r1=1736883&r2=1736884&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/SlingshotUtilTest.java (original)
+++ sling/trunk/samples/slingshot/src/test/java/org/apache/sling/sample/slingshot/SlingshotUtilTest.java Mon Mar 28 12:57:29 2016
@@ -35,44 +35,44 @@ public class SlingshotUtilTest {
public void loadData() {
context.load().json("/slingshot.json", SlingshotConstants.APP_ROOT_PATH);
}
-
+
@Test
public void getUserId_deepPath() {
-
- Resource resource = context.resourceResolver().getResource("/slingshot/users/admin/content");
-
+
+ Resource resource = context.resourceResolver().getResource("/slingshot/users/admin/hobby");
+
assertThat(SlingshotUtil.getUserId(resource), equalTo("admin"));
}
@Test
public void getUserId_exactPath() {
-
+
Resource resource = context.resourceResolver().getResource("/slingshot/users/admin");
-
+
assertThat(SlingshotUtil.getUserId(resource), equalTo("admin"));
}
-
+
@Test
public void getUserId_noMatch() {
-
+
Resource resource = context.resourceResolver().getResource("/slingshot/users");
-
+
assertThat(SlingshotUtil.getUserId(resource), nullValue());
}
-
+
@Test
public void getContentPath_match() {
-
- Resource resource = context.resourceResolver().getResource("/slingshot/users/admin/content/hobby");
-
+
+ Resource resource = context.resourceResolver().getResource("/slingshot/users/admin/hobby");
+
assertThat(SlingshotUtil.getContentPath(resource), equalTo("/hobby"));
}
-
+
@Test
public void getContentPath_noMatch() {
-
+
Resource resource = context.resourceResolver().getResource("/slingshot/users/admin");
-
+
assertThat(SlingshotUtil.getContentPath(resource), nullValue());
}
}