2Pack/Defer

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Introduction

  • You can follow the background on this from 2Pack/Reference.
  • This method exist in different forms in the pipoHandlers module. In this case below it is taken from MenuElementHandler.
  • Its purpose is to detect sub references and defer the creation of the table in AD until that sub reference has been created first.
List<String> notFounds = filler.autoFill(excludes);
if (notFounds.size() > 0) {
	element.defer = true;
	return;
}

Defer Process

  • Each ElementHandler will flag the defer value when it detects a missing reference ID in its downline.
  • During debugging, this did happened.
  • Thus at the final PackInHandler end-tag, the processDeferElements() routine is called:
   public void endElement (String uri, String localName, String qName) throws SAXException {
    	// Check namespace.

    	String elementValue = null;
    	if ("".equals (uri))
    		elementValue = qName;
    	else
    		elementValue = uri + localName;

    	if (elementValue.equals("adempiereAD")){
    		 processDeferElements();
  • The processDeferElements() then went through without getting defer.isEmpty()
    private void processDeferElements() throws SAXException {

    	if (defer.isEmpty()) return;

    	do {
    		int startSize = defer.size();
    		List<DeferEntry> tmp = new ArrayList<DeferEntry>(defer);
    		defer.clear();
    		for (DeferEntry d : tmp) {
    			if (d.startElement) {
	    			d.element.defer = false;
	    			d.element.unresolved = "";
	    			d.element.pass++;
    			} else {
    				if (d.element.deferEnd) {
    					d.element.deferEnd = false;
    	    			d.element.unresolved = "";
    				}
    			}
  • But yet the same issue persists.
  • We will have to dig from here to see why it did not call the elementHandler and create those deferred Elements.

See Also