本文整理汇总了Java中com.amazonaws.mturk.requester.CreateHITRequest类的典型用法代码示例。如果您正苦于以下问题:Java CreateHITRequest类的具体用法?Java CreateHITRequest怎么用?Java CreateHITRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CreateHITRequest类属于com.amazonaws.mturk.requester包,在下文中一共展示了CreateHITRequest类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHITAsync
import com.amazonaws.mturk.requester.CreateHITRequest; //导入依赖的package包/类
/**
* Creates a HIT asynchronously using the Axis worker thread pool.
* It returns an AsyncReply object, which can either be used to
* wait for the asynchronous call to complete and to get the result
* of the call. Alternatively, a callback handler can be passed
* that is notified when the call has completed.
*
* The work queue is using a pool of daemon threads to process the submitted tasks.
* To guarantee that all work submitted to the queue was processed before the JVM
* exits, this requires to wait for all future results of the submitted work items.
* This can conveniently be done using the getResult() method of the AsyncReply
* object returned by this method. A typical usage pattern would be to first submit
* all requests to the work queue, store the AsyncReply objects in an array and then
* call getResult() for each of the objects in the array.
*
* @throws ServiceException
*/
public AsyncReply createHITAsync(String hitTypeId, String title, String description, String keywords,
String question, Double reward, Long assignmentDurationInSeconds, Long autoApprovalDelayInSeconds,
Long lifetimeInSeconds, Integer maxAssignments, String requesterAnnotation,
QualificationRequirement[] qualificationRequirements, String[] responseGroup,
String uniqueRequestToken, ReviewPolicy assignmentReviewPolicy, ReviewPolicy hitReviewPolicy, AsyncCallback callback) {
CreateHITRequest request = wrapHITParams(hitTypeId, title, description, keywords,
question, reward, assignmentDurationInSeconds, autoApprovalDelayInSeconds,
lifetimeInSeconds, maxAssignments, requesterAnnotation,
qualificationRequirements, responseGroup, uniqueRequestToken,
assignmentReviewPolicy, hitReviewPolicy, null, null);
return executeAsyncRequest(request,
ResultMatch.CreateHIT.name(),
ResultMatch.CreateHIT.getResultTypeName(),
callback);
}
示例2: execute
import com.amazonaws.mturk.requester.CreateHITRequest; //导入依赖的package包/类
/**
* Checks if method is createHIT and appends 'myHIT' to the set of keywords
*/
@Override
public Reply execute(Message m) throws ServiceException {
if (m.getMethodName().equals("CreateHIT")) {
CreateHITRequest[] requestArray = (CreateHITRequest[]) m.getRequests();
for (CreateHITRequest request : requestArray) {
StringBuffer keywords = new StringBuffer();
//append existing keywords to string buffer
if (request.getKeywords() != null) {
keywords.append(request.getKeywords());
keywords.append(", ");
}
keywords.append("myHIT");
request.setKeywords(keywords.toString());
}
}
//pass the message to the next filter
return passMessage(m);
}
示例3: wrapHITParams
import com.amazonaws.mturk.requester.CreateHITRequest; //导入依赖的package包/类
private CreateHITRequest wrapHITParams(String hitTypeId, String title, String description, String keywords,
String question, Double reward, Long assignmentDurationInSeconds, Long autoApprovalDelayInSeconds,
Long lifetimeInSeconds, Integer maxAssignments, String requesterAnnotation,
QualificationRequirement[] qualificationRequirements, String[] responseGroup,
String uniqueRequestToken, ReviewPolicy assignmentReviewPolicy, ReviewPolicy hitReviewPolicy,
String hitLayoutId, HITLayoutParameter[] hitLayoutParameters) {
CreateHITRequest request = new CreateHITRequest();
if (question != null) request.setQuestion(question);
if (lifetimeInSeconds != null)request.setLifetimeInSeconds(lifetimeInSeconds);
if (hitTypeId != null) request.setHITTypeId(hitTypeId);
if (title != null) request.setTitle(title);
if (description != null) request.setDescription(description);
if (keywords != null) request.setKeywords(keywords);
if (maxAssignments != null) request.setMaxAssignments(maxAssignments);
if (responseGroup != null) request.setResponseGroup(responseGroup);
if (hitReviewPolicy != null) request.setHITReviewPolicy(hitReviewPolicy);
if (hitLayoutId != null) request.setHITLayoutId(hitLayoutId);
if (requesterAnnotation != null) request.setRequesterAnnotation(requesterAnnotation);
if (assignmentDurationInSeconds != null)request.setAssignmentDurationInSeconds(assignmentDurationInSeconds);
if (autoApprovalDelayInSeconds != null) request.setAutoApprovalDelayInSeconds(autoApprovalDelayInSeconds);
if (qualificationRequirements != null) request.setQualificationRequirement(qualificationRequirements);
if (assignmentReviewPolicy != null) request.setAssignmentReviewPolicy(assignmentReviewPolicy);
if (uniqueRequestToken != null) request.setUniqueRequestToken(uniqueRequestToken);
if (hitLayoutParameters != null) request.setHITLayoutParameter(hitLayoutParameters);
if (reward != null) {
Price p = new Price();
p.setAmount(new BigDecimal(reward));
p.setCurrencyCode("USD");
request.setReward(p);
}
return request;
}
示例4: execute
import com.amazonaws.mturk.requester.CreateHITRequest; //导入依赖的package包/类
public Reply execute(Message m) {
if (m.getMethodName().equals("CreateHIT")) {
CreateHITRequest[] requestArray = (CreateHITRequest[]) m.getRequests();
for (CreateHITRequest request : requestArray) {
if (request.getReward().getAmount().doubleValue() < 0.05) {
request.getReward().setAmount(new BigDecimal(0.05));
}
}
}
return passMessage(m);
}