JR Utily

exemple d'insert multiligne

......@@ -9,8 +9,10 @@ import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.IOException;
......@@ -19,7 +21,7 @@ import java.util.Date;
import java.util.List;
@Named
@RequestScoped
@SessionScoped
public class UpdateUserBean {
@Inject
private UserService userService;
......@@ -63,13 +65,7 @@ public class UpdateUserBean {
private boolean activated;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String add()
{
......@@ -161,6 +157,104 @@ public class UpdateUserBean {
return "success";
}
@PostConstruct
public void init() {
Logger logger = LoggerFactory.getLogger(UpdateUserBean.class);
logger.info("init");
allDisplayNameMasks = sharedService.getAllDisplayNameMasks();
availableUserRoles = sharedService.getAvailableUserRoles();
availableUserProperties = sharedService.getAvailableUserProperties();
}
public List<UserRole> getAvailableUserRoles() {
return availableUserRoles;
}
public void setAvailableUserRoles(List<UserRole> availableUserRoles) {
this.availableUserRoles = availableUserRoles;
}
public String getPresentation() {
return presentation;
}
public void setPresentation(String presentation) {
this.presentation = presentation;
}
public List<UserProperty> getAvailableUserProperties() {
return availableUserProperties;
}
public void setAvailableUserProperties(List<UserProperty> availableUserProperties) {
this.availableUserProperties = availableUserProperties;
}
public List<UserAttribute> getUserAttributes() {
return userAttributes;
}
public void setUserAttributes(List<UserAttribute> userAttributes) {
this.userAttributes = userAttributes;
}
public boolean isCriticProvider() {
return criticProvider;
}
public void setCriticProvider(boolean criticProvider) {
this.criticProvider = criticProvider;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public SharedService getSharedService() {
return sharedService;
}
public void setSharedService(SharedService sharedService) {
this.sharedService = sharedService;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFirstName() {
return firstName;
}
......@@ -201,14 +295,6 @@ public class UpdateUserBean {
this.allDisplayNameMasks = allDisplayNameMasks;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getEmail() {
return email;
}
......@@ -240,69 +326,4 @@ public class UpdateUserBean {
public void setRoles(List<UserRole> roles) {
this.roles = roles;
}
@PostConstruct
public void init() {
Logger logger = LoggerFactory.getLogger(UpdateUserBean.class);
logger.info("init");
allDisplayNameMasks = sharedService.getAllDisplayNameMasks();
availableUserRoles = sharedService.getAvailableUserRoles();
availableUserProperties = sharedService.getAvailableUserProperties();
}
public List<UserRole> getAvailableUserRoles() {
return availableUserRoles;
}
public void setAvailableUserRoles(List<UserRole> availableUserRoles) {
this.availableUserRoles = availableUserRoles;
}
public String getPresentation() {
return presentation;
}
public void setPresentation(String presentation) {
this.presentation = presentation;
}
public List<UserProperty> getAvailableUserProperties() {
return availableUserProperties;
}
public void setAvailableUserProperties(List<UserProperty> availableUserProperties) {
this.availableUserProperties = availableUserProperties;
}
public List<UserAttribute> getUserAttributes() {
return userAttributes;
}
public void setUserAttributes(List<UserAttribute> userAttributes) {
this.userAttributes = userAttributes;
}
public boolean isCriticProvider() {
return criticProvider;
}
public void setCriticProvider(boolean criticProvider) {
this.criticProvider = criticProvider;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
}
\ No newline at end of file
......
......@@ -9,7 +9,7 @@
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.hbm2ddl.import_files" value="import.sql"/>
<!-- <property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" />-->
<property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" />
</properties>
</persistence-unit>
......
......@@ -20,12 +20,15 @@ INSERT INTO UserProperty VALUES (2, 'avatar', 'Lien vers une icône ou une photo
INSERT INTO UserProperty VALUES (3, 'tagline', 'Ligne de présentation pour les contributeurs', TRUE);
INSERT INTO UserProperty VALUES (4, 'taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE);
INSERT INTO UserProperty VALUES (5, 'skin', 'Thème visuel', TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES (1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES (2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES (3, 'three', 'three', 'Marcus', 'Boone', 'three', 'three@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES (4, 'four', 'four', 'Ryo', 'Tetsuda', 'four', 'four@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES (5, 'five', 'five', 'Emily', 'Kolburn', 'five', 'five@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES (6, 'six', 'six', 'Kal', 'Varrik', 'six', 'six@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES
(1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE),
(2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE),
(3, 'three', 'three', 'Marcus', 'Boone', 'three', 'three@raza.org', TRUE, FALSE, TRUE, TRUE),
(4, 'four', 'four', 'Ryo', 'Tetsuda', 'four', 'four@raza.org', TRUE, FALSE, TRUE, TRUE),
(5, 'five', 'five', 'Emily', 'Kolburn', 'five', 'five@raza.org', TRUE, FALSE, TRUE, TRUE),
(6, 'six', 'six', 'Kal', 'Varrik', 'six', 'six@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable_UserRole VALUES (1,2);
INSERT INTO UserTable_UserRole VALUES (2,2);
INSERT INTO UserTable_UserRole VALUES (3,2);
......