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

The following examples show how to use org.dom4j.Attribute#getStringValue() . 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 check out the related API usage on the sidebar.
Example 1
Source File: ModelPermissionEntry.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
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
Source File: NodePermission.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
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
Source File: GlobalPermissionEntry.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 File: EssayResponse.java    From olat with 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 File: EssayResponse.java    From olat with 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 File: FIBResponse.java    From olat with 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 File: FIBResponse.java    From olat with 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 File: EssayResponse.java    From olat with 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 File: EssayResponse.java    From olat with 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 File: FIBResponse.java    From olat with 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 File: FIBResponse.java    From olat with 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
Source File: ServerConfiguration.java    From livingdoc-confluence with GNU General Public License v3.0 4 votes vote down vote up
private String getStringData(Attribute element) {
    String value = element.getStringValue();
    value = value.trim().replace('\\', '/');
    return value;
}