Implement the new Resources app (MGNLRES-140)

[MGNLRES-160] Create Publish and Unpublish actions Created: 29/May/15  Updated: 29/Jun/15  Resolved: 23/Jun/15

Status: Closed
Project: Magnolia Resources Module
Component/s: app
Affects Version/s: None
Fix Version/s: 2.4

Type: Sub-task Priority: Neutral
Reporter: Ilgun Ilgun Assignee: Ilgun Ilgun
Resolution: Fixed Votes: 0
Labels: platform-cell
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Date of First Response:
Sprint: 5.4 Sprint 4
Team: Nucleus

 Description   

Publish action has to publish the ancestor's of a given node. E.g /foo/bar.txt will publish foo as well.
However, Unpublish action should just unpublish the given node E.g /foo/bar.txt will just unpublish bar.



 Comments   
Comment by Aleksandr Pchelintcev [ 05/Jun/15 ]

These actions are not gonna work with the new Resources app out of the box since they rely on the published items to be {{JcrNodeAdapter}}s.

Comment by Ilgun Ilgun [ 09/Jun/15 ]

Changes can be found in: feature/hotfix-activation-actions

Comment by Aleksandr Pchelintcev [ 23/Jun/15 ]
  • HotfixActivationAction:
    • import org.apache.commons.codec.binary.StringUtils; - that's not the StringUtils you're looking for, org.apache.commons.lang3.StringUtils your friend is =)
    • JavaDoc Explain a bit the principles:
      • relation with the ActivationAction,
      • node preparation principle etc.
      • structure of the incoming item (what name/kind of properties to expect in there)
    • resourceHandle.getValue().toString() -> resourceHandle.getString()
    • publishParentNodes() should not be called from the c-tor, there's an execute() method for that
    • definition.setRecursive(true); - potentially problematic call, since the action definition is kind of a singleton, so we shouldn't modify those like that, consider using wrappers/delegate definitions for the delegate actions
    • "resourceHandle" - could it be a constant?
  • IsNotDeletedRule:
    • JavaDoc:
      • 'the item' -> the passed {@ link ResourcePath}

        ?

      • embrace JcrOrigin into {@ link}
      • mgnl:deleted - {@ code}

        ?

  • IsPublishedRule:
    • JavaDoc - same, introduce links where possible, be specific about the item type.
    • extract LayeredResourcePath cast into a local var
    • String resourcePath -> resourceHandle, itemId -> resourcePath
    • use 'final'for local vars
  • HotfixActivationActionTest:
    • Unnecessary casts to Booleans (e.g. context.getAttribute( etc)
    • All setImplementation(..) calls seem to be unnecessary
    • If you're dealing w/ RepoTestCase (which provides real jcr stuff), why you'd need mock sessions, maybe consider MgnlTestCase?
    • You instantiate MockContext, but the super class already prepares one - maybe re-use it?
Comment by Ilgun Ilgun [ 23/Jun/15 ]

Made the necessary changes regarding the review.

Comment by Aleksandr Pchelintcev [ 23/Jun/15 ]

HotfixActivationAction:

  • Why re-use onPreExecute() method? - that is not the logical place where the activation should be triggered, there is an execute() method that invokes the activation of the items
  • Check info.magnolia.ui.framework.action.AbstractMultiItemAction#getItems - I think that it would be more subtle and correct to override that method and leave the rest of the action as is
  • check the JavaDoc
    • still mentions non-existent publishParentNodes method,
    • "allows to activate/deactivate a hotfix" -> "allows to publish/un-publish a hotfixed version of a resource
    • * {@link ActivationAction}

      . - should be removed since current class extends ActivationAction.

IsPublishedrule:

  • JavaDoc
    • use link for info.magnolia.jcr.util.NodeTypes.Activatable#ACTIVATION_STATUS_NOT_ACTIVATED
Comment by Ilgun Ilgun [ 23/Jun/15 ]

Made necessary changes regarding review.

Generated at Mon Feb 12 06:47:59 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.