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
c6f37cff
Commit
c6f37cff
authored
Mar 16, 2015
by
michael.simon
Browse files
Test for Attribute Source query
parent
7e3d5a47
Changes
4
Hide whitespace changes
Inline
Side-by-side
bwreg-jpa/src/main/java/edu/kit/scc/webreg/dao/jpa/as/JpaASUserAttrDao.java
View file @
c6f37cff
...
...
@@ -27,9 +27,9 @@ public class JpaASUserAttrDao extends JpaBaseDao<ASUserAttrEntity, Long> impleme
@Override
public
ASUserAttrEntity
findASUserAttr
(
UserEntity
user
,
AttributeSourceEntity
attributeSource
)
{
try
{
return
(
ASUserAttrEntity
)
em
.
createQuery
(
"select a from ASUserAttrEntity
e
where "
return
(
ASUserAttrEntity
)
em
.
createQuery
(
"select a from ASUserAttrEntity
a
where "
+
"a.user = :user and a.attributeSource = :attributeSource"
)
.
setParameter
(
"user"
,
user
).
setParameter
(
"attributeSource"
,
"
attributeSource
"
).
getSingleResult
();
.
setParameter
(
"user"
,
user
).
setParameter
(
"attributeSource"
,
attributeSource
).
getSingleResult
();
}
catch
(
NoResultException
e
)
{
return
null
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/as/HttpUrlSingleAttributeSource.java
View file @
c6f37cff
...
...
@@ -83,7 +83,7 @@ public class HttpUrlSingleAttributeSource extends
if
(
entity
!=
null
)
{
try
{
String
r
=
EntityUtils
.
toString
(
entity
);
logger
.
debug
(
"Got String {}"
,
r
);
}
catch
(
ParseException
e
)
{
throw
new
RegisterException
(
e
);
}
catch
(
IOException
e
)
{
...
...
@@ -91,6 +91,9 @@ public class HttpUrlSingleAttributeSource extends
}
}
}
else
{
logger
.
debug
(
"Status HttpUrlSingleAS is not OK. It is {} - {}"
,
response
.
getStatusLine
().
getStatusCode
(),
response
.
getStatusLine
().
getReasonPhrase
());
}
}
}
bwreg-webapp/src/main/java/edu/kit/scc/webreg/bean/admin/as/ShowAttributeSourceBean.java
View file @
c6f37cff
...
...
@@ -12,16 +12,22 @@ package edu.kit.scc.webreg.bean.admin.as;
import
java.io.Serializable
;
import
javax.enterprise.context.RequestScoped
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.ViewScoped
;
import
javax.faces.event.ComponentSystemEvent
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
org.slf4j.Logger
;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.as.AttributeSourceEntity
;
import
edu.kit.scc.webreg.exc.RegisterException
;
import
edu.kit.scc.webreg.service.AttributeSourceService
;
import
edu.kit.scc.webreg.service.UserService
;
import
edu.kit.scc.webreg.service.reg.AttributeSourceQueryService
;
@
Named
(
"showAttributeSource
Bean
"
)
@
Request
Scoped
@
Managed
Bean
@
View
Scoped
public
class
ShowAttributeSourceBean
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -29,14 +35,42 @@ public class ShowAttributeSourceBean implements Serializable {
@Inject
private
AttributeSourceService
service
;
@Inject
private
UserService
userService
;
@Inject
private
AttributeSourceQueryService
asQueryService
;
@Inject
private
Logger
logger
;
private
AttributeSourceEntity
entity
;
private
Long
id
;
private
String
testUsername
;
public
void
preRenderView
(
ComponentSystemEvent
ev
)
{
entity
=
service
.
findByIdWithAttrs
(
id
,
"asProps"
);
if
(
entity
==
null
)
{
entity
=
service
.
findByIdWithAttrs
(
id
,
"asProps"
);
}
}
public
void
testSource
()
{
UserEntity
user
=
userService
.
findByEppn
(
testUsername
);
if
(
user
==
null
)
{
logger
.
info
(
"User {} not found"
,
testUsername
);
return
;
}
try
{
asQueryService
.
updateUserAttributes
(
user
,
entity
,
"test"
);
}
catch
(
RegisterException
e
)
{
logger
.
info
(
"Exception!"
,
e
);
}
}
public
Long
getId
()
{
return
id
;
}
...
...
@@ -52,4 +86,12 @@ public class ShowAttributeSourceBean implements Serializable {
public
void
setEntity
(
AttributeSourceEntity
entity
)
{
this
.
entity
=
entity
;
}
public
String
getTestUsername
()
{
return
testUsername
;
}
public
void
setTestUsername
(
String
testUsername
)
{
this
.
testUsername
=
testUsername
;
}
}
bwreg-webapp/src/main/webapp/admin/as/show-attribute-source.xhtml
View file @
c6f37cff
...
...
@@ -25,7 +25,7 @@
<h2><h:outputText
value=
"#{messages.job_class}: #{showAttributeSourceBean.entity.name}"
/></h2>
<div
class=
"panel"
>
<p:panel
header=
"#{messages.
job_class
}"
>
<p:panel
header=
"#{messages.
attribute_source
}"
>
<p:panelGrid
id=
"baseData"
columns=
"2"
>
...
...
@@ -69,6 +69,17 @@
</p:panel>
</div>
<div
class=
"panel"
>
<p:panel
header=
"#{messages.tools}"
>
<p:panelGrid
id=
"testData"
columns=
"2"
>
<h:outputText
value=
"#{messages.eppn}:"
/>
<p:inputText
value=
"#{showAttributeSourceBean.testUsername}"
/>
</p:panelGrid>
<p:commandButton
action=
"#{showAttributeSourceBean.testSource()}"
value=
"#{messages.test_source}"
/>
</p:panel>
</div>
</h:form>
</ui:define>
...
...
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