Mercurial > hg > mpdl-group
view software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/escidoc/Grant.java @ 0:408254cf2f1d
Erstellung
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 24 Nov 2010 17:24:23 +0100 |
parents | |
children |
line wrap: on
line source
package de.mpg.mpiwg.berlin.mpdl.escidoc; public class Grant { private String userName = "jwillenborg"; private String userId = "/aa/user-account/escidoc:22650"; private String roleName = "System-Administrator"; private String roleId = "/aa/role/escidoc:role-system-administrator"; public Grant(String userName, String userId, String roleName, String roleId) { this.userName = userName; this.userId = userId; this.roleName = roleName; this.roleId = roleId; } public String toXmlString() { StringBuilder str = new StringBuilder(); str.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); str.append("<grants:grant xmlns:grants=\"http://www.escidoc.de/schemas/grants/0.5\" xmlns:prop=\"http://escidoc.de/core/01/properties/\" " + "xmlns:srel=\"http://escidoc.de/core/01/structural-relations/\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"); str.append("<grants:properties>"); str.append("<srel:granted-to resource=\"user-account\" xlink:type=\"simple\" xlink:title=\"" + userName + "\" xlink:href=\"" + userId + "\"/>"); str.append("<srel:created-by xlink:type=\"simple\" xlink:title=\"System Administrator User\" xlink:href=\"/aa/user-account/escidoc:exuser1\" />"); str.append("<srel:role xlink:type=\"simple\" xlink:title=\"" + roleName + "\" xlink:href=\"" + roleId + "\" />"); str.append("</grants:properties>"); str.append("</grants:grant>"); return str.toString(); } }