use of com.emc.cloud.platform.ucs.in.model.ConfigResolveClass in project coprhd-controller by CoprHD.
the class UCSMServiceImpl method getServiceProfileTemplates.
@Override
public List<LsServer> getServiceProfileTemplates(String ucsmURL, String username, String password) throws ClientGeneralException {
List<LsServer> serviceProfileTemplates = Collections.synchronizedList(new ArrayList<LsServer>());
ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
ConfigResolveClass configResolveClass = new ConfigResolveClass();
configResolveClass.setClassId(NamingClassId.LS_SERVER);
configResolveClass.setInHierarchical("true");
FilterFilter inFilter = new FilterFilter();
OrFilter orFilter = new OrFilter();
EqFilter eqFilterInitTemplate = new EqFilter();
eqFilterInitTemplate.setProperty("type");
eqFilterInitTemplate.setClazz(NamingClassId.LS_SERVER);
eqFilterInitTemplate.setValue("initial-template");
EqFilter eqFilterUpdatingTemplate = new EqFilter();
eqFilterUpdatingTemplate.setProperty("type");
eqFilterUpdatingTemplate.setClazz(NamingClassId.LS_SERVER);
eqFilterUpdatingTemplate.setValue("updating-template");
orFilter.getAbstractFilter().add(factory.createEq(eqFilterUpdatingTemplate));
orFilter.getAbstractFilter().add(factory.createEq(eqFilterInitTemplate));
inFilter.setAbstractFilter(factory.createOr(orFilter));
configResolveClass.getContent().add(new JAXBElement<FilterFilter>(new QName("inFilter"), FilterFilter.class, inFilter));
com.emc.cloud.platform.ucs.out.model.ConfigResolveClass configResolveClassOut = computeSession.execute(factory.createConfigResolveClass(configResolveClass), com.emc.cloud.platform.ucs.out.model.ConfigResolveClass.class);
ConfigSet configSet = null;
if (configResolveClassOut.getContent() != null && !configResolveClassOut.getContent().isEmpty()) {
for (Object object : configResolveClassOut.getContent()) {
if (object instanceof JAXBElement<?>) {
if (!(((JAXBElement) object).getValue() instanceof ConfigSet)) {
continue;
}
configSet = ((JAXBElement<ConfigSet>) object).getValue();
if (configSet != null && configSet.getManagedObject() != null && !configSet.getManagedObject().isEmpty()) {
for (JAXBElement<?> managedObject : configSet.getManagedObject()) {
if (managedObject.getValue() instanceof LsServer) {
serviceProfileTemplates.add((LsServer) managedObject.getValue());
LsServer spt = (LsServer) managedObject.getValue();
log.info("SPT Name:" + spt.getName());
}
}
}
}
}
}
return serviceProfileTemplates;
}
Aggregations