{docbook}
<highlights>
<itemizedlist>
      <listitem>
        <para>
          <emphasis role="bold">
            <link linkend="CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin">Extended Publication Plugin</link>
          </emphasis> </para>
          <para>Details of an extended Publication plugin used to manage the lifecycles of documents in Content, including:</para>
          <itemizedlist>
              <listitem>
                 <para> <emphasis role="bold">
                 <link linkend="CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.States">States</link>
                  </emphasis> </para>
                  <para>Information about new states and new profiles of the extended publication that are enabled in Content.</para>
              </listitem>
              <listitem>
                 <para> <emphasis role="bold">
                 <link linkend="CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.StarEndPublicationDates">Start/End publication dates</link>
                  </emphasis> </para>
                  <para>Introduction to new properties added to the new publication plugin that allows you to manage the content publication in a defined period.</para>
              </listitem>
              <listitem>
                 <para> <emphasis role="bold">
                 <link linkend="CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.NewPublicationMixin">New Publication Mixin</link>
                  </emphasis></para>
                  <para>Introduction to the new authoring mixin that supplies more information about the document creator.</para>
              </listitem>
          </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">
            <link linkend="CONTref.Extensions.AuthoringExtension.PublicationManager">Publication Manager</link>
          </emphasis> </para>
          <para>Introduction to Publication Manager which manages lifecycles and contexts in Content and its details, including:</para>
          <itemizedlist>
              <listitem>
                 <para> <emphasis role="bold">
                 <link linkend="CONTref.Extensions.AuthoringExtension.PublicationManager.Lifecycle">Lifecycle</link>
                  </emphasis> </para>
                  <para>Sample code of lifecycle, information about 3 lifecycles, and instructions on how to listen to a lifecycle and to perform tasks when a content's state is updated.</para>
              </listitem>
              <listitem>
                 <para> <emphasis role="bold">
                 <link linkend="CONTref.Extensions.AuthoringExtension.PublicationManager.Context">Context</link>
                  </emphasis> </para>
                  <para>Details of context, its sample code and rules.</para>
              </listitem>
              <listitem>
                 <para> <emphasis role="bold">
                 <link linkend="CONTref.Extensions.AuthoringExtension.PublicationManager.NewAuthoringMixin">New Authoring Mixin</link>
                  </emphasis> </para>
                  <para>Introduction to the new authoring mixin that supplies more information about the document creator, its sample code and details of querying based on publication status.</para>
              </listitem>
          </itemizedlist>
      </listitem>
      </itemizedlist>
</highlights>
{docbook}

