diff options
Diffstat (limited to 'src/uml/qumldeployment.cpp')
-rw-r--r-- | src/uml/qumldeployment.cpp | 402 |
1 files changed, 85 insertions, 317 deletions
diff --git a/src/uml/qumldeployment.cpp b/src/uml/qumldeployment.cpp index 7a7df373..c53bb063 100644 --- a/src/uml/qumldeployment.cpp +++ b/src/uml/qumldeployment.cpp @@ -40,384 +40,152 @@ ****************************************************************************/ #include "qumldeployment.h" -#include <QtUml/QUmlComment> -#include <QtUml/QUmlDependency> +#include "private/qumldeploymentobject_p.h" + #include <QtUml/QUmlDeployedArtifact> #include <QtUml/QUmlDeploymentSpecification> #include <QtUml/QUmlDeploymentTarget> -#include <QtUml/QUmlElement> -#include <QtUml/QUmlNamedElement> -#include <QtUml/QUmlNamespace> -#include <QtUml/QUmlPackage> -#include <QtUml/QUmlParameterableElement> -#include <QtUml/QUmlStringExpression> -#include <QtUml/QUmlTemplateParameter> - -QT_BEGIN_NAMESPACE /*! - \class UmlDeployment + \class QUmlDeployment \inmodule QtUml \brief A deployment is the allocation of an artifact or artifact instance to a deployment target.A component deployment is the deployment of one or more artifacts or artifact instances to a deployment target, optionally parameterized by a deployment specification. Examples are executables and configuration files. */ - -QUmlDeployment::QUmlDeployment(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlDeployment::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlDeployment::ownedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); -} - -/*! - The Element that owns this element. - */ -QUmlElement *QUmlDeployment::owner() const -{ - return reinterpret_cast<QUmlElement *>(_owner); -} - -// OWNED ATTRIBUTES [ParameterableElement] - -/*! - The formal template parameter that owns this element. - */ -QUmlTemplateParameter *QUmlDeployment::owningTemplateParameter() const +QUmlDeployment::QUmlDeployment(bool createQObject) : + QUmlDependency(false), + _location(0) { - return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter); + if (createQObject) + _qObject = new QUmlDeploymentObject(this); } -/*! - The template parameter that exposes this element as a formal parameter. - */ -QUmlTemplateParameter *QUmlDeployment::templateParameter() const +QUmlDeployment::~QUmlDeployment() { - return reinterpret_cast<QUmlTemplateParameter *>(_templateParameter); + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -// OWNED ATTRIBUTES [NamedElement] - -/*! - Indicates the dependencies that reference the client. - */ -const QSet<QUmlDependency *> QUmlDeployment::clientDependency() const -{ - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); -} - -/*! - The name of the NamedElement. - */ -QString QUmlDeployment::name() const -{ - return _name; -} - -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlDeployment::nameExpression() const -{ - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); -} +// OWNED ATTRIBUTES /*! - Specifies the namespace that owns the NamedElement. + The specification of properties that parameterize the deployment and execution of one or more Artifacts. */ -QUmlNamespace *QUmlDeployment::namespace_() const +const QSet<QUmlDeploymentSpecification *> +QUmlDeployment::configuration() const { - return reinterpret_cast<QUmlNamespace *>(_namespace_); -} + // This is a read-write association end -/*! - A name which allows the NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from the names of the containing namespaces starting at the root of the hierarchy and ending with the name of the NamedElement itself. - */ -QString QUmlDeployment::qualifiedName() const -{ - return UmlNamedElement::qualifiedName(); + return _configuration; } -// OWNED ATTRIBUTES [PackageableElement] -/*! - Indicates that packageable elements must always have a visibility, i.e., visibility is not optional. - */ -QtUml::VisibilityKind QUmlDeployment::visibility() const +void QUmlDeployment::addConfiguration(QUmlDeploymentSpecification *configuration) { - return _visibility; -} + // This is a read-write association end -// OWNED ATTRIBUTES [Relationship] + if (!_configuration.contains(configuration)) { + _configuration.insert(configuration); + if (configuration->asQObject() && this->asQObject()) + QObject::connect(configuration->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeConfiguration(QObject *))); + configuration->asQObject()->setParent(this->asQObject()); -/*! - Specifies the elements related by the Relationship. - */ -const QSet<QUmlElement *> QUmlDeployment::relatedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_relatedElement)); -} - -// OWNED ATTRIBUTES [DirectedRelationship] + // Adjust subsetted properties + addOwnedElement(configuration); -/*! - Specifies the sources of the DirectedRelationship. - */ -const QSet<QUmlElement *> QUmlDeployment::source() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_source)); + // Adjust opposite properties + if (configuration) { + configuration->setDeployment(this); + } + } } -/*! - Specifies the targets of the DirectedRelationship. - */ -const QSet<QUmlElement *> QUmlDeployment::target() const +void QUmlDeployment::removeConfiguration(QUmlDeploymentSpecification *configuration) { - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_target)); -} + // This is a read-write association end -// OWNED ATTRIBUTES [Dependency] + if (_configuration.contains(configuration)) { + _configuration.remove(configuration); + if (configuration->asQObject()) + configuration->asQObject()->setParent(0); -/*! - The element(s) dependent on the supplier element(s). In some cases (such as a Trace Abstraction) the assignment of direction (that is, the designation of the client element) is at the discretion of the modeler, and is a stipulation. - */ -const QSet<QUmlNamedElement *> QUmlDeployment::client() const -{ - return *(reinterpret_cast<const QSet<QUmlNamedElement *> *>(&_client)); -} - -/*! - The element(s) independent of the client element(s), in the same respect and the same dependency relationship. In some directed dependency relationships (such as Refinement Abstractions), a common convention in the domain of class-based OO software is to put the more abstract element in this role. Despite this convention, users of UML may stipulate a sense of dependency suitable for their domain, which makes a more abstract element dependent on that which is more specific. - */ -const QSet<QUmlNamedElement *> QUmlDeployment::supplier() const -{ - return *(reinterpret_cast<const QSet<QUmlNamedElement *> *>(&_supplier)); -} - -// OWNED ATTRIBUTES [Deployment] + // Adjust subsetted properties + removeOwnedElement(configuration); -/*! - The specification of properties that parameterize the deployment and execution of one or more Artifacts. - */ -const QSet<QUmlDeploymentSpecification *> QUmlDeployment::configuration() const -{ - return *(reinterpret_cast<const QSet<QUmlDeploymentSpecification *> *>(&_configuration)); + // Adjust opposite properties + if (configuration) { + configuration->setDeployment(0); + } + } } /*! The Artifacts that are deployed onto a Node. This association specializes the supplier association. */ -const QSet<QUmlDeployedArtifact *> QUmlDeployment::deployedArtifact() const -{ - return *(reinterpret_cast<const QSet<QUmlDeployedArtifact *> *>(&_deployedArtifact)); -} - -/*! - The DeployedTarget which is the target of a Deployment. - */ -QUmlDeploymentTarget *QUmlDeployment::location() const +const QSet<QUmlDeployedArtifact *> +QUmlDeployment::deployedArtifact() const { - return reinterpret_cast<QUmlDeploymentTarget *>(_location); -} - -// OPERATIONS [Element] + // This is a read-write association end -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlDeployment::allOwnedElements() const -{ - QSet<QUmlElement *> r; - foreach (UmlElement *element, UmlElement::allOwnedElements()) - r.insert(reinterpret_cast<QUmlElement *>(element)); - return r; + return _deployedArtifact; } -/*! - The query mustBeOwned() indicates whether elements of this type must have an owner. Subclasses of Element that do not require an owner must override this operation. - */ -bool QUmlDeployment::mustBeOwned() const +void QUmlDeployment::addDeployedArtifact(QUmlDeployedArtifact *deployedArtifact) { - return UmlElement::mustBeOwned(); -} + // This is a read-write association end -// OPERATIONS [ParameterableElement] + if (!_deployedArtifact.contains(deployedArtifact)) { + _deployedArtifact.insert(deployedArtifact); + if (deployedArtifact->asQObject() && this->asQObject()) + QObject::connect(deployedArtifact->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeDeployedArtifact(QObject *))); -/*! - The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints. - */ -bool QUmlDeployment::isCompatibleWith(QUmlParameterableElement *p) const -{ - return UmlParameterableElement::isCompatibleWith(p); + // Adjust subsetted properties + addSupplier(deployedArtifact); + } } -/*! - The query isTemplateParameter() determines if this parameterable element is exposed as a formal template parameter. - */ -bool QUmlDeployment::isTemplateParameter() const +void QUmlDeployment::removeDeployedArtifact(QUmlDeployedArtifact *deployedArtifact) { - return UmlParameterableElement::isTemplateParameter(); -} - -// OPERATIONS [NamedElement] - -/*! - The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards. - */ -QList<QUmlNamespace *> QUmlDeployment::allNamespaces() const -{ - QList<QUmlNamespace *> r; - foreach (UmlNamespace *element, UmlNamedElement::allNamespaces()) - r.append(reinterpret_cast<QUmlNamespace *>(element)); - return r; -} + // This is a read-write association end -/*! - The query allOwningPackages() returns all the directly or indirectly owning packages. - */ -QSet<QUmlPackage *> QUmlDeployment::allOwningPackages() const -{ - QSet<QUmlPackage *> r; - foreach (UmlPackage *element, UmlNamedElement::allOwningPackages()) - r.insert(reinterpret_cast<QUmlPackage *>(element)); - return r; -} + if (_deployedArtifact.contains(deployedArtifact)) { + _deployedArtifact.remove(deployedArtifact); -/*! - The query isDistinguishableFrom() determines whether two NamedElements may logically co-exist within a Namespace. By default, two named elements are distinguishable if (a) they have unrelated types or (b) they have related types but different names. - */ -bool QUmlDeployment::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace *ns) const -{ - return UmlNamedElement::isDistinguishableFrom(n, ns); + // Adjust subsetted properties + removeSupplier(deployedArtifact); + } } /*! - The query separator() gives the string that is used to separate names when constructing a qualified name. + The DeployedTarget which is the target of a Deployment. */ -QString QUmlDeployment::separator() const +QUmlDeploymentTarget * +QUmlDeployment::location() const { - return UmlNamedElement::separator(); -} + // This is a read-write association end -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlDeployment::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); -} - -void QUmlDeployment::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); + return _location; } -// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement] - -void QUmlDeployment::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter) -{ - UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter); -} - -void QUmlDeployment::setTemplateParameter(QUmlTemplateParameter *templateParameter) -{ - UmlParameterableElement::setTemplateParameter(templateParameter); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlDeployment::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlDeployment::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlDeployment::setName(QString name) -{ - UmlNamedElement::setName(name); -} - -void QUmlDeployment::setNameExpression(QUmlStringExpression *nameExpression) -{ - UmlNamedElement::setNameExpression(nameExpression); -} -// SLOTS FOR OWNED ATTRIBUTES [PackageableElement] - -void QUmlDeployment::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlPackageableElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [Relationship] - -// SLOTS FOR OWNED ATTRIBUTES [DirectedRelationship] - -// SLOTS FOR OWNED ATTRIBUTES [Dependency] - -void QUmlDeployment::addClient(UmlNamedElement *client) -{ - UmlDependency::addClient(client); -} - -void QUmlDeployment::removeClient(UmlNamedElement *client) -{ - UmlDependency::removeClient(client); -} - -void QUmlDeployment::addSupplier(UmlNamedElement *supplier) -{ - UmlDependency::addSupplier(supplier); -} - -void QUmlDeployment::removeSupplier(UmlNamedElement *supplier) -{ - UmlDependency::removeSupplier(supplier); -} - -// SLOTS FOR OWNED ATTRIBUTES [Deployment] - -void QUmlDeployment::addConfiguration(UmlDeploymentSpecification *configuration) -{ - UmlDeployment::addConfiguration(configuration); -} - -void QUmlDeployment::removeConfiguration(UmlDeploymentSpecification *configuration) +void QUmlDeployment::setLocation(QUmlDeploymentTarget *location) { - UmlDeployment::removeConfiguration(configuration); -} + // This is a read-write association end -void QUmlDeployment::addDeployedArtifact(UmlDeployedArtifact *deployedArtifact) -{ - UmlDeployment::addDeployedArtifact(deployedArtifact); -} + if (_location != location) { + // Adjust subsetted properties + removeClient(_location); -void QUmlDeployment::removeDeployedArtifact(UmlDeployedArtifact *deployedArtifact) -{ - UmlDeployment::removeDeployedArtifact(deployedArtifact); -} + _location = location; + if (location->asQObject() && this->asQObject()) + QObject::connect(location->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setLocation())); -void QUmlDeployment::setLocation(QUmlDeploymentTarget *location) -{ - UmlDeployment::setLocation(location); + // Adjust subsetted properties + setOwner(location); + if (location) { + addClient(location); + } + } } -QT_END_NAMESPACE - |