ATG定制存储库

时间:2015-09-14 04:00:51

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

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

1 个答案:

答案 0 :(得分:1)

  1. 在config中的某个路径创建testRepository.xml(例如/com/myproject/content/testRepository.xml),其中包含具有所有自定义表的项描述符。

  2. 在与

  3. 相同的路径上创建testRepository.properties
      

    $类= atg.adapter.gsa.GSARepository       $范围=全球       XMLToolsFactory = / ATG /发电机/服务/ XML / XMLToolsFactory       展现dataSource = / ATG /发电机/服务/ JDBC / SwitchingDataSource       definitionFiles = / COM / myproject的/内容/ testRepository.xml       groupContainerPath = / ATG /注册表/ RepositoryGroups       idGenerator = / ATG /发电机/服务/ IdGenerator       锁管理= / ATG /发电机/服务/ ClientLockManager       repositoryName =测试存储库       transactionManager的= / ATG /发电机/交易/事务管理

    1. 现在您可以在Droplet或表单处理程序中将此组件引用为 -

      testRepository = / COM / myproject的/内容/ testRepository

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

    3. 现在您可以查询 -

    4. 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;
      }
      
相关问题