Class NodeDO

All Implemented Interfaces:
IBaseDO<Node>

public class NodeDO extends AbstractHrcEntityDO<Node>
  • Constructor Details

    • NodeDO

      public NodeDO()
  • Method Details

    • insert

      public Node insert(Node node) throws ApplicationException
      Overrides:
      insert in class AbstractComplexEntityDO<Node>
      Throws:
      ApplicationException
    • save

      public Node save(Node node, DataMap dataMap) throws ApplicationException
      Description copied from interface: IBaseDO
      map data to entity if any, validate and save
      Specified by:
      save in interface IBaseDO<Node>
      Overrides:
      save in class AbstractEntityBaseDO<Node>
      Parameters:
      node - mandatory
      dataMap - optional
      Returns:
      mapped entity
      Throws:
      ApplicationException
    • edit

      public Node edit(Node node) throws ApplicationException
      Overrides:
      edit in class AbstractComplexEntityDO<Node>
      Throws:
      ApplicationException
    • validator

      public mc.core.domain.generic.dobj.NodeDO.NodeValidator validator(Node node, DataMap map) throws ApplicationException
      Description copied from class: AbstractBaseDO
      for persistent entity copy constructor be used, the copy of entity be mapped and validated
      WARNING: in error case param map be changed! non valid fields be deleted from it
      all error be collect as ValidationResults in ValidationException and throw only by validate() call
      Examples to use:
      1. validator( navigationHrc, dataMap).thatValidField( NavigationHrc.Field.navigationHrcType).validate(); 2. validator( navigation, dataMap).thatValidField( Navigation.Field.navigationType, Navigation.Field.navigationHrc) .thatNotNullIf( HrcEntity.Field.parent, n -> n.getNavigationType().getParentNavigationType() != null).validate(); 3. validator( entity, dataMap).thatValidField( Country.Field.iso2Code, "message.validate.Country.iso2Code.missing").thatUnique( Country.Field.iso2Code).validate();
      Overrides:
      validator in class AbstractBaseDO<Node>
      Parameters:
      node - mandatory
      map - optional
      Returns:
      the validator
      Throws:
      ApplicationException - the application exception
    • delete

      public void delete(Node node, boolean force) throws ApplicationException
      Description copied from class: AbstractBaseDO
      NOTE: when overriding this method and you delete any other objects you need to call validateNotUsed before in case flag force is false!
      Overrides:
      delete in class AbstractComplexEntityDO<Node>
      Parameters:
      node - mandatory
      force - if true delete without usage check, which can result in db constraints error unless references are taken care of
      Throws:
      ApplicationException
    • delete

      public void delete(List<Node> nodes, boolean force) throws ApplicationException
      Delete node list
      Parameters:
      nodes -
      Throws:
      ApplicationException
    • deleteSync

      public void deleteSync(Node entity) throws ApplicationException
      called from actionlet for final delete
      Throws:
      ApplicationException
    • copy

      public Node copy(Node source, Node parentForCopy) throws ApplicationException
      Creates a deep copy of given Node, i.e. copies also all offspring. Also copies classification assignments for each Node. For large hierarchical trees the copying can take substantial time. Subclass of Node passed to this method must implement a constructor that takes as sole argument an instance of this class, otherwise an ApplicationException is thrown. The copy constructor should set all properties that must be copied but not the dependent objects such as entityToAttributes.
      Overrides:
      copy in class AbstractHrcEntityDO<Node>
      Parameters:
      source - Node, mandatory
      parentForCopy - Node, mandatory if hierarchy level of source demands a parent. Gives the parent to which copied object should belong. parentForCopy must be of same type as parent of source if the levels of the hierarchy are differentiated by type.
      Returns:
      copy
      Throws:
      ApplicationException
    • copy

      public Node copy(Node source, Node parentForCopy, NodeCopyFilter copyFilter) throws ApplicationException
      Creates a deep copy of given Node, i.e. copies also all offspring. Also copies classification assignments for each Node. For large hierarchical trees the copying can take substantial time. Subclass of Node passed to this method must implement a constructor that takes as sole argument an instance of this class, otherwise an ApplicationException is thrown. The copy constructor should set all properties that must be copied but not the dependent objects such as entityToAttributes.
      Parameters:
      source - Node, mandatory
      parentForCopy - Node, mandatory if hierarchy level of source demands a parent. Gives the parent to which copied object should belong. parentForCopy must be of same type as parent of source if the levels of the hierarchy are differentiated by type.
      copyFilter - copy flags, optional. if CopyFilter.addNamePostfix(boolean) is true postfix copy be added to name in all locales in AbstractEntityBaseDO#setCopyNamePostfix()
      Returns:
      copy
      Throws:
      ApplicationException
    • addClassification

      public ClassificationToNode addClassification(Node node, Classification classification) throws ApplicationException
      Throws:
      ApplicationException
    • removeClassification

      public void removeClassification(Node node, Classification classification, boolean removeClassificationAttributes) throws ApplicationException
      Throws:
      ApplicationException
    • changeOrderOfClassification

      public void changeOrderOfClassification(Node node, Classification classification, int targetPosition) throws UserException
      Throws:
      UserException
    • move

      public Node move(Node node, Node parentNode) throws ApplicationException
      Throws:
      ApplicationException
    • preview

      public void preview(Node node, String format, String templateName, OutputStream os) throws ApplicationException
      Throws:
      ApplicationException
    • getAttributesOfClassification

      public List<IAttributeAssignment> getAttributesOfClassification(Node node, Classification selectedClassification)
      loads all attributes of classification(s) and their classification parents this node is assigned to including inheritable attributes of classifications that are assigned to parents of the node.
      Parameters:
      node - mandatory
      selectedClassification - optional, if given only returns attributes of classification and their parents to which node is assigned. By default returns all attributes of all classification classes, filter duplicate attributes.
    • getAttributesOfClassification

      public Map<Node,List<IAttributeAssignment>> getAttributesOfClassification(List<Node> nodes, Classification selectedClassification)
      loads all attributes of classification(s) and their classification parents given nodes are assigned to, including inheritable attributes of classifications that are assigned to parents of nodes.
      Parameters:
      nodes - mandatory
      selectedClassification - optional, if given only returns attributes of classification and their parents to which node is assigned. By default returns all attributes of all classification classes, filter duplicate attributes
    • getAttributeValuesOfClassification

      public AttributeValues getAttributeValuesOfClassification(Node node, Classification classification)
      Parameters:
      node - mandatory
      classification - mandatory
      Returns:
      AttributeValues for all assigned attributes of given classification, ordered by prio of assignment. If node has no attribute value of a given attribute an empty AttributeValue is inserted in list. All AttributeValues have mandatory-flag and standardvalues-filter set.