Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
58edfcba
Commit
58edfcba
authored
Mar 17, 2015
by
michael.simon
Browse files
AS development
parent
1ef32141
Changes
9
Hide whitespace changes
Inline
Side-by-side
bwreg-jpa/src/main/java/edu/kit/scc/webreg/dao/as/ASUserAttrDao.java
View file @
58edfcba
...
...
@@ -10,6 +10,8 @@
******************************************************************************/
package
edu.kit.scc.webreg.dao.as
;
import
java.util.List
;
import
edu.kit.scc.webreg.dao.BaseDao
;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.as.ASUserAttrEntity
;
...
...
@@ -19,5 +21,7 @@ public interface ASUserAttrDao extends BaseDao<ASUserAttrEntity, Long> {
ASUserAttrEntity
findASUserAttr
(
UserEntity
user
,
AttributeSourceEntity
attributeSource
);
List
<
ASUserAttrEntity
>
findForUser
(
UserEntity
user
);
}
bwreg-jpa/src/main/java/edu/kit/scc/webreg/dao/jpa/as/JpaASUserAttrDao.java
View file @
58edfcba
...
...
@@ -10,6 +10,8 @@
******************************************************************************/
package
edu.kit.scc.webreg.dao.jpa.as
;
import
java.util.List
;
import
javax.enterprise.context.ApplicationScoped
;
import
javax.inject.Named
;
import
javax.persistence.NoResultException
;
...
...
@@ -36,6 +38,14 @@ public class JpaASUserAttrDao extends JpaBaseDao<ASUserAttrEntity, Long> impleme
}
}
@SuppressWarnings
(
"unchecked"
)
@Override
public
List
<
ASUserAttrEntity
>
findForUser
(
UserEntity
user
)
{
return
(
List
<
ASUserAttrEntity
>)
em
.
createQuery
(
"select a from ASUserAttrEntity a where "
+
"a.user = :user"
)
.
setParameter
(
"user"
,
user
).
getResultList
();
}
@Override
public
Class
<
ASUserAttrEntity
>
getEntityClass
()
{
return
ASUserAttrEntity
.
class
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/as/AbstractAttributeSourceWorkflow.java
View file @
58edfcba
package
edu.kit.scc.webreg.as
;
import
java.util.Set
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/ASUserAttrService.java
0 → 100644
View file @
58edfcba
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package
edu.kit.scc.webreg.service
;
import
java.util.List
;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.as.ASUserAttrEntity
;
public
interface
ASUserAttrService
extends
BaseService
<
ASUserAttrEntity
,
Long
>
{
List
<
ASUserAttrEntity
>
findForUser
(
UserEntity
user
);
}
bwreg-service/src/main/java/edu/kit/scc/webreg/service/impl/ASUserAttrServiceImpl.java
0 → 100644
View file @
58edfcba
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package
edu.kit.scc.webreg.service.impl
;
import
java.util.List
;
import
javax.ejb.Stateless
;
import
javax.inject.Inject
;
import
edu.kit.scc.webreg.dao.BaseDao
;
import
edu.kit.scc.webreg.dao.as.ASUserAttrDao
;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.as.ASUserAttrEntity
;
import
edu.kit.scc.webreg.service.ASUserAttrService
;
@Stateless
public
class
ASUserAttrServiceImpl
extends
BaseServiceImpl
<
ASUserAttrEntity
,
Long
>
implements
ASUserAttrService
{
private
static
final
long
serialVersionUID
=
1L
;
@Inject
private
ASUserAttrDao
dao
;
@Override
public
List
<
ASUserAttrEntity
>
findForUser
(
UserEntity
user
)
{
return
dao
.
findForUser
(
user
);
}
@Override
protected
BaseDao
<
ASUserAttrEntity
,
Long
>
getDao
()
{
return
dao
;
}
}
bwreg-service/src/main/java/edu/kit/scc/webreg/service/reg/impl/AttributeSourceQueryServiceImpl.java
View file @
58edfcba
package
edu.kit.scc.webreg.service.reg.impl
;
import
java.util.Date
;
import
javax.ejb.Stateless
;
import
javax.inject.Inject
;
...
...
@@ -74,6 +76,8 @@ public class AttributeSourceQueryServiceImpl implements AttributeSourceQueryServ
auditor
.
setAsUserAttr
(
asUserAttr
);
workflow
.
pollUserAttributes
(
asUserAttr
,
asValueDao
,
auditor
);
asUserAttr
.
setLastSuccessfulQuery
(
new
Date
());
asUserAttr
=
asUserAttrDao
.
persist
(
asUserAttr
);
auditor
.
finishAuditTrail
();
}
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/bean/UserAttributeSourcesBean.java
0 → 100644
View file @
58edfcba
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package
edu.kit.scc.webreg.bean
;
import
java.io.Serializable
;
import
java.util.List
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.ViewScoped
;
import
javax.faces.event.ComponentSystemEvent
;
import
javax.inject.Inject
;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.as.ASUserAttrEntity
;
import
edu.kit.scc.webreg.service.ASUserAttrService
;
import
edu.kit.scc.webreg.service.UserService
;
import
edu.kit.scc.webreg.util.SessionManager
;
@ManagedBean
@ViewScoped
public
class
UserAttributeSourcesBean
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
UserEntity
user
;
private
List
<
ASUserAttrEntity
>
userAttrList
;
private
ASUserAttrEntity
selectedUserAttr
;
@Inject
private
UserService
userService
;
@Inject
private
ASUserAttrService
asUserAttrService
;
@Inject
private
SessionManager
sessionManager
;
public
void
preRenderView
(
ComponentSystemEvent
ev
)
{
if
(
user
==
null
)
{
user
=
userService
.
findById
(
sessionManager
.
getUserId
());
userAttrList
=
asUserAttrService
.
findForUser
(
user
);
}
}
public
UserEntity
getUser
()
{
return
user
;
}
public
void
setUser
(
UserEntity
user
)
{
this
.
user
=
user
;
}
public
List
<
ASUserAttrEntity
>
getUserAttrList
()
{
return
userAttrList
;
}
public
void
setUserAttrList
(
List
<
ASUserAttrEntity
>
userAttrList
)
{
this
.
userAttrList
=
userAttrList
;
}
public
ASUserAttrEntity
getSelectedUserAttr
()
{
return
selectedUserAttr
;
}
public
void
setSelectedUserAttr
(
ASUserAttrEntity
selectedUserAttr
)
{
selectedUserAttr
=
asUserAttrService
.
findByIdWithAttrs
(
selectedUserAttr
.
getId
(),
"values"
);
this
.
selectedUserAttr
=
selectedUserAttr
;
}
}
bwreg-webapp/src/main/webapp/admin/user/list-users.xhtml
View file @
58edfcba
...
...
@@ -27,7 +27,7 @@
<p:dataTable
id=
"dataTable"
var=
"user"
value=
"#{listUserBean.userEntityList}"
paginator=
"true"
lazy=
"true"
rows=
"15"
>
<p:column
sortBy=
"#{user.id}"
style=
"width:3
0
px;"
>
<p:column
sortBy=
"#{user.id}"
style=
"width:3
6
px;"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{messages.id}"
/>
</f:facet>
...
...
bwreg-webapp/src/main/webapp/user/attribute-sources.xhtml
0 → 100644
View file @
58edfcba
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:bw=
"http://www.scc.kit.edu/bwfacelets"
xmlns:p=
"http://primefaces.org/ui"
xmlns:of=
"http://omnifaces.org/functions"
>
<head>
<title></title>
</head>
<body>
<f:view>
<f:metadata>
<f:event
type=
"javax.faces.event.PreRenderViewEvent"
listener=
"#{userAttributeSourcesBean.preRenderView}"
/>
</f:metadata>
<ui:composition
template=
"/template/default.xhtml"
>
<ui:param
name=
"title"
value=
"#{messages.title}"
/>
<ui:define
name=
"content"
>
<h:form
id=
"form"
>
<h2>
<h:outputText
value=
"#{messages.attribute_sources}: #{userAttributeSourcesBean.user.eppn}"
/>
</h2>
<div
class=
"panel"
>
<p:panel
header=
"#{messages.my_data}"
>
<p:panelGrid
id=
"baseData"
columns=
"2"
>
<bw:outputText
label=
"#{messages.name}"
value=
"#{userAttributeSourcesBean.user.surName}, #{userAttributeSourcesBean.user.givenName}"
/>
</p:panelGrid>
<p:dataTable
id=
"dataTable"
var=
"ua"
value=
"#{userAttributeSourcesBean.userAttrList}"
>
<p:column
sortBy=
"#{ua.attributeSource.name}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{messages.name}"
/>
</f:facet>
<h:outputText
value=
"#{ua.attributeSource.name}"
/>
</p:column>
<p:column
sortBy=
"#{ua.lastSuccessfulQuery}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{messages.last_update}"
/>
</f:facet>
<h:outputText
value=
"#{ua.lastSuccessfulQuery}"
/>
</p:column>
<p:column
style=
"width:24px"
>
<p:commandLink
update=
":form:documentPanel"
oncomplete=
"PF('documentDialog').show()"
title=
"View Detail"
styleClass=
"ui-icon ui-icon-search"
>
<f:setPropertyActionListener
value=
"#{ua}"
target=
"#{userAttributeSourcesBean.selectedUserAttr}"
/>
</p:commandLink>
</p:column>
</p:dataTable>
</p:panel>
</div>
<p:dialog
id=
"dialog"
header=
"Detail"
showEffect=
"fade"
widgetVar=
"documentDialog"
modal=
"true"
resizable=
"false"
>
<p:outputPanel
id=
"documentPanel"
>
<p:panelGrid
columns=
"2"
columnClasses=
"label,value"
rendered=
"#{not empty userAttributeSourcesBean.selectedUserAttr}"
>
<h:outputLabel
for=
"name2"
value=
"#{messages.name}"
/>
<h:outputText
id=
"name2"
value=
"#{userAttributeSourcesBean.selectedUserAttr.attributeSource.name}"
/>
</p:panelGrid>
<p:dataTable
var=
"v"
value=
"#{userAttributeSourcesBean.selectedUserAttr.values.toArray()}"
>
<p:column
style=
"width:128px"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{messages.key}"
/>
</f:facet>
<h:outputText
value=
"#{v.key}"
/>
</p:column>
<p:column
style=
"width:256px"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{messages.value}"
/>
</f:facet>
<h:outputText
value=
"#{v.valueString}"
/>
</p:column>
</p:dataTable>
</p:outputPanel>
</p:dialog>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment