【问题标题】:ATG customized repositoryATG 自定义存储库
【发布时间】:2015-09-14 04:00:50
【问题描述】:

如何在 ATG 中创建具有特定字段(如名称 id 等)的自定义存储库。以及如何根据姓名ID或任何其他字段查询相同的信息。

【问题讨论】:

    标签: atg atg-dynamo atg-droplet atg-dust


    【解决方案1】:
    1. 在配置中的某个路径(例如 /com/myproject/content/testRepository.xml)创建 testRepository.xml,其中包含所有自定义表的项目描述符。

    2. 在与 - 相同的路径下创建 testRepository.properties -

    $class=atg.adapter.gsa.GSARepository $范围=全局 XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory dataSource=/atg/dynamo/service/jdbc/SwitchingDataSource 定义文件=/com/myproject/content/testRepository.xml groupContainerPath=/atg/registry/RepositoryGroups idGenerator=/atg/dynamo/service/IdGenerator lockManager=/atg/dynamo/service/ClientLockManager repositoryName=测试存储库 transactionManager=/atg/dynamo/transaction/TransactionManager

    1. 现在您可以在您的 droplet 或表单处理程序中将此组件称为 -

      testRepository=/com/myproject/content/testRepository

    2. 在 java 中创建相同的 setter 和 getter。

    3. 现在您可以查询为 -

    private RepositoryItem[] getMyTestItems() {
    RepositoryItem[] testItems = null;
    try {
    RepositoryView repView = getTestRepository().getView("myItemDescriptor");
    RqlStatement statement = getRqlQuery(); //your query that can be defined in property file
    Object params[] = new Object[1];
    params[0] = "anyParam";
    
    testItems = statement.executeQuery(repView, params);
    } catch (RepositoryException ex) {
    vlogDebug("testItems{0} ", ex);
    } finally {
    LoadingStrategyContext.popLoadStrategy();
    }
    return testItems;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-04-04
      • 1970-01-01
      • 2013-02-17
      • 2020-06-12
      • 1970-01-01
      • 2014-02-22
      • 1970-01-01
      • 2018-02-09
      • 2018-10-06
      相关资源
      最近更新 更多