setGetOfferRequests(numberRequested)
![]() |
numberRequested - 오퍼 수신을 위한 매개변수를 정의하는 GetOfferRequest 오브젝트의 배열입니다.
|
GetOfferRequest request1 = new GetOfferRequest(5, GetOfferRequest.NO_DUPLICATION);
request1.setIpName("IP1");
OfferAttributeRequirements offerAttributes1 = new OfferAttributeRequirements();
NameValuePairImpl attr1 = new NameValuePairImpl("attr1",
NameValuePair.DATA_TYPE_NUMERIC, 1);
NameValuePairImpl attr2 = new NameValuePairImpl("attr2",
NameValuePair.DATA_TYPE_STRING, "value2");
NameValuePairImpl attr3 = new NameValuePairImpl("attr3",
NameValuePair.DATA_TYPE_STRING, "value3");
NameValuePairImpl attr4 = new NameValuePairImpl("attr4",
NameValuePair.DATA_TYPE_NUMERIC, 4);
offerAttributes1.setNumberRequested(5);
offerAttributes1.setAttributes(new NameValuePairImpl[] {attr1, attr2});
OfferAttributeRequirements childAttributes1 = new OfferAttributeRequirements();
childAttributes1.setNumberRequested(3);
childAttributes1.setAttributes(new NameValuePairImpl[] {attr3});
OfferAttributeRequirements childAttributes2 = new OfferAttributeRequirements();
childAttributes2.setNumberRequested(3);
childAttributes2.setAttributes(new NameValuePairImpl[] {attr4});
offerAttributes1.setChildRequirements(Arrays.asList(childAttributes1,
childAttributes2));
request1.setOfferAttributes(offerAttributes1);
GetOfferRequest request2 = new GetOfferRequest(3, GetOfferRequest.ALLOW_DUPLICATION);
request2.setIpName("IP2");
OfferAttributeRequirements offerAttributes2 = new OfferAttributeRequirements();
offerAttributes2.setNumberRequested(3);
offerAttributes2.setAttributes(new NameValuePairImpl[] {new NameValuePairImpl("attr5",
NameValuePair.DATA_TYPE_STRING, "value5")});
request2.setOfferAttributes(offerAttributes2);
GetOfferRequest request3 = new GetOfferRequest(2, GetOfferRequest.NO_DUPLICATION);
request3.setIpName("IP3");
request3.setOfferAttributes(null);
Command getOffersMultiIPCmd = new CommandImpl();
getOffersMultiIPCmd.setGetOfferRequests(new GetOfferRequest[] {request1,
request2, request3});
Copyright IBM Corporation 2013. All Rights Reserved.
|