当前位置: 首页>>代码示例>>Java>>正文


Java CreateHITRequest类代码示例

本文整理汇总了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);
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:35,代码来源:RequesterServiceRaw.java

示例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);
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:22,代码来源:AppendKeywordFilter.java

示例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;
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:36,代码来源:RequesterServiceRaw.java

示例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);
}
 
开发者ID:dbarowy,项目名称:java-aws-mturk,代码行数:12,代码来源:TestFilter.java


注:本文中的com.amazonaws.mturk.requester.CreateHITRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。