protected VpcOfferingDaoImpl() { super(); AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), Op.EQ); AllFieldsSearch.and("uName", AllFieldsSearch.entity().getUniqueName(), Op.EQ); AllFieldsSearch.and("displayText", AllFieldsSearch.entity().getDisplayText(), Op.EQ); AllFieldsSearch.and("svcOffId", AllFieldsSearch.entity().getServiceOfferingId(), Op.EQ); AllFieldsSearch.done(); }
private VpcOffering createVpcOfferingInTransaction(String name, String displayText, Multimap<Network.Service, Network.Provider> svcProviderMap, boolean isDefault, VpcOffering.State state, Long serviceOfferingId) { // create vpc offering object VpcOfferingVO offering = new VpcOfferingVO(name, displayText, isDefault, serviceOfferingId, false, false); if (state != null) { offering.setState(state); } if (s_logger.isDebugEnabled()) { s_logger.debug(String.format("Adding vpc offering %s", offering)); } offering = _vpcOffDao.persist(offering); // populate services and providers if (svcProviderMap != null) { for (Map.Entry<Network.Service, Network.Provider> entry : svcProviderMap.entries()) { Network.Service service = entry.getKey(); Network.Provider provider = entry.getValue(); VpcOfferingServiceMapVO offService = new VpcOfferingServiceMapVO(offering.getId(), service, provider); _vpcOffSvcMapDao.persist(offService); if (s_logger.isTraceEnabled()) { s_logger.trace(String.format("Added service for the vpc offering: %s with provider %s", offService, provider.getName())); } } } return offering; }
if (vpcOff == null || vpcOff.getState() != State.Enabled) { final InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find vpc offering in " + State.Enabled + " state by specified id"); if (vpcOff == null) { ex.addProxyObject(String.valueOf(vpcOffId), "vpcOfferingId"); } else { ex.addProxyObject(vpcOff.getUuid(), "vpcOfferingId"); final boolean isRegionLevelVpcOff = vpcOff.offersRegionLevelVPC(); if (isRegionLevelVpcOff && networkDomain == null) { throw new InvalidParameterValueException("Network domain must be specified for region level VPC"); final boolean useDistributedRouter = vpcOff.supportsDistributedRouter(); final VpcVO vpc = new VpcVO(zoneId, vpcName, displayText, owner.getId(), owner.getDomainId(), vpcOffId, cidr, networkDomain, useDistributedRouter, isRegionLevelVpcOff, vpcOff.getRedundantRouter());
private VpcOffering locateVpcOffering() { VpcOffering vpcOffer = _vpcOffDao.findByUniqueName(juniperVPCOfferingName); if (vpcOffer != null) { if (((VpcOfferingVO)vpcOffer).getState() == VpcOffering.State.Enabled) { return vpcOffer; ((VpcOfferingVO)vpcOffer).setState(VpcOffering.State.Enabled); long id = vpcOffer.getId(); _vpcOffDao.update(id, (VpcOfferingVO)vpcOffer); ((VpcOfferingVO)vpcOffer).setState(VpcOffering.State.Enabled); long id = vpcOffer.getId(); _vpcOffDao.update(id, (VpcOfferingVO)vpcOffer);
offering.setName(vpcOfferingName); offering.setDisplayText(displayText); if (st.name().equalsIgnoreCase(state)) { validState = true; offering.setState(st);
if (areServicesSupportedByVpcOffering(offering.getId(), supportedServices)) { supportedOfferings.add(offering);
@Override protected void findServiceOfferingId() { serviceOfferingId = vpcOffDao.findById(vpc.getVpcOfferingId()).getServiceOfferingId(); if (serviceOfferingId == null) { findDefaultServiceOfferingId(); } }
entity.setVpcOfferingId(redundantOffering.getId());
@Override public VpcOffering doInTransaction(final TransactionStatus status) { // create vpc offering object VpcOfferingVO offering = new VpcOfferingVO(name, displayText, isDefault, serviceOfferingId, supportsDistributedRouter, offersRegionLevelVPC, redundantRouter); if (state != null) { offering.setState(state); } s_logger.debug("Adding vpc offering " + offering); offering = _vpcOffDao.persist(offering); // populate services and providers if (svcProviderMap != null) { for (final Network.Service service : svcProviderMap.keySet()) { final Set<Provider> providers = svcProviderMap.get(service); if (providers != null && !providers.isEmpty()) { for (final Network.Provider provider : providers) { final VpcOfferingServiceMapVO offService = new VpcOfferingServiceMapVO(offering.getId(), service, provider); _vpcOffSvcMapDao.persist(offService); s_logger.trace("Added service for the vpc offering: " + offService + " with provider " + provider.getName()); } } else { throw new InvalidParameterValueException("Provider is missing for the VPC offering service " + service.getName()); } } } return offering; } });