Skip to content

Commit

Permalink
format source
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux authored and jharting committed Mar 26, 2011
1 parent 9b79f29 commit 78e52aa
Show file tree
Hide file tree
Showing 56 changed files with 2,849 additions and 3,094 deletions.
810 changes: 405 additions & 405 deletions booking/pom.xml

Large diffs are not rendered by default.

41 changes: 21 additions & 20 deletions booking/src/main/assembly/assembly.xml
@@ -1,22 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<formats>
<format>zip</format>
</formats>
<baseDirectory>${project.build.finalName}</baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<excludes>
<exclude>${project.build.directory}/**</exclude>
<exclude>.classpath</exclude>
<exclude>.project</exclude>
<exclude>.settings/**</exclude>
<exclude>src/main/assembly/**</exclude>
</excludes>
</fileSet>
</fileSets>
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<formats>
<format>zip</format>
</formats>
<baseDirectory>${project.build.finalName}</baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<excludes>
<exclude>${project.build.directory}/**</exclude>
<exclude>.classpath</exclude>
<exclude>.project</exclude>
<exclude>.settings/**</exclude>
<exclude>src/main/assembly/**</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
@@ -1,23 +1,18 @@
/*
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc., and individual contributors
* Copyright 2010, 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.
* Licensed 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.jboss.seam.examples.booking.account;

Expand All @@ -37,10 +32,11 @@
* A qualifier, which indicates that the user has been sucessfully authenticated
*
* @author pmuir
*
*
*/
@Target({ TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
public @interface Authenticated {}
public @interface Authenticated {
}
@@ -1,23 +1,18 @@
/*
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc., and individual contributors
* Copyright 2010, 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.
* Licensed 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.jboss.seam.examples.booking.account;

Expand All @@ -34,42 +29,34 @@
import org.jboss.seam.international.status.builder.BundleTemplateMessage;

/**
* Validate that both the password fields contain the same value. Implements the
* classic pasword change validation.
* Validate that both the password fields contain the same value. Implements the classic pasword change validation.
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
@FacesValidator("confirmPasswordValidator")
public class ConfirmPasswordValidator implements Validator
{
@Inject
private BundleTemplateMessage messageBuilder;

@Inject @InputField
private String newPassword;

@Inject @InputField
private String confirmPassword;



public void validate(final FacesContext ctx, final UIComponent form, final Object components)
throws ValidatorException{

if (newPassword == null || confirmPassword == null) {
throw new ValidatorException(new FacesMessage(messageBuilder.key(new DefaultBundleKey("null_fields"))
.defaults("null fields is forbidden")
.build().getText()));
}
if ((newPassword != null) && !newPassword.equals(confirmPassword))
{
throw new ValidatorException(new FacesMessage(messageBuilder.key(new DefaultBundleKey("account_passwordsDoNotMatch"))
.defaults("Passwords do not match")
.build().getText()));
}
}



public class ConfirmPasswordValidator implements Validator {
@Inject
private BundleTemplateMessage messageBuilder;

@Inject
@InputField
private String newPassword;

@Inject
@InputField
private String confirmPassword;

public void validate(final FacesContext ctx, final UIComponent form, final Object components) throws ValidatorException {

if (newPassword == null || confirmPassword == null) {
throw new ValidatorException(new FacesMessage(messageBuilder.key(new DefaultBundleKey("null_fields"))
.defaults("null fields is forbidden").build().getText()));
}
if ((newPassword != null) && !newPassword.equals(confirmPassword)) {
throw new ValidatorException(new FacesMessage(messageBuilder
.key(new DefaultBundleKey("account_passwordsDoNotMatch")).defaults("Passwords do not match").build()
.getText()));
}
}

}
@@ -1,23 +1,18 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc., and individual contributors
* Copyright 2010, 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.
* Licensed 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.jboss.seam.examples.booking.account;

Expand All @@ -35,38 +30,33 @@
import org.jboss.seam.international.status.builder.BundleTemplateMessage;

/**
* A JSF Validator, used to check that the password the user submits matches
* that on record.
* A JSF Validator, used to check that the password the user submits matches that on record.
*
* @author Dan Allen
* @author <a href="http://community.jboss.org/people/dan.j.allen">Dan Allen</a>
*/
@FacesValidator("currentPassword")
public class CurrentPasswordValidator implements Validator
{
@Inject
private BundleTemplateMessage messageBuilder;
public class CurrentPasswordValidator implements Validator {
@Inject
private BundleTemplateMessage messageBuilder;

@Inject
@Authenticated
private User currentUser;

@Inject
Messages messages;

@Inject @Authenticated
private User currentUser;

@Inject
Messages messages;
public void validate(final FacesContext ctx, final UIComponent comp, final Object value) throws ValidatorException {
String currentPassword = (String) value;
if ((currentUser.getPassword() != null) && !currentUser.getPassword().equals(currentPassword)) {
/*
* FIXME: This is an ugly way to put i18n in FacesMessages: https://jira.jboss.org/browse/SEAMFACES-24
*/

public void validate(final FacesContext ctx, final UIComponent comp, final Object value) throws ValidatorException
{
String currentPassword = (String) value;
if ((currentUser.getPassword() != null) && !currentUser.getPassword().equals(currentPassword))
{
/*
* FIXME:
* This is an ugly way to put i18n in FacesMessages:
* https://jira.jboss.org/browse/SEAMFACES-24
*/

throw new ValidatorException(new FacesMessage(messageBuilder.key(new DefaultBundleKey("account_passwordsDoNotMatch"))
.defaults("Passwords do not match")
.build().getText()));
}
}
throw new ValidatorException(new FacesMessage(messageBuilder
.key(new DefaultBundleKey("account_passwordsDoNotMatch")).defaults("Passwords do not match").build()
.getText()));
}
}

}
@@ -1,23 +1,18 @@
/*
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc., and individual contributors
* Copyright 2010, 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.
* Licensed 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.jboss.seam.examples.booking.account;

Expand All @@ -33,25 +28,25 @@
/**
* Exposes the currently logged in user
*
* @author Dan Allen
* @author <a href="http://community.jboss.org/people/dan.j.allen">Dan Allen</a>
*/
@Stateful @SessionScoped
public class CurrentUserManager
{
private User currentUser;
@Stateful
@SessionScoped
public class CurrentUserManager {
private User currentUser;

@Produces @Authenticated @Named("currentUser")
public User getCurrentAccount()
{
return currentUser;
}
@Produces
@Authenticated
@Named("currentUser")
public User getCurrentAccount() {
return currentUser;
}

// Injecting HttpServletRequest instead of HttpSession as the latter conflicts with a Weld bean on GlassFish 3.0.1
public void onLogin(@Observes @Authenticated User user, HttpServletRequest request)
{
currentUser = user;
// reward authenticated users with a longer session
// default is kept short to prevent search engines from driving up # of sessions
request.getSession().setMaxInactiveInterval(3600);
}
// Injecting HttpServletRequest instead of HttpSession as the latter conflicts with a Weld bean on GlassFish 3.0.1
public void onLogin(@Observes @Authenticated User user, HttpServletRequest request) {
currentUser = user;
// reward authenticated users with a longer session
// default is kept short to prevent search engines from driving up # of sessions
request.getSession().setMaxInactiveInterval(3600);
}
}

0 comments on commit 78e52aa

Please sign in to comment.