[jboss-svn-commits] JBL Code SVN: r18659 - in labs/jbosslabs/labs-3.0-build: core/core-api/src/main/java/org/jboss/labs/injection and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Mar 3 08:45:03 EST 2008
Author: wrzep
Date: 2008-03-03 08:45:02 -0500 (Mon, 03 Mar 2008)
New Revision: 18659
Added:
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/LicenseService.java
labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/exception/admin/LicenseNotFoundException.java
labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/LicenseServiceBean.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddLicense.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicense.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicenses.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/validator/UniqueLicenseNameValidator.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/addLicense.xhtml
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/license.xhtml
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/licenses.xhtml
Modified:
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/ProjectService.java
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/injection/LabsGuiceModule.java
labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/License.java
labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceBean.java
labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceEventListenerBean.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/Pages.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/hibernate.cfg.xml
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/home.xhtml
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/jbpm.cfg.xml
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/createProject.xhtml
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/projects.xhtml
Log:
JBLAB-904 Eventually fixed nested jdbc connection issue.
JBLAB-915 licenses mgmt stuff
Added: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/LicenseService.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/LicenseService.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/LicenseService.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,44 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.core.service;
+
+import org.jboss.labs.core.model.License;
+import org.jboss.labs.exception.admin.LicenseNotFoundException;
+
+import javax.ejb.Local;
+import java.util.List;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
+ at Local
+public interface LicenseService {
+
+ public List<License> getLicenses();
+
+ License getLicenseByName(String licenseName) throws LicenseNotFoundException;
+
+ void addLicense(License license);
+}
\ No newline at end of file
Modified: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/ProjectService.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/ProjectService.java 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/ProjectService.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -37,6 +37,10 @@
import javax.ejb.Local;
import java.util.List;
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
@Local
public interface ProjectService {
@@ -46,15 +50,15 @@
public Project getProject(String projectId) throws ProjectNotFoundException;
- Project merge(Project project);
+ public Project merge(Project project);
- void createProject(ProjectRequest projectRequest) throws CreateProjectException, LabsRollbackException;
+ public void createProject(ProjectRequest projectRequest) throws CreateProjectException, LabsRollbackException;
- boolean canJoin(String name, Project project);
+ public boolean canJoin(String name, Project project);
- List<ContributorAgreement> getCAsRequiredToJoin(String name, Project project);
+ public List<ContributorAgreement> getCAsRequiredToJoin(String name, Project project);
- void addUserToProject(JoinRequest joinRequest) throws NoSuchUserException, LabsRollbackException;
+ public void addUserToProject(JoinRequest joinRequest) throws NoSuchUserException, LabsRollbackException;
- Project promoteToLead(String projectId, String username) throws NoSuchUserException, LabsRollbackException;
+ public Project promoteToLead(String projectId, String username) throws NoSuchUserException, LabsRollbackException;
}
Modified: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/injection/LabsGuiceModule.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/injection/LabsGuiceModule.java 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/injection/LabsGuiceModule.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -28,6 +28,7 @@
import org.jboss.labs.auth.UserService;
import org.jboss.labs.auth.RoleBinderService;
import org.jboss.labs.core.service.ProjectService;
+import org.jboss.labs.core.service.LicenseService;
import org.jboss.labs.foo.FooService;
public class LabsGuiceModule implements Module {
@@ -38,6 +39,7 @@
binder.bind(AuthenticationService.class).toProvider(new JNDIProvider<AuthenticationService>("AuthenticationServiceImpl/local"));
binder.bind(ProjectService.class).toProvider(new JNDIProvider<ProjectService>("ProjectService/local"));
binder.bind(UserService.class).toProvider(new JNDIProvider<UserService>("UserServiceImpl/local"));
+ binder.bind(LicenseService.class).toProvider(new JNDIProvider<LicenseService>("LicenseService/local"));
}
}
Modified: labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/License.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/License.java 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/License.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -36,7 +36,8 @@
@ManyToMany(mappedBy = "licenseList")
private List<Project> projectList;
-
+
+ @Column(unique = true)
private String name;
private String licenseVersion;
private String url;
@@ -47,6 +48,7 @@
private License previousVersionLicense;
@OneToOne(mappedBy = "previousVersionLicense")
private License nextVersionLicense;
+ private static final long serialVersionUID = 9177530126586603818L;
public License() {
}
Added: labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/exception/admin/LicenseNotFoundException.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/exception/admin/LicenseNotFoundException.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/exception/admin/LicenseNotFoundException.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,42 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.exception.admin;
+
+import org.jboss.labs.exception.LabsException;
+import org.jboss.labs.exception.LabsRollbackException;
+
+import javax.ejb.ApplicationException;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+ at ApplicationException(rollback = true)
+public class LicenseNotFoundException extends LabsRollbackException {
+
+ private static final long serialVersionUID = 4183531789003701360L;
+
+ public LicenseNotFoundException(String msg) {
+ super(msg);
+ }
+}
\ No newline at end of file
Added: labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/LicenseServiceBean.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/LicenseServiceBean.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/LicenseServiceBean.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,41 @@
+package org.jboss.labs.core.service.impl;
+
+import org.jboss.labs.core.model.License;
+import org.jboss.labs.core.service.LicenseService;
+import org.jboss.labs.exception.admin.LicenseNotFoundException;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import java.util.List;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
+ at Stateless(name="LicenseService")
+public class LicenseServiceBean implements LicenseService {
+
+ @PersistenceContext(unitName = "core_model") private EntityManager em;
+
+ @SuppressWarnings("unchecked")
+ public List<License> getLicenses() {
+ return em.createQuery("SELECT l FROM License l").getResultList();
+ }
+
+ public License getLicenseByName(String licenseName) throws LicenseNotFoundException {
+ try {
+ return (License) em.createQuery("SELECT l FROM License l WHERE l.name = :name")
+ .setParameter("name", licenseName).getSingleResult();
+ } catch (Exception e) {
+ throw new LicenseNotFoundException(licenseName);
+ }
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public void addLicense(License license) {
+ em.persist(license);
+ }
+}
\ No newline at end of file
Modified: labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceBean.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceBean.java 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceBean.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -25,7 +25,7 @@
@Stateful(name="ProjectService")
@WebService(endpointInterface="org.jboss.labs.core.service.ProjectWebService")
- at Interceptors({LabsInjectionInterceptor.class})
+//@Interceptors({LabsInjectionInterceptor.class})
public class ProjectServiceBean implements ProjectService {
// ProjectServiceWebService {
Modified: labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceEventListenerBean.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceEventListenerBean.java 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceEventListenerBean.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -78,15 +78,15 @@
log.debug("Added project lead: " + username + " project: " + projectId);
// TODO uncomment when auth start working properly
-// try {
-// roleBinderService.grantUserProjectSuperrole(
-// userService.getUserByLogin(username),
-// projectId);
-// } catch (NoSuchUserException e) {
-// // shouldn't happen
-// throw new IllegalStateException(e);
-// }
-// log.debug("Project superrole granted: " + username + " project: " + projectId);
+ try {
+ roleBinderService.grantUserProjectSuperrole(
+ userService.getUserByLogin(username),
+ projectId);
+ } catch (NoSuchUserException e) {
+ // shouldn't happen
+ throw new IllegalStateException(e);
+ }
+ log.debug("Project superrole granted: " + username + " project: " + projectId);
}
public void projectContributorAdded(String username, String projectId) {
Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/Pages.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/Pages.java 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/Pages.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -28,14 +28,17 @@
*/
public class Pages {
- public static final String PROJECT_PREFIX = "/project";
- private static final String USER_PREFIX = "/user";
- private static final String EMAIL_PREFIX = "email";
+ public static final String PROJECT_PREFIX = "/project";
+ public static final String USER_PREFIX = "/user";
+ public static final String EMAIL_PREFIX = "/email";
+ public static final String LICENSE_PREFIX = "/license";
public static final String CONFIRMATION_PAGE = "/confirmation.seam";
public static final String HOME_PAGE = "/home.seam";
public static final String ERROR_PAGE = "/error.seam";
+ public static final String NOTIFICATIONS_PAGE = "/notifications.seam";
+
public static final String CREATE_PROJECT_PAGE = PROJECT_PREFIX + "/createProject.seam";
public static final String TICKET_PAGE = PROJECT_PREFIX + "/ticket.seam";
public static final String PROJECT_PAGE = PROJECT_PREFIX + "/project.seam";
@@ -51,5 +54,7 @@
public static final String EMAIL_JIRA_REQUEST = EMAIL_PREFIX + "/jiraRequest.xhtml";
- public static final String NOTIFICATIONS_PAGE = "/notifications.seam";
+ public static final String LICENSES_PAGE = LICENSE_PREFIX + "/licenses.seam";
+ public static final String LICENSE_PAGE = LICENSE_PREFIX + "/license.seam";
+ public static final String ADD_LICENSE_PAGE = LICENSE_PREFIX + "/addLicense.seam";
}
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddLicense.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddLicense.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddLicense.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,76 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.admin.action.license;
+
+import com.google.inject.Inject;
+import org.jboss.labs.core.model.Project;
+import org.jboss.labs.core.model.License;
+import org.jboss.labs.core.service.ProjectService;
+import org.jboss.labs.core.service.LicenseService;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.labs.exception.admin.ProjectNotFoundException;
+import org.jboss.labs.admin.Pages;
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.core.Conversation;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
+ at Name("addLicense")
+ at Guice
+public class AddLicense {
+
+ @In private Conversation conversation;
+
+ @Out(scope = ScopeType.CONVERSATION) private License newLicense;
+
+ @Inject private LicenseService licenseService;
+
+ @In private FacesMessages facesMessages;
+
+ @Begin(nested=true)
+ public String addLicenseStart() {
+
+ conversation.setDescription("Add license");
+
+ newLicense = new License();
+
+ return Pages.ADD_LICENSE_PAGE;
+ }
+
+ @End
+ public String addLicense(License license) {
+
+ licenseService.addLicense(license);
+
+ facesMessages.add("License has been added successfully.");
+
+ return Pages.LICENSES_PAGE;
+ }
+}
\ No newline at end of file
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicense.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicense.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicense.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,59 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.admin.action.license;
+
+import com.google.inject.Inject;
+import org.jboss.labs.core.model.Project;
+import org.jboss.labs.core.model.License;
+import org.jboss.labs.core.service.ProjectService;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.labs.exception.admin.ProjectNotFoundException;
+import org.jboss.labs.admin.Pages;
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.core.Conversation;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
+ at Name("showLicense")
+public class ShowLicense {
+
+ @Out(scope = ScopeType.CONVERSATION) private License license;
+
+ @In private Conversation conversation;
+
+ @Begin(nested=true)
+ public String showLicense(License license) throws ProjectNotFoundException {
+
+ this.license = license;
+
+ conversation.setDescription(license.getName());
+
+ return Pages.LICENSE_PAGE;
+ }
+}
\ No newline at end of file
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicenses.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicenses.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicenses.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,62 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.admin.action.license;
+
+import org.jboss.labs.admin.Pages;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.labs.core.model.License;
+import org.jboss.labs.core.service.LicenseService;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.ScopeType;
+import com.google.inject.Inject;
+
+import java.util.List;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+ at Name("showLicenses")
+ at Guice
+public class ShowLicenses {
+
+ @In private Conversation conversation;
+
+ @Inject private LicenseService licensesService;
+
+ @Out(scope = ScopeType.CONVERSATION) private List<License> licenses;
+
+ @Begin
+ public String showLicenses() {
+
+ conversation.setDescription("Licenses");
+
+ licenses = licensesService.getLicenses();
+
+ return Pages.LICENSES_PAGE;
+ }
+}
\ No newline at end of file
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/validator/UniqueLicenseNameValidator.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/validator/UniqueLicenseNameValidator.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/validator/UniqueLicenseNameValidator.java 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,63 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.admin.validator;
+
+import com.google.inject.Inject;
+import org.jboss.labs.core.service.ProjectService;
+import org.jboss.labs.core.service.LicenseService;
+import org.jboss.labs.exception.admin.ProjectNotFoundException;
+import org.jboss.labs.exception.admin.LicenseNotFoundException;
+import org.jboss.labs.injection.seam.Guice;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.faces.Validator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+ at Name("uniqueLicenseNameValidator")
+ at Validator
+ at Guice
+public class UniqueLicenseNameValidator implements javax.faces.validator.Validator {
+
+ @Inject private LicenseService licenseService;
+
+ public void validate(FacesContext facesContext, UIComponent uiComponent, Object o) throws ValidatorException {
+
+ String licenseName = (String) o;
+
+ try {
+ licenseService.getLicenseByName(licenseName);
+ } catch (LicenseNotFoundException e) {
+ // do nothing
+ return;
+ }
+
+ throw new ValidatorException(new FacesMessage("License '" + licenseName + "' already exsists."));
+ }
+}
\ No newline at end of file
Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/hibernate.cfg.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/hibernate.cfg.xml 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/hibernate.cfg.xml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -12,7 +12,8 @@
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <property name="hbm2ddl.auto">update</property>
+ <property name="hbm2ddl.auto">update</property>
+
<!--property name="transaction.flush_before_completion">true</property-->
<!-- ############################################ -->
Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/home.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/home.xhtml 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/home.xhtml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -13,9 +13,14 @@
<h:form id="mainForm">
<ul>
<li>
- <s:link value="Notifications" action="#{showNotifications.showNotifications}" />
+ <s:link value="Notifications" action="#{showNotifications.showNotifications()}" />
</li>
- <li><s:link value="Projects" action="#{showProjects.showProjects}"/></li>
+ <li>
+ <s:link value="Projects" action="#{showProjects.showProjects()}"/>
+ </li>
+ <li>
+ <s:link value="Licences" action="#{showLicenses.showLicenses()}"/>
+ </li>
</ul>
</h:form>
</ui:define>
Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/jbpm.cfg.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/jbpm.cfg.xml 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/jbpm.cfg.xml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -10,9 +10,11 @@
</service>
<service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
<service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
- <!--<service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />-->
+ <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
<service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
<service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
</jbpm-context>
+ <string name='resource.hibernate.cfg.xml' value='hibernate.cfg.xml' />
+
</jbpm-configuration>
\ No newline at end of file
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/addLicense.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/addLicense.xhtml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/addLicense.xhtml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,40 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ template="../layout/template.xhtml">
+
+<ui:define name="body">
+ <h2>Add License</h2>
+ <h:form id="mainForm">
+ <s:validateAll>
+ <table>
+ <tr>
+ <th>Name:</th>
+ <td>
+ <h:inputText value="#{newLicense.name}"
+ required="true" requiredMessage="License name is required">
+ <f:validator validatorId="uniqueLicenseNameValidator"/>
+ </h:inputText>
+ </td>
+ </tr>
+ <tr>
+ <th>URL:</th>
+ <td>
+ <h:inputText value="#{newLicense.url}" id="url"
+ required="true" requiredMessage="URL is required."/>
+ </td>
+ </tr>
+ </table>
+ <h:commandButton value="Add" action="#{addLicense.addLicense(newLicense)}"/>
+ <s:button value="Cancel" action="/license/licenses.seam">
+ <s:conversationPropagation type="end"/>
+ </s:button>
+ </s:validateAll>
+ </h:form>
+</ui:define>
+</ui:composition>
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/license.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/license.xhtml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/license.xhtml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,17 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ template="../layout/template.xhtml">
+
+<ui:define name="body">
+ <h2>License</h2>
+ <h:form id="mainForm">
+ #{license.name}
+ </h:form>
+</ui:define>
+</ui:composition>
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/licenses.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/licenses.xhtml (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/licenses.xhtml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -0,0 +1,28 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ template="../layout/template.xhtml">
+
+<ui:define name="body">
+ <h2>Licenses</h2>
+ <h:form id="mainForm">
+ <h:commandButton action="#{addLicense.addLicenseStart()}" value="Add license" />
+ <br/>
+ <h:dataTable value="#{licenses}"
+ rendered="#{! empty licenses}"
+ var="license">
+ <f:facet name="header">Licenses</f:facet>
+ <h:column>
+ <f:facet name="header">Name</f:facet>
+ <h:outputText value="#{license.name} "/>
+ <h:commandLink value="[edit]" action="#{showLicense.showLicense(license)}"/>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+</ui:define>
+</ui:composition>
Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/createProject.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/createProject.xhtml 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/createProject.xhtml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -35,11 +35,13 @@
<th>Project ID:</th>
<td>
<h:inputText value="#{req.projectId}" id="projectId" required="true" requiredMessage="Project ID is required.">
- <f:validator validatorId="uniqueProjectIdValidator"/>
+ <ui:remove>
+ <f:validator validatorId="uniqueProjectIdValidator"/>
+ </ui:remove>
</h:inputText>
</td>
</tr>
- <tr>
+ <tr>
<th>JIRA key:</th>
<td><h:inputText value="#{req.jiraKey}" id="jiraKey" required="true" requiredMessage="JIRA key is required."/></td>
</tr>
Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/projects.xhtml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/projects.xhtml 2008-03-03 10:57:05 UTC (rev 18658)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/project/projects.xhtml 2008-03-03 13:45:02 UTC (rev 18659)
@@ -23,7 +23,9 @@
</h:column>
<h:column>
<f:facet name="header">Name</f:facet>
- <h:commandLink value="#{project.name}" action="#{viewProject.view(project.projectId)}"/>
+ <h:outputText value="#{project.name} "/>
+ <h:commandLink value="[edit]" action="#{viewProject.view(project.projectId)}"
+ rendered="#{true}"/>
</h:column>
</h:dataTable>
</h:form>
More information about the jboss-svn-commits
mailing list