當前位置: 首頁>>代碼示例>>Java>>正文


Java Family.SUCCESSFUL屬性代碼示例

本文整理匯總了Java中javax.ws.rs.core.Response.Status.Family.SUCCESSFUL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Family.SUCCESSFUL屬性的具體用法?Java Family.SUCCESSFUL怎麽用?Java Family.SUCCESSFUL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.ws.rs.core.Response.Status.Family的用法示例。


在下文中一共展示了Family.SUCCESSFUL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findByDescriptionId

/**
 * Returns description matches for the specified description id.
 *
 * @param descriptionId the description id
 * @return the matches for description id
 * @throws Exception the exception
 */
public MatchResults findByDescriptionId(String descriptionId)
  throws Exception {
  Logger.getLogger(getClass()).debug(
      "Snomed Client - find description matches by description id "
          + descriptionId);

  validateNotEmpty(descriptionId, "descriptionId");

  final Client client = ClientBuilder.newClient();
  final WebTarget target =
      client.target(getUrl() + "/descriptions/" + descriptionId);
  final Response response = target.request(MediaType.APPLICATION_JSON).get();
  final String resultString = response.readEntity(String.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }

  // converting to object
  return Utility.getGraphForJson(resultString, MatchResults.class);
}
 
開發者ID:IHTSDO,項目名稱:SNOMED-in-5-minutes,代碼行數:29,代碼來源:SnomedClientRest.java

示例2: findByConceptId

/**
 * Returns the concept for the specified concept id.
 *
 * @param conceptId the concept id
 * @return the concept for id
 * @throws Exception the exception
 */
public Concept findByConceptId(String conceptId) throws Exception {
  Logger.getLogger(getClass()).debug(
      "Snomed Client - find concept by concept id " + conceptId);

  validateNotEmpty(conceptId, "conceptId");

  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(getUrl() + "/concepts/" + conceptId);
  final Response response = target.request(MediaType.APPLICATION_JSON).get();
  final String resultString = response.readEntity(String.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }

  // converting to object
  return Utility.getGraphForJson(resultString, Concept.class);
}
 
開發者ID:IHTSDO,項目名稱:SNOMED-in-5-minutes,代碼行數:26,代碼來源:SnomedClientRest.java

示例3: processResponse

private ErrorInfo processResponse( Response response, String outputFilename )
{
    if ( response.getStatusInfo().getFamily() == Family.SUCCESSFUL )
    {
        getLog().debug( String.format( "Status: [%d]", response.getStatus() ) );
        InputStream in = response.readEntity( InputStream.class );
        try
        {
            File of = new File( getOutputDir(), outputFilename );
            pipeToFile( in, of );
        }
        catch ( IOException ex )
        {
            getLog().debug( String.format( "IOException: [%s]", ex.toString() ) );
            return new ErrorInfo( String.format( "IOException: [%s]", ex.getMessage() ) );
        }

    }
    else
    {
        getLog().warn( String.format( "Error code: [%d]", response.getStatus() ) );
        getLog().debug( response.getEntity().toString() );
        return new ErrorInfo( response.getStatus(), response.getEntity().toString() );
    }
    return null;
}
 
開發者ID:cjnygard,項目名稱:rest-maven-plugin,代碼行數:26,代碼來源:Plugin.java

示例4: regenerateBins

@Override
public void regenerateBins(Long projectId, String type, String authToken)
  throws Exception {
  Logger.getLogger(getClass()).debug("Workflow Client - regenerate bins "
      + projectId + ", " + type + ", " + projectId);

  validateNotEmpty(projectId, "projectId");

  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(config.getProperty("base.url")
      + "/workflow/bin/regenerate/all?projectId=" + projectId + "&type="
      + type);
  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).post(Entity.text(""));

  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }

}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:22,代碼來源:WorkflowClientRest.java

示例5: updateProject

@Override
public void updateProject(ProjectJpa project, String authToken)
  throws Exception {
  Logger.getLogger(getClass())
      .debug("Project Client - update project " + project);
  Client client = ClientBuilder.newClient();
  WebTarget target =
      client.target(config.getProperty("base.url") + "/project/");

  String projectString = ConfigUtility
      .getStringForGraph(project == null ? new ProjectJpa() : project);
  Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).post(Entity.xml(projectString));

  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // do nothing, successful
  } else {
    throw new Exception("Unexpected status - " + response.getStatus());
  }
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:20,代碼來源:ProjectClientRest.java

示例6: updateConcept

@Override
public void updateConcept(ConceptJpa concept, String authToken)
  throws Exception {
  Logger.getLogger(getClass())
      .debug("Integration Test Client - update concept" + concept);

  final Client client = ClientBuilder.newClient();
  final WebTarget target =
      client.target(config.getProperty("base.url") + "/test/concept/update");

  final String conceptString = ConfigUtility
      .getStringForGraph(concept == null ? new ConceptJpa() : concept);
  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).put(Entity.xml(conceptString));

  final String resultString = response.readEntity(String.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(resultString);
  }

}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:23,代碼來源:IntegrationTestClientRest.java

示例7: exportWorkflowConfig