h1. Extended Publication Plugin {anchor:id=CONTref.Extensions.AuthoringExtension.ExtendedPublicationPluginRoleNotInToc}
This section covers the following topics:
* [States|#CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.States]
* [Start/End publication dates|#CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.StarEndPublicationDates]
* [New Publication Mixin|#CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.NewPublicationMixin]


{docbook}
<para xml:id="CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.States">
<citetitle>
<emphasis role="bold">States</emphasis>
</citetitle>
</para>
{docbook}

This extended publication has new states and new profiles that are enabled in Content.

* Profiles
** Author: This profile can edit a content and mark this content as redacted.
** Approver: This profile approves a pending content (marked by the Author).
** Publisher: This profile publishes contents or marks them as "Ready for publication" in multi-server mode.
** Archiver: An administrative profile which moves contents to an archive storage.
** Automatic: An administrative profile in which the content will be only managed by the system such as cron job.  
* States
** enrolled: It is a pure technical state, generally used for content creation.
** draft (Author): Content is in editing phase.
** pending (Author): The author validates the content.
** approved (Approver): A content is approved by the manager.
** inreview (Manager): This state can be used when a second approval state is needed (for i18 translation for example).
** staged (Publisher): A content is ready for publication (multi-server mode).
** published (Publisher or Automatic): A content is published and visible in the *Live* mode.
** unpublished (Publisher or Automatic): A content is not visible in the *Live* mode.
** obsolete: A content can still be published but it is not in an editing lifecycle anymore.
** archived (Automatic): A content is archived and ready to be moved in the archive workspace if enabled.


{docbook}
<para xml:id="CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.StarEndPublicationDates">
<citetitle>
<emphasis role="bold">Start/End publication datess</emphasis>
</citetitle>
</para>
{docbook}

In most cases, you do not want to publish a content directly, but at a defined date and you can also want  the content to be unpublished automatically after that.
New properties are added to the new publication plugin, that allows you to manage this:
* _publication\:startPublishedDate_
* _publication\:endPublishedDate_

The Content rendering engine does not know anything about publication dates, so another service needs to manage that.
When the publisher sets start/end publication dates, he can "stage" the content. The content will go automatically to the "published" state when the start date arrives and to the "unpublished" state after end date.
A cron job checks every hour (or less) all contents which need to be published (the start date in the past and the "staged" state) or unpublished (the end date in the past and the "published" state).

Thus, the publication dates are not mandatory and a content can go to:
* Staged: in multi-server mode, the publisher can only put the content to the "staged" state and wait for auto-publication.
* Published: in single-server mode, the publisher can directly publish a content (with or without publication dates).


{docbook}
<para xml:id="CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.NewPublicationMixin">
<citetitle>
<emphasis role="bold">New Publication Mixin</emphasis>
</citetitle>
</para>
{docbook}

{code:xml}<nodeType name="publication:authoringPublication" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
  <supertypes>
    <supertype>publication:stateAndVersionBasedPublication</supertype>
  </supertypes>
  <propertyDefinitions>
    <propertyDefinition name="publication:startPublishedDate" requiredType="Date" autoCreated="false"
      mandatory="true" onParentVersion="IGNORE" protected="false" multiple="false">
      <valueConstraints />
    </propertyDefinition>
    <propertyDefinition name="publication:endPublishedDate" requiredType="Date" autoCreated="false" mandatory="true"
      onParentVersion="IGNORE" protected="false" multiple="false">
      <valueConstraints />
    </propertyDefinition>
  </propertyDefinitions>
</nodeType>{code}

*Publication plugin UI*: {anchor:id=CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.PublicationPluginUI}

Note that some labels containing special or non-ASCII characters could not be well displayed in the publication UI.
You can extend the width of the current UI State button by adding:

{code:css}.UIPublicationPanel .StatusTable .ActiveStatus {
  width: 75px !important;
}{code}

Also, for the publication date inputs, _UIPublicationPanel_ should not initialize the dates to any default value.
The publishing and unpublish CRON jobs will do this:
* A staged document with null publication start date is published instantly.
* A document with null publication end date is published forever.

See the export section for more information about the CRON jobs.

h1. Publication Manager {anchor:id=CONTref.Extensions.AuthoringExtension.PublicationManagerRoleNotInToc}

The Publication Manager manages lifecycles and contexts in the Content platform. It allows managing different lifecycles based on different publication plugin in the platform.

{code:java}public interface PublicationManager {

	public List<Lifecycle> getLifecycles();

	public List<Context> getContexts();

	public Context getContext(String name);

	public Lifecycle getLifecycle(String name);

	public List<Lifecycle> getLifecyclesFromUser(String remoteUser, String state);
}{code}

In which:

* _getLifecycles_: returns a list of lifecycles (see below), with lifecycle name, publication plugin involved and possible states.
* _getContexts_: returns a list of context, with name, related Lifecycle and other properties (see below).
* _getContext_: returns a context by its name.
* _getLifecycle_: returns a lifecycle by its name.
* _getLifecycleFromUser_: returns a list of lifecycles in which the user has rights (based on membership property).

h2. Lifecycle {anchor:id=CONTref.Extensions.AuthoringExtension.PublicationManager.Lifecycle}

A lifecycle is defined by a simple vertical workflow with steps (states) and profiles (membership). Each lifecycle is related to a *Publication* plugin (compliant with the JBPM or Bonita business processes).

A lifecycle in eXo Platform is defined basing on:
* _Publication plugin_: eXo Platform 3.5 provides 2 publication plugin types:  _[AuthoringPublicationPlugin|#CONTref.Configuration.Plugins.AuthoringPublicationPlugin]_ and _[StatesAndVersionsPublicationPlugin|#CONTref.Configuration.Plugins.StageAndVersionPublicationPlugin]_.
* _State_: States list in lifecycle. You can use several states among [available states|#CONTref.Extensions.AuthoringExtension.ExtendedPublicationPlugin.States].
* _Membership_: User having specific membership can reach a state. There are two possible types: specific membership or _automatic_ (Only system job can reach state).

Note: eXo Platform allows defining more than one membership which can reach each state by using *memberships* field.

Lifecycle prototype:

{code:xml}<external-component-plugins>
<target-component>org.exoplatform.services.wcm.extensions.publication.PublicationManager</target-component>
 <component-plugin>
   <name>AddLifecycle</name>
   <set-method>addLifecycle</set-method>
   <type>org.exoplatform.services.wcm.extensions.publication.lifecycle.StatesLifecyclePlugin</type>
   <description>Configures</description>
   <priority>1</priority>
    <init-params>
     <object-param>
       <name>lifecycles</name>
       <object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig">
         <field  name="lifecycles">
           <collection type="java.util.ArrayList">
             <value>
               <object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$Lifecycle">
                 <field name="name"><string>$Lifecycle_name</string></field>
                 <field name="publicationPlugin"><string>$Publication_plugin</string></field>
                 <field  name="states">
                   <collection type="java.util.ArrayList">
                     <!-- list of states -->
                     <value>
                       <object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
                         <field name="state"><string>$State</string></field>
                         <field name="membership"><string>$Membership</string></field>
                         <!-- <field name="memberships">Memberships collection</field> -->
                       </object>
                     </value>
                   </collection>
                 </field>
               </object>
             </value>
           </collection>
         </field>
       </object>
     </object-param>
   </init-params>
 </component-plugin>
</external-component-plugins>{code}


For example: _Two lifecycles with/without states_

{code:xml}<external-component-plugins>
	<target-component>org.exoplatform.services.wcm.extensions.publication.PublicationManager</target-component>
	<component-plugin>
		<name>AddLifecycle</name>
		<set-method>addLifecycle</set-method>
		<type>org.exoplatform.services.wcm.extensions.publication.lifecycle.StatesLifecyclePlugin</type>
		<init-params>
			<object-param>
				<name>lifecycles</name>
				<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig">
					<field name="lifecycles">
						<collection type="java.util.ArrayList">
							<value>
								<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$Lifecycle">
									<field name="name">
										<string>lifecycle1</string>
									</field>
									<field name="publicationPlugin">
										<string>States and versions based publication</string>
									</field>
								</object>
							</value>
							<value>
								<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$Lifecycle">
									<field name="name">
										<string>lifecycle2</string>
									</field>
									<field name="publicationPlugin">
										<string>Authoring publication</string>
									</field>
									<field name="states">
										<collection type="java.util.ArrayList">
											<value>
												<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
													<field name="state">
														<string>draft</string>
													</field>
													<field name="memberships">
														<collection type="java.util.ArrayList">
															<value>
																<string>author:/communication</string>
															</value>
															<value>
																<string>author:/sanitaryAlert</string>
															</value>
															<value>
																<string>author:/informations</string>
															</value>
														</collection>
													</field>
												</object>
											</value>
											<value>
												<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
													<field name="state">
														<string>pending</string>
													</field>
													<field name="membership">
														<string>author:/platform/web-contributors</string>
													</field>
												</object>
											</value>
											<value>
												<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
													<field name="state">
														<string>approved</string>
													</field>
													<field name="membership">
														<string>manager:/platform/web-contributors</string>
													</field>
												</object>
											</value>
											<value>
												<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
													<field name="state">
														<string>staged</string>
													</field>
													<field name="membership">
														<string>publisher:/platform/web-contributors</string>
													</field>
												</object>
											</value>
											<value>
												<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
													<field name="state">
														<string>published</string>
													</field>
													<field name="membership">
														<string>automatic</string>
													</field>
												</object>
											</value>
										</collection>
									</field>
								</object>
							</value>
							<value>
								<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$Lifecycle">
									<field name="name">
										<string>lifecycle3</string>
									</field>
									<field name="publicationPlugin">
										<string>Authoring publication</string>
									</field>
									<field name="states">
										<collection type="java.util.ArrayList">
											<value>
												<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
													<field name="state">
														<string>draft</string>
													</field>
													<field name="membership">
														<string>author:/platform/web-contributors</string>
													</field>
												</object>
											</value>
											<value>
												<object type="org.exoplatform.services.wcm.extensions.publication.lifecycle.impl.LifecyclesConfig$State">
													<field name="state">
														<string>published</string>
													</field>
													<field name="memberships">
														<collection type="java.util.ArrayList">
															<value>
																<string>publisher:/communication</string>
															</value>
															<value>
																<string>publisher:/sanitaryAlert</string>
															</value>
															<value>
																<string>publisher:/informations</string>
															</value>
														</collection>
													</field>
												</object>
											</value>
										</collection>
									</field>
								</object>
							</value>
						</collection>
					</field>
				</object>
			</object-param>
		</init-params>
	</component-plugin>
</external-component-plugins>{code}

In the last example, there are three lifecycles:

* Lifecycle 1: Based on _[StatesAndVersionsPublicationPlugin|#CONTref.Configuration.Plugins.StageAndVersionPublicationPlugin]_.
** This allows to be backward compliant with older Content releases. If all your site contents are using an existing plugin, you can create a lifecycle for it and it will work.
** For new instances, you should use the new plugin with dynamic states capabilities.

* Lifecycle 2: Based on _[AuthoringPublicationPlugin|#CONTref.Configuration.Plugins.AuthoringPublicationPlugin]_.
** Visibility: Define only the "visible" steps. In this example, there is no step for "enrolled". Even if this step exists, it will not be displayed in the UI.
** Automatic: Set a step as "automatic". In this mode, the step will be visible in the UI but it will be managed by the system (e.g. a cron job).No user is allowed to reach this step.
* Lifecycle 3: Simulates the _StatesAndVersionsPublicationPlugin_ plugin. Note that this simple lifecycle will work in a single server configuration.

h3. Listen to a lifecycle {anchor:id=CONTref.Extensions.AuthoringExtension.PublicationManager.ListenToLifecycle}

When a state is changed, you can broadcast an event to add features.
The event could look like this:

{code:java}listenerService.broadcast(AuthoringPlugin.POST_UPDATE_STATE_EVENT, null, node);{code}

Listener declaration could look like this:

{code:xml}<external-component-plugins>
  <target-component>org.exoplatform.services.listener.ListenerService</target-component>
  <component-plugin>
    <name>PublicationService.event.postUpdateState</name>
    <set-method>addListener</set-method>
    <type>org.exoplatform.services.wcm.extensions.publication.listener.post.PostUpdateStateEventListener</type>
    <description>this listener will be called every time a content changes its current state</description>
  </component-plugin>
</external-component-plugins>{code}

h3. Perform tasks when a content's state is updated {anchor:id=CONTref.Extensions.AuthoringExtension.PublicationManager.PeroformTasksWhenContentUpdated}

To perform some tasks when a content's state is updated, you need to create a listener that handles the task and configure it. Following is the general configuration:

{code:xml}<external-component-plugins>
	<target-component>org.exoplatform.services.listener.ListenerService</target-component>
	<component-plugin>
		<name>PublicationService.event.postUpdateState</name>
		<set-method>addListener</set-method>
		<type>my.package.MyListener</type>
		<description>Your listener description</description>
	</component-plugin>
</external-component-plugins>{code}

With this configuration, your listener _my.package.MyListener_ will be executed each time a content's state is changed.

For example, eXo provides a listener which automatically sends email notifications about the new state to all users of defined groups: _org.exoplatform.wcm.authoring.listener.PostUpdateStateEventListener_. So, the configuration will be:

{code:xml}<external-component-plugins>
	<target-component>org.exoplatform.services.listener.ListenerService</target-component>
	<component-plugin>
		<name>PublicationService.event.postUpdateState</name>
		<set-method>addListener</set-method>
		<type>org.exoplatform.wcm.authoring.listener.PostUpdateStateEventListener</type>
		<description>This listener will send a mail when there are changes in a content's state</description>
	</component-plugin>
</external-component-plugins>{code}

h2. Context {anchor:id=CONTref.Extensions.AuthoringExtension.PublicationManager.Context}

A context is defined by simple rules. In Content, you can select to enroll the content in a specific lifecycle (for example, publication plugin) based on context parameters.
There are three parameters used to define contexts:
* Remote User: The current user who can create/edit the content.
* Current site name: The site from where the content is created (not the storage but the navigation).
* Node: The node which you want to enroll.

From these parameters, you can easily connect and define contexts based on:
* Membership: Does the current user have this membership?
* Site: On this particular site, you want to enroll contents in a specific lifecycle.
* Path: You can enroll contents in the lifecycles based on their path (from the Node).
* Type of content: You can enroll contents in the lifecycles based on their nodetype (from the Node).

Because each site has a content storage (categories + physical storage), you can select the right lifecycle for the right storage/site.
To avoid conflicts on contexts, you can set a priority (the less is the best).


Context prototype
{code:xml}<external-component-plugins>
 <target-component>org.exoplatform.services.wcm.extensions.publication.PublicationManager</target-component>
   <component-plugin>
   <name>AddContext</name>
   <set-method>addContext</set-method>
   <type>org.exoplatform.services.wcm.extensions.publication.context.ContextPlugin</type>
   <init-params>
     <object-param>
       <name>contexts</name>
       <object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig">
         <field  name="contexts">
           <collection type="java.util.ArrayList">
             <value>
               <object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig$Context">
                 <field name="name"><string>$Context_name</string></field>
                 <field name="priority"><string>$Priority</string></field>
                 <field name="lifecycle"><string>$Lifecycle_in_use</string></field>
                 <field name="memberships"><!-- List of role which is in context -></field>
                 <field name="site"><string>$Site</string></field>
                 <field name="path"><string>$Path</string></field>
                 <field name="nodetype"><string>$Type of Content</string></field>
               </object>
             </value>
           </collection>
         </field>
       </object>
     </object-param>
   </init-params>
 </component-plugin>
</external-component-plugins>
{code}

For example, *Different Contexts*:

{code:xml}<external-component-plugins>
	<target-component>org.exoplatform.services.wcm.extensions.publication.PublicationManager</target-component>
	<component-plugin>
		<name>AddContext</name>
		<set-method>addContext</set-method>
		<type>org.exoplatform.services.wcm.extensions.publication.context.ContextPlugin</type>
		<init-params>
			<object-param>
				<name>contexts</name>
				<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig">
					<field name="contexts">
						<collection type="java.util.ArrayList">
							<value>
								<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig$Context">
									<field name="name">
										<string>contextdefault</string>
									</field>
									<field name="priority">
										<string>200</string>
									</field>
									<field name="lifecycle">
										<string>lifecycle1</string>
									</field>
								</object>
								<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig$Context">
									<field name="name">
										<string>context1</string>
									</field>
									<field name="priority">
										<string>100</string>
									</field>
									<field name="lifecycle">
										<string>lifecycle1</string>
									</field>
									<field name="membership">
										<string>*:/platform/web-contributors</string>
									</field>
									<field name="site">
										<string>acme</string>
									</field>
									<field name="path">
										<string>repository:collaboration:/sites content/live/acme/categories</string>
									</field>
								</object>
								<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig$Context">
									<field name="name">
										<string>context2</string>
									</field>
									<field name="priority">
										<string>100</string>
									</field>
									<field name="lifecycle">
										<string>lifecycle1</string>
									</field>
									<field name="site">
										<string>default</string>
									</field>
								</object>
								<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig$Context">
									<field name="name">
										<string>context3</string>
									</field>
									<field name="priority">
										<string>80</string>
									</field>
									<field name="lifecycle">
										<string>lifecycle3</string>
									</field>
									<field name="membership">
										<string>manager:/company/finances</string>
									</field>
									<field name="path">
										<string>repository:collaboration:/documents/company/finances</string>
									</field>
								</object>
								<object type="org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig$Context">
									<field name="name">
										<string>context4</string>
									</field>
									<field name="priority">
										<string>50</string>
									</field>
									<field name="lifecycle">
										<string>lifecycle4</string>
									</field>
									<field name="memberships">
									  <collection type="java.util.ArrayList">
										<value>
											<string>manager:/communication</string>
										</value>
										<value>
											<string>manager:/sanitaryAlert</string>
										</value>
										<value>
											<string>manager:/informations</string>
										</value>
									  </collection>
									</field>
									<field name="path">
										<string>repository:collaboration:/documents/company/finances</string>
									</field>
									<field name="nodetype">
										<string>exo:article</string>
									</field>
								</object>
							</value>
						</collection>
					</field>
				</object>
			</object-param>
		</init-params>
	</component-plugin>
</external-component-plugins>{code}

The logic is very simple. When creating a content, it should be attached a lifecycle with the lifecycle priority:
* _context4_ is the most important (priority=50): you will enroll the content in the lifecycle "lifecycle4" if:
** The content creator has the _manager\:/company/finances_ membership.
** The content is stored in _repository\:collaboration\:/documents/company/finances_ or any subfolders.
** The content is a '{{exo\:article}}'.
* If not, you will continue with _context3_.

{note}
The contexts will be used only when the content is created and when you want to enroll it in a lifecycle for the first time.
Once you have the corresponding lifecycle, you will set the lifecycle inside the content (see [New Authoring Mixin|#CONTref.Extensions.AuthoringExtension.PublicationManager.NewAuthoringMixin]) and the context service will not be called again for this content.
{note}

h2. New Authoring Mixin {anchor:id=CONTref.Extensions.AuthoringExtension.PublicationManager.NewAuthoringMixin}

{code:xml}<nodeType name="publication:authoring" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
  <propertyDefinitions>
    <propertyDefinition name="publication:lastUser" requiredType="String" autoCreated="false" mandatory="false"
      onParentVersion="IGNORE" protected="false" multiple="false">
      <valueConstraints />
    </propertyDefinition>
    <propertyDefinition name="publication:lifecycle" requiredType="String" autoCreated="false" mandatory="false"
      onParentVersion="IGNORE" protected="false" multiple="false">
      <valueConstraints />
    </propertyDefinition>
  </propertyDefinitions>
</nodeType>{code}
When adding the content in a lifecycle, set the _publication:lifecycle_ property with the corresponding lifecycle.

{note}
A content can be in one lifecycle only.
{note}
Each time you change from one state to another, set the user who changed the state in _publication\:lastUser_.

*Querying based on publication status*: {anchor:id=CONTref.Extensions.AuthoringExtension.PublicationManager.QueryBaseOnPublicationStatus}

By adding this mixin to contents, you can access contents by simple queries based on the current user profile.
For example:
* All your draft contents:
** query: select \* from _nt\:base_ where {{publication:currentState}}"draft" and {{publication:lastUser}}="benjamin".
* All the contents you have to approve.
** call: _PublicationManager.getLifecycles('benjamin','approved')_ => returns lifecycles where you can go to the 'approved' state.
** query: select \* from _nt\:base_ where _publication\:currentState="pending"_ and _publication\:lifecycle="lifecycle1"_ or _publication\:lifecycle="lifecycle3"_.
* All the content that will be published tomorrow.
** query: select \* from _nt\:base_ where _publication\:currentState="staged"_ and _publication\:startPublishedDate_="xxxx".
