Skip to content

Commit

Permalink
Apply formatting changes in examples modules
Browse files Browse the repository at this point in the history
  • Loading branch information
manovotn committed Oct 5, 2023
1 parent e26c6b5 commit 95f2fca
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package org.jboss.weld.examples.login;

import java.util.List;
import java.util.logging.Logger;

import jakarta.ejb.Stateful;
import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Alternative;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.persistence.EntityManager;
import java.util.List;
import java.util.logging.Logger;

@Named("userManager")
@RequestScoped
Expand All @@ -33,7 +34,7 @@ public List<Person> getUsers() throws Exception {
}

public String addUser() throws Exception {
if(newUser.getName().isEmpty() || newUser.getUsername().isEmpty() || newUser.getPassword().isEmpty()){
if (newUser.getName().isEmpty() || newUser.getUsername().isEmpty() || newUser.getPassword().isEmpty()) {
return "/users.xhtml?faces-redirect=true";
}
userDatabase.persist(newUser);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package org.jboss.weld.examples.login;

import jakarta.inject.Qualifier;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import jakarta.inject.Qualifier;

@Retention(RetentionPolicy.RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
@Target({ TYPE, METHOD, FIELD, PARAMETER })
@Qualifier
public @interface LoggedIn {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.jboss.weld.examples.login;

import java.io.Serializable;
import java.util.List;

import jakarta.enterprise.context.SessionScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.faces.application.FacesMessage;
Expand All @@ -8,8 +11,6 @@
import jakarta.inject.Named;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.io.Serializable;
import java.util.List;

@SessionScoped
@Named
Expand All @@ -28,7 +29,10 @@ public class Login implements Serializable {
@SuppressWarnings("unchecked")
public void login() {

List<Person> results = userDatabase.createQuery("select u from Person u where u.username=:username and u.password=:password").setParameter("username", credentials.getUsername()).setParameter("password", credentials.getPassword()).getResultList();
List<Person> results = userDatabase
.createQuery("select u from Person u where u.username=:username and u.password=:password")
.setParameter("username", credentials.getUsername()).setParameter("password", credentials.getPassword())
.getResultList();

if (!results.isEmpty()) {
currentUser = results.get(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.jboss.weld.examples.login;

import java.util.List;
import java.util.logging.Logger;

import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.persistence.EntityManager;
import jakarta.transaction.UserTransaction;
import java.util.List;
import java.util.logging.Logger;

@Named("userManager")
@RequestScoped
Expand Down Expand Up @@ -45,7 +46,7 @@ public List<Person> getUsers() throws Exception {

@Override
public String addUser() throws Exception {
if(newUser.getName().isEmpty() || newUser.getUsername().isEmpty() || newUser.getPassword().isEmpty()){
if (newUser.getName().isEmpty() || newUser.getUsername().isEmpty() || newUser.getPassword().isEmpty()) {
return "/users.xhtml?faces-redirect=true";
}
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.jboss.weld.examples.login;

import java.util.logging.Logger;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.enterprise.inject.spi.InjectionPoint;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.util.logging.Logger;

@ApplicationScoped
public class Resources {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jboss.weld.examples.numberguess;


import java.io.Serializable;

import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.jboss.weld.examples.numberguess;


import jakarta.inject.Qualifier;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({TYPE, METHOD, PARAMETER, FIELD})
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.inject.Qualifier;

@Target({ TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.jboss.weld.examples.numberguess;


import jakarta.inject.Qualifier;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({TYPE, METHOD, PARAMETER, FIELD})
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.inject.Qualifier;

@Target({ TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.jboss.weld.examples.translator;

import jakarta.enterprise.context.Dependent;

import java.util.Arrays;
import java.util.List;

import jakarta.enterprise.context.Dependent;

@Dependent
public class SentenceParser {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.jboss.weld.examples.translator;

import java.io.Serializable;

import jakarta.ejb.EJB;
import jakarta.enterprise.context.Dependent;
import jakarta.inject.Inject;
import java.io.Serializable;

@Dependent
public class TextTranslator implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import jakarta.inject.Qualifier;

@Target({
TYPE, METHOD, PARAMETER, FIELD
TYPE, METHOD, PARAMETER, FIELD
})
@Retention(RUNTIME)
@Documented
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
public class Main {

public static void main(String[] args) {
Weld weld = new Weld().beanClasses(Game.class, Generator.class, MessageGenerator.class, NumberGuessFrame.class).disableDiscovery();
Weld weld = new Weld().beanClasses(Game.class, Generator.class, MessageGenerator.class, NumberGuessFrame.class)
.disableDiscovery();
// shutdown hook is registered automatically for WeldContainer
weld.initialize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
*/
package org.jboss.weld.environment.se.example.numberguess;

import jakarta.inject.Qualifier;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({TYPE, METHOD, PARAMETER, FIELD})
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.inject.Qualifier;

@Target({ TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
Expand Down

0 comments on commit 95f2fca

Please sign in to comment.