Rien de plus facile que de voir ce que contient un fichier .jar: Renommez-le en .zip et ouvrez-le !
















session = sessionFactory.openSession ()
session.close ()
session.beginTransaction().
org.hibernate.HibernateException
new org.hibernate.cfg.Configuration ().configure ().buildSessionFactory ();

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"[http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:oracle:thin:@dbServer:1521:db</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.connection.username">dbusername</property>
<property name="hibernate.connection.password">dbpassword</property>
<!-- Configuration hibernate -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.query.substitutions">1</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.jdbc.batch_size">50</property>
<property name="hibernate.jdbc.use_get_generated_keys">true</property>
<!-- Pool de connexion : ici C3P0 qui est déclaré -->
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.acquire_increment">3</property>
<property name="hibernate.c3p0.idle_test_period">180</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">1000</property>
<!désactiver la cache deuxième niveau -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!Liste des fichiers de Mapping hbm -->
<mapping resource="com/org/client/mapping/Client.hbm.xml"/>
</session-factory>
</hibernate-configuration>
CREATE TABLE CLIENT ( ID_Client NUMBER(10) NOT NULL, TITRE VARCHAR2(10), NOM VARCHAR2(30), REMISE NUMBER(19,5), CA NUMBER(19,5), CONSTRAINT PK_CLIENT PRIMARY KEY (CLIENT_ID) );
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class
name="[Nom_Package].Client"
table="CLIENT"
entity-name="Client"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="CLIENT"
</meta>
<id
name="idClient"
type="java.lang.Long"
column="ID_CLIENT"
>
<meta attribute="field-description" inherit="false">
Id du client
</meta>
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
type="java.lang.Long"
column="CLIENT_ID"
</meta>
<generator class="increment" />
</id>
<property
name="titre"
type="java.lang.String"
column="TITRE"
length="10"
>
<meta attribute="field-description" inherit="false">
Titre du client
</meta>
<meta attribute="field-description">
@hibernate.property
column="TITRE"
length="10"
</meta>
</property>
<property
name="name"
type="java.lang.String"
column="NAME"
length="30"
>
<meta attribute="field-description" inherit="false">
Nom du client
</meta>
<meta attribute="field-description">
@hibernate.property
column="NAME"
length="30"
</meta>
</property>
<property
name="remise"
type="java.math.BigDecimal"
column="REMISE"
length="19"
>
<meta attribute="field-description" inherit="false">
Remise du client
</meta>
<meta attribute="field-description">
@hibernate.property
column="REMISE"
length="19"
</meta>
</property>
<property
name="ca"
type="java.math.BigDecimal"
column="CA"
length="19"
>
<meta attribute="field-description" inherit="false">
Chiffre Affaire
</meta>
</class>
</hibernate-mapping>
<composite-id>
<key-property name="attribut1"/>
<key-property name="attribut2"/>
</composite-id>
org.hibernate.Session sess = sessFact.openSession();
Client c = new Client();
c.setName("John");
p.setTitre("Mr");
Transaction tx = sess.beginTransaction();
sess.saveOrUpdate(p);
tx.commit();
sess.close();

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%> <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>


