All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.day.cq.workflow.model.WorkflowModelSerializer Maven / Gradle / Ivy

/*
 * Copyright 1997-2008 Day Management AG
 * Barfuesserplatz 6, 4001 Basel, Switzerland
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * Day Management AG, ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Day.
 */
package com.day.cq.workflow.model;

/**
 * WorkflowModelSerializer is the interface for services that
 * provide functionality for de-/serialising
 * {@link WorkflowModel} from/to other (textual) representations.
 */
public interface WorkflowModelSerializer {
	/**
	 * Property for the type serialization type of the
	 * WorkflowModelSerializer.
	 */
	public static final String TYPE = "com.day.cq.workflow.serialzer.type";

	/**
	 * Property for the mime type of the serialization format of the
	 * WorkflowModelSerializer.
	 */
	public static final String MIME_TYPE = "com.day.cq.workflow.serialzer.mime";

	/**
	 * Returns the type of the WorkflowModelSerializer. Must
	 * return a unique string describing the type of the
	 * WorkflowModelSerializer and serialization format
	 * respectively.
	 * 
	 * @return Unique string identifier for the type of the
	 *         WorkflowModelSerializer and serialization format.
	 */
	String getType();

	/**
	 * Returns the mime type of the WorkflowModelSerializers
	 * serialization format.
	 * 
	 * @return The mime type of the serialized format.
	 */
	String getMimeType();

	/**
	 * Serializes the given {@link WorkflowModel} into a textual 
	 * representation.
	 * 
	 * @param model 
	 * 			The {@link WorkflowModel} to be serialized.
	 * 
	 * @return A serialized (textual) representation of the 
	 * 			{@link WorkflowModel}.
	 */
	String serialize(WorkflowModel model) throws Exception;

	/**
	 * Deserializes a {@link WorkflowModel} instance from the 
	 * given (textual) model definition.
	 * 
	 * @param modelDefinition The model definition as string.
	 * 
	 * @return The deserialized {@link WorkflowModel}.
	 */
	WorkflowModel deserialize(String modelDefinition) throws Exception;
}