Java 类com.amazonaws.mturk.requester.Locale 实例源码

项目:java-aws-mturk    文件:HITProperties.java   
private Locale getQualificationLocaleValue(int qualNum) {
  if (qualificationLocale[qualNum] == null || qualificationLocale[qualNum].equals(""))
    return null;

  String qualLocale = safeTrim(VelocityUtil.doMerge(qualificationLocale[qualNum], inputMap));
  return new Locale(qualLocale);    
}
项目:mturksdk-java-code-maven    文件:HITProperties.java   
private Locale getQualificationLocaleValue(int qualNum) {
  if (qualificationLocale[qualNum] == null || qualificationLocale[qualNum].equals(""))
    return null;

  String qualLocale = safeTrim(VelocityUtil.doMerge(qualificationLocale[qualNum], inputMap));
  return new Locale(qualLocale);    
}
项目:java-aws-mturk    文件:SimpleSurvey.java   
/**
 * Creates the simple survey.
 *
 */
public void createSimpleSurvey() {
  try {

    // This is an example of creating a qualification.
    // This is a built-in qualification -- user must be based in the US
    QualificationRequirement qualReq = new QualificationRequirement();
    qualReq.setQualificationTypeId(RequesterService.LOCALE_QUALIFICATION_TYPE_ID);
    qualReq.setComparator(Comparator.EqualTo);
    Locale country = new Locale();
    country.setCountry("US");
    qualReq.setLocaleValue(country);

    // The create HIT method takes in an array of QualificationRequirements
    // since a HIT can have multiple qualifications.
    QualificationRequirement[] qualReqs = null;
    qualReqs = new QualificationRequirement[] { qualReq };

    // Loading the question (QAP) file. HITQuestion is a helper class that
    // contains the QAP of the HIT defined in the external file. This feature 
    // allows you to write the entire QAP externally as a file and be able to 
    // modify it without recompiling your code.
    HITQuestion question = new HITQuestion(questionFile);

    //Creating the HIT and loading it into Mechanical Turk
    HIT hit = service.createHIT(null, // HITTypeId 
        title, 
        description, keywords, 
        question.getQuestion(),
        reward, assignmentDurationInSeconds,
        autoApprovalDelayInSeconds, lifetimeInSeconds,
        numAssignments, requesterAnnotation, 
        qualReqs,
        null // responseGroup
      );

    System.out.println("Created HIT: " + hit.getHITId());

    System.out.println("You may see your HIT with HITTypeId '" 
        + hit.getHITTypeId() + "' here: ");

    System.out.println(service.getWebsiteURL() 
        + "/mturk/preview?groupId=" + hit.getHITTypeId());

    //Demonstrates how a HIT can be retrieved if you know its HIT ID
    HIT hit2 = service.getHIT(hit.getHITId());

    System.out.println("Retrieved HIT: " + hit2.getHITId());

    if (!hit.getHITId().equals(hit2.getHITId())) {
      System.err.println("The HIT Ids should match: " 
          + hit.getHITId() + ", " + hit2.getHITId());
    }

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}
项目:mturksdk-java-code-maven    文件:SimpleSurvey.java   
/**
 * Creates the simple survey.
 *
 */
public void createSimpleSurvey() {
  try {

    // This is an example of creating a qualification.
    // This is a built-in qualification -- user must be based in the US
    QualificationRequirement qualReq = new QualificationRequirement();
    qualReq.setQualificationTypeId(RequesterService.LOCALE_QUALIFICATION_TYPE_ID);
    qualReq.setComparator(Comparator.EqualTo);
    Locale country = new Locale();
    country.setCountry("US");
    qualReq.setLocaleValue(country);

    // The create HIT method takes in an array of QualificationRequirements
    // since a HIT can have multiple qualifications.
    QualificationRequirement[] qualReqs = null;
    qualReqs = new QualificationRequirement[] { qualReq };

    // Loading the question (QAP) file. HITQuestion is a helper class that
    // contains the QAP of the HIT defined in the external file. This feature 
    // allows you to write the entire QAP externally as a file and be able to 
    // modify it without recompiling your code.
    HITQuestion question = new HITQuestion(questionFile);

    //Creating the HIT and loading it into Mechanical Turk
    HIT hit = service.createHIT(null, // HITTypeId 
        title, 
        description, keywords, 
        question.getQuestion(),
        reward, assignmentDurationInSeconds,
        autoApprovalDelayInSeconds, lifetimeInSeconds,
        numAssignments, requesterAnnotation, 
        qualReqs,
        null // responseGroup
      );

    System.out.println("Created HIT: " + hit.getHITId());

    System.out.println("You may see your HIT with HITTypeId '" 
        + hit.getHITTypeId() + "' here: ");

    System.out.println(service.getWebsiteURL() 
        + "/mturk/preview?groupId=" + hit.getHITTypeId());

    //Demonstrates how a HIT can be retrieved if you know its HIT ID
    HIT hit2 = service.getHIT(hit.getHITId());

    System.out.println("Retrieved HIT: " + hit2.getHITId());

    if (!hit.getHITId().equals(hit2.getHITId())) {
      System.err.println("The HIT Ids should match: " 
          + hit.getHITId() + ", " + hit2.getHITId());
    }

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}
项目:gort-public    文件:SimpleSurvey.java   
/**
 * Creates the simple survey.
 *
 */
public void createSimpleSurvey() {
  try {

    // This is an example of creating a qualification.
    // This is a built-in qualification -- user must be based in the US
    QualificationRequirement qualReq = new QualificationRequirement();
    qualReq.setQualificationTypeId(RequesterService.LOCALE_QUALIFICATION_TYPE_ID);
    qualReq.setComparator(Comparator.EqualTo);
    Locale country = new Locale();
    country.setCountry("US");
    qualReq.setLocaleValue(country);

    // The create HIT method takes in an array of QualificationRequirements
    // since a HIT can have multiple qualifications.
    QualificationRequirement[] qualReqs = null;
    qualReqs = new QualificationRequirement[] { qualReq };

    // Loading the question (QAP) file. HITQuestion is a helper class that
    // contains the QAP of the HIT defined in the external file. This feature 
    // allows you to write the entire QAP externally as a file and be able to 
    // modify it without recompiling your code.
    HITQuestion question = new HITQuestion(questionFile);

    //Creating the HIT and loading it into Mechanical Turk
    HIT hit = service.createHIT(null, // HITTypeId 
        title, 
        description, keywords, 
        question.getQuestion(),
        reward, assignmentDurationInSeconds,
        autoApprovalDelayInSeconds, lifetimeInSeconds,
        numAssignments, requesterAnnotation, 
        qualReqs,
        null // responseGroup
      );

    System.out.println("Created HIT: " + hit.getHITId());

    System.out.println("You may see your HIT with HITTypeId '" 
        + hit.getHITTypeId() + "' here: ");

    System.out.println(service.getWebsiteURL() 
        + "/mturk/preview?groupId=" + hit.getHITTypeId());

    //Demonstrates how a HIT can be retrieved if you know its HIT ID
    HIT hit2 = service.getHIT(hit.getHITId());

    System.out.println("Retrieved HIT: " + hit2.getHITId());

    if (!hit.getHITId().equals(hit2.getHITId())) {
      System.err.println("The HIT Ids should match: " 
          + hit.getHITId() + ", " + hit2.getHITId());
    }

  } catch (Exception e) {
    System.err.println(e.getLocalizedMessage());
  }
}