2ronwalf// The MIT License
2ronwalf//
2ronwalf// Copyright (c) 2004 Evren Sirin
2ronwalf//
2ronwalf// Permission is hereby granted, free of charge, to any person obtaining a copy
2ronwalf// of this software and associated documentation files (the "Software"), to
2ronwalf// deal in the Software without restriction, including without limitation the
2ronwalf// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2ronwalf// sell copies of the Software, and to permit persons to whom the Software is
2ronwalf// furnished to do so, subject to the following conditions:
2ronwalf//
2ronwalf// The above copyright notice and this permission notice shall be included in
2ronwalf// all copies or substantial portions of the Software.
2ronwalf//
2ronwalf// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2ronwalf// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2ronwalf// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2ronwalf// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2ronwalf// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2ronwalf// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2ronwalf// IN THE SOFTWARE.
2ronwalf
2ronwalf/*
2ronwalf * Created on Dec 28, 2003
2ronwalf *
2ronwalf */
2ronwalfpackage impl.owls.process;
2ronwalf
22daenzerorama
2ronwalfimport org.mindswap.owl.OWLIndividual;
10daenzeroramaimport org.mindswap.owls.process.BindingList;
2ronwalfimport org.mindswap.owls.process.CompositeProcess;
2ronwalfimport org.mindswap.owls.process.ControlConstruct;
2ronwalfimport org.mindswap.owls.vocabulary.OWLS;
2ronwalf
2ronwalf/**
2ronwalf * @author Evren Sirin
2ronwalf *
2ronwalf */
2ronwalfpublic class CompositeProcessImpl extends ProcessImpl implements CompositeProcess {
2ronwalf public CompositeProcessImpl(OWLIndividual ind) {
22daenzerorama super(ind);
2ronwalf }
2ronwalf
14daenzerorama /**
14daenzerorama * Returns the control construct with which the composite process is composed of.
14daenzerorama */
2ronwalf public ControlConstruct getComposedOf() {
2ronwalf return (ControlConstruct) getPropertyAs(OWLS.Process.composedOf, ControlConstruct.class);
2ronwalf }
2ronwalf
14daenzerorama /**
14daenzerorama * Sets the control construct with which the composite process is composed of.
14daenzerorama */
2ronwalf public void setComposedOf(ControlConstruct construct) {
2ronwalf setProperty(OWLS.Process.composedOf, construct);
2ronwalf }
10daenzerorama
14daenzerorama /**
14daenzerorama * Returns all bindings which are set within this composite process
14daenzerorama */
10daenzerorama public BindingList getAllBindings() {
10daenzerorama ControlConstruct cc = getComposedOf();
10daenzerorama return cc.getAllBindings();
10daenzerorama }
10daenzerorama
14daenzerorama /**
14daenzerorama * Delete the control construct with which this composite process is composed of
14daenzerorama */
14daenzerorama public void deleteComposedOf() {
18daenzerorama ControlConstruct cc = getComposedOf();
18daenzerorama
18daenzerorama removeComposedOf();
18daenzerorama
18daenzerorama if (cc != null)
18daenzerorama cc.delete();
14daenzerorama }
14daenzerorama
14daenzerorama /**
14daenzerorama * Removes the control construct with which this composite process is composed of
14daenzerorama * by breaking the property <code>process:composedOf</code>
14daenzerorama */
14daenzerorama public void removeComposedOf() {
14daenzerorama if (hasProperty(OWLS.Process.composedOf))
14daenzerorama removeProperties(OWLS.Process.composedOf);
14daenzerorama }
14daenzerorama
18daenzerorama public void delete() {
18daenzerorama super.delete();
18daenzerorama deleteComposedOf();
18daenzerorama individual.delete();
18daenzerorama }
18daenzerorama
2ronwalf}