Java Code Examples for org.dom4j.Attribute#getStringValue()

The following examples show how to use org.dom4j.Attribute#getStringValue() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public void initialise(Element element, NamespacePrefixResolver nspr, PermissionModel permissionModel)
{
    Attribute recipientAttribute = element.attribute(RECIPIENT);
    if (recipientAttribute != null)
    {
        recipient = recipientAttribute.getStringValue();
    }
    else
    {
        recipient = null;
    }

    Attribute accessAttribute = element.attribute(ACCESS);
    if (accessAttribute != null)
    {
        if (accessAttribute.getStringValue().equalsIgnoreCase(ALLOW))
        {
            access = AccessStatus.ALLOWED;
        }
        else if (accessAttribute.getStringValue().equalsIgnoreCase(DENY))
        {
            access = AccessStatus.DENIED;
        }
        else
        {
            throw new PermissionModelException("The default permission must be deny or allow");
        }
    }
    else
    {
        access = AccessStatus.DENIED;
    }
    
    
    Element permissionReferenceElement = element.element(PERMISSION_REFERENCE);
    QName typeQName = QName.createQName(permissionReferenceElement.attributeValue(TYPE), nspr);
    String name = permissionReferenceElement.attributeValue(NAME);
    permissionReference = PermissionReferenceImpl.getPermissionReference(typeQName, name);
}
 
Example 2
public void initialise(Element element, NamespacePrefixResolver nspr, PermissionModel permissionModel)
{
   Attribute nodeRefAttribute = element.attribute(NODE_REF);
   if(nodeRefAttribute != null)
   {
       nodeRef = new NodeRef(nodeRefAttribute.getStringValue());
   }
   
   Attribute inheritFromParentAttribute = element.attribute(INHERIT_FROM_PARENT);
   if(inheritFromParentAttribute != null)
   {
       inheritPermissionsFromParent = Boolean.parseBoolean(inheritFromParentAttribute.getStringValue());
   }
   else
   {
       inheritPermissionsFromParent = true;
   }
   
   // Node Permissions Entry

   for (Iterator npit = element.elementIterator(NODE_PERMISSION); npit.hasNext(); /**/)
   {
       Element permissionEntryElement = (Element) npit.next();
       ModelPermissionEntry permissionEntry = new ModelPermissionEntry(nodeRef);
       permissionEntry.initialise(permissionEntryElement, nspr, permissionModel);
       permissionEntries.add(permissionEntry);
   }
    
}
 
Example 3
public void initialise(Element element, NamespacePrefixResolver nspr, PermissionModel permissionModel)
{
    Attribute authorityAttribute = element.attribute(AUTHORITY);
    if(authorityAttribute != null)
    {
        authority = authorityAttribute.getStringValue();
    }
    Attribute permissionAttribute = element.attribute(PERMISSION);
    if(permissionAttribute != null)
    {
        permissionReference = permissionModel.getPermissionReference(null, permissionAttribute.getStringValue());
    }

}
 
Example 4
Source Project: olat   File: EssayResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the row size to the value stored in this column attribute. It the attribute is null the row size is set to the default value
 * 
 * @param i
 */
public void setRows(final Attribute i) {
    if (i == null) {
        rows = ROWS_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setRowsFromString(value);
    }
}
 
Example 5
Source Project: olat   File: EssayResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the column size to the value stored in this column attribute. It the attribute is null the size is set to the default value
 * 
 * @param i
 */
public void setColumns(final Attribute i) {
    if (i == null) {
        columns = COLUMNS_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setColumnsFromString(value);
    }
}
 
Example 6
Source Project: olat   File: FIBResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets se size to the value stored in this column attribute. It the attribute is null the size is set to the default value
 * 
 * @param i
 */
public void setSizeFromColumns(final Attribute i) {
    if (i == null) {
        size = SIZE_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setSizeFromString(value);
    }
}
 
Example 7
Source Project: olat   File: FIBResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets se size to the value stored in this column attribute. It the attribute is null the size is set to the default value
 * 
 * @param i
 */
public void setMaxLengthFromMaxChar(final Attribute i) {
    if (i == null) {
        maxLength = MAXLENGTH_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setMaxLengthFromString(value);
    }
}
 
Example 8
Source Project: olat   File: EssayResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the row size to the value stored in this column attribute. It the attribute is null the row size is set to the default value
 * 
 * @param i
 */
public void setRows(final Attribute i) {
    if (i == null) {
        rows = ROWS_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setRowsFromString(value);
    }
}
 
Example 9
Source Project: olat   File: EssayResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the column size to the value stored in this column attribute. It the attribute is null the size is set to the default value
 * 
 * @param i
 */
public void setColumns(final Attribute i) {
    if (i == null) {
        columns = COLUMNS_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setColumnsFromString(value);
    }
}
 
Example 10
Source Project: olat   File: FIBResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets se size to the value stored in this column attribute. It the attribute is null the size is set to the default value
 * 
 * @param i
 */
public void setSizeFromColumns(final Attribute i) {
    if (i == null) {
        size = SIZE_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setSizeFromString(value);
    }
}
 
Example 11
Source Project: olat   File: FIBResponse.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets se size to the value stored in this column attribute. It the attribute is null the size is set to the default value
 * 
 * @param i
 */
public void setMaxLengthFromMaxChar(final Attribute i) {
    if (i == null) {
        maxLength = MAXLENGTH_DEFAULT;
    } else {
        final String value = i.getStringValue();
        setMaxLengthFromString(value);
    }
}
 
Example 12
private String getStringData(Attribute element) {
    String value = element.getStringValue();
    value = value.trim().replace('\\', '/');
    return value;
}