Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

Prism is a data representation mechanisms that allows to present data in several formats and the same time. Prism objects have support for full schema (definitions) for a reliable data conversion. It includes deltas and diff/patch mechanism to support relative change model. Prisms can be transformed to compile-time classes and therefore considerably speed up the development cycle.

...

Code Block
xml
titleXML representation
xml

<user oid="123456">
  <name>jack</name>
  <employeeType>Captain</employeeType>
  <employeeType>Pirate</employeeType>
  <activation>
    <enabled>true</enabled>
  <activation>
</user>
Code Block
javascript
titleJSON representation
javascript

{
  "_oid": "123456",
  "name": "jack",
  "employeeType": [ "Captain", "Pirate" ],
  "activation": {
    "enabled": true,
  }
}

...

Code Block
java
titleLive data example
java

// Set the "fullName" property using a JAXB interface
UserType userType = ....
userType.setFullName("Jack Sparrow");

// Invoking native Prism interface to read fullName, returns "Jack Sparrow"
PrismObject<UserType> userPrism = ....
String fullName = userPrism.findProperty(new QName(NS_C, "fullName").getValue().getValue();

// Invoking DOM interface to read the fullName, returns "Jack Sparrow"
Element fullnameElement = ....
String fullName = fullnameElement.getTextContent()

...

Code Block
xml
titleObject with extension (XML representation)
xml

<user oid="123456">
  <name>jack</name>
  <extension>
    <pir:shipName>Black Pearl</pir:shipName>
  </extension>
  <employeeType>Captain</employeeType>
  <employeeType>Pirate</employeeType>
</user>

...

Code Block
java
titleInterface switching example
java

PrismObject<UserType> userPrism = ....;                                        // Native Prism API
UserType userType = userPrism.asObjectable();                                  // Switch to JAXB generated class

userType.setFullName("Jack Sparrow");                                          // Sets the "fullName" property

String fullName =
  userPrism.findProperty(new QName(NS_C, "fullName").getValue().getValue();    // Returns "Jack Sparrow"

...

Data Format

Parsing

Serialization

XML

Yes (DOM, StAX planned soon)

Yes (DOM)

JSON

Planned

Planned

Prism in midPoint

Prism is used as a universal data representation through the entire midPoint system. It is used from end to end, from user interface to the database. Every midPoint component works with prism objects. It means that midPoint is not using XML or JSON directly. Change of representation format is possible in the future.

See Also