logical pc_SDB_Reference :: Check (ErrorProtocol *protocol, PropertyHandle *str_ph, PropertyHandle *cs_ph, logical base_opt )
{
  PropertyHandle   *ddetype  = GPH("ddetype");
  PropertyHandle   *ddegent  = GPH("ddegent");
  TypeKey           tkey;
  logical           term     = NO;
  protocol->SetErrorVariable(2,GPH("sys_ident")->GetString(),0);

  SetProperty("reference_level","RL_direct",protocol,"auto-correkt for generation!");

  if ( !CheckType(protocol,str_ph,cs_ph) )
    GetTypeKey(tkey);
  else
    term = YES;
    
  if ( *ddegent == "PI" )
  {
    SetProperty("ddeatyp","AT_ODABA",protocol,"required for generic type PI");
    if ( *ddetype == "MEMO" )
      SetProperty("ddedim","1",protocol,"required for type MEMO");
  }
  
  pc_SDB_Index   index_pc(GPH("ddeindx"));
  if ( index_pc.GetCount() > 1 )
    SetProperty("multikey","Y",protocol,"required for more than one index");
    
  if ( !tkey.IsEmpty() )
    if ( index_pc.CheckAll(protocol,str_ph,tkey) )
      term = YES;
  return(term);
}
logical pc_SDB_Relationship :: Check (ErrorProtocol *protocol, PropertyHandle *str_ph, PropertyHandle *cs_ph, PropertyHandle *ext_ph, logical base_opt )
{
  PropertyHandle  *ddetype  = GPH("ddetype");
  PropertyHandle  *ddeinv   = GPH("ddeinv");
  PropertyHandle  *ddeext   = GPH("ddeext");
  PropertyHandle  *ddesecr  = GPH("ddesecr");
  PropertyHandle  *str_rshp = NULL;
  PropertyHandle  *str_base = NULL;
  PropertyHandle  *inv_ph   = NULL;
  TypeKey          tkey;
  logical          term         = NO;
BEGINSEQ
  protocol->SetErrorVariable(2,GPH("sys_ident")->GetString(),0);

  term = pc_SDB_Reference::Check(protocol,str_ph,cs_ph,base_opt);
  GetTypeKey(tkey);

  if ( CheckExtend(protocol,str_ph,ext_ph,NULL) )
    term = YES;
    
  if ( !GPH("ddeext")->IsEmpty() )
    SetProperty("owning","N",protocol,"required when base extent");
  
  if ( !ddeinv->IsEmpty() )
  {
    if ( !str_ph->Get(tkey.GetKey()) )
    {
      if ( !term )
        protocol->Write(140,0);
      ERROR
    } 
    if ( GPH("week_typed")->IsTrue() && *ddetype == *GetParentProperty()->GPH("sys_ident") )
                                                     LEAVESEQ
    str_rshp = str_ph->GPH("smcershp");
    str_base = str_ph->GPH("smcebase");
    
    if ( str_rshp->Get(*ddeinv) )
      inv_ph = str_rshp;
    else
    {
      if ( !str_base->Get(*ddeinv) )
      {
        protocol->Write(191,0,NULL,NULL,GetScopedType(),ddeinv->GetString());
        ERROR
      }
      else if ( base_opt )
      {
        protocol->Write(195,0,NULL,NULL,GetScopedType(),ddeinv->GetString());
        ERROR
      }
      inv_ph = str_base;
    }
Example #3
0
template<> void Entity::Add<Task>(Task *t)
{
	if(!t)
		throw std::invalid_argument("null task");
	//TODO if(e->parent)
	if(t->parent)
	{
		loadngo::base::Remove(t->parent->children, static_cast<Entity *>(t));
		if(t->parent->GetTypeKey() == Task::key)
		{
			dynamic_cast<Task *>(t->parent)->Fire(Task::Notification::TASK_CHILD_REMOVED);
		}
	}
	children.push_back(t);
	t->parent = this;
	if(GetTypeKey() == Task::key)
		dynamic_cast<Task *>(this)->Fire(Task::Notification::TASK_CHILD_ADDED);
	t->Fire(Task::Notification::TASK_CHANGED);
}