Tabnine Logo
TypeEditor.getEffective
Code IndexAdd Tabnine to your IDE (free)

How to use
getEffective
method
in
org.apache.jackrabbit.oak.plugins.nodetype.TypeEditor

Best Java code snippets using org.apache.jackrabbit.oak.plugins.nodetype.TypeEditor.getEffective (Showing top 6 results out of 315)

origin: org.apache.jackrabbit/oak-core

private void checkNodeTypeConstraints(NodeState after) throws CommitFailedException {
  EffectiveType effective = getEffective();
  Set<String> properties = effective.getMandatoryProperties();
  for (PropertyState ps : after.getProperties()) {
    properties.remove(ps.getName());
    checkPropertyTypeConstraints(ps);
  }
  // verify the presence of all mandatory items
  if (!properties.isEmpty()) {
    constraintViolation(21, "Mandatory property " + properties.iterator().next() + " not found in a new node");
  }
  List<String> names = Lists.newArrayList(after.getChildNodeNames());
  for (String child : effective.getMandatoryChildNodes()) {
    if (!names.remove(child)) {
      constraintViolation(25, "Mandatory child node " + child + " not found in a new node");
    }
  }
  if (!names.isEmpty()) {
    for (String name : names) {
      NodeState child = after.getChildNode(name);
      String primary = child.getName(JCR_PRIMARYTYPE);
      Iterable<String> mixins = child.getNames(JCR_MIXINTYPES);
      NodeBuilder childBuilder = builder.getChildNode(name);
      TypeEditor editor = new TypeEditor(this, name, primary, mixins, childBuilder, false);
      if (!effective.isValidChildNode(name, editor.getEffective())) {
        constraintViolation(25, "Unexpected child node " + name + " found in a new node");
      }
    }
  }
}
origin: apache/jackrabbit-oak

