use of com.google.gwt.xml.client.Text in project pentaho-platform by pentaho.
the class PermissionsPanel method replacePermissionsWithAll.
private void replacePermissionsWithAll(Element ace, Document fileInfo) {
NodeList perms = ace.getElementsByTagName(PERMISSIONS_ELEMENT_NAME);
int childCount = perms.getLength();
for (int i = 0; i < childCount; i++) {
Node perm = perms.item(i);
if (perm != null) {
ace.removeChild(perm);
}
}
Element newPerm = fileInfo.createElement(PERMISSIONS_ELEMENT_NAME);
Text textNode = fileInfo.createTextNode(Integer.toString(PERM_ALL));
newPerm.appendChild(textNode);
ace.appendChild(newPerm);
}
use of com.google.gwt.xml.client.Text in project pentaho-platform by pentaho.
the class PermissionsPanel method addRecipient.
/**
* @param recipientName
* @param recipientType
*/
void addRecipient(String recipientName, int recipientType, Document fileInfo) {
Element newAces = fileInfo.createElement(ACES_ELEMENT_NAME);
Element newPermission = fileInfo.createElement(PERMISSIONS_ELEMENT_NAME);
Element newRecipient = fileInfo.createElement(RECIPIENT_ELEMENT_NAME);
Element newRecipientType = fileInfo.createElement(RECIPIENT_TYPE_ELEMENT_NAME);
Element modifiableElementName = fileInfo.createElement(MODIFIABLE_ELEMENT_NAME);
Text textNode = fileInfo.createTextNode(recipientName);
newRecipient.appendChild(textNode);
textNode = fileInfo.createTextNode(Integer.toString(recipientType));
newRecipientType.appendChild(textNode);
textNode = fileInfo.createTextNode(Boolean.toString(true));
modifiableElementName.appendChild(textNode);
newAces.appendChild(newPermission);
newAces.appendChild(newRecipient);
newAces.appendChild(newRecipientType);
newAces.appendChild(modifiableElementName);
fileInfo.getDocumentElement().appendChild(newAces);
// Base recipient is created at this point.
// Now give them the default perms.
String strRecipientType = Integer.toString(recipientType);
updatePermissionForUserOrRole(fileInfo, recipientName, strRecipientType, true, PERM_READ);
}
use of com.google.gwt.xml.client.Text in project pentaho-platform by pentaho.
the class PermissionsPanel method addPermission.
/**
* @param recipient
* @param permission
*/
private void addPermission(String recipient, String recipientType, int permission, Document fileInfo) {
NodeList aces = fileInfo.getElementsByTagName(ACES_ELEMENT_NAME);
for (int i = 0; i < aces.getLength(); i++) {
Element ace = (Element) aces.item(i);
if (ace.getElementsByTagName(RECIPIENT_ELEMENT_NAME).item(0).getFirstChild().getNodeValue().equals(recipient) && ace.getElementsByTagName(RECIPIENT_TYPE_ELEMENT_NAME).item(0).getFirstChild().getNodeValue().equals(recipientType)) {
Element newPerm = fileInfo.createElement(PERMISSIONS_ELEMENT_NAME);
Text textNode = fileInfo.createTextNode(Integer.toString(permission));
newPerm.appendChild(textNode);
ace.appendChild(newPerm);
}
}
}
use of com.google.gwt.xml.client.Text in project data-access by pentaho.
the class DatabaseConnectionConverter method convertToXml.
public String convertToXml(IDatabaseConnection dbConn) {
Document document = XMLParser.createDocument();
try {
Element databaseConnection = document.createElement(DATABASE_CONNECTION);
document.appendChild(databaseConnection);
Element databaseName = document.createElement(DATABASE_NAME);
Text databaseNameText = document.createTextNode(dbConn.getDatabaseName());
databaseName.appendChild(databaseNameText);
databaseConnection.appendChild(databaseName);
Element databasePort = document.createElement(DATABASE_PORT);
Text databasePortText = document.createTextNode(dbConn.getDatabasePort());
databasePort.appendChild(databasePortText);
databaseConnection.appendChild(databasePort);
Element hostname = document.createElement(HOSTNAME);
Text hostnameText = document.createTextNode(dbConn.getHostname());
hostname.appendChild(hostnameText);
databaseConnection.appendChild(hostname);
Element indexTablespace = document.createElement(INDEX_TABLESPACE);
Text indexTablespaceText = document.createTextNode(dbConn.getIndexTablespace());
indexTablespace.appendChild(indexTablespaceText);
databaseConnection.appendChild(indexTablespace);
Element dataTablespace = document.createElement(DATA_TABLESPACE);
Text dataTablespaceText = document.createTextNode(dbConn.getIndexTablespace());
dataTablespace.appendChild(dataTablespaceText);
databaseConnection.appendChild(dataTablespace);
Element informixServername = document.createElement(SERVER_NAME);
Text informixServernameText = document.createTextNode(dbConn.getInformixServername());
informixServername.appendChild(informixServernameText);
databaseConnection.appendChild(informixServername);
Element name = document.createElement(NAME);
Text nameText = document.createTextNode(dbConn.getName());
name.appendChild(nameText);
databaseConnection.appendChild(name);
Element username = document.createElement(USERNAME);
Text usernameTxt = document.createTextNode(dbConn.getUsername());
username.appendChild(usernameTxt);
databaseConnection.appendChild(username);
Element password = document.createElement(PASSWORD);
Text passwordText = document.createTextNode(dbConn.getPassword());
password.appendChild(passwordText);
databaseConnection.appendChild(password);
Element accessType = document.createElement(ACCESS_TYPE);
Text accessTypeText = document.createTextNode(dbConn.getAccessType().getName());
accessType.appendChild(accessTypeText);
databaseConnection.appendChild(accessType);
Element databaseType = document.createElement(DATABASE_TYPE);
Text databaseTypeText = document.createTextNode(dbConn.getDatabaseType().getShortName());
databaseType.appendChild(databaseTypeText);
databaseConnection.appendChild(databaseType);
Element attrributes = document.createElement(ATTRIBUTES);
databaseConnection.appendChild(attrributes);
Map<String, String> attributeMap = dbConn.getAttributes();
for (String key : attributeMap.keySet()) {
Element attribute = document.createElement(key);
Text attributeText = document.createTextNode(attributeMap.get(key));
attribute.appendChild(attributeText);
attrributes.appendChild(attribute);
}
return document.toString();
} catch (Exception e) {
return null;
}
}