All Downloads are FREE. Search and download functionalities are using the official Maven repository.

odeling.org.kevoree.modeling.kotlin.generator.1.9.8.source-code.DefaultFactory.vm Maven / Gradle / Ivy

#* @vtlvariable name="packageName" type="java.lang.String" *#
#* @vtlvariable name="formatedFactoryName" type="java.lang.String" *#
#* @vtlvariable name="modelVersion" type="java.lang.String" *#
#* @vtlvariable name="js" type="java.lang.Boolean" *#
#* @vtlvariable name="classes" type="java.util.List" *#
#* @vtlvariable name="ctx" type="org.kevoree.modeling.kotlin.generator.GenerationContext" *#
#* @vtlvariable name="helper" type="org.kevoree.modeling.kotlin.generator.ProcessorHelperClass" *#

package ${packageName}.impl;

#foreach( $class in $classes )
import ${packageName}.${class.getName()};
#end

import ${packageName}.${formatedFactoryName};

#if(!$js)open#end class Default${formatedFactoryName} : ${formatedFactoryName} {

override fun getVersion() : String { return "${modelVersion}" }

#if($ctx.persistence)
override val elem_cache: java.util.HashMap = java.util.HashMap()
#end

#foreach( $class in $classes )
override fun create${class.getName()}() : ${class.getName()} {
val tempElem = ${class.getName()}Impl()
    #if($ctx.persistence)
initObject(tempElem)
    #end
return tempElem
}
#end

override fun create(metaClassName : String) : ${ctx.kevoreeContainer}? {
when(metaClassName){
#foreach( $class in $classes )
    ${helper.fqn($ctx,$ctx.getBasePackageForUtilitiesGeneration())}.util.Constants.${helper.fqn($ctx,$class).replace(".","_")} -> { return create${class.getName()}() }
    ${helper.fqn($ctx,$ctx.getBasePackageForUtilitiesGeneration())}.util.Constants.CN_$class.getName() -> { return create${class.getName()}() }

#end            else -> {return null;}
}
}

#if($ctx.persistence)

    override var datastore: org.kevoree.modeling.api.persistence.DataStore? = null

    override var compare: org.kevoree.modeling.api.compare.ModelCompare = ${packageName}.compare.DefaultModelCompare()

    protected fun initObject(elem : org.kevoree.modeling.api.time.TimeAwareKMFContainer){
    #if($ctx.timeAware)
        if(relativityStrategy == org.kevoree.modeling.api.time.RelativeTimeStrategy.LATEST){
            elem.now = org.kevoree.modeling.api.time.TimePoint(java.util.Date().getTime(),0);
        } else {
            elem.now = relativeTime;
        }
        #end
        elem.originFactory = this
    }

#end

#if($ctx.timeAware)
override var relativeTime: org.kevoree.modeling.api.time.TimePoint = org.kevoree.modeling.api.time.TimePoint(java.util.Date().getTime(),0)
override var queryMap: MutableMap = java.util.HashMap()
override var relativityStrategy: org.kevoree.modeling.api.time.RelativeTimeStrategy = org.kevoree.modeling.api.time.RelativeTimeStrategy.RELATIVE


#end


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy