def setBusinessObjectsAsSerializable(package):
	for jclass in [ jclass for jclass in package.getOwnedElement(Class) if hasStereotype(jclass, 'Entity')]:
		stereoImplements = [it for it in getTagValues(jclass, 'JavaImplements') if 'Serializable' in it] 
		modelImplements = [ ir for ir in jclass.getRealized() if ir.getImplemented().getName() == 'Serializable' ]
		if not stereoImplements and not modelImplements:
			addTagValue(jclass, "JavaImport", "java.io.Serializable")
			addTagValue(jclass, "JavaImplements", "Serializable")
	for subPackage in package.getOwnedElement(Package):
		setBusinessObjectsAsSerializable(subPackage)
def makeTypeSerializable(jclass):
    if not hasTagValueSuch(jclass, "JavaImplements", lambda x : "Serializable" in x):
        addTagValue(jclass, "JavaImplements", "java.io.Serializable")
				if pend is not rend and pend.getProvider() and pend.getProvider().getProviding().getInternalOwner()]
	
    for (jclass, iface) in p:
		ifname = iface.getName()
		fjcname = getFullClassName(jclass)
		fifname = getFullInterfaceName(iface)	
		vname = applyToFirstLetter(ifname, unicode.lower)+"Impl"
    
		# TODO: update this attribute somehow
		jatts = [ x for x in program.getOwnedAttribute() if x.getName() == vname]
		if len(jatts)==0:
		   jatt = createAttribute(program, vname, iface, "")
		   jatt.setValue("new " + fifname + "() {}")
		   note = modelingSession.getModel().createNote("JavaDesigner", "JavaAnnotation", jatt, "@Provided")
		   note.setMimeType('text/plain')
		   addTagValue(program, "JavaImport", "org.modelio.juniper.platform.Provided")
		else:
		   jatt = jatts[0]

    storagePrograms = [ pend.getProvider().getProviding().getInternalOwner()
            for port in program.getInternalStructure()\
            for req in port.getRequired()\
            for rend in req.getNaryProvider()\
            for pend in rend.getNaryLink().getNaryLinkEnd()
                                       if pend is not rend and\
                                           pend.getProvider() and\
                                           pend.getProvider() and\
                                           pend.getProvider().getProviding().getInternalOwner() and\
                                           hasStereotype(pend.getProvider().getProviding().getInternalOwner(), 'JUNIPERStorageProgram')\
    ]
        title = name
    return applyToFirstLetter(title, unicode.lower)


def getJavaClassName(el):
    return applyToFirstLetter(getJavaMethodName(el), unicode.upper)

putStereotype(el, 'JavaPackage')

#if not hasTagValue(el, "JavaName"):
	#addTagValue(el, "JavaName", "juniperApplication")

jclass = createJavaClass(el, 'JuniperProgram')
jclass.setOwner(el)
#addTagValue(jclass, "JavaImport", "java.util.logging.Logger")
addTagValue(jclass, "JavaExtends", "org.modelio.juniper.platform.JuniperProgram")
#addTagValue(jclass, "JavaImport", "mpi.MPI")
#addTagValue(jclass, "JavaImport", "org.modelio.juniper.CommunicationToolkit")

putStereotype(jclass, 'ResourceUsage_ModelElement')

#rankAtt = createConstant(jclass, "RANK", modelingSession.getModel().getUmlTypes().getINTEGER(), '0')
#addTagValue(rankAtt, "JavaFinal", "true")

# create log attribute
#logatt = modelingSession.getModel().createAttribute()
#logatt.setName("log")
#logatt.setOwner(jclass)
#logatt.setIsClass(True)
#logatt.setValue("Logger.getLogger(JuniperProgram.class.getName())")
#logatt.setChangeable(KindOfAccess.ACCESNONE)