Uploaded image for project: 'Magnolia DAM Module'
  1. Magnolia DAM Module
  2. MGNLDAM-719

Sortable File Size Column

XMLWordPrintable

      PXMDAM-8

      ----------------

      Hi Product Team,

      in some of our bigger customer projects we saw some issues regarding big files. Some of the users don't care about file sizes and push anything they like to the dam workspace. This ends in a big backup issue and you also have problems to download an xml export. For those reasons we have added a new column which shows the current file size of a mgnl:asset. If you are interessted i also attached the two java files for the column formatting.

      Now all works fine you see the file size in the column. But you can't sort it by this column because it's not possible to add a order by from a jcr subnode property. In this case it's a limitation of sql2 which you are using for the sorting in your container. I researched a little bit and it's only possible to sort this with a xpath query like this:

      /jcr:root//element(*, mgnl:asset) order by jcr:content/@size descending
      

      It's actualy way to much for me to implement a workaround, but it would be a nice improvement for the DAM App to have such a column.

      For all that people who have actualy the same issue. Here is a little groovy script what you can use to get a csv for the biggest files in your repo.

      hm = ctx.getHierarchyManager("dam")
        
      query = hm.getQueryManager().createQuery("/jcr:root//element(*, mgnl:asset) order by jcr:content/@size descending", "xpath")
      result = query.execute()
      contentCollection = result.getContent("mgnl:asset")
      println "path,size"
        
      contentCollection.each { c ->
      if (c.getJCRNode().hasNode('jcr:content')) {
        println "${c.handle},${PropertyUtil.getLong(c.getJCRNode().getNode('jcr:content'), 'size')}"
      }
      }
      

        Acceptance criteria

              Unassigned Unassigned
              marvink2 Marvin Kerkhoff
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD