Пример #1
0
bool wb_session::deleteFamily(wb_object o, bool storeix)
{
  if (isReadonly())
    throw wb_error_str("ReadOnlySession");

  if (!isLocal(o)) {
    m_sts = LDH__OTHERVOLUME;
    return false;
  }

  pwr_tStatus sts;
  wb_object parent = o.parent();
  sts = triggAnteUnadopt(parent, o);

  ldh_sEvent* ep = m_srep->eventStart(o.oid(), ldh_eEvent_ObjectDeleted);
  m_srep->eventOldFamily(ep, o);

  sts = triggPostUnadopt(parent, o);

  if (storeix)
    m_srep->recix_add(o);
  bool rsts = m_vrep->deleteFamily(&m_sts, (wb_orep*)o);
  m_srep->update();
  m_srep->eventSend(ep);
  return rsts;
}
Пример #2
0
pwr_tStatus wb_volume::triggPostMove(wb_object& o)
{
  pwr_tStatus sts;
  char *methodName;
  wb_tMethod method;
  
  wb_cdrep *cdrep = m_vrep->merep()->cdrep(&sts, o.cid());
  if (EVEN(sts)) return sts;

  cdrep->dbCallBack(&sts, ldh_eDbCallBack_PostMove, &methodName, 0);
  delete cdrep;
  if (EVEN(sts)) return LDH__SUCCESS;

  m_vrep->erep()->method(&sts, methodName, &method);
  if (EVEN(sts)) return LDH__SUCCESS;

  wb_object father = o.parent();
  if (father) {
    sts = ((wb_tMethodPostMove) (method))((ldh_tSesContext)this, o.oid(), father.oid(),
					   father.cid());
  }
  else
    sts = ((wb_tMethodPostMove) (method))((ldh_tSesContext)this, o.oid(), pwr_cNObjid,
					   pwr_cNClassId);
  return sts;
}
Пример #3
0
pwr_tStatus wb_volume::triggPostCreate(wb_object& o)
{
  pwr_tStatus sts;
  char *methodName;
  wb_tMethod method;
  
  // Call object method, or inherited method
  for ( wb_cdef cd = cdef(o.cid()); cd; cd = cd.super()) {
    wb_cdrep *cdrep = cd;
    
    cdrep->dbCallBack(&sts, ldh_eDbCallBack_PostCreate, &methodName, 0);

    if (ODD(sts)) {
      m_vrep->erep()->method(&sts, methodName, &method);
      if (EVEN(sts)) return LDH__SUCCESS;

      wb_object father = o.parent();
      if (father) {
	sts = ((wb_tMethodPostCreate) (method))((ldh_tSesContext)this, o.oid(), father.oid(),
						father.cid());
      }
      else
	sts = ((wb_tMethodPostCreate) (method))((ldh_tSesContext)this, o.oid(), pwr_cNObjid,
						pwr_cNClassId);
      return sts;
    }
  }

  return LDH__SUCCESS;
}
Пример #4
0
bool wb_session::moveObject(wb_object o, wb_destination d)
{
  if (isReadonly())
    throw wb_error_str("ReadOnlySession");

  validateDestination(d, o.cid());
  if (evenSts())
    return false;

  // Check that object is not ancestor to destination
  wb_object dest = object(d.oid());
  while (dest) {
    if (cdh_ObjidIsEqual(dest.oid(), o.oid()))
      throw wb_error(LDH__BADDEST);
    dest = dest.parent();
  }

  wb_object parent;
  switch (d.code()) {
  case ldh_eDest_IntoFirst:
  case ldh_eDest_IntoLast:
    parent = object(d.oid());
    break;
  case ldh_eDest_After:
  case ldh_eDest_Before:
    parent = object(d.oid()).parent();
    break;
  default:
    throw wb_error(LDH__NODEST);
  }

  wb_object old_parent = o.parent();
  m_sts = triggAnteMove(o, parent, old_parent);
  if (evenSts())
    return false;
  m_sts = triggAnteUnadopt(old_parent, o);
  if (evenSts())
    return false;
  m_sts = triggAnteAdopt(parent, o.cid());
  if (evenSts())
    return false;

  ldh_sEvent* ep = m_srep->eventStart(o.oid(), ldh_eEvent_ObjectMoved);
  m_srep->eventOldFamily(ep, o);

  bool rsts = m_vrep->moveObject(&m_sts, (wb_orep*)o, d);
  m_srep->update();

  triggPostMove(o);
  triggPostUnadopt(old_parent, o);
  triggPostAdopt(parent, o);

  m_srep->eventNewFamily(ep, o);
  m_srep->eventSend(ep);

  return rsts;
}
Пример #5
0
//
// printHierarchy
//
void wb_print_wbl::printHierarchy(wb_volume& v, wb_object& o)
{
  if (v.object() == o)
    indent(1) << "SObject " << v.name() << ":" << endl;
  else
    indent(1) << "SObject " << o.parent().longName() << endl;
  
  printObject(v, o);
  
  indent(-1) << "EndSObject" << endl;
}
Пример #6
0
bool wb_volume::isAncestor(wb_object& ancestor, wb_object& o)
{
  if (ancestor.oid().vid != o.oid().vid)
    return false;

  wb_object p = o.parent();
  while (p) {
    if (p.oid().oix == ancestor.oid().oix)
      return true;
    p = p.parent();
  }
  return false;
}
Пример #7
0
bool wb_recix::add_object_tree( wb_object &o) {

  clear();

  wb_object p = o.parent();
  if ( p)
    strcpy( m_srcroot, p.longName().c_str());

  add( o.longName().c_str(), o.oid().oix);
  for ( wb_object ch = o.first(); ch; ch = ch.after())
    add_object_ctree( ch);


  // for (  ix_iterator it = m_ix.begin(); it != m_ix.end(); it++) {
  //   cout << " Object: " << it->second << "  " << it->first << endl;
  // }  

  return true;
}
Пример #8
0
void wb_srep::eventOldFamily( ldh_sEvent *ep, wb_object o)
{

  if ( !m_thisSessionCb)
    return;

  if (ep == NULL)
    return;

  wb_object parent = o.parent();
  if ( parent)
    ep->OldParent = parent.oid();

  wb_object before = o.before();
  if ( before)
    ep->OldLsibling = before.oid();

  wb_object after = o.after();
  if ( after)
    ep->OldRsibling = after.oid();
}
Пример #9
0
void wb_srep::eventNewFamily( ldh_sEvent *ep, wb_object o)
{

  if ( !m_thisSessionCb)
    return;

  if ( !ep)
    return;

  wb_object parent = o.parent();
  if ( parent)
    ep->NewParent = parent.oid();

  wb_object before = o.before();
  if ( before)
    ep->NewLsibling = before.oid();

  wb_object after = o.after();
  if ( after)
    ep->NewRsibling = after.oid();
  
}