Toggle navigation
Toggle navigation
This project
Loading...
Sign in
grogv3
/
grog-cubi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Francois Leveque
2016-10-05 17:08:22 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
08a0358f9b2e315f6f34a268789da1c9ce33856f
08a0358f
1 parent
6448b26d
Compile (WIP sur updateUser.xhtml et le reste de la transition User)
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
348 additions
and
18 deletions
src/main/java/org/legrog/application/SharedService.java
src/main/java/org/legrog/application/SharedServiceSpring.java
src/main/java/org/legrog/entities/User.java
src/main/java/org/legrog/entities/UserAttribute.java
src/main/java/org/legrog/entities/UserAttributeRepository.java
src/main/java/org/legrog/entities/UserProperty.java
src/main/java/org/legrog/entities/UserPropertyRepository.java
src/main/java/org/legrog/presentation/AddUserBean.java → src/main/java/org/legrog/presentation/UpdateUserBean.java
src/main/webapp/WEB-INF/faces-config.xml
src/main/webapp/addUser.xhtml → src/main/webapp/addUser_short.xhtml
src/main/webapp/listUsers_short.xhtml
src/main/webapp/updateUser.xhtml
src/main/java/org/legrog/application/SharedService.java
View file @
08a0358
...
...
@@ -2,6 +2,7 @@ package org.legrog.application;
import
org.legrog.entities.Country
;
import
org.legrog.entities.DisplayNameMask
;
import
org.legrog.entities.UserProperty
;
import
org.legrog.entities.UserRole
;
import
java.util.List
;
...
...
@@ -16,4 +17,6 @@ public interface SharedService {
List
<
UserRole
>
getAvailableUserRoles
();
List
<
UserProperty
>
getAvailableUserProperties
();
}
\ No newline at end of file
...
...
src/main/java/org/legrog/application/SharedServiceSpring.java
View file @
08a0358
...
...
@@ -16,6 +16,8 @@ public class SharedServiceSpring implements SharedService {
CountryRepository
countryRepository
;
@Inject
UserRoleRepository
userRoleRepository
;
@Inject
UserPropertyRepository
userPropertyRepository
;
private
List
<
DisplayNameMask
>
allDisplayNameMasks
;
...
...
@@ -43,4 +45,6 @@ public class SharedServiceSpring implements SharedService {
public
List
<
UserRole
>
getAvailableUserRoles
()
{
return
userRoleRepository
.
findAll
();
}
public
List
<
UserProperty
>
getAvailableUserProperties
()
{
return
userPropertyRepository
.
findAll
();
}
}
...
...
src/main/java/org/legrog/entities/User.java
View file @
08a0358
...
...
@@ -425,7 +425,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
/**
* The list of attributes / properties for this user.
*/
// private List<UserAttribute> _attr
s;
private
List
<
UserAttribute
>
userAttribute
s
;
/**
* Retrieve this user's attributes.
...
...
@@ -440,22 +440,22 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
* @return a {@link java.util.List} of user attributes linked to this. Shall not be <code>null</code>.
* @see #setAttributes(java.util.List)
*/
/*
public
List
<
UserAttribute
>
getAttributes
()
{
return
_attr
s;
return
userAttribute
s
;
}
*/
/**
* @param attribs the List of attributes for this user.
* @see #getAttributes()
*/
/*
public
void
setAttributes
(
List
<
UserAttribute
>
attribs
)
{
_attr
s = attribs;
this
.
userAttribute
s
=
attribs
;
}
*/
/**
* The {@link org.roliste.data.db.GamingEvent}s this user's visited.
*/
...
...
src/main/java/org/legrog/entities/UserAttribute.java
0 → 100644
View file @
08a0358
package
org
.
legrog
.
entities
;
import
javax.persistence.*
;
@Entity
public
class
UserAttribute
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
private
int
userAttributeId
;
public
int
getUserAttributeId
()
{
return
userAttributeId
;
}
/**
* The linked user.
*/
@ManyToOne
private
User
user
;
/**
* Retrieve the user this attribute is attached to.
* @hibernate.many-to-one
* column="ID_UTILISATEUR"
* class="org.roliste.data.db.User"
* not-null="true"
* access="property"
* lazy="proxy"
* properties-name="PropertyPerUser"
* foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR"
* @return the {link org.roliste.data.db.User} this attribute is attached to.
* Shall not be <code>null</code>.
* see #setUser(org.roliste.data.db.User)
*/
public
User
getUser
()
{
return
user
;
}
/**
* Set the user this attribute is attached to.
* @param user the new {link org.roliste.data.db.User} this attribute will be attached to. Shall not be <code>null</code>.
* @see #getUser()
*/
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
/**
* The linked property.
*/
@ManyToOne
private
UserProperty
userProperty
;
/**
* Retrieve the property this attribute is attached to.
* @hibernate.many-to-one
* column="ID_PROP"
* class="org.roliste.data.db.UserProperty"
* not-null="true"
* access="property"
* lazy="false"
* properties-name="PropertyPerUser"
* foreign-key="FK_ATTRIBUTUTILISATEUR_PROPRIETE"
* @return the {link org.roliste.data.db.UserProperty} this attribute is attached to.
* Shall not be <code>null</code>.
* see #setProperty(org.roliste.data.db.UserProperty)
*/
public
UserProperty
getProperty
()
{
return
userProperty
;
}
/**
* Set the property this attribute is attached to.
* @param prop the new {link org.roliste.data.db.UserProperty} this attribute will be attached to. Shall not be <code>null</code>.
* @see #getProperty()
*/
public
void
setProperty
(
UserProperty
prop
)
{
userProperty
=
prop
;
}
/**
* The property value.
*/
private
String
value
;
/**
* Returns the property value.
* @return the {@link String} value. If property is known to be some other kind of value, you shall
* convert it yourself. May be <code>null</code>, in cases where the sole existence of the attribute
* is the value, or for unset attributes.
* @see #setValue(String)
* @hibernate.property
* column="ATTR_VALUE"
* access="property"
* length="200"
*/
public
String
getValue
()
{
return
value
;
}
/**
* Initializes attribute value.
* @param value the new {@link String} value.
* @see #getValue()
*/
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
/**
* Returns a string representation of this user attribute definition.
* @return a string representing this user attribute definition.
* @hidden
*/
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"ID_ATTR="
);
sb
.
append
(
getUserAttributeId
());
sb
.
append
(
" ATTR_PROP="
);
sb
.
append
(
userProperty
);
sb
.
append
(
" ATTR_VALUE="
);
sb
.
append
(
value
);
return
sb
.
toString
();
}
}
src/main/java/org/legrog/entities/UserAttributeRepository.java
0 → 100644
View file @
08a0358
package
org
.
legrog
.
entities
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
UserAttributeRepository
extends
JpaRepository
<
UserAttribute
,
Integer
>
{
}
src/main/java/org/legrog/entities/UserProperty.java
0 → 100644
View file @
08a0358
package
org
.
legrog
.
entities
;
import
javax.persistence.*
;
@Entity
public
class
UserProperty
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
private
int
userPropertyId
;
/**
*
* hibernate.id
* generator-class="identity"
* column="ID_PROP"
* access="property"
*/
public
Integer
getUserPropertyId
()
{
return
userPropertyId
;
}
/**
* The property name.
*/
private
String
name
;
/**
* Returns the property name.
* @return the {@link String} attribute identifier.
* @see #setName(String)
* hibernate.property
* column="ATTR_NAME"
* not-null="true"
* unique="true"
* access="property"
* length="50"
*/
public
String
getName
()
{
return
name
;
}
/**
* Initializes the property name.
* @param name the new {@link String} identifier.
* @see #getName()
*/
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/**
* The property tag.
*/
private
String
tag
;
/**
* Returns the property tag.
* @return the {@link String} value.
* @see #setTag(String)
* hibernate.property
* column="PROP_TAG"
* access="property"
* length="100"
*/
public
String
getTag
()
{
return
tag
;
}
/**
* Initializes property tag.
* @param tag the new {@link String} tag.
* @see #getTag()
*/
public
void
setTag
(
String
tag
)
{
this
.
tag
=
tag
;
}
/**
* The property validation status.
* A property may be temporarily deactivated.
*/
private
boolean
visible
;
/**
* Indicates if the property is visible / usable.
* If not, users should not be able to access the privileges
* they inherit from having this property set.
* @return the visible flag.
* @see #setVisible(boolean)
* hibernate.property
* column="IND_VISIBLE"
* access="property"
*/
public
boolean
isVisible
()
{
return
visible
;
}
/**
* Initializes the property visible flag.
* @param visible the new flag value.
* @see #isVisible
*/
public
void
setVisible
(
boolean
visible
)
{
this
.
visible
=
visible
;
}
/**
* Returns a string representation of this property definition.
* @return a string representing this property definition.
* hidden
*/
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"ID_PROP="
);
sb
.
append
(
getUserPropertyId
());
sb
.
append
(
" PROP_NAME="
);
sb
.
append
(
name
);
sb
.
append
(
" PROP_TAG="
);
sb
.
append
(
tag
);
sb
.
append
(
" IND_VISIBLE="
);
sb
.
append
(
visible
);
return
sb
.
toString
();
}
}
\ No newline at end of file
src/main/java/org/legrog/entities/UserPropertyRepository.java
0 → 100644
View file @
08a0358
package
org
.
legrog
.
entities
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
UserPropertyRepository
extends
JpaRepository
<
UserProperty
,
Integer
>
{
}
src/main/java/org/legrog/presentation/
Add
UserBean.java
→
src/main/java/org/legrog/presentation/
Update
UserBean.java
View file @
08a0358
...
...
@@ -2,9 +2,7 @@ package org.legrog.presentation;
import
org.legrog.application.SharedService
;
import
org.legrog.application.UserService
;
import
org.legrog.entities.DisplayNameMask
;
import
org.legrog.entities.User
;
import
org.legrog.entities.UserRole
;
import
org.legrog.entities.*
;
import
javax.annotation.PostConstruct
;
import
javax.enterprise.context.RequestScoped
;
...
...
@@ -14,7 +12,7 @@ import java.util.List;
@Named
@RequestScoped
public
class
Add
UserBean
{
public
class
Update
UserBean
{
@Inject
private
UserService
userService
;
@Inject
...
...
@@ -36,6 +34,8 @@ public class AddUserBean {
private
List
<
UserRole
>
availableUserRoles
;
private
List
<
UserProperty
>
availableUserProperties
;
private
String
email
;
private
boolean
anonymous
;
...
...
@@ -46,6 +46,14 @@ public class AddUserBean {
private
String
presentation
;
private
List
<
UserAttribute
>
userAttributes
;
private
boolean
criticProvider
;
private
boolean
visible
;
private
boolean
activated
;
public
String
getUsername
()
{
return
username
;
}
...
...
@@ -146,6 +154,7 @@ public class AddUserBean {
public
void
init
()
{
allDisplayNameMasks
=
sharedService
.
getAllDisplayNameMasks
();
availableUserRoles
=
sharedService
.
getAvailableUserRoles
();
availableUserProperties
=
sharedService
.
getAvailableUserProperties
();
}
public
List
<
UserRole
>
getAvailableUserRoles
()
{
...
...
@@ -163,4 +172,44 @@ public class AddUserBean {
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
...
...
src/main/webapp/WEB-INF/faces-config.xml
View file @
08a0358
...
...
@@ -33,7 +33,7 @@
</navigation-case>
<navigation-case>
<from-outcome>
addUser
</from-outcome>
<to-view-id>
/addUser.xhtml
</to-view-id>
<to-view-id>
/addUser
_short
.xhtml
</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>
listUsers
</from-outcome>
...
...
@@ -50,7 +50,7 @@
</navigation-rule>
<navigation-rule>
<from-view-id>
/addUser.xhtml
</from-view-id>
<from-view-id>
/addUser
_short
.xhtml
</from-view-id>
<navigation-case>
<from-outcome>
success
</from-outcome>
<to-view-id>
/listUsers_short.xhtml
</to-view-id>
...
...
src/main/webapp/addUser.xhtml
→
src/main/webapp/addUser
_short
.xhtml
View file @
08a0358
...
...
@@ -13,9 +13,9 @@
<h:panelGrid
columns=
"2"
>
<h:outputText
value=
"Username de l'utilisateur"
/>
<h:inputText
value=
'#{
add
UserBean.username}'
/>
<h:inputText
value=
'#{
update
UserBean.username}'
/>
<h:outputText
value=
'Add'
/>
<h:commandButton
action=
"#{
add
UserBean.add}"
value=
"Add"
/>
<h:commandButton
action=
"#{
update
UserBean.add}"
value=
"Add"
/>
</h:panelGrid>
</h:form>
</body>
...
...
src/main/webapp/listUsers_short.xhtml
View file @
08a0358
...
...
@@ -12,10 +12,10 @@
</h:commandLink>
</h:form>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{
add
UserBean.onload}"
/>
<f:event
type=
"preRenderView"
listener=
"#{
update
UserBean.onload}"
/>
</f:metadata>
<ul>
<ui:repeat
value=
"#{
add
UserBean.users}"
var=
"user"
>
<ui:repeat
value=
"#{
update
UserBean.users}"
var=
"user"
>
<li>
#{user.username}
</li>
</ui:repeat>
</ul>
...
...
src/main/webapp/updateUser.xhtml
View file @
08a0358
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment