當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。