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
cdbf1659
Commit
cdbf1659
authored
Mar 19, 2015
by
michael.simon
Browse files
optimize data model for attribute sources
parent
4c7a9a37
Changes
7
Hide whitespace changes
Inline
Side-by-side
bwreg-jpa/src/main/java/edu/kit/scc/webreg/entity/as/ASUserAttrEntity.java
View file @
cdbf1659
...
...
@@ -74,5 +74,4 @@ public class ASUserAttrEntity extends AbstractBaseEntity {
public
void
setValues
(
Set
<
ASUserAttrValueEntity
>
values
)
{
this
.
values
=
values
;
}
}
bwreg-jpa/src/main/java/edu/kit/scc/webreg/entity/as/AttributeSourceEntity.java
View file @
cdbf1659
...
...
@@ -11,6 +11,7 @@
package
edu.kit.scc.webreg.entity.as
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.persistence.Column
;
import
javax.persistence.ElementCollection
;
...
...
@@ -20,6 +21,7 @@ import javax.persistence.Inheritance;
import
javax.persistence.InheritanceType
;
import
javax.persistence.JoinTable
;
import
javax.persistence.MapKeyColumn
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
org.hibernate.annotations.Fetch
;
...
...
@@ -53,6 +55,9 @@ public class AttributeSourceEntity extends AbstractBaseEntity {
@Column
(
name
=
"service_source"
)
private
Boolean
serviceSource
;
@OneToMany
(
targetEntity
=
AttributeSourceServiceEntity
.
class
,
mappedBy
=
"attributeSource"
)
private
Set
<
AttributeSourceServiceEntity
>
attributeSourceServices
;
public
String
getName
()
{
return
name
;
}
...
...
@@ -92,4 +97,13 @@ public class AttributeSourceEntity extends AbstractBaseEntity {
public
void
setServiceSource
(
Boolean
serviceSource
)
{
this
.
serviceSource
=
serviceSource
;
}
public
Set
<
AttributeSourceServiceEntity
>
getAttributeSourceServices
()
{
return
attributeSourceServices
;
}
public
void
setAttributeSourceServices
(
Set
<
AttributeSourceServiceEntity
>
attributeSourceServices
)
{
this
.
attributeSourceServices
=
attributeSourceServices
;
}
}
bwreg-jpa/src/main/java/edu/kit/scc/webreg/entity/as/AttributeSourceUserEntity.java
deleted
100644 → 0
View file @
4c7a9a37
/*******************************************************************************
* 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.entity.as
;
import
javax.persistence.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
edu.kit.scc.webreg.entity.AbstractBaseEntity
;
import
edu.kit.scc.webreg.entity.UserEntity
;
@Entity
(
name
=
"AttributeSourceUserEntity"
)
@Table
(
name
=
"attribute_src_user"
)
public
class
AttributeSourceUserEntity
extends
AbstractBaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ManyToOne
@JoinColumn
(
name
=
"user_id"
,
nullable
=
false
)
private
UserEntity
user
;
@ManyToOne
@JoinColumn
(
name
=
"attribute_src_id"
,
nullable
=
false
)
private
AttributeSourceEntity
attributeSource
;
public
AttributeSourceEntity
getAttributeSource
()
{
return
attributeSource
;
}
public
void
setAttributeSource
(
AttributeSourceEntity
attributeSource
)
{
this
.
attributeSource
=
attributeSource
;
}
public
UserEntity
getUser
()
{
return
user
;
}
public
void
setUser
(
UserEntity
user
)
{
this
.
user
=
user
;
}
}
bwreg-service/src/main/java/edu/kit/scc/webreg/service/reg/AttributeSourceQueryService.java
View file @
cdbf1659
...
...
@@ -11,5 +11,4 @@ public interface AttributeSourceQueryService extends Serializable {
void
updateUserAttributes
(
UserEntity
user
,
AttributeSourceEntity
attributeSource
,
String
executor
)
throws
RegisterException
;
}
bwreg-service/src/main/java/edu/kit/scc/webreg/service/reg/impl/AttributeSourceQueryServiceImpl.java
View file @
cdbf1659
...
...
@@ -19,6 +19,7 @@ import edu.kit.scc.webreg.dao.as.AttributeSourceDao;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.as.ASUserAttrEntity
;
import
edu.kit.scc.webreg.entity.as.AttributeSourceEntity
;
import
edu.kit.scc.webreg.entity.as.AttributeSourceServiceEntity
;
import
edu.kit.scc.webreg.exc.RegisterException
;
import
edu.kit.scc.webreg.service.reg.AttributeSourceQueryService
;
...
...
@@ -50,7 +51,7 @@ public class AttributeSourceQueryServiceImpl implements AttributeSourceQueryServ
@Inject
private
ApplicationConfig
appConfig
;
@Override
public
void
updateUserAttributes
(
UserEntity
user
,
AttributeSourceEntity
attributeSource
,
String
executor
)
throws
RegisterException
{
...
...
@@ -67,6 +68,10 @@ public class AttributeSourceQueryServiceImpl implements AttributeSourceQueryServ
asUserAttr
=
asUserAttrDao
.
persist
(
asUserAttr
);
}
for
(
AttributeSourceServiceEntity
asse
:
attributeSource
.
getAttributeSourceServices
())
{
logger
.
debug
(
"Attributes requested for service {}"
,
asse
.
getService
().
getName
());
}
AttributeSourceWorkflow
workflow
=
getWorkflowInstance
(
attributeSource
.
getAsClass
());
AttributeSourceAuditor
auditor
=
new
AttributeSourceAuditor
(
auditDao
,
auditDetailDao
,
appConfig
);
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/bean/UserAttributeSourcesBean.java
View file @
cdbf1659
...
...
@@ -20,7 +20,9 @@ import javax.inject.Inject;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.as.ASUserAttrEntity
;
import
edu.kit.scc.webreg.entity.as.AttributeSourceEntity
;
import
edu.kit.scc.webreg.service.ASUserAttrService
;
import
edu.kit.scc.webreg.service.AttributeSourceService
;
import
edu.kit.scc.webreg.service.UserService
;
import
edu.kit.scc.webreg.util.SessionManager
;
...
...
@@ -34,6 +36,7 @@ public class UserAttributeSourcesBean implements Serializable {
private
List
<
ASUserAttrEntity
>
userAttrList
;
private
ASUserAttrEntity
selectedUserAttr
;
private
AttributeSourceEntity
selectedAttributeSource
;
@Inject
private
UserService
userService
;
...
...
@@ -41,6 +44,9 @@ public class UserAttributeSourcesBean implements Serializable {
@Inject
private
ASUserAttrService
asUserAttrService
;
@Inject
private
AttributeSourceService
attributeSourceService
;
@Inject
private
SessionManager
sessionManager
;
...
...
@@ -73,6 +79,12 @@ public class UserAttributeSourcesBean implements Serializable {
public
void
setSelectedUserAttr
(
ASUserAttrEntity
selectedUserAttr
)
{
selectedUserAttr
=
asUserAttrService
.
findByIdWithAttrs
(
selectedUserAttr
.
getId
(),
"values"
);
selectedAttributeSource
=
attributeSourceService
.
findByIdWithAttrs
(
selectedUserAttr
.
getAttributeSource
().
getId
(),
"attributeSourceServices"
);
this
.
selectedUserAttr
=
selectedUserAttr
;
}
public
AttributeSourceEntity
getSelectedAttributeSource
()
{
return
selectedAttributeSource
;
}
}
bwreg-webapp/src/main/webapp/user/attribute-sources.xhtml
View file @
cdbf1659
...
...
@@ -64,8 +64,15 @@
<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}"
/>
<h:outputLabel
value=
"#{messages.attribute_sources}"
/>
<p:dataList
var=
"ass"
value=
"#{userAttributeSourcesBean.selectedAttributeSource.attributeSourceServices.toArray()}"
>
<h:outputText
value=
"#{ass.service.name}"
/>
</p:dataList>
</p:panelGrid>
<p:dataTable
var=
"v"
value=
"#{userAttributeSourcesBean.selectedUserAttr.values.toArray()}"
>
<p:column
style=
"width:128px"
>
...
...
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