You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by "Franklin, Matthew B." <mf...@mitre.org> on 2011/07/11 18:46:46 UTC

Re: svn commit: r1144091 - in /incubator/rave/trunk/rave-portal/src: main/java/org/apache/rave/portal/model/ main/java/org/apache/rave/portal/repository/ main/java/org/apache/rave/portal/repository/impl/ main/java/org/apache/rave/portal/service/ main/j...

On 7/7/11 7:08 PM, "mpierce@apache.org" <mp...@apache.org> wrote:

>Author: mpierce
>Date: Thu Jul  7 23:08:58 2011
>New Revision: 1144091
>
>URL: http://svn.apache.org/viewvc?rev=1144091&view=rev
>Log:
>(RAVE-89) Creating a blank Page, Regions for newly registered user.
>Widgets can then be added from the widget store.

In the controller, you are doing a lot to create the new page.  IMHO, this
is really a task for the pageService.  The controller should just be a
simple 'router' that delegates any model manipulation off to the model
(includes services).

>
>
>Added:
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageLayoutRepository.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageLayoutService.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/RegionService.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageLayoutService.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultRegionService.java
>Removed:
>
>incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/NewAccountR
>equestReceived.jsp
>Modified:
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/Page.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/PageLayout.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/PageLayoutRepository.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageRepository.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageService.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/UserService.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageService.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultUserService.java
>
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>controller/NewAccountController.java
>
>incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>l/PageTest.java
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/Page.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/model/Page.java?rev=1144091&r1=1144090&r2=1144091
>&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/Page.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/Page.java Thu Jul  7 23:08:58 2011
>@@ -51,7 +51,7 @@ public class Page {
>     @JoinColumn(name="page_layout_id")
>     private PageLayout pageLayout;
>
>-    @OneToMany(fetch = FetchType.EAGER)
>+    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL,
>orphanRemoval = true)
>     @JoinColumn(name="page_id")
>     private List<Region> regions;
>
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/PageLayout.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/model/PageLayout.java?rev=1144091&r1=1144090&r2=1
>144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/PageLayout.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>l/PageLayout.java Thu Jul  7 23:08:58 2011
>@@ -27,6 +27,10 @@ import javax.persistence.*;
> @Entity
> @Table(name="page_layout")
> @SequenceGenerator(name="pageLayoutIdSeq", sequenceName =
>"page_layout_id_seq")
>+@NamedQueries({
>+    @NamedQuery(name="PageLayout.getByLayoutCode", query = "select pl
>from PageLayout pl where pl.code = :code")
>+})
>+
> public class PageLayout {
>     @Id @Column(name="id")
>     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
>"pageLayoutIdSeq")
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/PageLayoutRepository.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/repository/PageLayoutRepository.java?rev=1144091&
>r1=1144090&r2=1144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/PageLayoutRepository.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/PageLayoutRepository.java Thu Jul  7 23:08:58 2011
>@@ -20,4 +20,6 @@ package org.apache.rave.portal.repositor
>
> import org.apache.rave.portal.model.PageLayout;
>
>-public interface PageLayoutRepository extends Repository<PageLayout> { }
>\ No newline at end of file
>+public interface PageLayoutRepository extends Repository<PageLayout> {
>+        PageLayout getByPageLayoutCode(String codename);
>+}
>\ No newline at end of file
>
>Added:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageLayoutRepository.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/repository/impl/JpaPageLayoutRepository.java?rev=
>1144091&view=auto
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageLayoutRepository.java (added)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageLayoutRepository.java Thu Jul  7 23:08:58 2011
>@@ -0,0 +1,59 @@
>+/*
>+ * 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.rave.portal.repository.impl;
>+
>+import org.apache.commons.lang.NotImplementedException;
>+import org.apache.rave.portal.model.PageLayout;
>+import org.apache.rave.portal.repository.PageLayoutRepository;
>+import org.springframework.stereotype.Repository;
>+import org.springframework.transaction.annotation.Transactional;
>+
>+import javax.persistence.EntityManager;
>+import javax.persistence.PersistenceContext;
>+import javax.persistence.TypedQuery;
>+
>+import static
>org.apache.rave.portal.repository.impl.util.JpaUtil.getSingleResult;
>+import static
>org.apache.rave.portal.repository.impl.util.JpaUtil.saveOrUpdate;
>+
>+/**
>+ */
>+@Repository
>+public class JpaPageLayoutRepository implements PageLayoutRepository{
>+
>+    @PersistenceContext
>+    private EntityManager manager;
>+
>+    @Override
>+    public PageLayout get(long layoutId) {
>+        return manager.find(PageLayout.class, layoutId);
>+    }
>+
>+        @Override
>+        public PageLayout getByPageLayoutCode(String codename){
>+                 TypedQuery<PageLayout>query =
>manager.createNamedQuery("PageLayout.getByLayoutCode",PageLayout.class);
>+                 query.setParameter("code",codename);
>+                 return getSingleResult(query.getResultList());
>+        }
>+
>+    @Override
>+    public PageLayout save(PageLayout pageLayout) {
>+                 return
>saveOrUpdate(pageLayout.getId(),manager,pageLayout);
>+    }
>+}
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageRepository.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/repository/impl/JpaPageRepository.java?rev=114409
>1&r1=1144090&r2=1144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageRepository.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>sitory/impl/JpaPageRepository.java Thu Jul  7 23:08:58 2011
>@@ -29,6 +29,8 @@ import javax.persistence.PersistenceCont
> import javax.persistence.TypedQuery;
> import java.util.List;
>
>+import static
>org.apache.rave.portal.repository.impl.util.JpaUtil.saveOrUpdate;
>+
> @Repository
> public class JpaPageRepository implements PageRepository {
>
>@@ -49,6 +51,7 @@ public class JpaPageRepository implement
>
>     @Override
>     public Page save(Page item) {
>-        throw new NotImplementedException("Save is not implemented for
>this repository");
>+                 return saveOrUpdate(item.getId(),manager,item);
>+                 //        throw new NotImplementedException("Save is
>not implemented for this repository");
>     }
> }
>\ No newline at end of file
>
>Added:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageLayoutService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/PageLayoutService.java?rev=1144091&view=a
>uto
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageLayoutService.java (added)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageLayoutService.java Thu Jul  7 23:08:58 2011
>@@ -0,0 +1,25 @@
>+/*
>+ * 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.rave.portal.service;
>+
>+import org.apache.rave.portal.model.PageLayout;
>+
>+public interface PageLayoutService {
>+        public PageLayout getPageLayoutByCode(String code);
>+}
>\ No newline at end of file
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/PageService.java?rev=1144091&r1=1144090&r
>2=1144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageService.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/PageService.java Thu Jul  7 23:08:58 2011
>@@ -60,4 +60,10 @@ public interface PageService {
>          * @return the updated Region. //TODO need to make sure this is
>the right return.
>          */
>         Region removeWidgetFromPage(long regionWidgetId, long regionId);
>+
>+        /**
>+         * Registers a new page.
>+         * @param page the page object to register with the data
>management system.
>+         */
>+        void registerNewPage(Page page);
> }
>\ No newline at end of file
>
>Added:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/RegionService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/RegionService.java?rev=1144091&view=auto
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/RegionService.java (added)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/RegionService.java Thu Jul  7 23:08:58 2011
>@@ -0,0 +1,31 @@
>+/*
>+ * 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.rave.portal.service;
>+
>+import org.apache.rave.portal.model.Region;
>+
>+public interface RegionService {
>+
>+        /**
>+         * Register a new region
>+         * @param region the region object to register
>+         */
>+        void registerNewRegion(Region region);
>+
>+}
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/UserService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/UserService.java?rev=1144091&r1=1144090&r
>2=1144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/UserService.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/UserService.java Thu Jul  7 23:08:58 2011
>@@ -44,6 +44,17 @@ public interface UserService extends Use
>
>         /**
>          * Registers a new user object.
>+         * @param user the new user object to register with the data
>management system.
>          */
>         void registerNewUser(User user);
>+
>+        /**
>+         * Return the requested user object using the user's name.
>+         */
>+        User getUserByUsername(String userName);
>+
>+        /**
>+         * Return a user object by the user ID.
>+         */
>+        User getUserById(Long id);
> }
>\ No newline at end of file
>
>Added:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageLayoutService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/impl/DefaultPageLayoutService.java?rev=11
>44091&view=auto
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageLayoutService.java (added)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageLayoutService.java Thu Jul  7 23:08:58 2011
>@@ -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.rave.portal.service.impl;
>+
>+import org.apache.rave.portal.model.PageLayout;
>+import org.apache.rave.portal.service.PageLayoutService;
>+import org.apache.rave.portal.repository.PageLayoutRepository;
>+import org.springframework.beans.factory.annotation.Autowired;
>+import org.springframework.stereotype.Service;
>+
>+@Service
>+public class DefaultPageLayoutService implements PageLayoutService {
>+        private final PageLayoutRepository pageLayoutRepository;
>+
>+        @Autowired
>+        public DefaultPageLayoutService(PageLayoutRepository
>pageLayoutRepository) {
>+                 this.pageLayoutRepository=pageLayoutRepository;
>+        }
>+
>+        @Override
>+        public PageLayout getPageLayoutByCode(String code) {
>+                 return pageLayoutRepository.getByPageLayoutCode(code);
>+        }
>+}
>+
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/impl/DefaultPageService.java?rev=1144091&
>r1=1144090&r2=1144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageService.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultPageService.java Thu Jul  7 23:08:58 2011
>@@ -68,7 +68,6 @@ public class DefaultPageService implemen
>         @Override
>         @Transactional
>         public Region removeWidgetFromPage(long regionWidgetId, long
>regionId){
>-                 //TODO must implement.  Returns null for the time being.
>         Region region = getFromRepository(regionId, regionRepository);
>         return removeWidgetInstance(regionWidgetId, region);
>         }
>@@ -82,6 +81,12 @@ public class DefaultPageService implemen
>         return createWidgetInstance(widget, region, 0);
>     }
>
>+        @Override
>+        @Transactional
>+        public void registerNewPage(Page page) {
>+                 pageRepository.save(page);
>+        }
>+
>     private RegionWidget createWidgetInstance(Widget widget, Region
>region, int position) {
>         RegionWidget regionWidget = new RegionWidget();
>         regionWidget.setRenderOrder(position);
>
>Added:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultRegionService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/impl/DefaultRegionService.java?rev=114409
>1&view=auto
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultRegionService.java (added)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultRegionService.java Thu Jul  7 23:08:58 2011
>@@ -0,0 +1,45 @@
>+/*
>+ * 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.rave.portal.service.impl;
>+
>+import org.apache.rave.portal.model.Region;
>+import org.apache.rave.portal.service.RegionService;
>+import org.apache.rave.portal.repository.RegionRepository;
>+import org.springframework.beans.factory.annotation.Autowired;
>+import org.springframework.stereotype.Service;
>+import org.springframework.transaction.annotation.Transactional;
>+
>+@Service
>+public class DefaultRegionService implements RegionService {
>+
>+        private final RegionRepository regionRepository;
>+
>+        @Autowired
>+        public DefaultRegionService(RegionRepository regionRepository) {
>+                 this.regionRepository = regionRepository;
>+        }
>+
>+        @Override
>+        @Transactional
>+        public void registerNewRegion(Region region) {
>+                 regionRepository.save(region);
>+        }
>+
>+}
>\ No newline at end of file
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultUserService.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/service/impl/DefaultUserService.java?rev=1144091&
>r1=1144090&r2=1144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultUserService.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>ice/impl/DefaultUserService.java Thu Jul  7 23:08:58 2011
>@@ -113,4 +113,14 @@ public class DefaultUserService implemen
>         public void registerNewUser(User user) {
>                  userRepository.save(user);
>         }
>+
>+        @Override
>+        public User getUserById(Long id) {
>+                 return userRepository.get(id);
>+        }
>+
>+        @Override
>+        public User getUserByUsername(String userName){
>+                 return userRepository.getByUsername(userName);
>+        }
> }
>\ No newline at end of file
>
>Modified:
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>controller/NewAccountController.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>a/org/apache/rave/portal/web/controller/NewAccountController.java?rev=1144
>091&r1=1144090&r2=1144091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>controller/NewAccountController.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>controller/NewAccountController.java Thu Jul  7 23:08:58 2011
>@@ -20,9 +20,15 @@
> package org.apache.rave.portal.web.controller;
>
> import org.apache.rave.portal.service.UserService;
>+import org.apache.rave.portal.service.PageService;
>+import org.apache.rave.portal.service.PageLayoutService;
>+import org.apache.rave.portal.service.RegionService;
> import org.apache.rave.portal.web.util.ModelKeys;
> import org.apache.rave.portal.web.util.ViewNames;
> import org.apache.rave.portal.model.User;
>+import org.apache.rave.portal.model.Page;
>+import org.apache.rave.portal.model.PageLayout;
>+import org.apache.rave.portal.model.Region;
> import org.springframework.beans.factory.annotation.Autowired;
> import org.springframework.stereotype.Controller;
> import org.springframework.ui.Model;
>@@ -30,22 +36,31 @@ import org.springframework.web.bind.anno
> import org.springframework.web.bind.annotation.RequestMapping;
> import org.springframework.web.bind.annotation.RequestMethod;
> import org.springframework.web.bind.annotation.RequestParam;
>-
>+import java.util.List;
>+import java.util.ArrayList;
>
> @Controller
> @RequestMapping(value = { "/newaccount/*", "/newaccount" })
> public class NewAccountController {
>
>     private final UserService userService;
>-
>+        private final PageService pageService;
>+        private final PageLayoutService pageLayoutService;
>+        private final RegionService regionService;
>+
>     @Autowired
>-    public NewAccountController(UserService userService) {
>+    public NewAccountController(UserService userService, PageService
>pageService, PageLayoutService pageLayoutService, RegionService
>regionService) {
>         this.userService = userService;
>+                 this.pageService = pageService;
>+                 this.pageLayoutService = pageLayoutService;
>+                 this.regionService = regionService;
>     }
>
>     @RequestMapping(method = RequestMethod.POST)
>         //Needs to be specified by action.
>-    public String create(Model model, @RequestParam String userName,
>@RequestParam String password) {
>+        //TODO: have a more elegant way of adding a user
>+        public String create(Model model, @RequestParam String userName,
>@RequestParam String password) {
>+        //Create a new user object and register it.
>                  User user=new User();
>                  user.setUsername(userName);
>                  user.setPassword(password);
>@@ -53,9 +68,31 @@ public class NewAccountController {
>                  user.setLocked(false);
>                  user.setEnabled(true);
>                  userService.registerNewUser(user);
>-
>+
>+                 //Return the newly registered user
>+                 User
>registeredUser=userService.getUserByUsername(userName);
>+
>+                 //Create a PageLayout object.  We will default to
>+                 //the two-column layout
>+                 PageLayout
>pageLayout=pageLayoutService.getPageLayoutByCode("columns_2");
>+
>+                 //Create regions
>+                 List<Region> regions=new ArrayList<Region>();
>+                 Region region1=new Region();
>+                 Region region2=new Region();
>+                 regions.add(region1);
>+                 regions.add(region2);
>+
>+                 //Create a Page object and register it.
>+                 Page page=new Page();
>+                 page.setName("main");
>+                 page.setOwner(registeredUser);
>+                 page.setPageLayout(pageLayout);
>+                 page.setRenderSequence(1L);
>+
>page.setRegions(regions);
>+                 pageService.registerNewPage(page);
>+
>         return "redirect:/";
>     }
>-
>
> }
>\ No newline at end of file
>
>Modified:
>incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>l/PageTest.java
>URL:
>http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/jav
>a/org/apache/rave/portal/model/PageTest.java?rev=1144091&r1=1144090&r2=114
>4091&view=diff
>==========================================================================
>====
>---
>incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>l/PageTest.java (original)
>+++
>incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>l/PageTest.java Thu Jul  7 23:08:58 2011
>@@ -22,6 +22,7 @@ import org.junit.After;
> import org.junit.Before;
> import org.junit.Test;
>
>+
> import java.util.ArrayList;
> import java.util.List;
>
>
>


RE: svn commit: r1144091 - in /incubator/rave/trunk/rave-portal/src: main/java/org/apache/rave/portal/model/ main/java/org/apache/rave/portal/repository/ main/java/org/apache/rave/portal/repository/impl/ main/java/org/apache/rave/portal/service/ main/j...

Posted by "Ciancetta, Jesse E." <jc...@mitre.org>.
One technique that I've found useful for making sure code ends up in the right layer is to think about what would be required to change out a given component -- and if copy/paste is involved I know I've got code in the wrong place.

For example -- to keep my web tier (controllers) clean I try to think about what I would need to do if I wanted to bolt on an entirely new front end (maybe an applet, a flash front end, a web service layer, ...) and if that means copy/paste of code from the controller into the new front end would be required then that's a good indicator that I likely have code in my controller that should really be pushed down to my service layer.

And I do the same for the repository layer -- thinking about if I were to replace a given repository implementation with another, what logic would I need to copy/paste -- and if I find any then that usually means it's a business rule that I need to push back up into the service layer.

>-----Original Message-----
>From: Marlon Pierce [mailto:mpierce@cs.indiana.edu]
>Sent: Monday, July 11, 2011 12:58 PM
>To: rave-dev@incubator.apache.org
>Subject: Re: svn commit: r1144091 - in /incubator/rave/trunk/rave-portal/src:
>main/java/org/apache/rave/portal/model/
>main/java/org/apache/rave/portal/repository/
>main/java/org/apache/rave/portal/repository/impl/
>main/java/org/apache/rave/portal/service/ main/j...
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Yeah, Raminder also made this point offline.  I'm happy to reorganize the
>code, just wanted to commit things after I got it working.
>
>
>Marlon
>
>
>On 7/11/11 12:46 PM, Franklin, Matthew B. wrote:
>> On 7/7/11 7:08 PM, "mpierce@apache.org" <mp...@apache.org> wrote:
>>
>>> Author: mpierce
>>> Date: Thu Jul  7 23:08:58 2011
>>> New Revision: 1144091
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1144091&view=rev
>>> Log:
>>> (RAVE-89) Creating a blank Page, Regions for newly registered user.
>>> Widgets can then be added from the widget store.
>>
>> In the controller, you are doing a lot to create the new page.  IMHO, this
>> is really a task for the pageService.  The controller should just be a
>> simple 'router' that delegates any model manipulation off to the model
>> (includes services).
>>
>>>
>>>
>>> Added:
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageLayoutRepository.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageLayoutService.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/RegionService.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageLayoutService.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultRegionService.java
>>> Removed:
>>>
>>> incubator/rave/trunk/rave-portal/src/main/webapp/WEB-
>INF/views/NewAccountR
>>> equestReceived.jsp
>>> Modified:
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/Page.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/PageLayout.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/PageLayoutRepository.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageRepository.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageService.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/UserService.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageService.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultUserService.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/web/
>>> controller/NewAccountController.java
>>>
>>> incubator/rave/trunk/rave-
>portal/src/test/java/org/apache/rave/portal/mode
>>> l/PageTest.java
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/Page.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/model/Page.java?rev=1144091&r1=1144090&r2=11
>44091
>>> &view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/Page.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/Page.java Thu Jul  7 23:08:58 2011
>>> @@ -51,7 +51,7 @@ public class Page {
>>>     @JoinColumn(name="page_layout_id")
>>>     private PageLayout pageLayout;
>>>
>>> -    @OneToMany(fetch = FetchType.EAGER)
>>> +    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL,
>>> orphanRemoval = true)
>>>     @JoinColumn(name="page_id")
>>>     private List<Region> regions;
>>>
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/PageLayout.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/model/PageLayout.java?rev=1144091&r1=1144090
>&r2=1
>>> 144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/PageLayout.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/mode
>>> l/PageLayout.java Thu Jul  7 23:08:58 2011
>>> @@ -27,6 +27,10 @@ import javax.persistence.*;
>>> @Entity
>>> @Table(name="page_layout")
>>> @SequenceGenerator(name="pageLayoutIdSeq", sequenceName =
>>> "page_layout_id_seq")
>>> +@NamedQueries({
>>> +    @NamedQuery(name="PageLayout.getByLayoutCode", query =
>"select pl
>>>from PageLayout pl where pl.code = :code")
>>> +})
>>> +
>>> public class PageLayout {
>>>     @Id @Column(name="id")
>>>     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
>>> "pageLayoutIdSeq")
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/PageLayoutRepository.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/repository/PageLayoutRepository.java?rev=114409
>1&
>>> r1=1144090&r2=1144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/PageLayoutRepository.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/PageLayoutRepository.java Thu Jul  7 23:08:58 2011
>>> @@ -20,4 +20,6 @@ package org.apache.rave.portal.repositor
>>>
>>> import org.apache.rave.portal.model.PageLayout;
>>>
>>> -public interface PageLayoutRepository extends Repository<PageLayout> {
>}
>>> \ No newline at end of file
>>> +public interface PageLayoutRepository extends Repository<PageLayout>
>{
>>> +        PageLayout getByPageLayoutCode(String codename);
>>> +}
>>> \ No newline at end of file
>>>
>>> Added:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageLayoutRepository.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/repository/impl/JpaPageLayoutRepository.java?re
>v=
>>> 1144091&view=auto
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageLayoutRepository.java (added)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageLayoutRepository.java Thu Jul  7 23:08:58 2011
>>> @@ -0,0 +1,59 @@
>>> +/*
>>> + * 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.rave.portal.repository.impl;
>>> +
>>> +import org.apache.commons.lang.NotImplementedException;
>>> +import org.apache.rave.portal.model.PageLayout;
>>> +import org.apache.rave.portal.repository.PageLayoutRepository;
>>> +import org.springframework.stereotype.Repository;
>>> +import org.springframework.transaction.annotation.Transactional;
>>> +
>>> +import javax.persistence.EntityManager;
>>> +import javax.persistence.PersistenceContext;
>>> +import javax.persistence.TypedQuery;
>>> +
>>> +import static
>>> org.apache.rave.portal.repository.impl.util.JpaUtil.getSingleResult;
>>> +import static
>>> org.apache.rave.portal.repository.impl.util.JpaUtil.saveOrUpdate;
>>> +
>>> +/**
>>> + */
>>> +@Repository
>>> +public class JpaPageLayoutRepository implements PageLayoutRepository{
>>> +
>>> +    @PersistenceContext
>>> +    private EntityManager manager;
>>> +
>>> +    @Override
>>> +    public PageLayout get(long layoutId) {
>>> +        return manager.find(PageLayout.class, layoutId);
>>> +    }
>>> +
>>> +        @Override
>>> +        public PageLayout getByPageLayoutCode(String codename){
>>> +                 TypedQuery<PageLayout>query =
>>>
>manager.createNamedQuery("PageLayout.getByLayoutCode",PageLayout.cla
>ss);
>>> +                 query.setParameter("code",codename);
>>> +                 return getSingleResult(query.getResultList());
>>> +        }
>>> +
>>> +    @Override
>>> +    public PageLayout save(PageLayout pageLayout) {
>>> +                 return
>>> saveOrUpdate(pageLayout.getId(),manager,pageLayout);
>>> +    }
>>> +}
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageRepository.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/repository/impl/JpaPageRepository.java?rev=1144
>09
>>> 1&r1=1144090&r2=1144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageRepository.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/repo
>>> sitory/impl/JpaPageRepository.java Thu Jul  7 23:08:58 2011
>>> @@ -29,6 +29,8 @@ import javax.persistence.PersistenceCont
>>> import javax.persistence.TypedQuery;
>>> import java.util.List;
>>>
>>> +import static
>>> org.apache.rave.portal.repository.impl.util.JpaUtil.saveOrUpdate;
>>> +
>>> @Repository
>>> public class JpaPageRepository implements PageRepository {
>>>
>>> @@ -49,6 +51,7 @@ public class JpaPageRepository implement
>>>
>>>     @Override
>>>     public Page save(Page item) {
>>> -        throw new NotImplementedException("Save is not implemented for
>>> this repository");
>>> +                 return saveOrUpdate(item.getId(),manager,item);
>>> +                 //        throw new NotImplementedException("Save is
>>> not implemented for this repository");
>>>     }
>>> }
>>> \ No newline at end of file
>>>
>>> Added:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageLayoutService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/PageLayoutService.java?rev=1144091&vie
>w=a
>>> uto
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageLayoutService.java (added)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageLayoutService.java Thu Jul  7 23:08:58 2011
>>> @@ -0,0 +1,25 @@
>>> +/*
>>> + * 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.rave.portal.service;
>>> +
>>> +import org.apache.rave.portal.model.PageLayout;
>>> +
>>> +public interface PageLayoutService {
>>> +        public PageLayout getPageLayoutByCode(String code);
>>> +}
>>> \ No newline at end of file
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/PageService.java?rev=1144091&r1=114409
>0&r
>>> 2=1144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageService.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/PageService.java Thu Jul  7 23:08:58 2011
>>> @@ -60,4 +60,10 @@ public interface PageService {
>>>          * @return the updated Region. //TODO need to make sure this is
>>> the right return.
>>>          */
>>>         Region removeWidgetFromPage(long regionWidgetId, long regionId);
>>> +
>>> +        /**
>>> +         * Registers a new page.
>>> +         * @param page the page object to register with the data
>>> management system.
>>> +         */
>>> +        void registerNewPage(Page page);
>>> }
>>> \ No newline at end of file
>>>
>>> Added:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/RegionService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/RegionService.java?rev=1144091&view=au
>to
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/RegionService.java (added)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/RegionService.java Thu Jul  7 23:08:58 2011
>>> @@ -0,0 +1,31 @@
>>> +/*
>>> + * 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.rave.portal.service;
>>> +
>>> +import org.apache.rave.portal.model.Region;
>>> +
>>> +public interface RegionService {
>>> +
>>> +        /**
>>> +         * Register a new region
>>> +         * @param region the region object to register
>>> +         */
>>> +        void registerNewRegion(Region region);
>>> +
>>> +}
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/UserService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/UserService.java?rev=1144091&r1=114409
>0&r
>>> 2=1144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/UserService.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/UserService.java Thu Jul  7 23:08:58 2011
>>> @@ -44,6 +44,17 @@ public interface UserService extends Use
>>>
>>>         /**
>>>          * Registers a new user object.
>>> +         * @param user the new user object to register with the data
>>> management system.
>>>          */
>>>         void registerNewUser(User user);
>>> +
>>> +        /**
>>> +         * Return the requested user object using the user's name.
>>> +         */
>>> +        User getUserByUsername(String userName);
>>> +
>>> +        /**
>>> +         * Return a user object by the user ID.
>>> +         */
>>> +        User getUserById(Long id);
>>> }
>>> \ No newline at end of file
>>>
>>> Added:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageLayoutService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/impl/DefaultPageLayoutService.java?rev=1
>1
>>> 44091&view=auto
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageLayoutService.java (added)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageLayoutService.java Thu Jul  7 23:08:58 2011
>>> @@ -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.rave.portal.service.impl;
>>> +
>>> +import org.apache.rave.portal.model.PageLayout;
>>> +import org.apache.rave.portal.service.PageLayoutService;
>>> +import org.apache.rave.portal.repository.PageLayoutRepository;
>>> +import org.springframework.beans.factory.annotation.Autowired;
>>> +import org.springframework.stereotype.Service;
>>> +
>>> +@Service
>>> +public class DefaultPageLayoutService implements PageLayoutService {
>>> +        private final PageLayoutRepository pageLayoutRepository;
>>> +
>>> +        @Autowired
>>> +        public DefaultPageLayoutService(PageLayoutRepository
>>> pageLayoutRepository) {
>>> +                 this.pageLayoutRepository=pageLayoutRepository;
>>> +        }
>>> +
>>> +        @Override
>>> +        public PageLayout getPageLayoutByCode(String code) {
>>> +                 return pageLayoutRepository.getByPageLayoutCode(code);
>>> +        }
>>> +}
>>> +
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/impl/DefaultPageService.java?rev=114409
>1&
>>> r1=1144090&r2=1144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageService.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultPageService.java Thu Jul  7 23:08:58 2011
>>> @@ -68,7 +68,6 @@ public class DefaultPageService implemen
>>>         @Override
>>>         @Transactional
>>>         public Region removeWidgetFromPage(long regionWidgetId, long
>>> regionId){
>>> -                 //TODO must implement.  Returns null for the time being.
>>>         Region region = getFromRepository(regionId, regionRepository);
>>>         return removeWidgetInstance(regionWidgetId, region);
>>>         }
>>> @@ -82,6 +81,12 @@ public class DefaultPageService implemen
>>>         return createWidgetInstance(widget, region, 0);
>>>     }
>>>
>>> +        @Override
>>> +        @Transactional
>>> +        public void registerNewPage(Page page) {
>>> +                 pageRepository.save(page);
>>> +        }
>>> +
>>>     private RegionWidget createWidgetInstance(Widget widget, Region
>>> region, int position) {
>>>         RegionWidget regionWidget = new RegionWidget();
>>>         regionWidget.setRenderOrder(position);
>>>
>>> Added:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultRegionService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/impl/DefaultRegionService.java?rev=11440
>9
>>> 1&view=auto
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultRegionService.java (added)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultRegionService.java Thu Jul  7 23:08:58 2011
>>> @@ -0,0 +1,45 @@
>>> +/*
>>> + * 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.rave.portal.service.impl;
>>> +
>>> +import org.apache.rave.portal.model.Region;
>>> +import org.apache.rave.portal.service.RegionService;
>>> +import org.apache.rave.portal.repository.RegionRepository;
>>> +import org.springframework.beans.factory.annotation.Autowired;
>>> +import org.springframework.stereotype.Service;
>>> +import org.springframework.transaction.annotation.Transactional;
>>> +
>>> +@Service
>>> +public class DefaultRegionService implements RegionService {
>>> +
>>> +        private final RegionRepository regionRepository;
>>> +
>>> +        @Autowired
>>> +        public DefaultRegionService(RegionRepository regionRepository) {
>>> +                 this.regionRepository = regionRepository;
>>> +        }
>>> +
>>> +        @Override
>>> +        @Transactional
>>> +        public void registerNewRegion(Region region) {
>>> +                 regionRepository.save(region);
>>> +        }
>>> +
>>> +}
>>> \ No newline at end of file
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultUserService.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/service/impl/DefaultUserService.java?rev=1144091
>&
>>> r1=1144090&r2=1144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultUserService.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/serv
>>> ice/impl/DefaultUserService.java Thu Jul  7 23:08:58 2011
>>> @@ -113,4 +113,14 @@ public class DefaultUserService implemen
>>>         public void registerNewUser(User user) {
>>>                  userRepository.save(user);
>>>         }
>>> +
>>> +        @Override
>>> +        public User getUserById(Long id) {
>>> +                 return userRepository.get(id);
>>> +        }
>>> +
>>> +        @Override
>>> +        public User getUserByUsername(String userName){
>>> +                 return userRepository.getByUsername(userName);
>>> +        }
>>> }
>>> \ No newline at end of file
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/web/
>>> controller/NewAccountController.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/main/jav
>>>
>a/org/apache/rave/portal/web/controller/NewAccountController.java?rev=1
>144
>>> 091&r1=1144090&r2=1144091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/web/
>>> controller/NewAccountController.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/main/java/org/apache/rave/portal/web/
>>> controller/NewAccountController.java Thu Jul  7 23:08:58 2011
>>> @@ -20,9 +20,15 @@
>>> package org.apache.rave.portal.web.controller;
>>>
>>> import org.apache.rave.portal.service.UserService;
>>> +import org.apache.rave.portal.service.PageService;
>>> +import org.apache.rave.portal.service.PageLayoutService;
>>> +import org.apache.rave.portal.service.RegionService;
>>> import org.apache.rave.portal.web.util.ModelKeys;
>>> import org.apache.rave.portal.web.util.ViewNames;
>>> import org.apache.rave.portal.model.User;
>>> +import org.apache.rave.portal.model.Page;
>>> +import org.apache.rave.portal.model.PageLayout;
>>> +import org.apache.rave.portal.model.Region;
>>> import org.springframework.beans.factory.annotation.Autowired;
>>> import org.springframework.stereotype.Controller;
>>> import org.springframework.ui.Model;
>>> @@ -30,22 +36,31 @@ import org.springframework.web.bind.anno
>>> import org.springframework.web.bind.annotation.RequestMapping;
>>> import org.springframework.web.bind.annotation.RequestMethod;
>>> import org.springframework.web.bind.annotation.RequestParam;
>>> -
>>> +import java.util.List;
>>> +import java.util.ArrayList;
>>>
>>> @Controller
>>> @RequestMapping(value = { "/newaccount/*", "/newaccount" })
>>> public class NewAccountController {
>>>
>>>     private final UserService userService;
>>> -
>>> +        private final PageService pageService;
>>> +        private final PageLayoutService pageLayoutService;
>>> +        private final RegionService regionService;
>>> +
>>>     @Autowired
>>> -    public NewAccountController(UserService userService) {
>>> +    public NewAccountController(UserService userService, PageService
>>> pageService, PageLayoutService pageLayoutService, RegionService
>>> regionService) {
>>>         this.userService = userService;
>>> +                 this.pageService = pageService;
>>> +                 this.pageLayoutService = pageLayoutService;
>>> +                 this.regionService = regionService;
>>>     }
>>>
>>>     @RequestMapping(method = RequestMethod.POST)
>>>         //Needs to be specified by action.
>>> -    public String create(Model model, @RequestParam String userName,
>>> @RequestParam String password) {
>>> +        //TODO: have a more elegant way of adding a user
>>> +        public String create(Model model, @RequestParam String userName,
>>> @RequestParam String password) {
>>> +        //Create a new user object and register it.
>>>                  User user=new User();
>>>                  user.setUsername(userName);
>>>                  user.setPassword(password);
>>> @@ -53,9 +68,31 @@ public class NewAccountController {
>>>                  user.setLocked(false);
>>>                  user.setEnabled(true);
>>>                  userService.registerNewUser(user);
>>> -
>>> +
>>> +                 //Return the newly registered user
>>> +                 User
>>> registeredUser=userService.getUserByUsername(userName);
>>> +
>>> +                 //Create a PageLayout object.  We will default to
>>> +                 //the two-column layout
>>> +                 PageLayout
>>> pageLayout=pageLayoutService.getPageLayoutByCode("columns_2");
>>> +
>>> +                 //Create regions
>>> +                 List<Region> regions=new ArrayList<Region>();
>>> +                 Region region1=new Region();
>>> +                 Region region2=new Region();
>>> +                 regions.add(region1);
>>> +                 regions.add(region2);
>>> +
>>> +                 //Create a Page object and register it.
>>> +                 Page page=new Page();
>>> +                 page.setName("main");
>>> +                 page.setOwner(registeredUser);
>>> +                 page.setPageLayout(pageLayout);
>>> +                 page.setRenderSequence(1L);
>>> +
>>> page.setRegions(regions);
>>> +                 pageService.registerNewPage(page);
>>> +
>>>         return "redirect:/";
>>>     }
>>> -
>>>
>>> }
>>> \ No newline at end of file
>>>
>>> Modified:
>>> incubator/rave/trunk/rave-
>portal/src/test/java/org/apache/rave/portal/mode
>>> l/PageTest.java
>>> URL:
>>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-
>portal/src/test/jav
>>>
>a/org/apache/rave/portal/model/PageTest.java?rev=1144091&r1=1144090&r
>2=114
>>> 4091&view=diff
>>>
>===========================================================
>===============
>>> ====
>>> ---
>>> incubator/rave/trunk/rave-
>portal/src/test/java/org/apache/rave/portal/mode
>>> l/PageTest.java (original)
>>> +++
>>> incubator/rave/trunk/rave-
>portal/src/test/java/org/apache/rave/portal/mode
>>> l/PageTest.java Thu Jul  7 23:08:58 2011
>>> @@ -22,6 +22,7 @@ import org.junit.After;
>>> import org.junit.Before;
>>> import org.junit.Test;
>>>
>>> +
>>> import java.util.ArrayList;
>>> import java.util.List;
>>>
>>>
>>>
>>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
>iQEcBAEBAgAGBQJOGyueAAoJEEfVXEODPFIDLowH/3EeE1DCcu8z9XYG5C4QK
>Xhi
>oQKL7zK32Wdsgidht7sdPjRtDsN1MzODf/ERNKxMYZ3VMvnKEu4vdXZzDnCMC
>DpS
>+XTliiNbGWDkn4JHp5voeYSbrJAzajCF3alsMHqyP7SyItCoCQ7HPKrUQTXNKBag
>OAYkCa2Ja/C/RGQnTLDXQElbeJLuIG97cuBqNo//UmztGLn+UYN8sjGfha19Ek1
>Q
>2h6ZowHNmd2xQMV7TKBg3Bv32DYsYI6NG9E8IjT1vxZVoIBtk2CuBdFJaE2o86A
>d
>5Vns6pwLv21o3P3XMQ1hRXEaS1mP7kDQ7AaPOdLpFxJR9A0Nxub4kpa7z2jVX
>Ck=
>=Bs8x
>-----END PGP SIGNATURE-----

Re: svn commit: r1144091 - in /incubator/rave/trunk/rave-portal/src: main/java/org/apache/rave/portal/model/ main/java/org/apache/rave/portal/repository/ main/java/org/apache/rave/portal/repository/impl/ main/java/org/apache/rave/portal/service/ main/j...

Posted by Marlon Pierce <mp...@cs.indiana.edu>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yeah, Raminder also made this point offline.  I'm happy to reorganize the code, just wanted to commit things after I got it working.


Marlon


On 7/11/11 12:46 PM, Franklin, Matthew B. wrote:
> On 7/7/11 7:08 PM, "mpierce@apache.org" <mp...@apache.org> wrote:
> 
>> Author: mpierce
>> Date: Thu Jul  7 23:08:58 2011
>> New Revision: 1144091
>>
>> URL: http://svn.apache.org/viewvc?rev=1144091&view=rev
>> Log:
>> (RAVE-89) Creating a blank Page, Regions for newly registered user.
>> Widgets can then be added from the widget store.
> 
> In the controller, you are doing a lot to create the new page.  IMHO, this
> is really a task for the pageService.  The controller should just be a
> simple 'router' that delegates any model manipulation off to the model
> (includes services).
> 
>>
>>
>> Added:
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageLayoutRepository.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageLayoutService.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/RegionService.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageLayoutService.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultRegionService.java
>> Removed:
>>
>> incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/NewAccountR
>> equestReceived.jsp
>> Modified:
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/Page.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/PageLayout.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/PageLayoutRepository.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageRepository.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageService.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/UserService.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageService.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultUserService.java
>>
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>> controller/NewAccountController.java
>>
>> incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>> l/PageTest.java
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/Page.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/model/Page.java?rev=1144091&r1=1144090&r2=1144091
>> &view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/Page.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/Page.java Thu Jul  7 23:08:58 2011
>> @@ -51,7 +51,7 @@ public class Page {
>>     @JoinColumn(name="page_layout_id")
>>     private PageLayout pageLayout;
>>
>> -    @OneToMany(fetch = FetchType.EAGER)
>> +    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL,
>> orphanRemoval = true)
>>     @JoinColumn(name="page_id")
>>     private List<Region> regions;
>>
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/PageLayout.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/model/PageLayout.java?rev=1144091&r1=1144090&r2=1
>> 144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/PageLayout.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/mode
>> l/PageLayout.java Thu Jul  7 23:08:58 2011
>> @@ -27,6 +27,10 @@ import javax.persistence.*;
>> @Entity
>> @Table(name="page_layout")
>> @SequenceGenerator(name="pageLayoutIdSeq", sequenceName =
>> "page_layout_id_seq")
>> +@NamedQueries({
>> +    @NamedQuery(name="PageLayout.getByLayoutCode", query = "select pl
>>from PageLayout pl where pl.code = :code")
>> +})
>> +
>> public class PageLayout {
>>     @Id @Column(name="id")
>>     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
>> "pageLayoutIdSeq")
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/PageLayoutRepository.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/repository/PageLayoutRepository.java?rev=1144091&
>> r1=1144090&r2=1144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/PageLayoutRepository.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/PageLayoutRepository.java Thu Jul  7 23:08:58 2011
>> @@ -20,4 +20,6 @@ package org.apache.rave.portal.repositor
>>
>> import org.apache.rave.portal.model.PageLayout;
>>
>> -public interface PageLayoutRepository extends Repository<PageLayout> { }
>> \ No newline at end of file
>> +public interface PageLayoutRepository extends Repository<PageLayout> {
>> +        PageLayout getByPageLayoutCode(String codename);
>> +}
>> \ No newline at end of file
>>
>> Added:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageLayoutRepository.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/repository/impl/JpaPageLayoutRepository.java?rev=
>> 1144091&view=auto
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageLayoutRepository.java (added)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageLayoutRepository.java Thu Jul  7 23:08:58 2011
>> @@ -0,0 +1,59 @@
>> +/*
>> + * 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.rave.portal.repository.impl;
>> +
>> +import org.apache.commons.lang.NotImplementedException;
>> +import org.apache.rave.portal.model.PageLayout;
>> +import org.apache.rave.portal.repository.PageLayoutRepository;
>> +import org.springframework.stereotype.Repository;
>> +import org.springframework.transaction.annotation.Transactional;
>> +
>> +import javax.persistence.EntityManager;
>> +import javax.persistence.PersistenceContext;
>> +import javax.persistence.TypedQuery;
>> +
>> +import static
>> org.apache.rave.portal.repository.impl.util.JpaUtil.getSingleResult;
>> +import static
>> org.apache.rave.portal.repository.impl.util.JpaUtil.saveOrUpdate;
>> +
>> +/**
>> + */
>> +@Repository
>> +public class JpaPageLayoutRepository implements PageLayoutRepository{
>> +
>> +    @PersistenceContext
>> +    private EntityManager manager;
>> +
>> +    @Override
>> +    public PageLayout get(long layoutId) {
>> +        return manager.find(PageLayout.class, layoutId);
>> +    }
>> +
>> +        @Override
>> +        public PageLayout getByPageLayoutCode(String codename){
>> +                 TypedQuery<PageLayout>query =
>> manager.createNamedQuery("PageLayout.getByLayoutCode",PageLayout.class);
>> +                 query.setParameter("code",codename);
>> +                 return getSingleResult(query.getResultList());
>> +        }
>> +
>> +    @Override
>> +    public PageLayout save(PageLayout pageLayout) {
>> +                 return
>> saveOrUpdate(pageLayout.getId(),manager,pageLayout);
>> +    }
>> +}
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageRepository.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/repository/impl/JpaPageRepository.java?rev=114409
>> 1&r1=1144090&r2=1144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageRepository.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/repo
>> sitory/impl/JpaPageRepository.java Thu Jul  7 23:08:58 2011
>> @@ -29,6 +29,8 @@ import javax.persistence.PersistenceCont
>> import javax.persistence.TypedQuery;
>> import java.util.List;
>>
>> +import static
>> org.apache.rave.portal.repository.impl.util.JpaUtil.saveOrUpdate;
>> +
>> @Repository
>> public class JpaPageRepository implements PageRepository {
>>
>> @@ -49,6 +51,7 @@ public class JpaPageRepository implement
>>
>>     @Override
>>     public Page save(Page item) {
>> -        throw new NotImplementedException("Save is not implemented for
>> this repository");
>> +                 return saveOrUpdate(item.getId(),manager,item);
>> +                 //        throw new NotImplementedException("Save is
>> not implemented for this repository");
>>     }
>> }
>> \ No newline at end of file
>>
>> Added:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageLayoutService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/PageLayoutService.java?rev=1144091&view=a
>> uto
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageLayoutService.java (added)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageLayoutService.java Thu Jul  7 23:08:58 2011
>> @@ -0,0 +1,25 @@
>> +/*
>> + * 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.rave.portal.service;
>> +
>> +import org.apache.rave.portal.model.PageLayout;
>> +
>> +public interface PageLayoutService {
>> +        public PageLayout getPageLayoutByCode(String code);
>> +}
>> \ No newline at end of file
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/PageService.java?rev=1144091&r1=1144090&r
>> 2=1144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageService.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/PageService.java Thu Jul  7 23:08:58 2011
>> @@ -60,4 +60,10 @@ public interface PageService {
>>          * @return the updated Region. //TODO need to make sure this is
>> the right return.
>>          */
>>         Region removeWidgetFromPage(long regionWidgetId, long regionId);
>> +
>> +        /**
>> +         * Registers a new page.
>> +         * @param page the page object to register with the data
>> management system.
>> +         */
>> +        void registerNewPage(Page page);
>> }
>> \ No newline at end of file
>>
>> Added:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/RegionService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/RegionService.java?rev=1144091&view=auto
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/RegionService.java (added)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/RegionService.java Thu Jul  7 23:08:58 2011
>> @@ -0,0 +1,31 @@
>> +/*
>> + * 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.rave.portal.service;
>> +
>> +import org.apache.rave.portal.model.Region;
>> +
>> +public interface RegionService {
>> +
>> +        /**
>> +         * Register a new region
>> +         * @param region the region object to register
>> +         */
>> +        void registerNewRegion(Region region);
>> +
>> +}
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/UserService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/UserService.java?rev=1144091&r1=1144090&r
>> 2=1144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/UserService.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/UserService.java Thu Jul  7 23:08:58 2011
>> @@ -44,6 +44,17 @@ public interface UserService extends Use
>>
>>         /**
>>          * Registers a new user object.
>> +         * @param user the new user object to register with the data
>> management system.
>>          */
>>         void registerNewUser(User user);
>> +
>> +        /**
>> +         * Return the requested user object using the user's name.
>> +         */
>> +        User getUserByUsername(String userName);
>> +
>> +        /**
>> +         * Return a user object by the user ID.
>> +         */
>> +        User getUserById(Long id);
>> }
>> \ No newline at end of file
>>
>> Added:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageLayoutService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/impl/DefaultPageLayoutService.java?rev=11
>> 44091&view=auto
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageLayoutService.java (added)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageLayoutService.java Thu Jul  7 23:08:58 2011
>> @@ -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.rave.portal.service.impl;
>> +
>> +import org.apache.rave.portal.model.PageLayout;
>> +import org.apache.rave.portal.service.PageLayoutService;
>> +import org.apache.rave.portal.repository.PageLayoutRepository;
>> +import org.springframework.beans.factory.annotation.Autowired;
>> +import org.springframework.stereotype.Service;
>> +
>> +@Service
>> +public class DefaultPageLayoutService implements PageLayoutService {
>> +        private final PageLayoutRepository pageLayoutRepository;
>> +
>> +        @Autowired
>> +        public DefaultPageLayoutService(PageLayoutRepository
>> pageLayoutRepository) {
>> +                 this.pageLayoutRepository=pageLayoutRepository;
>> +        }
>> +
>> +        @Override
>> +        public PageLayout getPageLayoutByCode(String code) {
>> +                 return pageLayoutRepository.getByPageLayoutCode(code);
>> +        }
>> +}
>> +
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/impl/DefaultPageService.java?rev=1144091&
>> r1=1144090&r2=1144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageService.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultPageService.java Thu Jul  7 23:08:58 2011
>> @@ -68,7 +68,6 @@ public class DefaultPageService implemen
>>         @Override
>>         @Transactional
>>         public Region removeWidgetFromPage(long regionWidgetId, long
>> regionId){
>> -                 //TODO must implement.  Returns null for the time being.
>>         Region region = getFromRepository(regionId, regionRepository);
>>         return removeWidgetInstance(regionWidgetId, region);
>>         }
>> @@ -82,6 +81,12 @@ public class DefaultPageService implemen
>>         return createWidgetInstance(widget, region, 0);
>>     }
>>
>> +        @Override
>> +        @Transactional
>> +        public void registerNewPage(Page page) {
>> +                 pageRepository.save(page);
>> +        }
>> +
>>     private RegionWidget createWidgetInstance(Widget widget, Region
>> region, int position) {
>>         RegionWidget regionWidget = new RegionWidget();
>>         regionWidget.setRenderOrder(position);
>>
>> Added:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultRegionService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/impl/DefaultRegionService.java?rev=114409
>> 1&view=auto
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultRegionService.java (added)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultRegionService.java Thu Jul  7 23:08:58 2011
>> @@ -0,0 +1,45 @@
>> +/*
>> + * 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.rave.portal.service.impl;
>> +
>> +import org.apache.rave.portal.model.Region;
>> +import org.apache.rave.portal.service.RegionService;
>> +import org.apache.rave.portal.repository.RegionRepository;
>> +import org.springframework.beans.factory.annotation.Autowired;
>> +import org.springframework.stereotype.Service;
>> +import org.springframework.transaction.annotation.Transactional;
>> +
>> +@Service
>> +public class DefaultRegionService implements RegionService {
>> +
>> +        private final RegionRepository regionRepository;
>> +
>> +        @Autowired
>> +        public DefaultRegionService(RegionRepository regionRepository) {
>> +                 this.regionRepository = regionRepository;
>> +        }
>> +
>> +        @Override
>> +        @Transactional
>> +        public void registerNewRegion(Region region) {
>> +                 regionRepository.save(region);
>> +        }
>> +
>> +}
>> \ No newline at end of file
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultUserService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/service/impl/DefaultUserService.java?rev=1144091&
>> r1=1144090&r2=1144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultUserService.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/serv
>> ice/impl/DefaultUserService.java Thu Jul  7 23:08:58 2011
>> @@ -113,4 +113,14 @@ public class DefaultUserService implemen
>>         public void registerNewUser(User user) {
>>                  userRepository.save(user);
>>         }
>> +
>> +        @Override
>> +        public User getUserById(Long id) {
>> +                 return userRepository.get(id);
>> +        }
>> +
>> +        @Override
>> +        public User getUserByUsername(String userName){
>> +                 return userRepository.getByUsername(userName);
>> +        }
>> }
>> \ No newline at end of file
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>> controller/NewAccountController.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/jav
>> a/org/apache/rave/portal/web/controller/NewAccountController.java?rev=1144
>> 091&r1=1144090&r2=1144091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>> controller/NewAccountController.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/web/
>> controller/NewAccountController.java Thu Jul  7 23:08:58 2011
>> @@ -20,9 +20,15 @@
>> package org.apache.rave.portal.web.controller;
>>
>> import org.apache.rave.portal.service.UserService;
>> +import org.apache.rave.portal.service.PageService;
>> +import org.apache.rave.portal.service.PageLayoutService;
>> +import org.apache.rave.portal.service.RegionService;
>> import org.apache.rave.portal.web.util.ModelKeys;
>> import org.apache.rave.portal.web.util.ViewNames;
>> import org.apache.rave.portal.model.User;
>> +import org.apache.rave.portal.model.Page;
>> +import org.apache.rave.portal.model.PageLayout;
>> +import org.apache.rave.portal.model.Region;
>> import org.springframework.beans.factory.annotation.Autowired;
>> import org.springframework.stereotype.Controller;
>> import org.springframework.ui.Model;
>> @@ -30,22 +36,31 @@ import org.springframework.web.bind.anno
>> import org.springframework.web.bind.annotation.RequestMapping;
>> import org.springframework.web.bind.annotation.RequestMethod;
>> import org.springframework.web.bind.annotation.RequestParam;
>> -
>> +import java.util.List;
>> +import java.util.ArrayList;
>>
>> @Controller
>> @RequestMapping(value = { "/newaccount/*", "/newaccount" })
>> public class NewAccountController {
>>
>>     private final UserService userService;
>> -
>> +        private final PageService pageService;
>> +        private final PageLayoutService pageLayoutService;
>> +        private final RegionService regionService;
>> +
>>     @Autowired
>> -    public NewAccountController(UserService userService) {
>> +    public NewAccountController(UserService userService, PageService
>> pageService, PageLayoutService pageLayoutService, RegionService
>> regionService) {
>>         this.userService = userService;
>> +                 this.pageService = pageService;
>> +                 this.pageLayoutService = pageLayoutService;
>> +                 this.regionService = regionService;
>>     }
>>
>>     @RequestMapping(method = RequestMethod.POST)
>>         //Needs to be specified by action.
>> -    public String create(Model model, @RequestParam String userName,
>> @RequestParam String password) {
>> +        //TODO: have a more elegant way of adding a user
>> +        public String create(Model model, @RequestParam String userName,
>> @RequestParam String password) {
>> +        //Create a new user object and register it.
>>                  User user=new User();
>>                  user.setUsername(userName);
>>                  user.setPassword(password);
>> @@ -53,9 +68,31 @@ public class NewAccountController {
>>                  user.setLocked(false);
>>                  user.setEnabled(true);
>>                  userService.registerNewUser(user);
>> -
>> +
>> +                 //Return the newly registered user
>> +                 User
>> registeredUser=userService.getUserByUsername(userName);
>> +
>> +                 //Create a PageLayout object.  We will default to
>> +                 //the two-column layout
>> +                 PageLayout
>> pageLayout=pageLayoutService.getPageLayoutByCode("columns_2");
>> +
>> +                 //Create regions
>> +                 List<Region> regions=new ArrayList<Region>();
>> +                 Region region1=new Region();
>> +                 Region region2=new Region();
>> +                 regions.add(region1);
>> +                 regions.add(region2);
>> +
>> +                 //Create a Page object and register it.
>> +                 Page page=new Page();
>> +                 page.setName("main");
>> +                 page.setOwner(registeredUser);
>> +                 page.setPageLayout(pageLayout);
>> +                 page.setRenderSequence(1L);
>> +
>> page.setRegions(regions);
>> +                 pageService.registerNewPage(page);
>> +
>>         return "redirect:/";
>>     }
>> -
>>
>> }
>> \ No newline at end of file
>>
>> Modified:
>> incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>> l/PageTest.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/jav
>> a/org/apache/rave/portal/model/PageTest.java?rev=1144091&r1=1144090&r2=114
>> 4091&view=diff
>> ==========================================================================
>> ====
>> ---
>> incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>> l/PageTest.java (original)
>> +++
>> incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/mode
>> l/PageTest.java Thu Jul  7 23:08:58 2011
>> @@ -22,6 +22,7 @@ import org.junit.After;
>> import org.junit.Before;
>> import org.junit.Test;
>>
>> +
>> import java.util.ArrayList;
>> import java.util.List;
>>
>>
>>
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOGyueAAoJEEfVXEODPFIDLowH/3EeE1DCcu8z9XYG5C4QKXhi
oQKL7zK32Wdsgidht7sdPjRtDsN1MzODf/ERNKxMYZ3VMvnKEu4vdXZzDnCMCDpS
+XTliiNbGWDkn4JHp5voeYSbrJAzajCF3alsMHqyP7SyItCoCQ7HPKrUQTXNKBag
OAYkCa2Ja/C/RGQnTLDXQElbeJLuIG97cuBqNo//UmztGLn+UYN8sjGfha19Ek1Q
2h6ZowHNmd2xQMV7TKBg3Bv32DYsYI6NG9E8IjT1vxZVoIBtk2CuBdFJaE2o86Ad
5Vns6pwLv21o3P3XMQ1hRXEaS1mP7kDQ7AaPOdLpFxJR9A0Nxub4kpa7z2jVXCk=
=Bs8x
-----END PGP SIGNATURE-----