@Override
public InputStream exportWorkflowConfig(Long projectId, Long workflowId,
  String authToken) throws Exception {
  Logger.getLogger(getClass()).debug(
      "Workflow Client - export workflow - " + projectId + ", " + workflowId);

  validateNotEmpty(projectId, "projectId");
  validateNotEmpty(workflowId, "workflowId");
  Client client = ClientBuilder.newClient();
  WebTarget target =
      client.target(config.getProperty("base.url") + "/config/export"
          + "?projectId=" + projectId + "&workflowId=" + workflowId);
  Response response = target.request(MediaType.APPLICATION_OCTET_STREAM)
      .header("Authorization", authToken).post(Entity.text(""));

  InputStream in = response.readEntity(InputStream.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }
  return in;
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:23,代碼來源:WorkflowClientRest.java

示例8: clearBins

@Override
public void clearBins(Long projectId, String type, String authToken)
  throws Exception {
  Logger.getLogger(getClass()).debug("Workflow Client - clear bins "
      + projectId + ", " + type + ", " + projectId);

  validateNotEmpty(projectId, "projectId");

  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(config.getProperty("base.url")
      + "/workflow/bin/clear/all?projectId=" + projectId + "&type=" + type);
  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).post(Entity.text(""));

  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }

}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:21,代碼來源:WorkflowClientRest.java

示例9: addPrecedenceList

@Override
public PrecedenceList addPrecedenceList(PrecedenceListJpa precedenceList,
  String authToken) throws Exception {
  Logger.getLogger(getClass())
      .debug("Metadata Client - add precedence list ");

  Client client = ClientBuilder.newClient();
  WebTarget target =
      client.target(config.getProperty("base.url") + "/metadata/precedence");
  final String precString = ConfigUtility.getStringForGraph(
      precedenceList == null ? new PrecedenceListJpa() : precedenceList);
  Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).put(Entity.xml(precString));

  String resultString = response.readEntity(String.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }
  // converting to object
  PrecedenceList result =
      ConfigUtility.getGraphForString(resultString, PrecedenceListJpa.class);
  return result;
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:25,代碼來源:MetadataClientRest.java

示例10: removeConcept

@Override
public void removeConcept(Long id, boolean cascade, String authToken)
  throws Exception {
  Logger.getLogger(getClass())
      .debug("Integration Test Client - remove concept " + id);
  validateNotEmpty(id, "id");
  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(config.getProperty("base.url")
      + "/test/concept/remove/" + id + (cascade ? "?cascade=true" : ""));

  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).delete();

  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // do nothing, successful
  } else {
    throw new Exception("Unexpected status - " + response.getStatus());
  }
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:19,代碼來源:IntegrationTestClientRest.java

示例11: addConceptNote

@Override
public void addConceptNote(Long id, String noteText, String authToken)
  throws Exception {

  Logger.getLogger(getClass()).debug("Content Client - add concept note for "
      + id + ", " + ", with text " + noteText);

  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(
      config.getProperty("base.url") + "/content/concept/" + id + "/note");

  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).post(Entity.text(noteText));

  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // do nothing
  } else {
    throw new Exception(response.toString());
  }
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:20,代碼來源:ContentClientRest.java

示例12: addDescriptorNote

@Override
public void addDescriptorNote(Long id, String noteText, String authToken)
  throws Exception {

  Logger.getLogger(getClass())
      .debug("Content Client - add descriptor note for " + id + ", "
          + ", with text " + noteText);

  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(
      config.getProperty("base.url") + "/content/descriptor/" + id + "/note");

  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).post(Entity.text(noteText));

  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // do nothing
  } else {
    throw new Exception(response.toString());
  }
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:21,代碼來源:ContentClientRest.java

示例13: getCode

@Override
public Code getCode(String terminologyId, String terminology, String version,
  Long projectId, String authToken) throws Exception {
  Logger.getLogger(getClass())
      .debug("Content Client - get code " + terminologyId + ", " + terminology
          + ", " + version + ", " + projectId + ", " + authToken);
  validateNotEmpty(terminologyId, "terminologyId");
  validateNotEmpty(terminology, "terminology");
  validateNotEmpty(version, "version");

  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(config.getProperty("base.url")
      + "/content/code/" + terminology + "/" + version + "/" + terminologyId);
  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).get();

  final String resultString = response.readEntity(String.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }

  // converting to object
  return ConfigUtility.getGraphForString(resultString, CodeJpa.class);
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:26,代碼來源:ContentClientRest.java

示例14: addRelationship

@Override
public ConceptRelationship addRelationship(
  ConceptRelationshipJpa relationship, String authToken) throws Exception {
  Logger.getLogger(getClass())
      .debug("Integration Test Client - add relationship" + relationship);

  final Client client = ClientBuilder.newClient();
  final WebTarget target = client.target(
      config.getProperty("base.url") + "/test/concept/relationship/add");

  final String relString = ConfigUtility.getStringForGraph(
      relationship == null ? new ConceptRelationshipJpa() : relationship);
  final Response response = target.request(MediaType.APPLICATION_XML)
      .header("Authorization", authToken).put(Entity.xml(relString));

  final String resultString = response.readEntity(String.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception("Unexpected status - " + response.getStatus());
  }

  // converting to object
  return ConfigUtility.getGraphForString(resultString,
      ConceptRelationshipJpa.class);
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:26,代碼來源:IntegrationTestClientRest.java

示例15: addUser

@Override
public User addUser(UserJpa user, String authToken) throws Exception {
  Logger.getLogger(getClass()).debug("Security Client - add user " + user);
  Client client = ClientBuilder.newClient();
  WebTarget target =
      client.target(config.getProperty("base.url") + "/security/user/add");

  String userString =
      (user != null ? ConfigUtility.getStringForGraph(user) : "");
  Response response =
      target.request(MediaType.APPLICATION_XML)
          .header("Authorization", authToken).put(Entity.xml(userString));

  String resultString = response.readEntity(String.class);
  if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
    // n/a
  } else {
    throw new Exception(response.toString());
  }

  // converting to object
  UserJpa result =
      ConfigUtility.getGraphForString(resultString, UserJpa.class);

  return result;
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:26,代碼來源:SecurityClientRest.java


注:本文中的javax.ws.rs.core.Response.Status.Family.SUCCESSFUL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。