001: /***************************************************************
002: * This file is part of the [fleXive](R) project.
003: *
004: * Copyright (c) 1999-2008
005: * UCS - unique computing solutions gmbh (http://www.ucs.at)
006: * All rights reserved
007: *
008: * The [fleXive](R) project is free software; you can redistribute
009: * it and/or modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation;
011: * either version 2 of the License, or (at your option) any
012: * later version.
013: *
014: * The GNU General Public License can be found at
015: * http://www.gnu.org/copyleft/gpl.html.
016: * A copy is found in the textfile GPL.txt and important notices to the
017: * license from the author are found in LICENSE.txt distributed with
018: * these libraries.
019: *
020: * This library is distributed in the hope that it will be useful,
021: * but WITHOUT ANY WARRANTY; without even the implied warranty of
022: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023: * GNU General Public License for more details.
024: *
025: * For further information about UCS - unique computing solutions gmbh,
026: * please see the company website: http://www.ucs.at
027: *
028: * For further information about [fleXive](R), please see the
029: * project website: http://www.flexive.org
030: *
031: *
032: * This copyright notice MUST APPEAR in all copies of the file!
033: ***************************************************************/package com.flexive.shared.workflow;
034:
035: import com.flexive.shared.exceptions.FxInvalidParameterException;
036: import com.flexive.shared.value.FxString;
037:
038: import java.io.Serializable;
039:
040: /**
041: * Editable step definition.
042: *
043: * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
044: */
045: public class StepDefinitionEdit extends StepDefinition implements
046: Serializable {
047: private static final long serialVersionUID = 8136768479690229989L;
048:
049: /**
050: * Copy constructor taking a step definition object
051: * @param stepDefinition the source step definition
052: */
053: public StepDefinitionEdit(StepDefinition stepDefinition) {
054: super (stepDefinition.getId(), stepDefinition.getLabel().copy(),
055: stepDefinition.getDescription(), stepDefinition
056: .getUniqueTargetId());
057: }
058:
059: /**
060: * Public default constructor.
061: */
062: public StepDefinitionEdit() {
063: }
064:
065: /**
066: * Set the step definition description
067: * @param description the step definition description
068: */
069: public void setDescription(String description) {
070: this .description = description;
071: }
072:
073: /**
074: * Set the step definition id
075: * @param id the step definition id
076: */
077: public void setId(long id) {
078: this .id = id;
079: }
080:
081: /**
082: * Set the step definition name
083: * @param name the step definition name
084: */
085: public void setLabel(FxString name) {
086: this .label = name;
087: }
088:
089: /**
090: * Set the step definition's unique target step definition
091: * @param uniqueTarget the step definition's unique target step definition
092: */
093: public void setUniqueTargetId(long uniqueTarget) {
094: if (uniqueTarget != -1 && uniqueTarget == this .id) {
095: throw new FxInvalidParameterException("UNIQUETARGET",
096: "ex.stepdefinition.uniqueTarget.circular.self",
097: this .label + " (Id: " + this .id + ")")
098: .asRuntimeException();
099: }
100: this.uniqueTargetId = uniqueTarget;
101: }
102: }
|