XWiki Datenmodell (Rust)

Aus Dokument
Zur Navigation springen Zur Suche springen

Hinweis: Diese Inhalte wurden mit Unterstützung von Künstlicher Intelligenz erstellt und redaktionell überprüft (Transparenzhinweis gemäß Art. 50 EU AI Act).

Dieses Datenmodell bildet den typischen Aufbau von XWiki in Rust ab, nur als struct/enum (keine Logik):

Wiki → Space → Document → Objects/Attachments/Revisions

Grundstruktur: Wiki, Space, Document

Eine XWiki-Instanz kann mehrere (Sub-)Wikis enthalten (Wiki-Farm).

struct Wiki {
    id: String,              // z.B. "xwiki"
    name: String,
    description: String,
    spaces: Vec<Space>,
    is_main_wiki: bool,
}

Spaces sind hierarchisch (können verschachtelt sein).

struct Space {
    name: String,
    parent: Option<Box<Space>>,
    documents: Vec<Document>,
    subspaces: Vec<Space>,
}

Ein Dokument (Page) ist die zentrale Content-Einheit in XWiki.

struct Document {
    id: DocumentReference,
    title: String,
    content: String,
    syntax: Syntax,
    version: String,          // z.B. "1.3"
    revisions: Vec<Revision>,
    objects: Vec<XObject>,
    attachments: Vec<Attachment>,
    author: String,
    creator: String,
    creation_date: String,    // ggf. chrono::DateTime<Utc>
    last_modified: String,
    locale: String,
    parent: Option<DocumentReference>,
    tags: Vec<String>,
    hidden: bool,
}

Eindeutige Referenz auf ein Dokument: wiki:space.page

struct DocumentReference {
    wiki: String,
    spaces: Vec<String>,      // verschachtelte Space-Pfade
    page: String,
}

Versionierung

struct Revision {
    version: String,
    author: String,
    date: String,
    comment: String,
    minor_edit: bool,
}

Syntax / Rendering

enum Syntax {
    XWiki20,
    XWiki21,
    Markdown11,
    Html5,
    Plain,
    Velocity,
    Other(String),
}

XClass / XObject / XProperty (das "strukturierte Daten"-System)

Eine XClass definiert ein wiederverwendbares Datenschema (wie eine Klasse).

struct XClass {
    reference: DocumentReference,
    properties: Vec<XProperty>,
}

struct XProperty {
    name: String,
    prop_type: PropertyType,
    pretty_name: String,
    mandatory: bool,
}

enum PropertyType {
    StringProperty,
    TextAreaProperty,
    NumberProperty(NumberKind),
    BooleanProperty,
    DateProperty,
    ListProperty { values: Vec<String>, multi_select: bool },
    DBListProperty { query: String },
    PasswordProperty,
    EmailProperty,
    UsersProperty,
    GroupsProperty,
}

enum NumberKind {
    Integer,
    Long,
    Float,
    Double,
}

Ein XObject ist eine Instanz einer XClass, an ein Dokument angehängt.

struct XObject {
    class_reference: DocumentReference,
    number: u32,               // Index, falls mehrere Objects gleicher Klasse
    properties: Vec<PropertyValue>,
}

struct PropertyValue {
    name: String,
    value: FieldValue,
}

enum FieldValue {
    Text(String),
    Number(f64),
    Boolean(bool),
    Date(String),
    List(Vec<String>),
    Empty,
}

Attachments

struct Attachment {
    filename: String,
    mime_type: String,
    size_bytes: u64,
    author: String,
    date: String,
    version: String,
    content_ref: String,       // Pfad/Handle zum Binärinhalt
}

Rechte / Sicherheit

struct Right {
    level: RightLevel,
    entity: RightEntity,
    scope: RightScope,
    allow: bool,
}

enum RightLevel {
    View,
    Edit,
    Comment,
    Delete,
    Admin,
    Register,
    ProgrammingRight,
}

enum RightEntity {
    User(String),
    Group(String),
}

enum RightScope {
    Wiki(String),
    Space(String),
    Document(DocumentReference),
}

Benutzer / Gruppen

struct User {
    reference: DocumentReference,   // Users sind selbst Dokumente in XWiki.XWikiUsers
    username: String,
    email: String,
    groups: Vec<String>,
    active: bool,
}

struct Group {
    reference: DocumentReference,
    members: Vec<String>,
}

Zusammenfassung

  • WikiSpace (verschachtelbar) → Document als Basis-Hierarchie
  • Document trägt Content (in einer Syntax) und strukturierte Daten via XObject/XClass/XProperty
  • Attachment und Revision hängen am Dokument
  • Rechte (Right) sind granular auf Wiki/Space/Document-Ebene vergebbar

Hinweis

Hinweis: Diese Inhalte wurden mit Unterstützung von Künstlicher Intelligenz erstellt und redaktionell überprüft (Transparenzhinweis gemäß Art. 50 EU AI Act).