org.eclipse.uml2.uml.internal.operations.DeploymentTargetOperations Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2005, 2014 IBM Corporation, CEA, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - initial API and implementation
* Kenn Hussey (CEA) - 418466
*
*/
package org.eclipse.uml2.uml.internal.operations;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.uml2.common.util.UnionEObjectEList;
import org.eclipse.uml2.uml.Artifact;
import org.eclipse.uml2.uml.DeployedArtifact;
import org.eclipse.uml2.uml.Deployment;
import org.eclipse.uml2.uml.DeploymentTarget;
import org.eclipse.uml2.uml.Manifestation;
import org.eclipse.uml2.uml.PackageableElement;
import org.eclipse.uml2.uml.UMLPackage;
/**
*
* A static utility class that provides operations related to 'Deployment Target' model objects.
*
*
*
* The following operations are supported:
*
* - {@link org.eclipse.uml2.uml.DeploymentTarget#getDeployedElements() Get Deployed Elements}
*
*
*
* @generated
*/
public class DeploymentTargetOperations
extends NamedElementOperations {
/**
*
*
* @generated
*/
protected DeploymentTargetOperations() {
super();
}
/**
*
*
*
* Derivation for DeploymentTarget::/deployedElement
* result = (deployment.deployedArtifact->select(oclIsKindOf(Artifact))->collect(oclAsType(Artifact).manifestation)->collect(utilizedElement)->asSet())
* From package UML::Deployments.
* @param deploymentTarget The receiving 'Deployment Target' model object.
*
* @generated NOT
*/
public static EList getDeployedElements(
DeploymentTarget deploymentTarget) {
EList deployedElements = new UniqueEList.FastCompare();
for (Deployment deployment : deploymentTarget.getDeployments()) {
for (DeployedArtifact deployedArtifact : deployment
.getDeployedArtifacts()) {
if (deployedArtifact instanceof Artifact) {
for (Manifestation manifestation : ((Artifact) deployedArtifact)
.getManifestations()) {
PackageableElement utilizedElement = (PackageableElement) manifestation
.eGet(
UMLPackage.Literals.MANIFESTATION__UTILIZED_ELEMENT,
false);
if (utilizedElement != null) {
deployedElements.add(utilizedElement);
}
}
}
}
}
return new UnionEObjectEList(
(InternalEObject) deploymentTarget,
UMLPackage.Literals.DEPLOYMENT_TARGET__DEPLOYED_ELEMENT,
deployedElements.size(), deployedElements.toArray());
}
} // DeploymentTargetOperations