bambou/session.go
func (s *Session) AssignChildren(parent Identifiable, children []Identifiable, identity Identity) *Error {

	url, berr := s.getURLForChildrenIdentity(parent, identity)
	if berr != nil {
		return berr
	}

	var ids []string
	for _, c := range children {

		if i := c.Identifier(); i != "" {
			ids = append(ids, c.Identifier())
		} else {
			return NewBambouError("VSD Error", "One of the object to assign has no ID")
		}
	}

	buffer := &bytes.Buffer{}
	json.NewEncoder(buffer).Encode(ids)

	request, err := http.NewRequest("PUT", url, buffer)
	if err != nil {
		return NewBambouError("HTTP transaction error", err.Error())
	}

	response, berr := s.send(request, nil)
	if berr != nil {
		return berr
	}
	defer response.Body.Close()

	return nil
}
func (s *Session) AssignChildren(parent Identifiable, children []Identifiable, identity Identity) *Error {

	url, berr := s.getURLForChildrenIdentity(parent, identity)
	if berr != nil {
		return berr
	}

	var ids []string
	for _, c := range children {

		if i := c.Identifier(); i != "" {
			ids = append(ids, c.Identifier())
		} else {
			return NewBambouError("VSD Error", "One of the object to assign has no ID")
		}
	}

	buffer := &bytes.Buffer{}
	json.NewEncoder(buffer).Encode(ids)

	request, err := http.NewRequest("PUT", url, buffer)
	if err != nil {
		return NewBambouError("HTTP transaction error", err.Error())
	}

	response, berr := s.send(request, nil)
	if berr != nil {
		return berr
	}
	defer response.Body.Close()

	return nil
}
func ( s * Session ) AssignChildren ( parent Identifiable , children [ ] Identifiable , identity Identity ) * Error { url , berr := s . getURLForChildrenIdentity ( parent , identity ) if berr != nil { return berr } var ids [ ] string for _ , c := range children { if i := c . Identifier ( ) ; i != " " { ids = append ( ids , c . Identifier ( ) ) } else { return NewBambouError ( " " , " " ) } } buffer := & bytes . Buffer { } json . NewEncoder ( buffer ) . Encode ( ids ) request , err := http . NewRequest ( " " , url , buffer ) if err != nil { return NewBambouError ( " " , err . Error ( ) ) } response , berr := s . send ( request , nil ) if berr != nil { return berr } defer response . Body . Close ( ) return nil }
// AssignChildren assigns the list of given child Identifiables to the given Identifiable parent in the server.
AssignChildren assigns the list of given child Identifiables to the given Identifiable parent in the server .