@Test
  public void testActionableDynamicQuery() throws Exception {
    final IntegerWrapper count = new IntegerWrapper();

    ActionableDynamicQuery actionableDynamicQuery =
        DDLRecordVersionLocalServiceUtil.getActionableDynamicQuery();

    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod<DDLRecordVersion>() {
          @Override
          public void performAction(DDLRecordVersion ddlRecordVersion) {
            Assert.assertNotNull(ddlRecordVersion);

            count.increment();
          }
        });

    actionableDynamicQuery.performActions();

    Assert.assertEquals(count.getValue(), _persistence.countAll());
  }
コード例 #2
0
  @Override
  public AssetRenderer<DDLRecord> getAssetRenderer(long classPK, int type) throws PortalException {

    DDLRecord record = null;
    DDLRecordVersion recordVersion = null;

    if (type == TYPE_LATEST) {
      recordVersion = DDLRecordVersionLocalServiceUtil.getRecordVersion(classPK);

      record = recordVersion.getRecord();
    } else {
      record = DDLRecordLocalServiceUtil.getRecord(classPK);

      recordVersion = record.getRecordVersion();
    }

    DDLRecordAssetRenderer ddlRecordAssetRenderer =
        new DDLRecordAssetRenderer(record, recordVersion);

    ddlRecordAssetRenderer.setAssetRendererType(type);
    ddlRecordAssetRenderer.setServletContext(_servletContext);

    return ddlRecordAssetRenderer;
  }