コード例 #1
0
  protected DDMFormFieldValue createDDMFormFieldValue(String name) {
    DDMFormFieldValue ddmFormFieldValue = new DDMFormFieldValue();

    ddmFormFieldValue.setName(name);

    LocalizedValue localizedValue = new LocalizedValue(LocaleUtil.US);

    localizedValue.addString(LocaleUtil.US, StringPool.BLANK);

    ddmFormFieldValue.setValue(localizedValue);

    return ddmFormFieldValue;
  }
コード例 #2
0
  protected void updateServiceContext(String expando, long fileEntryTypeId, String metadata)
      throws PortalException {

    Map<String, Serializable> expandoBridgeAttributes =
        _serviceContext.getExpandoBridgeAttributes();

    expandoBridgeAttributes.put(_EXPANDO_ATTRIBUTE_NAME, expando);

    _serviceContext.setExpandoBridgeAttributes(expandoBridgeAttributes);

    _serviceContext.setAttribute("fileEntryTypeId", fileEntryTypeId);

    if (fileEntryTypeId <= 0) {
      return;
    }

    DLFileEntryType fileEntryType =
        DLFileEntryTypeLocalServiceUtil.getFileEntryType(fileEntryTypeId);

    List<DDMStructure> ddmStructures = fileEntryType.getDDMStructures();

    for (DDMStructure ddmStructure : ddmStructures) {
      DDMFormValues ddmFormValues =
          (DDMFormValues)
              _serviceContext.getAttribute(
                  DDMFormValues.class.getName() + ddmStructure.getStructureId());

      for (DDMFormFieldValue ddmFormFieldValue : ddmFormValues.getDDMFormFieldValues()) {

        String fieldType = ddmStructure.getFieldType(ddmFormFieldValue.getName());

        if (fieldType.equals("text")) {
          LocalizedValue localizedValue = new LocalizedValue(LocaleUtil.US);

          localizedValue.addString(LocaleUtil.US, metadata);

          ddmFormFieldValue.setValue(localizedValue);
        }
      }

      _serviceContext.setAttribute(
          DDMFormValues.class.getName() + ddmStructure.getStructureId(), ddmFormValues);
    }
  }