@QueryParam(value = "resource") UriRef resource,
@QueryParam(value = "roles") String roles,
@QueryParam(value = "user") String userName,
@Context UriInfo uriInfo) throws ParseException {
AccessController.checkPermission(new UserManagerAccessPermission());
LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
MGraph resultGraph = new SimpleMGraph();
NonLiteral node = new BNode();
resultGraph.add(new TripleImpl(resource, USERMANAGER.custominformation,
node));
resultGraph.add(new TripleImpl(node, RDF.type,
USERMANAGER.CustomUserInformationPage));
ArrayList<NonLiteral> customfields = new ArrayList<NonLiteral>();
if (!roles.equals("") && roles.trim().length() > 0) {
String[] rolesArray = roles.split(",");
for (int i = 0; i < rolesArray.length; i++) {
NonLiteral collection = customPropertyManager
.getCustomPropertyCollection(PERMISSION.Role,
rolesArray[i]);
customfields.addAll(customPropertyManager
.getCustomfieldsOfCollection(collection));
}
}
for (NonLiteral customField : customfields) {
UriRef property = customPropertyManager
.getCustomFieldProperty(customField);
if (userName != null && !userName.equals("")
&& userName.trim().length() > 0) {
NonLiteral user = getCustomUser(contentGraph, userName);
if (user != null) {
Lock readLock = contentGraph.getLock().readLock();
readLock.lock();
try {
Iterator<Triple> values = contentGraph.filter(user,
property, null);
while (values.hasNext()) {
Resource value = values.next().getObject();
resultGraph.add(new TripleImpl(customField,
CUSTOMPROPERTY.actualvalues, value));