コード例 #1
0
ファイル: KieSrampUtil.java プロジェクト: KurtStam/dtgov
  /**
   * Creating a KieBase from the workflow GAV specified in the config.
   *
   * @return KieBase for package SRAMPPackage
   * @throws SrampClientException
   * @throws SrampAtomException
   */
  public KieContainer getKieContainer(ReleaseId releaseId)
      throws SrampClientException, SrampAtomException {
    KieServices ks = KieServices.Factory.get();
    KieRepository repo = ks.getRepository();
    SrampAtomApiClient client = SrampAtomApiClientFactory.createAtomApiClient();

    Governance governance = new Governance();
    QueryResultSet results =
        client
            .buildQuery(SRAMP_KIE_JAR_QUERY)
            .parameter(governance.getGovernanceWorkflowGroup())
            .parameter(governance.getGovernanceWorkflowName())
            .parameter(governance.getGovernanceWorkflowVersion())
            .count(1)
            .query();
    if (results.size() > 0) {
      ArtifactSummary artifactSummery = results.get(0);
      InputStream is = client.getArtifactContent(artifactSummery);
      KieModule kModule = repo.addKieModule(ks.getResources().newInputStreamResource(is));
      logger.info(
          Messages.i18n.format(
              "KieSrampUtil.CreatingKieContainer", artifactSummery)); // $NON-NLS-1$
      KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());
      // Creating the KieBase for the SRAMPPackage
      logger.info(
          Messages.i18n.format(
              "KieSrampUtil.FindKieBase",
              governance.getGovernanceWorkflowPackage())); // $NON-NLS-1$
      return kContainer;
    } else {
      return null;
    }
  }
コード例 #2
0
ファイル: KieSrampUtil.java プロジェクト: KurtStam/dtgov
 /**
  * Returns true if the workflow JAR is deployed to the s-ramp repository.
  *
  * @param groupId
  * @param artifactId
  * @param version
  * @return true or false
  */
 public boolean isSRAMPPackageDeployed(String groupId, String artifactId, String version) {
   try {
     SrampAtomApiClient client = SrampAtomApiClientFactory.createAtomApiClient();
     QueryResultSet results =
         client
             .buildQuery(SRAMP_KIE_JAR_QUERY)
             .parameter(groupId)
             .parameter(artifactId)
             .parameter(version)
             .count(1)
             .query();
     if (results.size() > 0) {
       return Boolean.TRUE;
     }
   } catch (SrampClientException e) {
     logger.error(e.getMessage(), e);
   } catch (SrampAtomException e) {
     logger.error(e.getMessage(), e);
   }
   return Boolean.FALSE;
 }