package org.bench4q.web.service;

import java.util.LinkedList;
import java.util.List;

import org.bench4q.share.models.master.plugin.PluginInfoModel;
import org.bench4q.share.models.master.plugin.PluginResponseModel;
import org.bench4q.share.models.master.plugin.PluginUIModel;
import org.springframework.stereotype.Component;

@Component
public class PluginService {

	public List<PluginInfoModel> extractPluginInfoModels(
			PluginResponseModel pluginResponseModel) {

		List<PluginInfoModel> pluginInfoModels = new LinkedList<PluginInfoModel>();
		if (pluginResponseModel == null
				|| pluginResponseModel.getPluginUIModels() == null) {
			return pluginInfoModels;
		} else {
			for (PluginUIModel pluginUIModel : pluginResponseModel
					.getPluginUIModels()) {
				pluginInfoModels.add(pluginUIModel.getPluginInfoModel());
			}
			return pluginInfoModels;
		}

	}
}
