Exemple #1
0
func (this *Table) GetLink(chain string, foreignKeys coll.Collection) *LinkNav {
	idx := strings.Index(chain, FK_NAV_SEP)
	var link Str
	if idx > 0 {
		link = Str(chain[:idx])
	} else {
		link = Str(chain)
	}

	// check columns
	o, _ := this.columnsMap.Get(link)
	c, _ := o.(*Column)

	if c != nil {
		return NewLinkNav(foreignKeys, c)
	}

	var fk *Association
	if this.associationMap != nil {
		o, _ = this.associationMap.Get(link)
		fk, _ = o.(*Association)
	}

	if fk != nil {
		if idx < 0 {
			foreignKeys.Add(fk)
			return NewLinkNav(foreignKeys, c)
		}
		return fk.GetLink(chain[idx+1:], this, foreignKeys)
	}
	return nil
}
Exemple #2
0
func (this *Association) GetLink(chain string, from *Table, foreignKeys coll.Collection) *LinkNav {
	// verifica as tabelas
	var table *Table
	if this.tableFrom.Equals(from) {
		table = this.tableTo
	} else {
		table = this.tableFrom
	}

	foreignKeys.Add(this)
	return table.GetLink(chain, foreignKeys)
}
Exemple #3
0
func (this *EntityTransformer) OnTransformation(result coll.Collection, instance interface{}) {
	if instance != nil {
		result.Add(instance)
	}
}
func (this *EntityTreeTransformer) OnTransformation(result coll.Collection, instance interface{}) {
	this.crawler.Rewind()
	if instance != nil && (!this.reuse || !result.Contains(instance)) {
		result.Add(instance)
	}
}