IModule[] module = (IModule[]) modules.get(ii);
int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
if (moduleDeltaKind != ServerBehaviourDelegate.REMOVED) {
//GERONIMODEVTOOLS-361
for (IModule singleModule:module){
EnvironmentType environment = getEnvironment(singleModule);
if (environment != null) {
ArtifactType child = environment.getModuleId();
DependenciesType dependencies = environment.getDependencies();
if (dependencies != null) {
List<DependencyType> depList = dependencies.getDependency();
for ( DependencyType dep : depList) {
ArtifactType parent = deploymentFactory.createArtifactType();
parent.setGroupId( dep.getGroupId() );
parent.setArtifactId( dep.getArtifactId() );
parent.setVersion( dep.getVersion() );
parent.setType( dep.getType() );
StringBuilder configId = new StringBuilder();
if (dep.getGroupId()!=null)
configId.append(dep.getGroupId());
configId.append("/");
if (dep.getArtifactId()!=null)
configId.append(dep.getArtifactId());
configId.append("/");
if (dep.getVersion()!=null)
configId.append(dep.getVersion());
configId.append("/");
if (dep.getType()!=null)
configId.append(dep.getType());
if (!DeploymentUtils.isInstalledModule(server,configId.toString()))
dm.addDependency( child, parent );
}
}
}
}
}
}
//
// Iterate through all the modules again and reorder as necessary
//
for (int ii=0; ii<modules.size(); ii++) {
IModule[] module = (IModule[]) modules.get(ii);
int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
if (module!=null && !reorderedModules.contains(module)) {
// Not already moved
if (moduleDeltaKind == ServerBehaviourDelegate.REMOVED) {
// Move module if going to be removed
reorderedModules.add(module);
reorderedKinds.add(moduleDeltaKind);
}
else {
EnvironmentType environment = getEnvironment(module[0]);
if (environment != null) {
ArtifactType artifact = environment.getModuleId();
if (artifact == null) {
// Move if null (nothing can be done)
if (!reorderedModules.contains(module)) {
reorderedModules.add(module);
reorderedKinds.add(moduleDeltaKind);