public DDMFormValues getDDMFormValues(DDMStructure ddmStructure) throws PortalException {

    if (_ddmFormValues != null) {
      return _ddmFormValues;
    }

    JournalArticle article = getArticle();

    if (article == null) {
      return _ddmFormValues;
    }

    String content = article.getContent();

    if (Validator.isNull(content)) {
      return _ddmFormValues;
    }

    JournalConverter journalConverter = getJournalConverter();

    Fields fields = journalConverter.getDDMFields(ddmStructure, content);

    if (fields == null) {
      return _ddmFormValues;
    }

    _ddmFormValues = FieldsToDDMFormValuesConverterUtil.convert(ddmStructure, fields);

    return _ddmFormValues;
  }
Example #2
0
  @Override
  public DDMFormValues getDDMFormValues(
      long ddmStructureId, String fieldNamespace, ServiceContext serviceContext)
      throws PortalException {

    DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(ddmStructureId);

    Fields fields = getFields(ddmStructure.getStructureId(), fieldNamespace, serviceContext);

    return FieldsToDDMFormValuesConverterUtil.convert(ddmStructure, fields);
  }
  protected long create(StorageAdapter storageAdapter, long ddmStructureId, Fields fields)
      throws Exception {

    DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure(ddmStructureId);

    DDMFormValues ddmFormValues = FieldsToDDMFormValuesConverterUtil.convert(ddmStructure, fields);

    return storageAdapter.create(
        TestPropsValues.getCompanyId(),
        ddmStructureId,
        ddmFormValues,
        ServiceContextTestUtil.getServiceContext(group.getGroupId()));
  }