FirstSpirit Object Service - Documentation for Developers

e-Spirit AG

FirstSpirit Version 5.x

2017-10-06
Table of Contents

1. Introduction

FirstSpirit enables customer-specific projects, which are subject to a huge variety of different requirements, to be realized. One of these requirements is often to transfer the content maintained in the content management system (CMS) to a portal server and then use it there.

With its open and expandable system architecture, FirstSpirit provides the optimum conditions for integrating editorial content into various portal servers, such as SAP, IBM, Liferay or Sharepoint.

Particular benefits can be achieved by combining a portal server with the FirstSpirit CMS, as this sees the individual technical characteristics of a pure portal-server solution, such as sophisticated navigation adaptations, complemented by the functional strengths of the FirstSpirit system and transferred into a successful complete system.

Portal integration with FirstSpirit always consists of two parts:

  1. Components on the FirstSpirit side

    These components are used to determine and prepare the necessary editorial data, and to transfer it to the portal server. They are usually generic, i.e., independent of the specific portal server to which the data is being transferred.

  2. Components on the portal side

    These components are used to process the editorial content and transfer it from the CMS into a specific portal server; therefore, they are always particular to a certain portal server.

This document will describe the components on the FirstSpirit side and their functionalities in order to depict the requirements for implementing the necessary component on the portal side. The component on the portal side is explained in separate documentation.

This document is aimed at portal developers, who should be able to implement the possibility of portal integration with its help. It is not a handbook for FirstSpirit developers or editors.

As a prerequisite, the reader must be confident in using FirstSpirit version 5.x and already be familiar with UX-Bridge.

1.1. Architecture

A portal is connected to FirstSpirit through an architecture consisting of components which are coupled to one another (see figure Architecture).

These components are:

  • The FirstSpirit Object Service module installed on the FirstSpirit Server
  • The UX-Bridge including the UX-Bus
  • The FirstSpirit Object Service (FOS) including its internal persistence layer
  • The portal server including the portal-specific Portal Plugin

The Portal Plugin deals with importing the content into the connected portal. It is made available by the respective portal provider, who describes it in detail in separate documentation.

Architecture
Figure 1. Architecture


The individual components always interact in accordance with the following schema:

  • A change to content made on the FirstSpirit Server creates messages during a generation operation, which are made available on the UX-Bus. These messages contain all relevant information on the modified data.
  • The FirstSpirit Object Service (FOS) receives the messages and refreshes the data inventory stored in its internal persistence layer. It then uses the data matching procedure carried out during this step to determine which data has been changed exactly. The FOS passes the result of the alignment on to the Portal Plugin of the connected portal via the UX-Bus in the form of event messages, after it has first indicated the start of the schedule by sending a status message. The portal is informed of potential changes to content via ChangedContent messages. The information transfer is concluded by another status message.
  • The Portal Plugin accepts these service messages and triggers a refresh operation of the data's live state within the portal. Depending on the portal, the information contained in the event message may not be sufficient for the refresh operation. In this case, the Portal Plugin requests the required data from the FOS via its REST interface, to enable it to perform the refresh.

The contents from FirstSpirit (images, texts, etc.) are not transferred from the FOS. If you wish these to be available, they must be transferred separately. There are several processes for implementing this. For example, the contents can be transferred via the UX-Bridge. However, we recommend a solution using a file system.

1.2. Portal Plugin

The Portal Plugin is the connection element facilitating communication between the FirstSpirit Object Service (FOS) and the portal. It receives the service messages pushed by the FOS via the UX-Bus and itself uses the REST interface of the FOS to communicate with the latter (see figure Communication between the FOS and the Portal Plugin).

The REST interface is used to query further data from the FOS if the information transferred is not sufficient for refreshing the data inventory in the portal. Ideally, this step is omitted.

In the case of a full generation operation, the affected project is set to maintenance mode in the FOS and the Portal Plugin is informed when it starts and ends. No further information is sent, nor is it possible to query data for this project via the REST interface (see chapter Maintenance mode).

Once the maintenance mode has been terminated, the Portal Plugin independently performs a complete alignment process, whereby it discards the portal's entire existing data inventory and reads it in again using the REST interface.

Communication between the FOS and the Portal Plugin
Figure 2. Communication between the FOS and the Portal Plugin


1.3. Topics covered in this documentation

This document describes the interface for connecting portals to FirstSpirit and covers the elements required for the communication which takes place within the architecture.

Chapter 2: Developer's tasks are described in this chapter.

Chapter 3: All elements required for communication between the components are presented and explained in this chapter.

Chapter 4: This chapter contains important information which must be taken into consideration by the developer.

Chapter 5: Certain specific terms used in this document are listed and explained in this chapter.

Chapter 6: This chapter contains e-Spirit AG's legal notices relating to the module described in this documentation.

2. Developer's tasks

Portal integration with FirstSpirit involves various components which are coupled to one another (see chapter Architecture). With the exception of the Portal Plugin, these are components on the FirstSpirit side.

The Portal Plugin is the connection element facilitating communication between the FOS and the portal. Since the Portal Plugin has to take the requirements of the relevant portal into account, it can only ever be a component on the portal side.

Therefore, it is up to the developer to implement the Portal Plugin. He must ensure that the Portal Plugin accepts the service messages made available on the UX-Bus by the FOS and processes them accordingly.

Should adaptations to the presentation channel become necessary in order to transfer further data, the developer must either make these changes too and make the results available or document the required steps.

The data transferred to the FOS can be queried via its REST interface. So the Portal Plugin must be able to use this interface and perform corresponding requests.

A request of this type is also required following a full generation operation, which activates the maintenance mode for the project. While maintenance mode is active, the FOS does not send any messages for the project and rejects all requests to the REST interface with a "Retry later" response. After the maintenance mode is terminated, the Portal Plugin is simply informed it has ended. It must then independently exchange the data available in the portal by requesting the modified data inventory from the FOS.

If specific information, such as the URL for the portal or access data, has to be configured on the FirstSpirit side, the developer must provide an appropriate configuration option for this. It makes sense to realize such a configuration option via a FirstSpirit module (for example, a ProjectApp with a configuration dialog) and to have the necessary attributes sent from that module to the FOS (see also chapter Project-specific attributes).

Finally, it is up to the developer to write the respective portal-specific Documentation for Users and make it available. This must include the steps required to use the Portal Plugin and should describe how the plugin works. In particular, it must point out the changes to potentially be made by the user (in the presentation channel, for example).

2.1. Project-specific attributes

There is a possibility that additional information, such as the URL for the portal or access data, may be required for the portal integration. In this case, the developer must provide an appropriate configuration option available on the FirstSpirit side, which accepts, processes, and forwards all information.

The FOS module has two methods via which project-specific attributes can be transferred to the FOS or removed from it for this purpose. It makes sense to integrate these methods into a ProjectApp and to gather the required information via a configuration dialog.

The next two sections show how to use the methods.

In order to avoid conflicts with other portal variables, it must be ensured that the keys of the project-specific attributes are unique. It is therefore recommended to use a prefix as per the following template:

<company name><Portal Plugin name><attribute name>

Example: eSpiritDefaultPluginMyKey

2.1.1. Adding and changing project-specific attributes

Project-specific attributes are added or changed using the insert method of an attributeHandler. This method expects a hashMap as a transfer parameter.

