/**
   * Searches for the given name the xsl in eFaps. If exists, the instance is returned.
   *
   * @return found instance (or null if not found)
   * @throws EFapsException if search query could not be executed
   * @see #programName
   */
  @Override
  public Instance searchInstance() throws EFapsException {
    Instance instance = null;

    final Type esjpType = Type.get(ADMIN_PROGRAM_XSL);
    final SearchQuery query = new SearchQuery();
    query.setQueryTypes(esjpType.getName());
    query.addWhereExprEqValue("Name", getProgramName());
    query.addSelect("OID");
    query.executeWithoutAccessCheck();
    if (query.next()) {
      instance = Instance.get((String) query.get("OID"));
    }
    query.close();

    return instance;
  }
示例#2
0
  public StoreResource getStoreResource(final Type _type, final long _fileId)
      throws EFapsException {
    StoreResource storeRsrc = null;

    // TODO: dynamic class loading instead of hard coded store resource name
    String provider = _type.getProperty("StoreResource");
    if (provider.equals("org.efaps.db.transaction.JDBCStoreResource")) {
      storeRsrc = new JDBCStoreResource(this, _type, _fileId);
    } else {
      storeRsrc = new VFSStoreResource(this, _type, _fileId);
    }
    System.out.println("storeRsrc.getContext()=" + storeRsrc.getContext());
    storeRsrc.open();
    this.storeStore.add(storeRsrc);
    return storeRsrc;
  }