protected CommodityDTO buyCommodity( EClass type, EntityDTO buyer, String sellerUuid, Float used, String name, EClass extClass) { CommodityDTO commBoughtDto = new CommodityDTO( type, null, used, null, null, buyer.getName(), false, true, null, extClass); commBoughtDto.setName(name); EntityDTO.putCommBoughtInMap(sellerUuid, commBoughtDto, buyer.getCommodBoughtMap()); return commBoughtDto; }
protected CommodityDTO sellCommodity( EClass type, EntityDTO seller, Float capacity, String name, EClass extClass) { CommodityDTO commSoldDto = new CommodityDTO( type, null, null, capacity, null, seller.getName(), false, true, null, extClass); commSoldDto.setName(name); seller.getCommodSoldList().add(commSoldDto); return commSoldDto; }
protected void createVmFlowCommodities(EntityDTO vmDTO, String pmUuid) { for (String key : PodUtil.FLOW_KEYS) { CommodityDTO flowCommBought = buyDynamicCommodity(AbstractionPackage.eINSTANCE.getFlow(), vmDTO, pmUuid, key, 0f); flowCommBought.setLocalName(vmDTO.getName()); // TODO Create flow commodity discExt if there's flow target /* List<VMTTarget> flowTargets = DiscoveryUtil.getFlowTargets(); for (VMTTarget vmtTarget : flowTargets) { flowCommBought.setExtClass(DiscoveryExtensionsPackage.eINSTANCE .getFlowDiscoveryExtension()); flowCommBought.setLocalName(vmDTO.getName()); }*/ } }