io.cloudslang.content.dca.controllers.CreateResourceJSONController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cs-microfocus-dca Show documentation
Show all versions of cs-microfocus-dca Show documentation
Micro Focus DCA Integration
/*
* (c) Copyright 2018 Micro Focus, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cloudslang.content.dca.controllers;
import io.cloudslang.content.dca.models.DcaBaseResourceModel;
import io.cloudslang.content.dca.models.DcaDeploymentParameterModel;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class CreateResourceJSONController {
@NotNull
public static List getDcaBaseResourceModels(@NotNull final List baseResourceUuids,
@NotNull final List baseResourceCiTypes,
@NotNull final List baseResourceTypeUuids) {
final Iterator baseResourceUuidsIter = baseResourceUuids.iterator();
final Iterator baseResourceCiTypesIter = baseResourceCiTypes.iterator();
final Iterator baseResourceTypeUuidsIter = baseResourceTypeUuids.iterator();
final List dcaBaseResources = new ArrayList<>();
while (baseResourceUuidsIter.hasNext() && baseResourceCiTypesIter.hasNext() && baseResourceTypeUuidsIter.hasNext()) {
dcaBaseResources.add(new DcaBaseResourceModel(baseResourceUuidsIter.next(), baseResourceCiTypesIter.next(), baseResourceTypeUuidsIter.next()));
}
return dcaBaseResources;
}
@NotNull
public static List getDcaDeploymentParameterModels(
@NotNull final List deploymentParameterNames,
@NotNull final List deploymentParameterValues) {
final Iterator deploymentParameterNamesIter = deploymentParameterNames.iterator();
final Iterator deploymentParameterValuesIter = deploymentParameterValues.iterator();
final List deploymentParameters = new ArrayList<>();
while (deploymentParameterNamesIter.hasNext() && deploymentParameterValuesIter.hasNext()) {
deploymentParameters.add(new DcaDeploymentParameterModel(deploymentParameterNamesIter.next(), deploymentParameterValuesIter.next()));
}
return deploymentParameters;
}
}