[jboss-svn-commits] JBL Code SVN: r18886 - in labs/jbosslabs/labs-3.0-build: core/core-model/src/main/java/org/jboss/labs/core/model and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Mar 12 10:49:19 EDT 2008
Author: wrzep
Date: 2008-03-12 10:49:19 -0400 (Wed, 12 Mar 2008)
New Revision: 18886
Added:
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddCompatibleLicense.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/LicenseServiceFactory.java
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/UpdateLicense.java
Removed:
labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/validator/UniqueLicenseNameValidator.java
Modified:
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/core/model/License.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/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceBean.java
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/webapp/META-INF/persistence.xml
labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/WEB-INF/components.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/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
Log:
JBLAB-915
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/core/service/LicenseService.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -41,4 +41,6 @@
License getLicenseByName(String licenseName) throws LicenseNotFoundException;
void addLicense(License license);
+
+ License updateLicense(License license);
}
\ No newline at end of file
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-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/core/core-model/src/main/java/org/jboss/labs/core/model/License.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -26,8 +26,10 @@
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
+import java.util.ArrayList;
@Entity
+ at Table(uniqueConstraints={@UniqueConstraint(columnNames={"name", "licenseVersion"})})
public class License implements Serializable {
@Id @GeneratedValue
private Integer id;
@@ -37,13 +39,12 @@
@ManyToMany(mappedBy = "licenseList")
private List<Project> projectList;
- @Column(unique = true)
private String name;
private String licenseVersion;
private String url;
@OneToMany
private List<License> compatibleLicensesList;
- private String agreementVersion;
+
@OneToOne
private License previousVersionLicense;
@OneToOne(mappedBy = "previousVersionLicense")
@@ -103,6 +104,9 @@
public List<License> getCompatibleLicensesList() {
+ if (compatibleLicensesList == null) {
+ setCompatibleLicensesList(new ArrayList<License>());
+ }
return compatibleLicensesList;
}
@@ -110,14 +114,6 @@
this.compatibleLicensesList = compatibleLicensesList;
}
- public void setAgreementVersion(String newagreementVersion) {
- this.agreementVersion = newagreementVersion;
- }
-
- public String getAgreementVersion() {
- return agreementVersion;
- }
-
public License getPreviousVersionLicense() {
return previousVersionLicense;
}
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/LicenseServiceBean.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -5,8 +5,6 @@
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;
@@ -18,7 +16,9 @@
@Stateless(name="LicenseService")
public class LicenseServiceBean implements LicenseService {
- @PersistenceContext(unitName = "core_model") private EntityManager em;
+ @PersistenceContext(unitName = "core_model")
+ //, type = PersistenceContextType.EXTENDED) \
+ private EntityManager em;
@SuppressWarnings("unchecked")
public List<License> getLicenses() {
@@ -34,8 +34,11 @@
}
}
- @TransactionAttribute(TransactionAttributeType.REQUIRED)
public void addLicense(License license) {
em.persist(license);
}
+
+ public License updateLicense(License license) {
+ return em.merge(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-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/services/project-service/src/main/java/org/jboss/labs/core/service/impl/ProjectServiceBean.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -24,7 +24,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 {
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddCompatibleLicense.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddCompatibleLicense.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddCompatibleLicense.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -0,0 +1,55 @@
+/*
+* 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.core.model.License;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.In;
+
+import java.io.Serializable;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
+ at Name("addCompatibleLicense")
+public class AddCompatibleLicense implements Serializable {
+
+ private Object compatibleLicense;
+ @In private License license;
+
+ private static final long serialVersionUID = -4903680348182905686L;
+
+ public void addCompatibleLicense() {
+ license.getCompatibleLicensesList().add(license);
+ }
+
+ public Object getCompatibleLicense() {
+ return compatibleLicense;
+ }
+
+ public void setCompatibleLicense(Object compatibleLicense) {
+ this.compatibleLicense = compatibleLicense;
+ }
+}
\ No newline at end of file
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/AddLicense.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -23,39 +23,39 @@
package org.jboss.labs.admin.action.license;
-import com.google.inject.Inject;
-import org.jboss.labs.core.model.Project;
+import org.jboss.labs.admin.Pages;
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.ScopeType;
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;
import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.core.Conversation;
+import javax.naming.NamingException;
+import java.io.Serializable;
+import java.util.List;
+
/**
* @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
*/
@Name("addLicense")
- at Guice
-public class AddLicense {
+public class AddLicense implements Serializable {
@In private Conversation conversation;
- @Out(scope = ScopeType.CONVERSATION) private License newLicense;
+ @Out(scope = ScopeType.CONVERSATION, required = false) private License newLicense;
- @Inject private LicenseService licenseService;
+ @In private List<License> licenses;
+ @In private LicenseService licenseService;
+
@In private FacesMessages facesMessages;
+
+ private static final long serialVersionUID = -8691237645254515935L;
@Begin(nested=true)
- public String addLicenseStart() {
+ public String addLicenseStart() throws NamingException {
conversation.setDescription("Add license");
@@ -64,13 +64,28 @@
return Pages.ADD_LICENSE_PAGE;
}
- @End
- public String addLicense(License license) {
+ // @End hadrcoded inside
+ public String addLicense(License license) throws NamingException {
+ for (License l : licenses) {
+ if (l.getName().equals(license.getName()) &&
+ (l.getLicenseVersion().equals(license.getLicenseVersion()))) {
+ facesMessages.add("License '" + license.getName()
+ + ", version " + license.getLicenseVersion() + "' already exsists.");
+
+ newLicense = license;
+
+ return null;
+ }
+ }
+
licenseService.addLicense(license);
+ licenses.add(license);
facesMessages.add("License has been added successfully.");
+ conversation.end();
+
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/LicenseServiceFactory.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/LicenseServiceFactory.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/LicenseServiceFactory.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -0,0 +1,46 @@
+/*
+* 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.injection.seam.Guice;
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.ScopeType;
+import com.google.inject.Inject;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
+ at Name("licenseServiceFactory")
+ at Guice
+public class LicenseServiceFactory {
+
+ @Inject private org.jboss.labs.core.service.LicenseService licenseService;
+
+ @Factory(value = "licenseService", scope = ScopeType.SESSION, autoCreate = true)
+ public org.jboss.labs.core.service.LicenseService getLicenseService() {
+ System.out.println("LicenseServiceFactory.getLicenseService");
+ return licenseService;
+ }
+}
\ No newline at end of file
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicense.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -23,17 +23,14 @@
package org.jboss.labs.admin.action.license;
-import com.google.inject.Inject;
-import org.jboss.labs.core.model.Project;
+import org.jboss.labs.admin.Pages;
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.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;
/**
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/ShowLicenses.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -24,16 +24,14 @@
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.ScopeType;
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;
@@ -41,12 +39,11 @@
* @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
*/
@Name("showLicenses")
- at Guice
public class ShowLicenses {
@In private Conversation conversation;
- @Inject private LicenseService licensesService;
+ @In private LicenseService licenseService;
@Out(scope = ScopeType.CONVERSATION) private List<License> licenses;
@@ -55,7 +52,7 @@
conversation.setDescription("Licenses");
- licenses = licensesService.getLicenses();
+ licenses = licenseService.getLicenses();
return Pages.LICENSES_PAGE;
}
Added: labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/UpdateLicense.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/UpdateLicense.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/action/license/UpdateLicense.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -0,0 +1,87 @@
+/*
+* 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.core.model.License;
+import org.jboss.labs.core.service.LicenseService;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.faces.FacesMessages;
+
+import javax.naming.NamingException;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Pawel Wrzeszcz (pwrzeszcz [at] jboss . org)
+ */
+
+ at Name("updateLicense")
+public class UpdateLicense implements Serializable {
+
+ @In private Conversation conversation;
+
+ @Out(scope = ScopeType.CONVERSATION, required = false) private License license;
+
+ @In private List<License> licenses;
+
+ @In private LicenseService licenseService;
+
+ @In private FacesMessages facesMessages;
+
+ private static final long serialVersionUID = -8691237645254515225L;
+
+ public String save(License license) throws NamingException {
+
+ for (License l : licenses) {
+ if (l.getName().equals(license.getName()) &&
+ (l.getLicenseVersion().equals(license.getLicenseVersion()))
+ && (!l.equals(license))) {
+
+ facesMessages.add("License '" + license.getName()
+ + ", version " + license.getLicenseVersion() + "' already exsists.");
+
+ this.license = license;
+
+ return null;
+ }
+ }
+
+ this.license = licenseService.updateLicense(license);
+
+ conversation.end();
+
+ facesMessages.add("License has been updated successfully.");
+
+ return Pages.LICENSES_PAGE;
+ }
+
+// @End
+// public String save(License license) throws NamingException {
+// apply(license);
+// return Pages.LICENSES_PAGE;
+// }
+}
\ No newline at end of file
Deleted: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/java/org/jboss/labs/admin/validator/UniqueLicenseNameValidator.java 2008-03-12 14:49:19 UTC (rev 18886)
@@ -1,63 +0,0 @@
-/*
-* 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/META-INF/persistence.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/META-INF/persistence.xml 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/META-INF/persistence.xml 2008-03-12 14:49:19 UTC (rev 18886)
@@ -13,6 +13,8 @@
<class>org.jboss.labs.core.model.admin.Request</class>
<class>org.jboss.labs.core.model.admin.ProjectRequest</class>
<class>org.jboss.labs.core.model.admin.JoinRequest</class>
+
+
</persistence-unit>
</persistence>
Modified: labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/WEB-INF/components.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/WEB-INF/components.xml 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/WEB-INF/components.xml 2008-03-12 14:49:19 UTC (rev 18886)
@@ -18,8 +18,8 @@
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd">
- <core:init debug="true" jndi-pattern="@jndiPattern@"/>
-
+ <core:init debug="true" jndi-pattern="@jndiPattern@" />
+
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
conversation-id-parameter="cid"/>
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-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/home.xhtml 2008-03-12 14:49:19 UTC (rev 18886)
@@ -16,10 +16,10 @@
<s:link value="Requests" action="#{showRequests.showRequests()}" />
</li>
<li>
- <s:link value="Projects" action="#{showProjects.showProjects()}"/>
+ <s:link value="Projects" action="#{showProjects.showProjects()}" />
</li>
<li>
- <s:link value="Licences" action="#{showLicenses.showLicenses()}" disabled="true"/>
+ <s:link value="Licences" action="#{showLicenses.showLicenses()}" />
</li>
</ul>
</h:form>
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/addLicense.xhtml 2008-03-12 14:49:19 UTC (rev 18886)
@@ -17,12 +17,17 @@
<th>Name:</th>
<td>
<h:inputText value="#{newLicense.name}"
- required="true" requiredMessage="License name is required">
- <f:validator validatorId="uniqueLicenseNameValidator"/>
- </h:inputText>
+ required="true" requiredMessage="License name is required"/>
</td>
</tr>
<tr>
+ <th>Version:</th>
+ <td>
+ <h:inputText value="#{newLicense.licenseVersion}"
+ required="true" requiredMessage="License version is required"/>
+ </td>
+ </tr>
+ <tr>
<th>URL:</th>
<td>
<h:inputText value="#{newLicense.url}" id="url"
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/license.xhtml 2008-03-12 14:49:19 UTC (rev 18886)
@@ -10,8 +10,64 @@
<ui:define name="body">
<h2>License</h2>
- <h:form id="mainForm">
- #{license.name}
+ <h:form id="mainForm">
+ <s:validateAll>
+ <table>
+ <tr>
+ <th>Name:</th>
+ <td>
+ <h:inputText value="#{license.name}"
+ required="true" requiredMessage="License name is required"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Version:</th>
+ <td>
+ <h:inputText value="#{license.licenseVersion}"
+ required="true" requiredMessage="License version is required"/>
+ </td>
+ </tr>
+ <tr>
+ <th>URL:</th>
+ <td>
+ <h:inputText value="#{license.url}" id="url"
+ required="true" requiredMessage="URL is required."/>
+ </td>
+ </tr>
+ </table>
+
+ Compatible licenses:
+ <h:dataTable value="#{l.compatibleLicensesList}" var="l" rendered="#{not empty l.compatibleLicensesList}">
+ <h:column>
+ <f:facet name="header">Name</f:facet>
+ #{l.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Version</f:facet>
+ #{l.licenseVersion}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Action</f:facet>
+ <h:commandLink value="delete" action="#{l.compatibleLicensesList.remove(l)}"/>
+ </h:column>
+ </h:dataTable>
+ <h:selectOneMenu value="#{addCompatibleLicense.compatibleLicense}">
+ <s:selectItems value="#{licenses}" var="x"
+ label="#{x.name} #{x.licenseVersion}"
+
+ noSelectionLabel="Please Select..."/>
+
+ </h:selectOneMenu>
+ <h:commandButton action="#{addCompatibleLicense.addCompatibleLicense()}" value="Add" disabled="true"/>
+ <br/>
+ <h:commandButton value="Save" action="#{updateLicense.save(license)}"/>
+ <ui:remove>
+ <h:commandButton value="Apply" action="#{updateLicense.apply(license)}" />
+ </ui:remove>
+ <s:button value="Cancel" action="/license/licenses.seam">
+ <s:conversationPropagation type="end"/>
+ </s:button>
+ </s:validateAll>
</h:form>
</ui:define>
</ui:composition>
Modified: 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 2008-03-12 13:57:39 UTC (rev 18885)
+++ labs/jbosslabs/labs-3.0-build/views/admin/src/main/webapp/license/licenses.xhtml 2008-03-12 14:49:19 UTC (rev 18886)
@@ -20,6 +20,13 @@
<h:column>
<f:facet name="header">Name</f:facet>
<h:outputText value="#{license.name} "/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Version</f:facet>
+ <h:outputText value="#{license.licenseVersion} "/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Action</f:facet>
<h:commandLink value="[edit]" action="#{showLicense.showLicense(license)}"/>
</h:column>
</h:dataTable>
More information about the jboss-svn-commits
mailing list