private void checkNodeTypeConstraints(NodeState after) throws CommitFailedException {
  EffectiveType effective = getEffective();
  Set<String> properties = effective.getMandatoryProperties();
  for (PropertyState ps : after.getProperties()) {
    properties.remove(ps.getName());
    checkPropertyTypeConstraints(ps);
  }
  // verify the presence of all mandatory items
  if (!properties.isEmpty()) {
    constraintViolation(21, "Mandatory property " + properties.iterator().next() + " not found in a new node");
  }
  List<String> names = Lists.newArrayList(after.getChildNodeNames());
  for (String child : effective.getMandatoryChildNodes()) {
    if (!names.remove(child)) {
      constraintViolation(25, "Mandatory child node " + child + " not found in a new node");
    }
  }
  if (!names.isEmpty()) {
    for (String name : names) {
      NodeState child = after.getChildNode(name);
      String primary = child.getName(JCR_PRIMARYTYPE);
      Iterable<String> mixins = child.getNames(JCR_MIXINTYPES);
      NodeBuilder childBuilder = builder.getChildNode(name);
      TypeEditor editor = new TypeEditor(this, name, primary, mixins, childBuilder, false);
      if (!effective.isValidChildNode(name, editor.getEffective())) {
        constraintViolation(25, "Unexpected child node " + name + " found in a new node");
      }
    }
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

private void checkNodeTypeConstraints(NodeState after) throws CommitFailedException {
  EffectiveType effective = getEffective();
  Set<String> properties = effective.getMandatoryProperties();
  for (PropertyState ps : after.getProperties()) {
    properties.remove(ps.getName());
    checkPropertyTypeConstraints(ps);
  }
  // verify the presence of all mandatory items
  if (!properties.isEmpty()) {
    constraintViolation(21, "Mandatory property " + properties.iterator().next() + " not found in a new node");
  }
  List<String> names = Lists.newArrayList(after.getChildNodeNames());
  for (String child : effective.getMandatoryChildNodes()) {
    if (!names.remove(child)) {
      constraintViolation(25, "Mandatory child node " + child + " not found in a new node");
    }
  }
  if (!names.isEmpty()) {
    for (String name : names) {
      NodeState child = after.getChildNode(name);
      String primary = child.getName(JCR_PRIMARYTYPE);
      Iterable<String> mixins = child.getNames(JCR_MIXINTYPES);
      NodeBuilder childBuilder = builder.getChildNode(name);
      TypeEditor editor = new TypeEditor(this, name, primary, mixins, childBuilder, false);
      if (!effective.isValidChildNode(name, editor.getEffective())) {
        constraintViolation(25, "Unexpected child node " + name + " found in a new node");
      }
    }
  }
}
origin: org.apache.jackrabbit/oak-core

@Override
public TypeEditor childNodeChanged(
    String name, NodeState before, NodeState after)
    throws CommitFailedException {
  String primary = after.getName(JCR_PRIMARYTYPE);
  Iterable<String> mixins = after.getNames(JCR_MIXINTYPES);
  if (primary == null && effective != null) {
    // no primary type defined, find and apply a default type
    primary = effective.getDefaultType(name);
    if (primary != null) {
      builder.setProperty(JCR_PRIMARYTYPE, primary, NAME);
    } else {
      constraintViolation(
          4, "No default primary type available "
          + " for child node " + name);
    }
  }
  // if node type didn't change no need to validate child node
  boolean validate = primaryChanged(before, primary) || mixinsChanged(before, mixins);
  NodeBuilder childBuilder = builder.getChildNode(name);
  TypeEditor editor = new TypeEditor(this, name, primary, mixins, childBuilder, validate);
  if (checkThisNode && validate && !effective.isValidChildNode(name, editor.getEffective())) {
    constraintViolation(
        1, "No matching definition found for child node " + name
        + " with effective type " + editor.getEffective());
  }
  return editor;
}
origin: apache/jackrabbit-oak

@Override
public TypeEditor childNodeChanged(
    String name, NodeState before, NodeState after)
    throws CommitFailedException {
  String primary = after.getName(JCR_PRIMARYTYPE);
  Iterable<String> mixins = after.getNames(JCR_MIXINTYPES);
  if (primary == null && effective != null) {
    // no primary type defined, find and apply a default type
    primary = effective.getDefaultType(name);
    if (primary != null) {
      builder.setProperty(JCR_PRIMARYTYPE, primary, NAME);
    } else {
      constraintViolation(
          4, "No default primary type available "
          + " for child node " + name);
    }
  }
  // if node type didn't change no need to validate child node
  boolean validate = primaryChanged(before, primary) || mixinsChanged(before, mixins);
  NodeBuilder childBuilder = builder.getChildNode(name);
  TypeEditor editor = new TypeEditor(this, name, primary, mixins, childBuilder, validate);
  if (checkThisNode && validate && !effective.isValidChildNode(name, editor.getEffective())) {
    constraintViolation(
        1, "No matching definition found for child node " + name
        + " with effective type " + editor.getEffective());
  }
  return editor;
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public TypeEditor childNodeChanged(
    String name, NodeState before, NodeState after)
    throws CommitFailedException {
  String primary = after.getName(JCR_PRIMARYTYPE);
  Iterable<String> mixins = after.getNames(JCR_MIXINTYPES);
  if (primary == null && effective != null) {
    // no primary type defined, find and apply a default type
    primary = effective.getDefaultType(name);
    if (primary != null) {
      builder.setProperty(JCR_PRIMARYTYPE, primary, NAME);
    } else {
      constraintViolation(
          4, "No default primary type available "
          + " for child node " + name);
    }
  }
  // if node type didn't change no need to validate child node
  boolean validate = primaryChanged(before, primary) || mixinsChanged(before, mixins);
  NodeBuilder childBuilder = builder.getChildNode(name);
  TypeEditor editor = new TypeEditor(this, name, primary, mixins, childBuilder, validate);
  if (checkThisNode && validate && !effective.isValidChildNode(name, editor.getEffective())) {
    constraintViolation(
        1, "No matching definition found for child node " + name
        + " with effective type " + editor.getEffective());
  }
  return editor;
}
org.apache.jackrabbit.oak.plugins.nodetypeTypeEditorgetEffective

Popular methods of TypeEditor

  • <init>
  • checkNodeTypeConstraints
  • checkPropertyTypeConstraints
  • checkRequiredType
  • checkValueConstraints
  • childNodeChanged
  • constraintViolation
    Throws or logs the specified constraint violation.
  • createEffectiveType
  • getPath
  • getRequiredType
  • mixinsChanged
  • primaryChanged
  • mixinsChanged,
  • primaryChanged,
  • propertyChanged,
  • childNodeDeleted,
  • create,
  • propertyDeleted

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • JLabel (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now