(*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 *)

(*
   Derived from ISO TC184/SC4/WG12 N - ISO/CD-TS 10303-xxxx Design management - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Design_management_xim;

USE FROM Approval_xim;

USE FROM Work_order_xim;

USE FROM Product_view_definition_xim;

USE FROM Design_management_mim;

    TYPE dm_approval_item_armx = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON approval_item WITH
   		(Frozen_assignment_armx);
    END_TYPE;

    TYPE managed_design_object_armx = EXTENSIBLE GENERIC_ENTITY SELECT
    	(Product_view_definition);    
    END_TYPE;

  	ENTITY Add_design_object_management_relationship
      (* CONNOTATIONAL *) SUBTYPE OF (Design_object_management_relationship);
    	current_design_object : managed_design_object_armx;
      DERIVE
    	SELF\Activity.name : label := '';
      UNIQUE
        UR1 : current_design_object;
      WHERE
        WR1 : EXISTS(SELF\Activity.name);      
	END_ENTITY;

  	ENTITY Change_design_object_management_relationship
      (* CONNOTATIONAL *) SUBTYPE OF (Design_object_management_relationship);
    		current_design_object  : managed_design_object_armx;
      	previous_design_object : OPTIONAL managed_design_object_armx;
      	attribute_name : OPTIONAL STRING;
      DERIVE
    	SELF\Activity.name : label := '';
      WHERE
      	WR1: TYPEOF(current_design_object) = TYPEOF(previous_design_object);
       	WR2: current_design_object <> previous_design_object;
       	WR3 : EXISTS(SELF\Activity.name);
  	END_ENTITY;

  	ENTITY Delete_design_object_management_relationship
      (* CONNOTATIONAL *) SUBTYPE OF (Design_object_management_relationship);
      	previous_design_object : managed_design_object_armx;
      DERIVE
    	SELF\Activity.name : label := '';
      UNIQUE
      	UR1 : previous_design_object;
      WHERE
        WR1 : EXISTS(SELF\Activity.name);
  	END_ENTITY;

  	ENTITY Design_object_management_relationship
   	  ABSTRACT SUPERTYPE OF (ONEOF
		(Change_design_object_management_relationship,
       	Delete_design_object_management_relationship,
		Add_design_object_management_relationship)ANDOR
		(View_dependent_design_object_management_relationship))
      (* CONNOTATIONAL *) SUBTYPE OF (Activity, design_object_management_relationship_action);
  	END_ENTITY;


  	ENTITY Frozen_assignment_armx
  		(* CONNOTATIONAL *) SUBTYPE OF (frozen_assignment);
    	SELF\frozen_assignment.items RENAMED frozen_item       : SET[1:?] OF managed_design_object_armx;
		(** Need a global rule to capture cardinality
	      assigned_approval : Approval;
		*)
      DERIVE
        SELF\approval_assignment.assigned_approval : approval := ?;
  	END_ENTITY;

  	ENTITY View_dependent_design_object_management_relationship
      (* CONNOTATIONAL *) SUBTYPE OF (Design_object_management_relationship);
      	previous_design : Product_view_definition;
      	current_design  : Product_view_definition;
      DERIVE
    	SELF\Activity.name : label := '';
      WHERE
        WR1 : EXISTS(SELF\Activity.name);
  	END_ENTITY;

END_SCHEMA;

