@Override protected void updateIncomingId(Balance incoming) { incoming.setId(incoming.getSchedulingPolicyUnit().getId()); } }
@Override public V3Balance adapt(Balance from) { V3Balance to = new V3Balance(); if (from.isSetLinks()) { to.getLinks().addAll(adaptOut(from.getLinks())); if (from.isSetActions()) { to.setActions(adaptOut(from.getActions())); if (from.isSetComment()) { to.setComment(from.getComment()); if (from.isSetDescription()) { to.setDescription(from.getDescription()); if (from.isSetId()) { to.setId(from.getId()); if (from.isSetHref()) { to.setHref(from.getHref()); if (from.isSetName()) { to.setName(from.getName()); if (from.isSetSchedulingPolicy()) { to.setSchedulingPolicy(adaptOut(from.getSchedulingPolicy())); if (from.isSetSchedulingPolicyUnit()) { to.setSchedulingPolicyUnit(adaptOut(from.getSchedulingPolicyUnit()));
@Override public Balance adapt(V3Balance from) { Balance to = new Balance(); if (from.isSetLinks()) { to.getLinks().addAll(adaptIn(from.getLinks())); to.setActions(adaptIn(from.getActions())); to.setComment(from.getComment()); to.setDescription(from.getDescription()); to.setId(from.getId()); to.setHref(from.getHref()); to.setName(from.getName()); to.setSchedulingPolicy(adaptIn(from.getSchedulingPolicy())); to.setSchedulingPolicyUnit(adaptIn(from.getSchedulingPolicyUnit()));
@Override protected void verify(Balance model, Balance transform) { assertNotNull(transform); assertEquals(model.getId(), transform.getId()); assertEquals(model.getSchedulingPolicyUnit().getId(), transform.getSchedulingPolicyUnit().getId()); }
@Mapping(from = ClusterPolicy.class, to = Balance.class) public static Balance map(ClusterPolicy entity, Balance template) { if (template == null) { assert false : "scheduling balance cannot be null"; return null; } Balance model = template; SchedulingPolicyUnit schedulingPolicyUnit = new SchedulingPolicyUnit(); schedulingPolicyUnit.setId(model.getId()); model.setSchedulingPolicyUnit(schedulingPolicyUnit); return model; }
@Mapping(from = Balance.class, to = ClusterPolicy.class) public static ClusterPolicy map(Balance model, ClusterPolicy template) { ClusterPolicy entity = template != null ? template : new ClusterPolicy(); if (model.isSetSchedulingPolicyUnit() && model.getSchedulingPolicyUnit().isSetId()) { Guid guid = GuidUtils.asGuid(model.getSchedulingPolicyUnit().getId()); entity.setBalance(guid); } return entity; } }
@Override protected Balance postPopulate(Balance model) { model.setId(ID); SchedulingPolicyUnit schedulingPolicyUnit = new SchedulingPolicyUnit(); schedulingPolicyUnit.setId(ID); model.setSchedulingPolicyUnit(schedulingPolicyUnit); return model; }
public static void validateAdd(Balance balance) { if (balance == null) { throw new ValidationException("Parameter 'balance' is mandatory but was not provided."); } if (balance.getSchedulingPolicyUnit()==null || balance.getSchedulingPolicyUnit().getId()==null) { throw new ValidationException("Parameter 'balance.scheduling_policy_unit.id' is mandatory but was not provided."); } }
/** * Create an instance of {@link Balance } * */ public Balance createBalance() { return new Balance(); }
@Override public Balances list() { ClusterPolicy clusterPolicy = getClusterPolicy(); Balances balances = new Balances(); if (clusterPolicy.getBalance() != null) { Balance balance = new Balance(); balance.setId(clusterPolicy.getBalance().toString()); balances.getBalances().add(addLinks(map(clusterPolicy, balance))); } return balances; }