<?xml version="1.0" encoding="ISO-8859-1" ?> <taglib> <tlib-version>1.0</tlib-version> <jsp-version>1.2</jsp-version> <short-name>montagamoi</short-name> <uri>http://www.owliance.com/taglibs/montagamoi-1.0</uri> <description>Bibliothèque de taglibs</description> <tag> <name>switchtag</name> <tag-class>monpackage.SwitchTag</tag-class> <description>Tag qui affiche le corps ...</description> <attribute> <name>test</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> <tag> <name>casetag</name> <tag-class>monpackage.CaseTag</tag-class> <description>Tag qui affiche le corps ...</description> <attribute> <name>value</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> <tag> <name>iteratetag</name> <tag-class>monpackage.IterateTag</tag-class> <description>Tag qui affiche le corps ...</description> <attribute> <name>count</name> <required>true</required> <rtexprvalue>true</rtexprvalue> <type>java.lang.Integer</type> </attribute> </tag> </taglib>
<%@ taglib uri="http://www.owliance.com/taglibs/montagamoi-1.0" prefix="montagamoi"%> <br/> <br/> <montagamoi:iteratetag count="10"> <br/> <montagamoi:switchtag test="3"> <montagamoi:casetag value="0">Zéro</montagamoi:casetag> <montagamoi:casetag value="1">Un</montagamoi:casetag> <montagamoi:casetag value="2">Deux</montagamoi:casetag> <montagamoi:casetag value="3">Trois</montagamoi:casetag> </montagamoi:switchtag> </montagamoi:iteratetag>
package monpackage;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
public class IterateTag extends BodyTagSupport {
/**
*
*/
private static final long serialVersionUID = 9368853820192946960L;
private int count = 0;
private int current;
public void setCount(int i) {
count = i;
}
public int doStartTag() throws JspException {
current = 0;
if (current < count) {
return EVAL_BODY_INCLUDE;
} else {
return SKIP_BODY;
}
}
public int doAfterBody() throws JspException {
current++;
if (current < count) {
return EVAL_BODY_AGAIN;
} else {
return SKIP_BODY;
}
}
}
package monpackage;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
public class CaseTag extends TagSupport {
public String value;
public void setValue(String p_value) {
this.value = p_value;
}
public int doStartTag() throws JspException {
if (this.getParent() instanceof SwitchTag) {
SwitchTag parent = (SwitchTag) getParent();
if (parent.isValid(this.value))
return EVAL_BODY_INCLUDE;
else
return SKIP_BODY;
} else {
throw new JspException(
"Le Tag case doit être à l'intérieur du tag Switch");
}
}
}
package monpackage;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
public class SwitchTag extends TagSupport {
/**
*
*/
private static final long serialVersionUID = 3752830055610590228L;
private String test;
public int doStartTag() throws JspException {
return EVAL_BODY_INCLUDE;
}
public void setTest(String p_value) {
test = p_value;
}
public boolean isValid(String caseValue) {
if (test == null)
return false;
return (test.equals(caseValue));
}
}

public class LoginAction extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
String username = ((LoginForm)form).getUsername();
String password = ((LoginForm)form).getPassword();
ActionErrors errors = new ActionErrors();
if ((!username.equals("dery")) || (!password.equals("radar")))
{
errors.add("password","error.password.mismatch");
}
if (!errors.empty())
{
saveErrors(request,errors);
return mapping.findForward("login");
}
//sauvegarde du nom utilisateur dans la session
HttpSession session = request.getSession();
session.setAttribute("authentification", username);
//forward vers URI success
return mapping.findForward("success");
}
}
public class TestLoginAction extends CactusStrutsTestCase
{
public void setUp() {super.setUp();}
public void tearDown() {super.tearDown();}
public TestLoginAction (String testName)
{
super(testName);
}
public void testSucessfullLogin(){}
}
public class TestLoginAction extends CactusStrutsTestCase {
public TestLoginAction (String testName)
{
super(testName);
}
public void testSucessfullLogin()
{
setRequestPathInfo("/login") ;
}
}
public class TestLoginAction extends CactusStrutsTestCase {
public TestLoginAction (String testName)
{
super(testName);
}
public void testSucessfullLogin()
{
setRequestPathInfo("/login") ;
addRequestParameter("username", "dery");
addRequestParameter("password", "radar");
}
}
public class TestLoginAction extends CactusStrutsTestCase {
public TestLoginAction (String testName)
{
super(testName);
}
public void testSucessfullLogin()
{
setRequestPathInfo("/login") ;
addRequestParameter("username", "dery");
addRequestParameter("password", "radar");
actionPerform();
}
}
public class TestLoginAction extends CactusStrutsTestCase {
public TestLoginAction (String testName)
{
super(testName);
}
public void testSucessfullLogin()
{
setRequestPathInfo("/login") ;
addRequestParameter("username", "dery");
addRequestParameter("password", "radar");
actionPerform();
verifyForward("success");
}
}
public class TestLoginAction extends CactusStrutsTestCase {
public TestLoginAction (String testName)
{
super(testName);
}
public void testSucessfullLogin()
{
setRequestPathInfo("/login") ;
addRequestParameter("username", "dery");
addRequestParameter("password", "radar");
actionPerform();
verifyForward("success");
assertEquals("dery", (String) getSession().getAttribute("authentification"));
}
}
public class TestLoginAction extends CactusStrutsTestCase {
public TestLoginAction (String testName)
{
super(testName);
}
public void testSucessfullLogin()
{
setRequestPathInfo("/login") ;
addRequestParameter("username", "dery");
addRequestParameter("password", "radar");
actionPerform();
verifyForward("success");
assertEquals("dery", (String) getSession().getAttribute("authentification"));
verifyNoActionErrors();
}
}
public void testFailedLogin()
{
setRequestPathInfo("/login");
addRequestParameter("username", "dery");
addRequestParameter("password", "error");
actionPerform();
verifyForward("login");
verifyActionErrors(new String[] {"error.password.mismatch"});
assertNull((String)getSession().getAttribute("authentification"));
}
<servlet> <servlet-name>StrutsServletRedirector</servlet-name> <servlet-class> org.apache.cactus.server.ServletTestRedirector </servlet-class> </servlet> <servlet-mapping> <servlet-name>StrutsServletRedirector</servlet-name> <url-pattern>/StrutsServletRedirector</url-pattern> </servlet-mapping>




