protected void addFileEntryTypeAttributes(Document document, DLFileVersion dlFileVersion)
      throws PortalException, SystemException {

    DLFileEntryType dlFileEntryType =
        DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(dlFileVersion.getFileEntryTypeId());

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

    for (DDMStructure ddmStructure : ddmStructures) {
      Fields fields = null;

      try {
        DLFileEntryMetadata fileEntryMetadata =
            DLFileEntryMetadataLocalServiceUtil.getFileEntryMetadata(
                ddmStructure.getStructureId(), dlFileVersion.getFileVersionId());

        fields = StorageEngineUtil.getFields(fileEntryMetadata.getDDMStorageId());
      } catch (Exception e) {
      }

      if (fields != null) {
        DDMIndexerUtil.addAttributes(document, ddmStructure, fields);
      }
    }
  }
  @Override
  public int getClassTypeFieldNamesCount(long classTypeId, Locale locale) throws Exception {

    List<Tuple> classTypeFieldNames = new ArrayList<Tuple>();

    DLFileEntryType dlFileEntryType =
        DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classTypeId);

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

    for (DDMStructure ddmStructure : ddmStructures) {
      classTypeFieldNames.addAll(getDDMStructureFieldNames(ddmStructure, locale));
    }

    return classTypeFieldNames.size();
  }
  @Override
  public List<Tuple> getClassTypeFieldNames(long classTypeId, Locale locale, int start, int end)
      throws Exception {

    List<Tuple> classTypeFieldNames = new ArrayList<Tuple>();

    DLFileEntryType dlFileEntryType =
        DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classTypeId);

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

    for (DDMStructure ddmStructure : ddmStructures) {
      classTypeFieldNames.addAll(getDDMStructureFieldNames(ddmStructure, locale));
    }

    return ListUtil.subList(classTypeFieldNames, start, end);
  }
 @Override
 public DLFileEntryType getDLFileEntryType() throws PortalException {
   return DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(getFileEntryTypeId());
 }