[seam-commits] Seam SVN: r10688 - in branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks: entity and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 28 18:45:14 EDT 2009


Author: jharting
Date: 2009-04-28 18:45:14 -0400 (Tue, 28 Apr 2009)
New Revision: 10688

Removed:
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/UserHome.java
Modified:
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/Authenticator.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ContextHome.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ResourceNotFoundException.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/TaskHome.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Context.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Task.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/User.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/resource/UserResourceHome.java
   branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/test/UserFactory.java
Log:
seam tasks example server part

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/Authenticator.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/Authenticator.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/Authenticator.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks;
 
 import javax.persistence.EntityManager;
@@ -4,10 +25,12 @@
 
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Out;
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.example.tasks.entity.User;
+import org.jboss.seam.log.Log;
 import org.jboss.seam.security.Credentials;
 import org.jboss.seam.security.Identity;
 
@@ -31,6 +54,8 @@
    private EntityManager entityManager;
    @Out(scope = ScopeType.SESSION)
    private User user;
+   @Logger
+   private Log log;
 
    public boolean authenticate()
    {
@@ -39,6 +64,7 @@
       {
          if (user.isAdmin())
          {
+            log.info("Admin rights granted for {0}", user.getUsername());
             identity.addRole("admin");
          }
          return true;

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ContextHome.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ContextHome.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ContextHome.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks;
 
 import org.jboss.seam.annotations.AutoCreate;
@@ -5,6 +26,11 @@
 import org.jboss.seam.example.tasks.entity.Context;
 import org.jboss.seam.framework.EntityHome;
 
+/**
+ * 
+ * @author Jozef Hartinger
+ *
+ */
 @Name("contextHome")
 @AutoCreate
 public class ContextHome extends EntityHome<Context>

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ResourceNotFoundException.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ResourceNotFoundException.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/ResourceNotFoundException.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks;
 
 /**

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/TaskHome.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/TaskHome.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/TaskHome.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks;
 
 import org.jboss.seam.annotations.AutoCreate;
@@ -5,6 +26,11 @@
 import org.jboss.seam.example.tasks.entity.Task;
 import org.jboss.seam.framework.EntityHome;
 
+/**
+ * 
+ * @author Jozef Hartinger
+ *
+ */
 @Name("taskHome")
 @AutoCreate
 public class TaskHome extends EntityHome<Task>

Deleted: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/UserHome.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/UserHome.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/UserHome.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,13 +0,0 @@
-package org.jboss.seam.example.tasks;
-
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.example.tasks.entity.User;
-import org.jboss.seam.framework.EntityHome;
-
- at Name("userHome")
- at AutoCreate
-public class UserHome extends EntityHome<User>
-{
-
-}

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Context.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Context.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Context.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks.entity;
 
 import java.util.List;
@@ -16,6 +37,11 @@
 
 import org.hibernate.validator.NotNull;
 
+/**
+ * 
+ * @author Jozef Hartinger
+ *
+ */
 @Entity
 @XmlRootElement
 @Table(uniqueConstraints = @UniqueConstraint(columnNames = { "NAME", "OWNER_USERNAME" }))

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Task.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Task.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/Task.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks.entity;
 
 import java.util.Date;
@@ -16,6 +37,11 @@
 
 import org.hibernate.validator.NotNull;
 
+/**
+ * 
+ * @author Jozef Hartinger
+ *
+ */
 @Entity
 @XmlRootElement
 @NamedQuery(name="taskByNameAndContext", query="select task from Task task where task.name like :task and task.context.id = :context")

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/User.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/User.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/entity/User.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks.entity;
 
 import java.util.List;
@@ -10,6 +31,11 @@
 
 import org.hibernate.validator.NotNull;
 
+/**
+ * 
+ * @author Jozef Hartinger
+ *
+ */
 @Entity
 @XmlRootElement
 public class User

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/resource/UserResourceHome.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/resource/UserResourceHome.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/resource/UserResourceHome.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -25,8 +25,7 @@
 
 import org.jboss.seam.annotations.In;
 import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.security.Admin;
-import org.jboss.seam.example.tasks.UserHome;
+import org.jboss.seam.annotations.security.Restrict;
 import org.jboss.seam.example.tasks.entity.User;
 import org.jboss.seam.framework.EntityHome;
 import org.jboss.seam.resteasy.ResourceHome;
@@ -41,7 +40,7 @@
  */
 @Path("/auth/user")
 @Name("userResourceHome")
- at Admin
+ at Restrict("#{s:hasRole('admin')}")
 public class UserResourceHome extends ResourceHome<User, String>
 {
 
@@ -50,8 +49,8 @@
       setMediaTypes(new String[] { "application/xml", "application/json", "application/fastinfoset" });
    }
 
-   @In
-   private UserHome userHome;
+   @In()
+   private EntityHome<User> userHome;
 
    @Override
    public EntityHome getEntityHome()

Modified: branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/test/UserFactory.java
===================================================================
--- branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/test/UserFactory.java	2009-04-28 22:41:24 UTC (rev 10687)
+++ branches/community/Seam_2_1/examples/tasks/src/main/org/jboss/seam/example/tasks/test/UserFactory.java	2009-04-28 22:45:14 UTC (rev 10688)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.seam.example.tasks.test;
 
 import org.jboss.seam.annotations.Factory;
@@ -3,6 +24,6 @@
 import org.jboss.seam.annotations.In;
 import org.jboss.seam.annotations.Name;
-import org.jboss.seam.example.tasks.UserHome;
 import org.jboss.seam.example.tasks.entity.User;
+import org.jboss.seam.framework.EntityHome;
 
 /**
@@ -16,7 +37,7 @@
 public class UserFactory
 {
 
-   @In private UserHome userHome;
+   @In private EntityHome<User> userHome;
    
    @Factory(autoCreate=true, value="user")
    public User getDemo() {




More information about the seam-commits mailing list