@Override public void handleGet(Operation get) { NetworkInterfaceState currentState = getState(get); boolean doExpand = get.getUri().getQuery() != null && UriUtils.hasODataExpandParamValue(get.getUri()); if (!doExpand) { get.setBody(currentState).complete(); return; } // retrieve the description and include in an augmented version of our // state. Operation getDesc = Operation .createGet(this, currentState.networkInterfaceDescriptionLink) .setCompletion( (o, e) -> { if (e != null) { get.fail(e); return; } NetworkInterfaceDescription desc = o .getBody(NetworkInterfaceDescription.class); NetworkInterfaceStateWithDescription stateWithDesc = NetworkInterfaceStateWithDescription .create(desc, currentState); get.setBody(stateWithDesc).complete(); }); sendRequest(getDesc); }
@Override public void handleGet(Operation get) { NetworkInterfaceState currentState = getState(get); boolean doExpand = get.getUri().getQuery() != null && UriUtils.hasODataExpandParamValue(get.getUri()); if (!doExpand) { get.setBody(currentState).complete(); return; } // retrieve the description and include in an augmented version of our // state. Operation getDesc = Operation .createGet(this, currentState.networkInterfaceDescriptionLink) .setCompletion( (o, e) -> { if (e != null) { get.fail(e); return; } NetworkInterfaceDescription desc = o .getBody(NetworkInterfaceDescription.class); NetworkInterfaceStateWithDescription stateWithDesc = NetworkInterfaceStateWithDescription .create(desc, currentState); get.setBody(stateWithDesc).complete(); }); sendRequest(getDesc); }
public static NetworkInterfaceStateWithDescription create( NetworkInterfaceDescription description, NetworkInterfaceState state) { NetworkInterfaceStateWithDescription stateWithDesc = new NetworkInterfaceStateWithDescription(); state.copyTo(stateWithDesc); // Populate 'stateWithDesc' from 'state' stateWithDesc.address = state.address; stateWithDesc.networkLink = state.networkLink; stateWithDesc.subnetLink = state.subnetLink; stateWithDesc.securityGroupLinks = state.securityGroupLinks; stateWithDesc.deviceIndex = state.deviceIndex; // Then extend with 'description' data stateWithDesc.networkInterfaceDescriptionLink = description.documentSelfLink; stateWithDesc.description = description; return stateWithDesc; }
public static NetworkInterfaceStateWithDescription create( NetworkInterfaceDescription description, NetworkInterfaceState state) { NetworkInterfaceStateWithDescription stateWithDesc = new NetworkInterfaceStateWithDescription(); state.copyTo(stateWithDesc); // Populate 'stateWithDesc' from 'state' stateWithDesc.address = state.address; stateWithDesc.networkLink = state.networkLink; stateWithDesc.subnetLink = state.subnetLink; stateWithDesc.securityGroupLinks = state.securityGroupLinks; stateWithDesc.deviceIndex = state.deviceIndex; // Then extend with 'description' data stateWithDesc.networkInterfaceDescriptionLink = description.documentSelfLink; stateWithDesc.description = description; return stateWithDesc; }