<filter>
<filter-name>localeFilter</filter-name>
<filter-class>com.cleyris.ebee.filter.LocaleFilter</filter-class>
</filter>
..
<listener>
<listener-class>com.cleyris.ebee.listener.StartupListener</listener-class>
</listener>
<listener>
<listener-class>com.cleyris.ebee.listener.UserCounterListener</listener-class>
</listener>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd" default-lazy-init="true"> <!-- ======================== FILTER CHAIN ======================= --> <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy"> <property name="filterInvocationDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor </value> <!-- Put channelProcessingFilter before securityContextHolderAwareRequestFilter to turn on SSL switching --> <!-- It's off by default b/c Canoo WebTest doesn't support SSL out-of-the-box --> </property> </bean> <!-- Pour limiter le nombre des connecteurs à la session en même temps --> <bean id="concurrentSessionController" class="org.acegisecurity.concurrent.ConcurrentSessionControllerImpl"> <property name="maximumSessions"> <value>1</value> </property> <property name="sessionRegistry"> <ref local="sessionRegistry" /> </property> </bean> <bean id="sessionRegistry" class="org.acegisecurity.concurrent.SessionRegistryImpl" /> <bean id="httpSessionContextIntegrationFilter" class="org.acegisecurity.context.HttpSessionContextIntegrationFilter"/> <!-- Fin --> <!-- Changed to use logout.jsp since causes 404 on WebSphere: http://issues.appfuse.org/browse/APF-566 --> <bean id="logoutFilter" class="org.acegisecurity.ui.logout.LogoutFilter"> <constructor-arg value="/index.jsp"/> <constructor-arg> <list> <ref bean="rememberMeServices"/> <bean class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler"/> </list> </constructor-arg> <property name="filterProcessesUrl" value="/logout.jsp"/> </bean> <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter"> <property name="authenticationManager" ref="authenticationManager"/> <property name="authenticationFailureUrl" value="/login.jsp?error=true"/> <property name="defaultTargetUrl" value="/"/> <property name="filterProcessesUrl" value="/j_security_check"/> <property name="rememberMeServices" ref="rememberMeServices"/> </bean> <bean id="securityContextHolderAwareRequestFilter" class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter"/> <bean id="rememberMeProcessingFilter" class="org.acegisecurity.ui.rememberme.RememberMeProcessingFilter"> <property name="authenticationManager" ref="authenticationManager"/> <property name="rememberMeServices" ref="rememberMeServices"/> </bean> <bean id="anonymousProcessingFilter" class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter"> <property name="key" value="anonymous"/> <property name="userAttribute" value="anonymous,ROLE_ANONYMOUS"/> </bean> <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter"> <property name="authenticationEntryPoint"> <bean class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint"> <property name="loginFormUrl" value="/login.jsp"/> <property name="forceHttps" value="false"/> </bean> </property> </bean> <bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor"> <property name="authenticationManager" ref="authenticationManager"/> <property name="accessDecisionManager" ref="accessDecisionManager"/> <property name="objectDefinitionSource"> <value> PATTERN_TYPE_APACHE_ANT /passwordHint.html*=ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER /signup.html*=ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER /a4j.res/*.html*=ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER <!-- APF-737, OK to remove if not using JSF --> /**/*.html*=ROLE_ADMIN,ROLE_USER </value> </property> </bean> <bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased"> <property name="allowIfAllAbstainDecisions" value="false"/> <property name="decisionVoters"> <list> <bean class="org.acegisecurity.vote.RoleVoter"/> </list> </property> </bean> <bean id="rememberMeServices" class="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices"> <property name="userDetailsService" ref="UserDao"/> <property name="key" value="23_*!cdU='612./e;NrI"/> <property name="parameter" value="rememberMe"/> </bean> <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <ref local="daoAuthenticationProvider"/> <ref local="anonymousAuthenticationProvider"/> <ref local="rememberMeAuthenticationProvider"/> </list> </property> </bean> <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider"> <property name="userDetailsService" ref="UserDao"/> <property name="passwordEncoder" ref="passwordEncoder"/> </bean> <bean id="anonymousAuthenticationProvider" class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider"> <property name="key" value="anonymous"/> </bean> <bean id="rememberMeAuthenticationProvider" class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider"> <property name="key" value="23_*!cdU='612./e;NrI"/> </bean> <!-- This bean definition must be available to ApplicationContext.getBean() so StartupListener can look for it and detect if password encryption is turned on or not --> <bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.ShaPasswordEncoder"/> <!-- This bean is optional; it isn't used by any other bean as it only listens and logs --> <bean id="loggerListener" class="org.acegisecurity.event.authentication.LoggerListener"/> <!-- Apply method-level interceptor to userManager bean --> <aop:config> <aop:advisor id="managerSecurity" advice-ref="methodSecurityInterceptor" pointcut="execution(* com.cleyris.ebee.core.service.UserManager.*(..))"/> </aop:config> <bean id="methodSecurityInterceptor" class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <property name="authenticationManager" ref="authenticationManager"/> <property name="accessDecisionManager" ref="accessDecisionManager"/> <property name="objectDefinitionSource"> <value> com.cleyris.ebee.core.service.UserManager.getUsers=ROLE_ADMIN com.cleyris.ebee.core.service.UserManager.removeUser=ROLE_ADMIN </value> </property> </bean> <!-- SSL Switching: to use this, configure it in the filterChainProxy bean --> <bean id="channelProcessingFilter" class="org.acegisecurity.securechannel.ChannelProcessingFilter"> <property name="channelDecisionManager" ref="channelDecisionManager"/> <property name="filterInvocationDefinitionSource"> <value> PATTERN_TYPE_APACHE_ANT /admin/**=REQUIRES_SECURE_CHANNEL /login*=REQUIRES_SECURE_CHANNEL /j_security_check*=REQUIRES_SECURE_CHANNEL /signup.html*=REQUIRES_SECURE_CHANNEL /saveUser.html*=REQUIRES_SECURE_CHANNEL /**=REQUIRES_INSECURE_CHANNEL </value> </property> </bean> <bean id="channelDecisionManager" class="org.acegisecurity.securechannel.ChannelDecisionManagerImpl"> <property name="channelProcessors"> <list> <bean class="org.acegisecurity.securechannel.SecureChannelProcessor"/> <bean class="org.acegisecurity.securechannel.InsecureChannelProcessor"/> </list> </property> </bean> </beans>
public interface UserManager extends Manager {
/**
*
* @param user cette methode est utilis�e par acegi pour ajouter un autre utilisateur
* @return
* @throws UserExistsException
*/
public User saveUser(User user) throws UserExistsException;
/**
* cette methode est utilis�e par acegi pour intercepter un utilisateur
* @param userId
* @return
*/
public User getUser(String userId);
/**
* cette methode est utilis�e par acegi pour supprimer un utilisateur
* @param userId
*/
public void removeUser(String userId);
/**
*
* @param username cette methode est utilis�e par acegi pour afficher l'utilisateur � travers son login
* @return
* @throws UsernameNotFoundException
*/
public User getUserByUsername(String username) throws UsernameNotFoundException, CleyrisException ;
}
public class UserManagerImpl extends BaseManager implements UserManager{
//c'est la partie Acegi
@SuppressWarnings("unchecked")
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
List<UserDetails> users = userDAO.setHqlQuery("from User where username=:username").setParameter("username",username).list();
if (users == null || users.isEmpty()) {
throw new UsernameNotFoundException("user '" + username + "' not found...");
} else {
return (UserDetails) users.get(0);
}
}
public User getUser(String userId) {
return userDao.get(new Long(userId));
}
public User saveUser(User user) throws UserExistsException {
// if new user, lowercase userId
if (user.getUserId()== 0) {
user.setUsername(user.getUsername().toLowerCase());
}
try {
return userDao.saveUser(user);
} catch (DataIntegrityViolationException e) {
if (log.isErrorEnabled())
log
.error("Exception occurs class:com.cleyris.ebee.core.service.UserManagerImpl.java method:saveUser: "
+ e.getMessage() + ".");
throw new UserExistsException(Constants.UserExists);
} catch (EntityExistsException e) { // needed for JPA
if (log.isErrorEnabled())
log
.error("Exception occurs class:com.cleyris.ebee.core.service.UserManagerImpl.java method:saveUser: "
+ e.getMessage() + ".");
throw new UserExistsException(Constants.UserExists);
}
}
public void removeUser(String userId) {
log.debug("removing user: " + userId);
userDao.remove(new Long(userId));
}
public User getUserByUsername(String username) throws UsernameNotFoundException, CleyrisException {
User user= (User) userDao.loadUserByUsername(username);
return user;
}
public List<User> getUsers(User user) {
return userDao.getUsers();
}
}
package com.cleyris.ebee.core.dao;
import java.util.List;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Transactional;
import com.cleyris.ebee.core.modele.User;
/**
* @author mlaouini
*/
public interface UserDao extends BaseDao<User, Long> {
/**
* charger les informations d'utilisateurs basé sur login .
* @param username the user's username
* @return userDetails populated userDetails object
* @throws org.acegisecurity.userdetails.UsernameNotFoundException thrown when user not found in database
*/
@Transactional
UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
/**
* charger une liste d'utilisateurs trier par le login en appliquant le majuscule sur le login ==>username.
*
* @return List populated list of users
*/
List<User> getUsers();
/**
* sauvegarder un utilisateur.
* @param user the object to be saved
* @return the persisted User object
*/
User saveUser(User user);
}
public class UserDaoImpl extends BaseDaoImpl<User, Long> implements UserDao, UserDetailsService {
public UserDaoImpl() {
super(User.class);
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public List<User> getUsers() {
return getHibernateTemplate().find("from User u order by upper(u.username)");
}
/**
* {@inheritDoc}
*/
public User saveUser(User user) {
log.debug("user's id: " + user.getUserId());
getHibernateTemplate().saveOrUpdate(user);
// necessary to throw a DataIntegrityViolation and catch it in UserManager
getHibernateTemplate().flush();
return user;
}
public User save(User user) {
return this.saveUser(user);
}
/**
* {@inheritDoc}
*/
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
List users = getHibernateTemplate().find("from User where username=?", username);
if (users == null || users.isEmpty()) {
throw new UsernameNotFoundException("user '" + username + "' not found...");
} else {
return (UserDetails) users.get(0);
}
}
}
/**
* @author mlaouini
*/
@Entity
@javax.persistence.SequenceGenerator(name="SEQ_STORE",sequenceName="sequence_users")
@Table(name = "users", schema = "ebee")
public class User extends BaseObject implements UserDetails {
private String username; // required
private String password; // required
private String confirmPassword;
private String passwordHint;
private Set<Role> roles = new HashSet<Role>();
private boolean enabled;
private boolean accountExpired;
private boolean accountLocked;
private boolean credentialsExpired;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "user_role", schema = "ebee", joinColumns = { @JoinColumn(name = "userid", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "roleid", nullable = false, updatable = false) })
@NotNull
public Set<Role> getRoles() {
return this.roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
/**
* @see org.acegisecurity.userdetails.UserDetails#getAuthorities()
* @return GrantedAuthority[] an array of roles.
*/
@Transient
public GrantedAuthority[] getAuthorities() {
return roles.toArray(new GrantedAuthority[0]);
}
@Column(name = "account_enabled")
public boolean isEnabled() {
return enabled;
}
@Column(name = "account_expired", nullable = false)
public boolean isAccountExpired() {
return accountExpired;
}
/**
* @see org.acegisecurity.userdetails.UserDetails#isAccountNonExpired()
*/
@Transient
public boolean isAccountNonExpired() {
return !isAccountExpired();
}
@Column(name = "account_locked", nullable = false)
public boolean isAccountLocked() {
return accountLocked;
}
/**
* @see org.acegisecurity.userdetails.UserDetails#isAccountNonLocked()
*/
@Transient
public boolean isAccountNonLocked() {
return !isAccountLocked();
}
@Column(name = "credentials_expired", nullable = false)
public boolean isCredentialsExpired() {
return credentialsExpired;
}
/**
* @see org.acegisecurity.userdetails.UserDetails#isCredentialsNonExpired()
*/
@Transient
public boolean isCredentialsNonExpired() {
return !credentialsExpired;
}
@Column(nullable = false, length = 50, unique = true)
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Column(nullable = false)
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Transient
public String getConfirmPassword() {
return confirmPassword;
}
public void setConfirmPassword(String confirmPassword) {
this.confirmPassword = confirmPassword;
}
@Column(name = "password_hint")
public String getPasswordHint() {
return passwordHint;
}
public void setPasswordHint(String passwordHint) {
this.passwordHint = passwordHint;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setAccountExpired(boolean accountExpired) {
this.accountExpired = accountExpired;
}
public void setAccountLocked(boolean accountLocked) {
this.accountLocked = accountLocked;
}
public void setCredentialsExpired(boolean credentialsExpired) {
this.credentialsExpired = credentialsExpired;
}
}
axis2-web
META-INF
WEB-INF
classes
conf
axis2.xml
lib
activation.jar
...
xmlSchema.jar
modules
modules.list
addressing.mar
...
soapmonitor.mar
services
services.list
aservice.aar
...
version.aar
web.xml



- CataloguePrix
- META-INF
- services.xml
- lib
- com
- owliance
- console
- parametrage
- CataloguePrix.class








package odas.toolbox.testng.test;
import java.text.ParseException;
import java.util.List;
import odas.toolbox.persistance.jpa.hibernate.model.P70paramet;
import odas.toolbox.persistance.service.IService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestNG {
// couche service
private IService service;
@BeforeClass
public void init() {
// log
log("init");
// configuration de l'application
ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config.xml");
// couche service
service = (IService) ctx.getBean("service");
}
@BeforeMethod
public void setUp() throws ParseException {
// on vide la base
clean();
// on la remplit
fill();
}
// logs
private void log(String message) {
System.out.println("----------- " + message);
}
// affichage contenu table
private void dump() {
log("dump");
System.out.format("[personnes]%n");
for (P70paramet p : service.getAll()) {
System.out.println(p);
}
}
// remplissage table
public void fill() throws ParseException {
log("fill");
// création personnes
P70paramet p1 = new P70paramet();
P70paramet p2 = new P70paramet();
// qu'on sauvegarde
service.saveArray(new P70paramet[] { p1, p2 });
}
// supression éléments de la table
public void clean() {
log("clean");
for (P70paramet p : service.getAll()) {
service.delete(p.getP70idpkpar());
}
}
@Test()
public void test01() {
log("test1");
//dump();
// liste des personnes
List<P70paramet> parametres = service.getAll();
assert 119 == parametres.size();
}
}