#**##parse( "jmi/default:storyPattern/object/import.vm" )
#**#
#**##set( $localVars = $engine.getFromInformation("localVars") )
#**##set( $package = $object.InstanceOf.DeclaredInPackage)
#**##if ( $createVar )
#*   *#	#set( $return = $localVars.addLocalVariable($name, $object.InstanceOf, $object) )
#**##end
#**#
#**#// create object
#**#
#**##if ( $optional )
#*   *#    if ($name == null)
#*   *#    {
#**##end
#**##set( $classOfLocalVar = $object.InstanceOf.Class.Name )
#**##if( $classOfLocalVar.equals("de.tu_darmstadt.fujaba.mof.adapter.FMAClass") )
#*   *#	##----- BEGIN MOF Facility specific
#*   *#	#set($isReference = "false")
#*   *#	#set($isFullJavaNameGiven = "false")
#*   *#	#set($isFullJMIReflectiveNameGiven = "false")
#*   *#	#set($isRepositoryKeyGiven = "false")
#*   *#	#set($tagCollection = $object.InstanceOf.Type.Adaptee.Tag)
#*   *#	#foreach($actualTag in $tagCollection)
#*      *#		#if($actualTag.Name.equals("stereotype") && $actualTag.value.equals("reference"))
#*         *#			#set($isReference = "true")
#*      *#		#elseif($actualTag.Name.equals("reference") && $isFullJavaNameGiven == "false")
#*         *#			#set($isFullJavaNameGiven = "true")
#*         *#			#set($fullJavaName = $actualTag.value)
#*      *#		#elseif($actualTag.Name.equals("repositoryKey") && $isRepositoryKeyGiven == "false")
#*         *#			#set($isRepositoryKeyGiven = "true")
#*         *#			#set($repositoryKey = $actualTag.value)
#*      *#		#elseif($actualTag.Name.equals("fullName") && $isFullJMIReflectiveNameGiven == "false")
#*         *#			#set($isFullJMIReflectiveNameGiven = "true")
#*         *#			#set($fullJMIReflectiveName = $actualTag.value)
#*      *#		#end
#*   *#	#end
#*   *#
#*   *#	#set( $naviPath = $mofutility.getNavigationPath($package) )
#*   *#	#if($naviPath && $isReference == "false")
#*      *#		##----- if a navigation path is available and the type is no reference, it must be a member of our own repository
#*      *#		#set( $accessOwnElementsThroughFacility = $mofutility.AccessOwnElementsThroughFacility )
#*      *#		#if( $accessOwnElementsThroughFacility )
#*         *#			##----- due to performance issues even elements of the same repository may be accessed via Facility
#*         *#			#set($facilityInstanceName = $mofutility.FacilityInstanceName)
#*         *#			#set($qualifiedName = $mofutility.getQualifiedName($object.InstanceOf))
#*         *#			#set($fullPackageName = $package.FullPackageName)
#*         *#			$name = ( $qualifiedName )( ${facilityInstanceName}.getInstance( refOutermostPackage(), "${fullPackageName}.${type}" ) );
#*      *#		#else
#*         *#			##----- normal access via JMI reflection
#*         *#			#set( $proxyInterfacePrefix = $mofutility.getProjectPreferencePropertyAsString("momoc.generator.class.proxyinterface.prefix"))
#*         *#			#set( $interfacePrefix = $mofutility.getProjectPreferencePropertyAsString("momoc.generator.class.interface.prefix") )  	 
#*         *#			#if ( $mofutility.nullIfEmpty($object.ReflectiveTypeExpr) )
#*            *#				## generic
#*            *#				## $name = de.uni_kassel.features.SDMReflectUtil.newInstance( ${type}.class, $object.runtimeVarName )
#*            *#				$name = ( $qualifiedName)${naviPath}.refClass($object.ReflectiveTypeExpr).refCreateInstance(null);
#*         *#			#else
#*            *#				## not generic
#*            *#				$name = ${naviPath}.get${proxyInterfacePrefix}${type}().create${interfacePrefix}${type}();
#*         *#			#end
#*      *#		#end
#*   *#	#else
#*      *#		##----- no navigation path is available, or it is a referenced type, so we must use a Facility
#*      *#		##----- this is, e.g., the case in a TGG rule when elements are created in the source and target domain
#*      *#		##----- in this case the type must have the following tags:
#*      *#		##----- "reference" contains the full qualified Java class name (e.g., "org.moflon.myMetamodel.prefixXsuffix"
#*      *#		##----- "fullName" contains the full qualified name of the type in the repository (e.g., "myMetamodel.X")
#*      *#		##----- "repositoryKey" identifies the repository in which the type is located (the key must be registered at the Facility)
#*      *#		#if($isFullJavaNameGiven == "false" || $isFullJMIReflectiveNameGiven == "false")
#*         *#			<specify tags 'reference' and 'fullName' in referenced type '${fullPackageName}.${type}' to get access to foreign repositories>
#*      *#		#else
#*         *#			#set( $facilityInstanceName = $mofutility.FacilityInstanceName )
#*         *#			#set( $fullPackageName = $package.FullPackageName )
#*         *#			#if($isRepositoryKeyGiven == "true")
#*            *#				$name = ( $fullJavaName )( ${facilityInstanceName}.getInstance( ${repositoryKey}, "${fullJMIReflectiveName}" ) );
#*         *#			#else
#*            *#				// try to locate type of instance in any registered repository
#*            *#				$name = ( $fullJavaName )( ${facilityInstanceName}.getInstance( null, "${fullJMIReflectiveName}" ) );
#*         *#			#end
#*      *#		#end
#*   *#	#end
#*   *#	##----- END MOF Facility specific
#**##end
#**###--------------------
#**##if ( $optional )
#*   *#    }
#**##end