The map must be filled in advance with the project-specific attributes and the associated values in the form of key/value pairs. There is no restriction to a certain number of attributes here.

The insert method of the attributeHandler sends the hashMap to the FOS, in whose internal persistence layer the transferred values are saved. The individual attributes are then available to the Portal Plugin, which can query them via the REST interface.

Adding and changing project-specific attributes. 

import com.espirit.moddev.fos.AttributeHandler;
import java.util.HashMap;

// create attributeHandler
attributeHandler = new AttributeHandler(context);

// create map with attributes/values to add
attributeMap = new HashMap();
attributeMap.put(eSpiritDefaultPluginMyKey,myValue);
attributeMap.put(eSpiritDefaultPluginMySecondKey,mySecondValue);

// insert map
attributeHandler.insert(attributeMap);

2.1.2. Removing attributes

Project-specific attributes are removed using the delete method of an attributeHandler. This method expects a hashSet as a transfer parameter.

The attributes to be removed simply have to be added to the set; the values belonging to the attributes are not important here. They are removed at the same time the attributes are deleted, so they do not have to be specified explicitly.

The delete method of the attributeHandler transfers the hashSet to the FOS, which removes the corresponding attributes from its internal persistence layer.

Deleting attributes. 

import com.espirit.moddev.fos.AttributeHandler;
import java.util.HashSet;
// create attributeHandler
attributeHandler = new AttributeHandler(context);
// create set with attributes to delete
attributeSet = new HashSet();
attributeSet.add(eSpiritDefaulPluginMyKey);
// delete set
attributeHandler.delete(attributeSet);

3. Prerequisites for communication

Data is transferred from the FirstSpirit project being used into the connected portal by means of communication between the components used in the architecture (see figure Architecture).

This communication is ensured by a communication chain consisting of various elements:

The individual elements are explained in detail in the sections that follow.

3.1. Presentation channel

An additional XML channel, which must be created manually, is required as well as the presentation channels that already exist for a project.

The process of creating the XML channel is described in the FirstSpirit Object Service Documentation for Administrators and should, therefore, be carried out by an administrator.

Only the presentation channel described has to be added to the project, irrespective of the number of connected portals. It is not necessary to add a separate presentation channel for each portal!

The newly created presentation channel is activated automatically and is available in the project immediately. It can be used to add more attributes and media to the nodes created during the generation.

The data of the generated nodes is sent to the FOS in the messages created during a generation operation performed on the FirstSpirit Server and is saved in the persistence layer of the FOS. These messages already contain the languages and resolutions used within the project, as well as the data transferred by FirstSpirit as standard, for which the release states of the Page, Site, and Media Store are taken into account. The following information relating to the elements of these stores is recorded in the messages:

  • The UID
  • The FirstSpirit ID
  • The ID of the parent element
  • The revision
  • The type
  • The last editor
  • The release date
  • The display name
  • The URL
  • The type of URL
  • The file path
  • The user and group names
  • The metadata
  • The structure variables
  • The information as to whether a folder in the Site Store is displayed in the navigation
  • The information as to whether a folder in the Site Store is displayed in the sitemap
  • The start node of a folder in the Site Store
  • The list of content areas for a page
  • The sorting of child elements for a page
  • The translation status of pages
  • The flag for considering sections in the generation operation
  • The name of the section
  • The validity period of a section
  • The name of the section's higher-level content area
  • The file name of a medium
  • The description of a medium
  • The media type (picture/file)
  • A note on using a content projection
  • A note on using a document group

The datasets of a data source are represented by content projections, which are assigned in the FOS as separate PageRefContentProjection objects to both the associated page and to the page reference based on that page. If these objects are overview pages, an index is added to their reference name, according to the number of generated objects. The FS_ID of the associated dataset is added to the reference name of detail pages.

Document groups are combined into a single document by merging multiple page references and are therefore viewed as one individual page reference in the FOS.

In the messages sent to the FOS, the content projections and document groups receive a parameter, which identifies them accordingly. This parameter can assume the value true or false and is also saved in the persistence layer once the messages have been transferred. This enables content projections and document groups to be queried by the Portal Plugin via the REST interface too.

Content projections have an additional parameter, via which all IDs of the represented datasets are recorded. This is also saved in the persistence layer of the FOS.

The data of the document groups is only transferred if the presentation channel created previously by the administrator has been activated as a presentation channel in the respective document group (see figure Activated presentation channel within a document group).

Activated presentation channel within a document group
Figure 3. Activated presentation channel within a document group


If further data is to be transferred in addition to the information provided by FirstSpirit, the output must be expanded manually. This is facilitated by the presentation channel of the page template used, in which the required data must be specified in the form of an attribute or media list.

The structure of this attribute or media list and an example are described in the sections that follow.

The message addressed to the FOS is expanded accordingly. After the transfer, the project-specific data is saved to the persistence layer of the FOS automatically, in addition to the standard FirstSpirit data.

The project-specific data is thus available to be accessed via the REST interface and can (just like the data transferred by FirstSpirit as standard) be queried by the Portal Plugin and used in the portal.

Project-specific data may be, for example, simple content from input components, the individual images of a media folder referenced for a gallery or calculated values, such as a validity period required for the visibility of content. Information from the project settings can also be transferred in this way.

If the additional data is defined in the presentation channel of a different template (e.g., section, format or table template), it must be referenced in the presentation channel of the page template. Otherwise, it will not be considered as part of the generation, nor will it be forwarded to the FOS.

3.1.1. List of attributes

Each attribute consists of a key/value pair and a tag, which surrounds the pair. The surrounding tag comprises the type and the reference name (UID) of the required element to which the new attribute is to be added. The key can be selected as desired - with one exception - and encloses the data to be transferred, which is the value that corresponds to the selected key.

So an individual attribute has the following structure:

<OBJEKTTYP uid=UID_OBJEKT>
 <KEY>VALUE</KEY>
</OBJEKTTYP>

The available object types are: Media, MediaFolder, Page, PageFolder, PageRef, PageRefContentProjection, PageRefFolder, and Section.

The key contentUrl_<language code> represents a special case. It cannot be used to expand a node, since it serves to overwrite the URL attribute. Therefore, this key should be used with caution.

The individual attributes, as many of which as desired can be specified within the presentation channel, must be combined into a list using a surrounding <attributes/> tag.

Input:

<attributes>
 <PageFolder uid="$CMS_VALUE(#global.node.uid)$">
  <portlettype>$CMS_VALUE(pt_portlettype)$</portlettype >
 </PageFolder>
 <Page uid="$CMS_VALUE(#global.page.uid)$">
  <pageportletname>$CMS_VALUE(pt_portletname)$</pageportletname>
 </Page>
</attributes>

Output:

<attributes>
 <PageFolder uid="umsetzungmitfirstspirit">
  <portlettype>WIDGET</portlettype>
 </PageFolder>
 <Page uid="firstspirit">
  <pageportletname>Blog</pageportletname>
 </Page>
</attributes>

It is important to note that attributes can only be added for the elements which have been generated in each case. This means they must be contained in the message addressed to the FOS.

This message always consists of the following for a generated element:

  • The page reference including parent chain
  • The page including parent chain
  • The sections contained in the page
  • The media (excluding remote media)

    • referenced in a page or a section
    • referenced in the metadata of an existing element
    • used for navigation

An attempt to add an attribute to an element which does not exist will result in a warning in the generation schedule.

