Class: DatatypeMappingBLOB

Inherits:
DatatypeMapping show all
Defined in:
lib/ontomde-java/jpa/mapping.rb,
lib/ontomde-java/struts/mappingForJsp.rb,
lib/ontomde-java/struts/mappingForBean.rb,
lib/ontomde-java/java/xsdDatatypeMapping.rb,
lib/ontomde-java/java/javaDatatypeMapping.rb

Direct Known Subclasses

DatatypeMappingIMG

Instance Method Summary collapse

Methods inherited from DatatypeMapping

#addActionFieldMethod!, #crank_validation_annotation, #flex_writeMXML_Form_item_property, #flex_writeMXML_Form_item_property_column, #flex_writeMXML_MXvalidator, #flex_writeMXML_validate, #flex_writeMXML_vo_mapping, #flex_writeVO_getParameter, #flex_writeVO_initFromXML_mapping, #flex_writeVO_initItemFromXML_mapping, #flex_writeVO_vars_datatype, #java_Name, #java_getUndefinedValue, #java_helper_addMethods!, #java_helper_customCode, #java_qualifiedName, #prot_init, #rdf_uri, #struts_edit_writeFieldGeneric_DisplayTable_displayTag_column, #struts_generateHelper

Instance Method Details

#getFormCopyTo(field) ⇒ Object



119
120
121
# File 'lib/ontomde-java/struts/mappingForBean.rb', line 119

def getFormCopyTo(field)
  return "try {_to.set#{field.java_NameBean}(get#{field.java_NameBean}().getFileData());\n} catch(java.io.FileNotFoundException e) {log.error(e);} catch(java.io.IOException e2){log.error(e2);}\n"
end

#getFormInitFrom(field) ⇒ Object



123
124
125
126
# File 'lib/ontomde-java/struts/mappingForBean.rb', line 123

def getFormInitFrom(field)
  return ""
  #return "this.set#{field.java_NameBean}(_from.get#{field.java_NameBean}()==null?null:#{::Muml_Classifier::STRUTS_DATE_FORMATER_INSTANCE}.format(_from.get#{field.java_NameBean}()));\n"
end

#getFormType(field) ⇒ Object



116
117
118
# File 'lib/ontomde-java/struts/mappingForBean.rb', line 116

def getFormType(field)
  return field.umlx_getOrCreateClass("org.apache.struts.upload.FormFile")
end

#getJSP(datatype, field, owner) ⇒ Object



197
198
199
200
# File 'lib/ontomde-java/struts/mappingForJsp.rb', line 197

def getJSP(datatype,field,owner)
  n=datatype.java_Name.downcase #TODO
  return %{<html:file property="#{field.java_Name}" size="20%" maxlength="30" styleId="#{n}" #{::Muml_DataType::STRUTS_ERROR_STYLE}/>}
end

#java_getTypeObject



171
172
173
# File 'lib/ontomde-java/java/javaDatatypeMapping.rb', line 171

def java_getType
  return "byte[]"
end

#jpa_addTypeModificator(ah) ⇒ Object



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/ontomde-java/jpa/mapping.rb', line 344

def jpa_addTypeModificator(ah)
  #no super
  ah.java_annotation_add('@Lob')
  ah.umlx_owner_one.java_import_add('javax.persistence.Lob')

  #add column name when needed
  n=ah.jpa_addNameAnnotation
  n=n.nil? ? '' : ",#{n}"
  
  #mysql: MEDIUMBLOB LONGBLOB TINYBLOB BLOB
  if ah.context[:mysql]
    ah.java_annotation_add(%{@Column(columnDefinition="LONGBLOB"#{n})}) 
    ah.umlx_owner_one.java_import_add('javax.persistence.Column')
  end
  #cf: http://db.apache.org/derby/docs/10.1/ref/rrefblob.html
  if ah.context[:derby]
    ah.java_annotation_add(%{@Column(columnDefinition="BLOB(4M)"#{n})})
    ah.umlx_owner_one.java_import_add('javax.persistence.Column')    
  end
end

#xsd_getTypeObject



86
87
88
# File 'lib/ontomde-java/java/xsdDatatypeMapping.rb', line 86

def xsd_getType
  return "xsd:base64Binary"
end