Search in sources :

Example 1 with AclImpl

use of org.apache.wiki.auth.acl.AclImpl in project jspwiki by apache.

the class WikiPage method clone.

/**
 *  Creates a deep clone of a WikiPage.  Strings are not cloned, since
 *  they're immutable.  Attributes are not cloned, only the internal
 *  HashMap (so if you modify the contents of a value of an attribute,
 *  these will reflect back to everyone).
 *
 *  @return A deep clone of the WikiPage
 */
public Object clone() {
    WikiPage p = new WikiPage(m_engine, m_name);
    p.m_wiki = m_wiki;
    p.m_author = m_author;
    p.m_version = m_version;
    p.m_lastModified = m_lastModified != null ? (Date) m_lastModified.clone() : null;
    p.m_fileSize = m_fileSize;
    for (Map.Entry<String, Object> entry : m_attributes.entrySet()) {
        p.m_attributes.put(entry.getKey(), entry.getValue());
    }
    if (m_accessList != null) {
        p.m_accessList = new AclImpl();
        for (Enumeration<AclEntry> entries = m_accessList.entries(); entries.hasMoreElements(); ) {
            AclEntry e = entries.nextElement();
            p.m_accessList.addEntry(e);
        }
    }
    return p;
}
Also used : AclImpl(org.apache.wiki.auth.acl.AclImpl) AclEntry(org.apache.wiki.auth.acl.AclEntry) Map(java.util.Map) HashMap(java.util.HashMap) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AclEntry (org.apache.wiki.auth.acl.AclEntry)1 AclImpl (org.apache.wiki.auth.acl.AclImpl)1