3.1.2. List of media

The tag <medialist/> enables a list of media to be transferred in addition to the attribute list. The individual entries in this list contain four items of information, which belong together in two pairs:

The first pair relates to the medium and contains its type and reference name.

The second pair refers to the element which uses the medium. The origin and originType values specify the reference name and the type of this element. It could be, for example, a folder or a section within a page.

The following values are possible for the originType: PageRefFolder, PageRef, Page, and Section.

Sections do not have unique reference names. For this reason, the reference name of the corresponding page must also be specified for the origin value for sections. It should precede the reference name of the section, separated by a hash symbol (#):

origin="<reference name of the page>#<reference name of the section>"

Example

origin="mithras_home#pressreleaseteaser"

The structure of the origin value entry will change, depending on where the media list is entered:

Example for entry in the presentation channel of a page template

$CMS_VALUE(#global.page.name)$#$CMS_VALUE(#global.page.body("Content left").children.first.name)$

Example for entry in the presentation channel of a section template

$CMS_VALUE(#global.page.name)$#$CMS_VALUE(#global.section.name)$

Both pairs are bundled into a tag and together they represent one entry in the list of media.

Therefore, a media list with just one element has the following structure:

<medialist>
 <Media uid=UID_MEDIUM origin=UID_REFERENZELEMENT originType=TYPE_REFERENZELEMENT/>
</medialist>

The medium is saved in the persistence layer of the FOS with this information and a reference to the specified reference element is generated.

The individual media entries do not contain any attributes, as these are recorded and sent to the FOS via the standard FirstSpirit mechanism (see also chapter Presentation channel).

If other data is to be transferred in addition, it must be recorded in the list of attributes.

A media list with just one entry could look like this.

Input:

<medialist>
 <Media uid="connector_cable" originType="$CMS_VALUE(#global.node.UidType)$" origin="$CMS_VALUE(#global.page.name)$"/>
</medialist>

Output:

<medialist>
 <Media uid="connector_cable" originType="Page" origin="mithras_home"/>
</medialist>

3.1.3. Combining the lists

In order to be able to send the information made available via the attribute and media lists in the message created by a generation operation, the two individual lists must be combined into one joint list.

This is done using the surrounding <supplementary/> tag, which links the two lists to one another:

<supplementary>
 <attributes> […] </attributes>
 <medialist> […] </medialist>
</supplementary>

3.1.4. Example

A simple XML message generated as described in the preceding sections could look like this, for example:

<supplementary>
 <attributes>
  <PageFolder uid="umsetzungmitfirstspirit">
   <portlettype>WIDGET</portlettype>
  </PageFolder>
  <Page uid="firstspirit">
   <pageportletname>Blog</pageportletname>
  </Page>
 </attributes>
 <medialist>
  <Media uid="connector_cable" originType="PageRefFolder" origin="firstspirit"/>
 </medialist>
</supplementary>

As mentioned in chapter List of attributes, content projections can be supplemented by additional attributes too. In this case, however, it is necessary to expand the Uid, whereby a distinction must be made between detail and overview pages.

The ID of the relevant dataset must be appended to the Uid of detail pages, separated by a hash symbol (#).

The index of the relevant page (0 ... n) is also appended to the Uid of overview pages, again separated by a hash symbol (#).

<supplementary>
 <attributes>
  // Detailpage
  <PageRefContentProjection uid="$CMS_VALUE(#global.node.uid)$#$CMS_VALUE(#global.dataset.entity.id)$">
   <myAttribute>myValue</myAttribute>
  </PageRefContentProjection>
  // Overviewpage
  <PageRefContentProjection uid="$CMS_VALUE(#global.node.uid)$#$CMS_VALUE(#global.pageParams.index)$">
   <myAttribute>myValue</myAttribute>
  </PageRefContentProjection>
 </attributes>
</supplementary>

3.2. Service messages

Communication between the FOS and the Portal Plugin is usually performed via service messages, which are pushed to the Portal Plugin by the FOS.

A distinction must be made between three different types of service message:

These messages are sent as standard to:

activemq:topic:PORTAL-EVENTS

This end point is defined in the applicationContext.xml of the FOS and can be changed by the administrator if necessary. For a description of this process, refer to the FirstSpirit Object Service Documentation for Administrators.

Portal Plugin requests to the FOS are made via its REST interface.

3.2.1. Status messages

Each time a generation operation is run, the Portal Plugin is informed of this via what are known as status messages, which indicate the start and end of the schedule respectively.

Furthermore, the status messages also contain information on the type of generation executed on the FirstSpirit Server. A full generation operation activates the maintenance mode for the corresponding project in the FOS automatically.

The Portal Plugin must be informed of this state, as the FOS stops communication while maintenance mode for this project is active. It also reacts to all requests to the REST interface with a "Retry later" response. So the Portal Plugin receives no information on the corresponding project from the FOS during this time.

The information transferred and the structure of a status message are described in chapter Message structure.

3.2.2. Event messages

The FOS sends information on changes, that have been made to the data inventory and determined as such, to the Portal Plugin via the UX-Bus. This information is referred to as an event message. Each event message contains a list of individual events.

A full generation operation activates the maintenance mode for the corresponding project in the FOS. This mode prevents event messages being sent to the Portal Plugin. The data inventory in the portal is refreshed by the Portal Plugin afterwards, using the REST interface.

An event message is only sent by the FOS automatically if it is deemed necessary. Prior to that, data matching must first have been performed in the persistence layer of the FOS, which was in turn triggered by a generation operation on the FirstSpirit Server.

If data matching does not determine that any changes have been made to the data inventory, it is superfluous to send event messages to the Portal Plugin, as it is not necessary to refresh the live state on the portal server. In this case, the Portal Plugin is simply informed of the start and end of the schedule by means of a status message. However, no event messages are sent.

If data matching does record changes that have been made to the data inventory, the FOS transfers every one of these changes to the Portal Plugin in the form of event messages. Changes to inherited attributes, such as metadata, are a special case and are therefore dealt with separately (see chapter Inheritance).

Event messages are sent via push. No previous action is required on the part of the Portal Plugin. Ideally, the information contained in the event messages should be sufficient to refresh the data inventory contained in the portal. Otherwise the Portal Plugin must send a request to the REST interface.

A detailed explanation of the information transferred in event messages and its structure can be found in the sections that follow.

3.2.3. ChangedContent messages

The FOS transfers changes to content to the Portal Plugin via the UX-Bus using ChangedContent messages. These are special event messages, which differ from standard event messages only in terms of their type.

Since all data is deleted and read in again during a full generation, ChangedContent messages are only significant in conjunction with a delta generation. Unlike event messages, they are not affected by the maintenance mode, and will therefore still be sent if the maintenance mode has been activated manually.

A ChangedContent message is only sent automatically if it is deemed necessary, as is also the case for event messages.

Only if changes have been made to content will the FOS transfer these to the Portal Plugin. Unlike with event messages, information will be sent in precisely one ChangedContent message, in which all changes are combined.

If no changes have been detected, the Portal Plugin is simply informed of the start and end of the schedule by means of a status message.

ChangedContent messages are sent via push. No previous action is required on the part of the Portal Plugin.

To ensure that all information is transferred, the FOS must know all the project information. To this end, the Send project information message checkbox must be enabled, as described in the FirstSpirit Object Service Documentation for Administrators.

A detailed explanation of the information transferred in ChangedContent messages and its structure can be found in the sections that follow.

3.2.4. Maintenance mode

Generally speaking, a generation operation on the FirstSpirit Server and subsequent data matching in the FOS trigger the sending of event messages. Every change determined by the FOS generates an event message during this process, which is pushed to the Portal Plugin via the UX-Bus.

A full generation operation performed on the FirstSpirit Server, however, triggers an alignment of all data in the persistence layer of the FOS for a project. Such a full alignment would thus cause countless event messages to be sent.

To prevent this, the project is set to a maintenance mode in the FOS automatically while a full alignment is being performed. The Portal Plugin is informed of this procedure by a status message.

During the maintenance mode, the FOS does not deliver any data for the corresponding project to the Portal Plugin. If the Portal Plugin attempts to request data via the REST interface nevertheless, it receives a "Retry later" response.

Once the full alignment is complete, maintenance mode is usually deactivated automatically and the Portal Plugin is again informed of this by a corresponding status message. It then independently requests the project's entire data inventory via the REST interface and exchanges the data in the portal.

The FirstSpirit Object Service Admin Interface provides an option to activate or deactivate the maintenance mode manually. If this is done, the FOS may behave differently.

If the maintenance mode had already been activated manually prior to the full alignment or if errors occur during it, the project will remain in maintenance mode even after the full alignment is over. Automatic deactivation does not happen in this case.

More information is available in the FirstSpirit Object Service Documentation for Administrators.

3.2.5. Inheritance

In FirstSpirit there is an option to define attributes at folders of the Site, Page, and Media Store and for all lower-level elements to inherit them by using metadata, for example.

If a portal possesses the inheritance function, it is sufficient to only take such a folder into account to a limited extent: Just the change made to the attributes of the parent node is kept in the associated event message and transferred to the Portal Plugin. This then automatically assigns the attributes to the lower-level elements.

If a portal does not possess the inheritance function, it is not sufficient to transfer the information of the parent node, as the change which has been made would then only be assigned to that node. The effect of this change on the attributes of its lower-level elements would therefore be lost, which would result in a loss of information. This is why all lower-level elements are also transferred to the Portal Plugin via event messages in this case. However, these additional messages which are sent only say which elements are affected. They do not contain the modified attributes, as they would otherwise be transferred for both the parent node and all lower-level elements. This would lead to redundancies. In order to prevent this, the modified attributes themselves must be determined for every lower-level element via the REST interface of the FOS.

When modifying a site folder, only that folder and information on the change which has been made are ever recorded in the event message. In this case, this information is sufficient, since every portal is able to map the structure and is thus usually capable of assigning the attributes of a parent node to its lower-level structure elements.

If a page folder is changed, the event message always contains, alongside the corresponding PageFolder event, the events for all the pages contained in the folder and the page references based on them. The Portal Plugin thus receives all the information it needs in every case: If the portal being used cannot handle inheritance, the modified attributes are assigned via a query to the REST interface of the FOS. Otherwise the information on the page folder contained in the event message is sufficient.

Since the effects of changes made to site and page folders are thus already recorded via the general structure of the event messages (see also the table in chapter Message structure), inheritance simply has to be taken into account for the attributes defined at media folders.

The handling of media folders can be explicitly defined manually via a switch in the FirstSpirit Object Service Admin Interface.

MediaEvent mode for media folders
Figure 4. MediaEvent mode for media folders


This switch is described in the FirstSpirit Object Service Documentation for Administrators and should, therefore, only be used by an administrator.

If the MediaEvent mode is set to SINGLE, only the media folder, including information on the modifications which have been made, is recorded in the corresponding event message. The modified attributes are assigned to its lower-level elements via the Portal Plugin.

If the MULTI MediaEvent mode is activated, only the events for all the elements contained in the folder are recorded in the associated event message. This also includes subfolders contained in the folder. The folder itself is not taken into account. For this reason the modified attributes are assigned to the media at this point already and not afterwards via a request to the REST interface of the FOS.

To avoid data loss, the MULTI MediaEvent mode is activated as standard.

3.2.6. Message structure

The Portal Plugin receives service messages in the form of JSON documents, which always have the same structure, as follows:

{
 "schedulerID":"ID",
 "projectName" : "PROJECTNAME",
 "createTime" : "A MESSAGE'S CREATE TIME",
 "startTime" : "A SCHEDULE'S START TIME",
 "type" : "A MESSAGE'S TYPE"
 //specific Parameter
 "status" : "A STATUS MESSAGE'S STATUS"
 "fullGeneration": TRUE OR FALSE
 "events" : [ {...} ]
}

Since the FOS may potentially manage several projects and these will all use the same interface, it must always be possible to unambiguously assign the service messages to a FirstSpirit project. Therefore, every JSON document created by the FOS initially contains the project's unique name, the time the message was created, and the start time of the underlying generation schedule:

"projectName" : "PROJECTNAME",
"createTime" : "AN EVENT MESSAGE'S CREATE TIME",
"startTime" : "THE SCHEDULE'S START TIME",

The type specified for the message distinguishes whether it is a status message, an event message or a ChangedContent message. For a status message, the parameter has the value StatusMessage; for an event message, it is EventMessage; and for a ChangedContent message, it is ChangedContentMessage.

"type" : "StatusMessage"
"type" : "EventMessage"
"type" : "ChangedContentMessage"

Chapter Examples uses examples to explain the message types.

Status message

In the case of a status message, the status and fullGeneration parameters are added to the document.

The status parameter can only have the values start and end. These define whether the information relates to the start or the end of a generation operation.

"status" : "start"	// Schedule Start
"status" : "end"	// Schedule End

The fullGeneration parameter identifies the type of generation and can only have the value true or false. In the case of a full generation operation, the parameter has the value true.

"fullGeneration" : true		// Full-Generation
"fullGeneration" : false	// each other Generation

The Portal Plugin can use the fullGeneration parameter to identify that the maintenance mode has been activated in the FOS for the project.

If the fullGeneration parameter has the value true, a full generation operation has been performed. A generation operation of this type activates the maintenance mode for the project automatically.

The Portal Plugin is informed of the start and end of the maintenance mode via the status messages with the values start and end for the status parameter and the value true for the fullGeneration parameter:

The maintenanceModeStopped parameter provides information about whether or not the maintenance mode has been deactivated again once the full generation is complete and can only have the value true or false. If the maintenance mode has been deactivated, the parameter has the value true. The maintenance mode can be retained if the number of errors allowed in the FOS has been exceeded during the generation.

[...]
"type" : "StatusMessage"
"status" : "start" || "end"			// Start or End of the MaintenanceMode
"fullGeneration" : true
"maintenanceModeStopped" : "true" || "false 	// just when status:end

Event message

In the case of an event message, the rest of the document's structure is formed by an array of associated events:

"events" : [
 { [...] },
 { [...] }
]

These events always represent the change made to one single element. With the exception of media, the element's parent chain is also always taken into account, which is why the events are sometimes mutually dependent.

Within the parent chain there is a special feature in relation to the start pages. If changes have been made to a start page within the parent chain and no event has yet been sent for the same, this start page will be transferred in the current event message (including folder). This guarantees that a start page is always available for every folder, either because the information has already been sent in a previous event message or is being delivered in the current message.

The table below shows the events triggered if a change is made:

Table 1. Overview of events triggered due to a change
Event triggeredPageRef folderPageRefContent projectionPageSectionPage folderMediumMedia folderUserGroup

Change to

PageRefFolder

PageRef

ContentProjection

Page

Section

PageFolder

Medium

MediaFolder

[]

[]

User

Group



Changes to MediaFolders are indicated differently in this table, as in this case the send process is controlled by the inheritance functionality (see chapter Inheritance). One or the other check mark in the table will apply, depending on the configuration.

Since sections are always part of a page in FirstSpirit, they do not have their own version or change date. They always use the information of the associated page. Therefore, if a change is made to a section, all other sections of the page are always affected too.

The event message generated for such a change thus contains events for all the sections included in the page.

If several elements have been changed within the project, a separate event message is created for each element.

The structure of an event is described in the section that follows.

3.2.7. Structure of an event

All events always have the following parameters:

  • type
  • id
  • origin
  • refname
  • nodeType
  • removedProperties
  • changedProperties
  • addedReferences
  • removedReferences
  • addedPermissions
  • removedPermissions

These correspond to the type of the event, as well as the reference name and the type of the element represented by the event. The properties of the element which have potentially been changed or deleted and the references of the element which have been added or deleted are also specified.

The values available for the nodeType and type parameters are explained in the corresponding sections.

The id parameter corresponds to a consecutive number assigned to the events within an event message. It serves to uniquely identify an event within an event message.

The origin parameter can only have the values true or false. It indicates whether the specific element represented by the event has changed or just a referenced element. If a section has been changed, for example, a Page event must be generated too. In this case, the Section event receives the value true for the origin parameter. Since the Page event was only generated on the basis of the Section event, but the page has not changed, the origin parameter in the Page event adopts the value false.

Changes to the properties of a FirstSpirit element are transferred in the form of removedProperties or changedProperties:

"events": [
{ "type":"...",
  "id":...,
  "origin":...,
  "refname":"...",
  "nodeType": "...",

  "removedProperties": [
   {"name":"headline", "language":"DE"},
   {"name":"headline", "language":"EN"} ],

  "changedProperties": [
   {"name":"title", "langugae":"DE", "value":"Startseite"},
   {"name":"title", "language":"EN", "value":"Startpage"},
   {"name":"description", "value":"The startpage!"} ]
}]

The Properties are all specified by their respective names. Since the value of a property is only significant in the event of changes, it is not listed for removed properties.

In addition, the language parameter and a language code are added to language-dependent properties to enable the removed or changedProperties to be processed for all languages available in the project.

The references of a FirstSpirit element are recorded by specifying addedReferences or removedReferences:

{ "type":"...",
  "id":...,
  "origin":...,
  "refname":"...",
  "nodeType":"...",

  "addedReferences": [
   { "refType":"REFERENCE'S TYPE",
     "refname":"THE REFERENCED ELEMENT'S REFERENCENAME",
     "type":"THE REFERENCED ELEMENT'S TYPE",
     "direction":"The DIRECTION OF THE REFERENCE"} ],

  "removedReferences": [
   { "refType":" THE REFERENCE'S TYPE ",
     "refname":" THE REFERENCED ELEMENT'S REFERENCENAME",
     "type":"THE REFERENCED ELEMENT'S TYPE",
     "direction":"The DIRECTION OF THE REFERENCE"} ]
}

Each entry contains the type of reference, the reference name, and the type of element referenced. Possible values for the refType are:

  • references
  • isParent
  • isStartNode
  • navPicture
  • navPictureMouseover
  • navPictureSelected
  • navPictureMouseoverSelected

The direction of the connection is also specified via the direction attribute. Possible values are INCOMING for incoming connections or OUTGOING for outgoing connections.

Changes to a user's or a group's access permissions are represented by the corresponding User or Group events. These contain the nodeType User or Group and have the following parameters as well as the ones which are always present:

  • addedPermissions
  • removedPermissions

This is information relating to permissions which have either been assigned to or removed from a user or a group.

{ "type" : "MODIFIED",
  "id" : ...,
  "origin" : true,
  "refname" : "USER'S (OR GROUP'S) NAME",
  "nodeType" : "USER OR GROUP",

  "addedPermissions" : [
   { "access" : "ZUGRIFFSRECHT",
     "refname" : "NAME DES KNOTENS",
     "nodeType" : "TYP DES KNOTENS"
   } ],

   "removedPermissions" : [
    { "access" : "ZUGRIFFSRECHT",
      "refname" : "NAME DES KNOTENS",
      "nodeType" : "TYP DES KNOTENS"
    } ],
}

Every entry in the two lists contains the reference name and the node type of the element for which access permissions have been changed. The value of the access parameter indicates exactly which permission has been changed. For example, if the canChange permission has been removed on the page with the reference name homepage, this is depicted as follows in the event message:

"removedPermissions" : [
 { "access" : "canChange",
   "refname" : "homepage",
   "nodeType" : "Page"
 } ]

All values available for the access parameter are explained in chapter Access.

If there are no values for the removedProperties, changedProperties, addedReferences, removedReferences, removedPermissions, or changedPermissions parameters for an event, these parameters are not included in the event.

3.2.8. NodeType

Each event represents a change to the FirstSpirit project being used. This may be a change to a user group, an individual user or an element from the Page, Site or Media Store.

The following values are therefore available for the nodeType parameter:

  • Group
  • User
  • Page
  • Section
  • PageFolder
  • PageRef
  • PageRefContentProjection
  • PageRefFolder
  • Media
  • MediaFolder

Document groups are not included in this list, as they consist of several individual pages, which are combined into one single document. They are treated in the same way as page references and, as such, trigger events with the PageRef node type.

Changes to datasets in the data sources are not taken into account by explicit events either, as they are recorded by means of content projections. These are assigned in the FOS to the associated page and page reference via a separate PageRefContentProjection object. Therefore, they are represented by the corresponding events with the PageRefContentProjection node type.

3.2.9. Type

A FirstSpirit element always has one of four possible states, according to whether the corresponding element has been created, modified, deleted or not edited at all.

Since a non-edited element has no significance when it comes to refreshing the live state, the following values are available for the type parameter of an event (see chapter Event messages):

  • CREATED
  • MODIFIED
  • DELETED

Since individual events are mutually dependent, an event message may sometimes contain several events with different node types (see chapter NodeType) but the same event type.

Example 1 - Deleting a page

If a page is deleted, for example, this will also require the media used exclusively by that page to be removed too, as well as the sections belonging to it and the page references based on it. Assuming that a page does not exist in total isolation within a project, a corresponding event message would therefore have to contain not only the Page event, but also, potentially, a Media event, Section event, and PageRef event too. In this case, all four events would have the event type DELETE.

Example 2 - Deleting a section

Deleting a section removes just that section itself and the media used exclusively by that section. The associated page and the page reference based on it are retained; they are, however, classed as modified. The corresponding event message would therefore have to contain not only the Section event and Media event with the event type DELETED, but also a Page event and PageRef event with the event type MODIFIED.

Media which are no longer referenced anywhere else are deleted from the persistence layer of the FOS. They are not removed from the FirstSpirit project being used.

3.2.10. Access

The editorial permissions which can be configured in the FirstSpirit JavaClient (see figure Editorial permissions which can be configured in the JavaClient) are irrelevant when it comes to subsequently viewing the deployed live page.

Editorial permissions which can be configured in the JavaClient
Figure 5. Editorial permissions which can be configured in the JavaClient


However, certain use cases are possible where editors are redirected via a corresponding methodology from the portal into the FirstSpirit environment in order to edit content, for example. It makes good sense for this methodology to only be available to editors logged in to the portal who have the necessary FirstSpirit permissions; otherwise, it should be hidden.

For this reason, changes to editorial permissions are also transferred to the Portal Plugin with the event messages (see chapter Structure of an event). The relevant permission is specified in a User or Group event via the access parameter, which then takes on one of the following values:

  • canSee
  • canRead
  • canChange
  • canDelete
  • canAppendLeaf
  • canAppendFolder
  • canDeleteLeaf
  • canDeleteFolder
  • canRelease
  • canMetaSee
  • canMetaChange
  • canChangePermission
  • canNothing

Since the permissions are inherited between the user/user group and node, the canNothing "permission" is required. The canNothing permission serves to distinguish whether a permission is inherited from the parent node or does not exist. For example, if a User has the canRead permission for a PageRefFolder, he also has read access to all PageRefs in that folder, provided that no specific access permissions have been set for these PageRefs. If read access (and all other permissions) is rejected for a PageRef, this receives the canNothing permission for this user or user group. Without the canNothing permission this could not be done and inheritance would not be possible. It comes into play if the inheritance hierarchy has been interrupted in FirstSpirit and all permissions have been removed for a user or user group.

The canNothing permission is only required for the purpose of inheritance management on the portal side. If a node is retrieved via the REST interface, it always has all the relevant permissions for that node.

For information on the individual editorial permissions, refer to the FirstSpirit Handbook for Editors.

3.2.11. Examples

This section provides an example of each of the three message types.

Status message

A status message created by the FOS could look like this, for example:

{ "schedulerId":"139292",
  "projectName":"FOS-Project",
  "createTime":"1369404090435",
  "startTime":"1369404090509",
  "type":"StatusMessage",
  "status":"start",
  "fullGeneration":false
}

The status message can be identified in this example by its type. Its status indicates that it is a start message, which is used to inform the Portal Plugin of the start of a schedule. This schedule is not a full generation operation, as the fullGeneration parameter shows.

Event message

An event message created by the FOS for sending to the Portal Plugin could have the following content, for example:

{ "schedulerID":"3141592", "projectName":"Mithras Energy",
  "createTime":"1369404090435", "startTime":"1369404090509",
  "type":"EventMessage",
  "events":[
   { type:MODIFIED, id:1, origin:true,
     refname:startpageref, nodeType:PageRef
   },
   { type: MODIFIED, id:2, origin:true,
     refname:startpage, nodeType:Page
   },
   { type:CREATED, id:3, origin:true,
     refname:newstartpagetext, nodeType:Section
   },
   { type:DELETED, id:4, origin:true,
     refname:startpagetext, nodeType:Section
   },
   { type:DELETED, id:5, origin:true,
     refname:startpageimage1, nodeType:Media
   },
   { type:DELETED, id:6, origin:true,
     refname:startpageimage2, nodeType:Media
   },
   { type:MODIFIED, id:7, origin:true,
     refname:everybody, nodeType:Group,
     removedPermission:[
      {	refname: startpageref, type:PageRef,
        access:canChange },
      {	refname: startpage, type:Page,
        access:canChange }
] } ] }

In this example, the startpagetext section has been deleted (see id:4). Since there were no further references from other elements to the startpageimage1 and startpageimage2 media used by that section, they have been removed too (see id:5 and id:6). The three events therefore have the event type DELETED.

The newstartpagetext section has been created in place of the deleted section for the same page (see id:3). Therefore, the associated event type is CREATED.

The changes described mean that the startpage belonging to the section and the startpageref based on the page are also classed as modified (see id:1 and id:2). Furthermore, the canChange permission has been removed from the everybody group on the startpage and the startpageref (see id:7). The three events are therefore of the type MODIFIED.

ChangedContent message

A ChangedContent event message created by the FOS for sending to the Portal Plugin could have the following content, for example:

{ "schedulerId":"5887",
  "projectName":"FOS-Project,
  "createTime":"1375169338642",
  "startTime":"1375169338781",
  "type":"ChangedContentMessage",
  "events":[
    { "type":"MODIFIED",
      "id":3,
      "origin":true,
      "refname":"startpageref",
      "nodeType":"PageRef"
    }
  ]
}

In this example, the content of the startpageref section has been changed.

It is not possible to determine the extent to which the page content has been modified. Therefore, in order to transfer the new content, the page must be imported into the portal from the generation directory of the FirstSpirit Server again.

Depending on the portal, it may be necessary to first query additional information about the page from the FOS via the Rest interface for this import.

3.3. REST interface

Changes made in a project are transferred to the FOS by means of a deployment. This shares the information required to refresh the live state with the Portal Plugin via what are known as event messages, following a data matching process (see chapter Service messages).

Further information may be needed for a refresh operation, depending on the portal being used. The FOS has a REST interface for this purpose, which enables the Portal Plugin to request additional data from the FOS.

Technically speaking, the FOS is a web application to be installed on a web application server. One part of this application is the REST Api documentation, where the methods made available by the REST interface are recorded.

The process of installing the web application depicting the FOS on a web application server is described in the FirstSpirit Object Service Documentation for Administrators and should, therefore, be carried out by an administrator.

The REST Api documentation is provided in the form of a website (see figure REST Api documentation). It can be accessed in the browser via the application server on which the FOS has been installed, under the following address:
http://<server name>:<port>/<web app name>/ui/apidoc

REST Api documentation
Figure 6. REST Api documentation


On this page, all operations made available by the REST interface are listed and described. Clicking on the name of an operation expands it, showing detailed information on its functionality, parameters, return values, etc. Furthermore, the Try it out! button provides an opportunity to test the operation. To do this, however, a valid API Key used in the request must be entered at the top right of the page.

More detailed information on API Keys can be found in the chapters below and in the FirstSpirit Object Service Documentation for Administrators.

3.3.1. Data which can be queried via the REST interface

The messages created during the generation operation performed on the FirstSpirit Server enable data to be transferred to the FOS and saved in its persistence layer.

The messages include the information made available via the extra presentation channel which has been created, as well as standard FirstSpirit data.

Since the data transferred via the presentation channel is project-specific and, as such, always individual, no further details can be given on it.

The languages and resolutions used in the project are recorded for the part of the message created by FirstSpirit as standard; the release states of the Page, Site, and Media Store are also taken into account.

A list of the information contained in this part of the message can be found in chapter Presentation channel.

All information is saved in the persistence layer of the FOS. It can be queried via the REST interface and is thus also available to the Portal Plugin if necessary.

The REST interface has a URL, to which all requests must be directed:
http://<server name>:<port>/<webb app name>/rest/v1

If the result of a request is required in the tree view (parameter: view=tree), the site folder and sections are output in the same order in which they are arranged in the FirstSpirit project.

Each request to the REST interface must contain an HTTP header called apikey. This header's value must be a UUID, which is known to the FOS as an API Key.

The API Keys are used to define access permissions for projects via the REST interface. Without this header, a request will be answered with the state 401 Unauthorized. As well as permissions for reading project data, an API Key can also have administrative permissions for a project, which enable it to send requests that modify the project.

More information on managing API Keys is available in the FirstSpirit Object Service Documentation for Administrators.

3.3.2. FOS client

The FOS client makes it possible to perform queries to the REST interface of the FOS from an application, which is usually the Portal Plugin which is to be implemented. It must be integrated into this application and is therefore provided in the form of a jar file, which is included in the supplied fos-client <version number> distribution.tar.gz along with all the other dependencies.

When updating a module, it is necessary to extract the fos-client <version number>.jar file and, if applicable, all other dependencies, from the distribution and use only these to exchange the jar files used.

3.3.3. Examples

Two examples of requests to the REST interface of the FOS are depicted here. All requests can be carried out via an http request and by using the Java API. Both versions and the result of the request are provided for each example.

List of all projects managed by the FOS

Since the FOS is not linked to one particular project on the FirstSpirit Server, it will usually manage several projects, which use it as an interface. This example shows how to query an overview of all these projects.

http request

A query via an http request is performed by expanding the URL:

http://<server name>:<port>/<web app name>/rest/v1/projects

A header called apikey containing a valid API Key as a value must be sent with this http request.

Java API

When performing a query via the Java API, an ApiClient with access to the REST interface of the FOS must be built first. It is important here to ensure that an http header is defined called apikey. The client can be used to query the resources of the FOS and to determine the projects it manages.

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import org.junit.Test;
import com.espirit.moddev.fos.api.project.Project;
import com.espirit.moddev.fos.api.result.ResultListProjects;
public class ClientExample {
 public void createClient() {
  // get a client builder for the REST-Service
  ApiClient.Builder apiClientBuilder = ApiClient.builder("http://<SERVERNAME>:<PORT>/<WEBAPP-NAME>/rest/v1/");

  // set the apikey to be used
  apiClientBuilder.header("apikey", "<APIKEY>");

  // build a Client
  ApiClient client = apiClientBuilder.build();

  // get the ProjectsResources
  ProjectsResources projectResources = client.getResources();

  // get all Projects
  ResultListProjects projects = projectResources.projects();

  // iterate over the Projects
  for (Project project : projects.getItems()) {
   System.out.println(project.getName());
  }
  client.close();
 }
}

Result

In this example, the REST interface returns the two projects FOS and FS Object Service. As can be seen in the additional information, FOS is a single-language project, while the FS Object Service project uses the German and English languages. Furthermore, just one of the two projects is in the maintenance mode, which has been activated automatically in this case.

{ "view":list,"items":[
  { "name":"FOS",
    "attributes":[{}],
    "languages":["DE"],
    "maintenanceMode":false,
    "automaticMaintenanceMode":false
  },
  { "name":"FS Object Service",
    "attributes":[{}],
    "languages":["DE","EN"],
    "maintenanceMode":true,
    "automaticMaintenanceMode":true
  }
] }

When the request was sent, an API Key was transferred, which had an impact on the content of the result. In creating the list of individual projects, the permissions of the API Key were taken into account and a result was generated that corresponds to these permissions. In this example, therefore, it can be assumed that the API Key has read permissions for the projects FOS and FS Object Service. However, it may be the case that other projects exist for which the API Key being used has no permissions and which, therefore, have not been included in the results. In the same way, it is also possible that neither FOS nor FS Object Service would be included in the results if a different API Key were used.

Determining a particular page from a particular project

In contrast to the previous example, it is also possible to determine just one single element via the REST interface of the FOS. This example shows the query which returns the Mithras home page reference from the FS Object Service project.

If the name of the project contains blank spaces or other special characters, it must be encoded for use within a URL.

Example

Name of the project: FS Object Service

URL encoded: FS%20Object%20Service

Slashes and backslashes represent a special case.

These are permitted in the names of FirstSpirit projects, but lead to problems in conjunction with Tomcat servers, which therefore exclude them as standard. The Tomcat server can be configured accordingly, but this will result in potential security vulnerabilities (see: http://tomcat.apache.org/tomcat-7.0-doc/security-howto.html).

When querying specific information from a project, instead of the display name, the respective reference names of the corresponding elements must be used.

Example

Display name of an object being used: Mithras home

Reference name of the same object: mithras_home

http request

In this case too, the request to the REST interface of the FOS causes the URL to be expanded. However, the name of the project, the type of the element to be determined, and its reference name are also specified:

http://<server name>:<port>/<web app name>/rest/v1/projects/FS%20Object%20Service/pageref/mithras_home

A header named apikey must be included in the http request here too!

Java API

When performing a query via the Java API, an ApiClient with access to the REST interface of the FOS must be built first. As for every other request, this primarily means that an API Key is defined in the http header. The ApiClient created enables all project resources to be queried, from which the required page reference can be determined.

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import org.junit.Test;
import com.espirit.moddev.fos.api.project.Project;
import com.espirit.moddev.fos.api.result.ResultListProjects;

public class ClientExample {
 public void createClient() {
  // get a client builder for the REST-Service
  ApiClient.Builder apiClientBuilder = ApiClient.builder("http://<SERVERNAME>:<PORT>/<WEBAPP-NAME>/rest/v1/");

  // set the apikey to be used
  apiClientBuilder.header("apikey", "<APIKEY>");

  // build a Client
  ApiClient client = apiClientBuilder.build();

  // get the ProjectsResources
  ProjectsResources projectResources = client.getResources();

  try {
   // get the pageref "mithras_home"
   Result result = projectResources.detail("FS Object Service", "pageref", "mithras_home", "list", null, null, null, null);
   System.out.println(result);
  } catch (NotFoundException e)
   e.printStackTrace();
  } catch (ProjectNotFoundException e)
   e.printStackTrace();
  } catch (BadRequestException e) {
   e.printStackTrace();
  } catch (MaintenanceException e) {
   e.printStackTrace();
  }
  client.close();
 }
}

Result

In this example, the REST interface returns the page reference Mithras home as required. The information transferred by FirstSpirit as standard regarding the page is also output.

{ "view": "list",
  "item": {
   "pageRef": {
    "refname": "mithras_home",
    "type": "PageRef",
    "attributes": [
     { "name": "fsId",
       "value": "325146"},
     { "name": "refname",
       "value": "mithras_home"},
     { "name": "type",
       "value": "PageRef"},
     { "name": "modifiedby",
       "value": "Admin"},
     { "name": "releasedate",
       "value": "1370595424313"},
     { "name": "displayName",
       "language": "DE",
       "value": "Mithras Startseite"},
     { "name": "displayName",
       "language": "EN",
       "value": "Mithras Homepage"},
     { "name": "url",
       "language": "DE",
       "value": "http://<LifeserverName>:<Port>/mithras/content/de/startpage/mithras_home.html"},
     { "name": "url",
       "language": "EN",
       "value": "http://<LifeserverName>:<Port>/mithras/content/en/startpage/mithras_home.html"}
    ],
    "groupPermissions": [],
    "userPermissions": [],
    "nodeReferences": {}
   }
 }
}

In this example too, it should be noted that the result depends on the API Key being used. In order to obtain the result shown, the API Key must have read permissions for the project FS Object Service. Otherwise the request would have ended with the http state 401 Unauthorized.

4. Important information

This chapter contains further information which should be noted for working with the FOS.

4.1. Data model

The data model used in the FOS is based on the data model used by FirstSpirit.

Data model
Figure 7. Data model


The arrows indicate the direction of the connection.

4.2. Hierarchy of the FirstSpirit elements

In FirstSpirit, the individual elements are subject to a fixed hierarchy which is defined both by the various stores and by the structuring of the elements within the stores. This hierarchy is determined by the FOS and is shown in the following graphic:

Hierarchy of the FirstSpirit elements
Figure 8. Hierarchy of the FirstSpirit elements


The arrows represent the links between the individual elements. The green arrows correspond to the relevant isParent relationship and therefore clarify the potential influence of an element on another one. It is important to note that this type of influence can only ever exist within a store.

Example

As a PageRef is based on a page, there is always a link to it. It is therefore not possible to inherit attributes from the PageRef to the page across the boundaries of the two stores. If the page still has inherited attributes, they can only come from the higher-level PageFolder, due to the isParent relationship.

4.3. Data modifications in the FOS

It is only possible to refresh all data saved in the FOS by carrying out a full deployment. The delta deployment, on the other hand, only takes into account the data which has caused the revision of the element in FirstSpirit to change (see also FirstSpirit Object Service Documentation for Administrators).

Changes to templates and datasets represent an exception to this rule. Although these may not necessarily cause the revision to be incremented, they are still taken into account during a delta deployment in the form of ChangedContent messages (see chapter ChangedContent messages).

This is of particular relevance in connection with inheritable information (such as metadata and structure variables) and when using additional attributes specified via the presentation channel.

If the portal used does not support inheritance, the REST interface of the FOS can be used for identifying inheritable information. To do this, the inherit parameter must be used when querying the subtree for the changed element. This parameter ensures that the subtree is returned with extended inheritance information. This means that the inherited information is returned both for the changed element and for all its lower-level elements.

When using the presentation channel, it is important to ensure that the elements to which additional attributes have been added are given new revisions. This is the only case where the FOS refreshes its data inventory for the corresponding elements and transmits the information to the Portal Plugin in the form of an event.

4.4. Moving structure elements

The structure inside the FirstSpirit project can be changed at any time in any way by moving page references or site folders. This type of rearrangement of structure elements is also shared with the Portal Plugin via Event messages.

Different numbers of event messages are generated depending on the type of movement.

Movement within a subtree

If a page reference or a site folder is moved into a folder below its current position, this counts as a movement within the same subtree. As all affected elements are in this subtree, only one event message is generated. This includes events for both of the affected folders and the moved element.

Movement to a different subtree

If a page reference or site folder is moved into a higher-level folder to its current position or into the structure of a different folder on the same level, this counts as a movement to a different subtree. In this case, two event messages are sent. The first message contains the event for changing the folder from which the element has been moved. The second message consists of the events for the moved element and for the target folder.

Example

Figure Site shows the structure of a FirstSpirit project. For the purposes of simplification, only the A1 folder has a page reference. This should be moved to any other position in the structure.

The page reference is a child element of the A1 folder. It is therefore the starting point of the associated subtree. All the elements contained within it make up the subtree, which is highlighted on the diagram. Moving the page reference within this area therefore generates just one event message, as previously described.

The A, A2, and B site folders are at the same or a higher level than the A1 folder. For this reason, they and their subfolders are not part of the subtree mentioned above. This can be seen in the diagram from the fact that they are not within the marked area. Positioning of the page reference at any point below one of these folders counts as movement to another subtree. This therefore generates two event messages, as previously described.

Site
Figure 9. Site


4.5. Metadata

If metadata is set on a page in FirstSpirit, it is output as a string value. However, it should be noted that some input components have special features with respect to their output formats.

4.5.1. INPUT_PERMISSION

The values of a CMS_INPUT_PERMISSION input component are output in JSON, which is in turn written in a string, e.g.:

{\"activities\":[{\"name\":\"myActivity\",\"allowed\":[\"Management\",\"Marketing\"],\"forbidden\":[\"Customer\"]}]}

This is required to generate a static JSON schema. If the values were supplied not as a string but directly as JSON, a dynamic schema would be generated.

For the INPUT_PERMISSION component, both the activities and groups are "dynamic". They therefore do not depend only on the project, but can also change further within it.

The value can be read first as a string and then called as a jsonFromString easily using a JSON library. Please note that there can be any number of activities and groups.

Please also note that the name of the INPUT_PERMISSION input component also depends on the project. It should therefore be possible to configure which name is given to the input component that has the permissions.

4.5.2. INPUT_DATE

The format in which values of the INPUT_DATE input component are output is not significantly different to the format of other input components (string). However, the format of the date in the output text depends on the configuration of the input component (mode) in FirstSpirit.

If the mode is set to DATE, then only the set date is output: 2014-07-02

If the mode is set to TIME, then the selected time is output: 05:11:51

If the mode is set to DATETIME, then the time and date including the time zone are output. Please note that the time will be the time stamp in the time zone of the server: 2014-07-02T05:11:45+01:00

4.6. Querying large projects via the REST interface

Querying data from very large projects via the REST interface may lead to problems with performance and memory. We therefore recommend that you do not load the entire structure at once, but rather load the data level by level with the help of the depth parameter.

4.7. Language-dependent content projections

Content projections are used in many FirstSpirit projects. This means that the page references of the relevant pages can be sorted.

Language-dependent sorting in FirstSpirit
Figure 10. Language-dependent sorting in FirstSpirit


If language-dependent sorting is selected here, please note that the contentId of messages created during a generation operation performed on the FirstSpirit Server only ever corresponds to the FS_ID of the dataset in the master language. This has no effect on sorting; names, for example, will still be displayed in order of language, as required.

Examples

Sorting according to Name column, DE presentation channel

FS_IDName_DEName_ENURL_DEURL_EN

1

Alpha

Zeta

url_de_1

url_en_1

2

Beta

Ypsilon

url_de_2

url_en_2

3

Chi

Xi

url_de_3

url_en_3

PageRefContentProjection in the message

contentIdPageRefContentProjection

1

Alpha, url_de_1, Xi, url_en_3

2

Beta, url_de_2, Ypsilon, url_en_2

3

Chi, url_de_3, Zeta, url_en_1

5. Glossary

Event message

Information sent by the FOS to the Portal Plugin via the UX-Bus

Message

Information sent by the FOS module to the FOS via the UX-Bus

Portal Plugin

Specific component, which deals with importing the content into the portal

FirstSpirit Object Service (FOS)

Interface between the UX-Bus and the Portal Plugin

Service message

Information sent by the FOS to the Portal Plugin via the UX-Bus. This is either a status message, an event message or a ChangedContent message

Status message

Information used by the FOS to indicate the start or end of a schedule to the Portal Plugin

UX-Bridge

Interface between FirstSpirit and the UX-Bus

UX-Bus

Central infrastructure component for distributing content

6. Legal notices

The FirstSpirit Object Service is a product of e-Spirit AG, Dortmund, Germany.

Only a license agreed upon with e-Spirit AG is valid with respect to the user for using the module.

Details regarding any third-party software products in use but not created by e-Spirit AG, as well as the third-party licenses and, if applicable, update information can be found in the file THIRD-PARTY.txt included with the module.

7. Disclaimer

This document is provided for information purposes only. e-Spirit may change the contents hereof without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. e-Spirit specifically disclaims any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. The technologies, functionality, services, and processes described herein are subject to change without notice.