Author: jaz
Date: Tue Feb 27 14:53:42 2007 New Revision: 512471 URL: http://svn.apache.org/viewvc?view=rev&rev=512471 Log: implemented new data resource types for AUDIO/VIDEO content Modified: ofbiz/trunk/applications/content/data/ContentTypeData.xml ofbiz/trunk/applications/content/entitydef/entitygroup.xml ofbiz/trunk/applications/content/entitydef/entitymodel.xml ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml ofbiz/trunk/applications/content/servicedef/services_data.xml Modified: ofbiz/trunk/applications/content/data/ContentTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/ContentTypeData.xml?view=diff&rev=512471&r1=512470&r2=512471 ============================================================================== --- ofbiz/trunk/applications/content/data/ContentTypeData.xml (original) +++ ofbiz/trunk/applications/content/data/ContentTypeData.xml Tue Feb 27 14:53:42 2007 @@ -171,8 +171,10 @@ <DataResourceType dataResourceTypeId="URL_RESOURCE" description="URL Resource" hasTable="N" parentTypeId=""/> <DataResourceType dataResourceTypeId="SHORT_TEXT" description="Short Text" hasTable="N" parentTypeId=""/> <DataResourceType dataResourceTypeId="ELECTRONIC_TEXT" description="Long Text" hasTable="Y" parentTypeId=""/> + <DataResourceType dataResourceTypeId="AUDIO_OBJECT" description="Audio" hasTable="Y" parentTypeId=""/> <DataResourceType dataResourceTypeId="IMAGE_OBJECT" description="Image" hasTable="Y" parentTypeId=""/> <DataResourceType dataResourceTypeId="OTHER_OBJECT" description="Other" hasTable="Y" parentTypeId=""/> + <DataResourceType dataResourceTypeId="VIDEO_OBJECT" description="Video" hasTable="Y" parentTypeId=""/> <DataResourceType dataResourceTypeId="SURVEY" description="Survey" hasTable="N" parentTypeId=""/> <DataResourceType dataResourceTypeId="SURVEY_RESPONSE" description="Survey Response" hasTable="N" parentTypeId=""/> Modified: ofbiz/trunk/applications/content/entitydef/entitygroup.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/entitydef/entitygroup.xml?view=diff&rev=512471&r1=512470&r2=512471 ============================================================================== --- ofbiz/trunk/applications/content/entitydef/entitygroup.xml (original) +++ ofbiz/trunk/applications/content/entitydef/entitygroup.xml Tue Feb 27 14:53:42 2007 @@ -71,6 +71,7 @@ <!-- org.ofbiz.content.data --> <!-- ========================================================= --> + <entity-group group="org.ofbiz" entity="AudioDataResource" /> <entity-group group="org.ofbiz" entity="CharacterSet" /> <entity-group group="org.ofbiz" entity="DataCategory" /> <entity-group group="org.ofbiz" entity="DataResource" /> @@ -88,6 +89,7 @@ <entity-group group="org.ofbiz" entity="MetaDataPredicate" /> <entity-group group="org.ofbiz" entity="MimeType" /> <entity-group group="org.ofbiz" entity="OtherDataResource" /> + <entity-group group="org.ofbiz" entity="VideoDataResource" /> <!-- ========================================================= --> <!-- org.ofbiz.content.document --> Modified: ofbiz/trunk/applications/content/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/entitydef/entitymodel.xml?view=diff&rev=512471&r1=512470&r2=512471 ============================================================================== --- ofbiz/trunk/applications/content/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/content/entitydef/entitymodel.xml Tue Feb 27 14:53:42 2007 @@ -786,6 +786,16 @@ <!-- org.ofbiz.content.data --> <!-- ========================================================= --> + <entity entity-name="AudioDataResource" + package-name="org.ofbiz.content.data" + title="Other Data Object Entity"> + <field name="dataResourceId" type="id-ne"></field> + <field name="audioData" type="blob"></field> + <prim-key field="dataResourceId"/> + <relation type="one" fk-name="DATA_REC_AUDIO" rel-entity-name="DataResource"> + <key-map field-name="dataResourceId"/> + </relation> + </entity> <entity entity-name="CharacterSet" package-name="org.ofbiz.content.data" title="Character Set Entity"> @@ -1075,6 +1085,16 @@ <field name="dataResourceContent" type="blob"></field> <prim-key field="dataResourceId"/> <relation type="one" fk-name="DATA_REC_OTHER" rel-entity-name="DataResource"> + <key-map field-name="dataResourceId"/> + </relation> + </entity> + <entity entity-name="VideoDataResource" + package-name="org.ofbiz.content.data" + title="Other Data Object Entity"> + <field name="dataResourceId" type="id-ne"></field> + <field name="videoData" type="blob"></field> + <prim-key field="dataResourceId"/> + <relation type="one" fk-name="DATA_REC_VIDEO" rel-entity-name="DataResource"> <key-map field-name="dataResourceId"/> </relation> </entity> Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml?view=diff&rev=512471&r1=512470&r2=512471 ============================================================================== --- ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml (original) +++ ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml Tue Feb 27 14:53:42 2007 @@ -404,6 +404,48 @@ <remove-value value-name="lookedUpValue"/> </simple-method> + <!-- Methods for VideoDataResource --> + <simple-method method-name="createVideoDataResource" short-description="Create Video Data Resource"> + <make-value entity-name="VideoDataResource" value-name="newEntity"/> + <set-nonpk-fields map-name="parameters" value-name="newEntity"/> + <set-pk-fields map-name="parameters" value-name="newEntity"/> + <create-value value-name="newEntity"/> + </simple-method> + <simple-method method-name="updateVideoDataResource" short-description="Update Video Data Resource"> + <make-value entity-name="VideoDataResource" value-name="lookupKeyValue"/> + <set-pk-fields map-name="parameters" value-name="lookupKeyValue"/> + <find-by-primary-key entity-name="VideoDataResource" map-name="lookupKeyValue" value-name="lookedUpValue"/> + <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/> + <store-value value-name="lookedUpValue"/> + </simple-method> + <simple-method method-name="removeVideoDataResource" short-description="Remove Video Data Resource"> + <make-value entity-name="VideoDataResource" value-name="lookupKeyValue"/> + <set-pk-fields map-name="parameters" value-name="lookupKeyValue"/> + <find-by-primary-key entity-name="VideoDataResource" map-name="lookupKeyValue" value-name="lookedUpValue"/> + <remove-value value-name="lookedUpValue"/> + </simple-method> + + <!-- Methods for AudioDataResource --> + <simple-method method-name="createAudioDataResource" short-description="Create Audio Data Resource"> + <make-value entity-name="AudioDataResource" value-name="newEntity"/> + <set-nonpk-fields map-name="parameters" value-name="newEntity"/> + <set-pk-fields map-name="parameters" value-name="newEntity"/> + <create-value value-name="newEntity"/> + </simple-method> + <simple-method method-name="updateAudioDataResource" short-description="Update Audio Data Resource"> + <make-value entity-name="AudioDataResource" value-name="lookupKeyValue"/> + <set-pk-fields map-name="parameters" value-name="lookupKeyValue"/> + <find-by-primary-key entity-name="AudioDataResource" map-name="lookupKeyValue" value-name="lookedUpValue"/> + <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/> + <store-value value-name="lookedUpValue"/> + </simple-method> + <simple-method method-name="removeAudioDataResource" short-description="Remove Audio Data Resource"> + <make-value entity-name="AudioDataResource" value-name="lookupKeyValue"/> + <set-pk-fields map-name="parameters" value-name="lookupKeyValue"/> + <find-by-primary-key entity-name="AudioDataResource" map-name="lookupKeyValue" value-name="lookedUpValue"/> + <remove-value value-name="lookedUpValue"/> + </simple-method> + <!-- Methods for OtherDataResource --> <simple-method method-name="createOtherDataResource" short-description="Create Other Data Resource"> <make-value entity-name="OtherDataResource" value-name="newEntity"/> @@ -493,6 +535,22 @@ <then> <set field="parameters.dataResourceTypeId" value="IMAGE_OBJECT"/> </then> + <else-if> + <condition> + <if-regexp field-name="parameters._uploadedFile_contentType" expr="video.*"/> + </condition> + <then> + <set field="parameters.dataResourceTypeId" value="VIDEO_OBJECT"/> + </then> + </else-if> + <else-if> + <condition> + <if-regexp field-name="parameters._uploadedFile_contentType" expr="audio.*"/> + </condition> + <then> + <set field="parameters.dataResourceTypeId" value="AUDIO_OBJECT"/> + </then> + </else-if> <else> <set field="parameters.dataResourceTypeId" value="OTHER_OBJECT"/> </else> @@ -514,6 +572,16 @@ <return/> </if-compare> + <if-compare field-name="parameters.dataResourceTypeId" value="VIDEO_OBJECT" operator="equals"> + <call-simple-method method-name="saveImageObjectDateResource"/> + <return/> + </if-compare> + + <if-compare field-name="parameters.dataResourceTypeId" value="AUDIO_OBJECT" operator="equals"> + <call-simple-method method-name="saveImageObjectDateResource"/> + <return/> + </if-compare> + <if-compare field-name="parameters.dataResourceTypeId" value="OTHER_OBJECT" operator="equals"> <call-simple-method method-name="saveOtherObjectDateResource"/> <return/> @@ -610,6 +678,60 @@ <set-service-fields service-name="createImageDataResource" map-name="dataResource" to-map-name="serviceContext"/> <set from-field="parameters.uploadedFile" field="serviceContext.imageData"/> <call-service service-name="createImageDataResource" in-map-name="serviceContext"/> + + <field-to-result field-name="dataResourceId" map-name="dataResource"/> + </simple-method> + + <!-- save VIDEO_OBJECT data --> + <simple-method method-name="saveVideoObjectDateResource" short-description="Attach an uploaded file to a data resource as VIDEO_OBJECT"> + <entity-one entity-name="DataResource" value-name="dataResource"> + <field-map field-name="dataResourceId" env-name="parameters.dataResourceId"/> + </entity-one> + <if-empty field-name="dataResource"> + <add-error><fail-message message="No data resource found for ID: [$parameters.dataResourceId}]"/></add-error> + </if-empty> + <if-empty field-name="_uploadedFile_fileName" map-name="parameters"> + <add-error><fail-message message="No uploaded content found in context"/></add-error> + </if-empty> + <check-errors/> + + <!-- update the data resource with file data --> + <set from-field="parameters.dataResourceTypeId" field="dataResource.dataResourceTypeId"/> + <set from-field="parameters._uploadedFile_fileName" field="dataResource.dataResourceName"/> + <set from-field="parameters._uploadedFile_contentType" field="dataResource.mimeTypeId"/> + <store-value value-name="dataResource"/> + + <!-- fields serviceName and fileField are required to be set by calling method --> + <set-service-fields service-name="createVideoDataResource" map-name="dataResource" to-map-name="serviceContext"/> + <set from-field="parameters.uploadedFile" field="serviceContext.videoData"/> + <call-service service-name="createVideoDataResource" in-map-name="serviceContext"/> + + <field-to-result field-name="dataResourceId" map-name="dataResource"/> + </simple-method> + + <!-- save AUDIO_OBJECT data --> + <simple-method method-name="saveAudioObjectDateResource" short-description="Attach an uploaded file to a data resource as AUDIO_OBJECT"> + <entity-one entity-name="DataResource" value-name="dataResource"> + <field-map field-name="dataResourceId" env-name="parameters.dataResourceId"/> + </entity-one> + <if-empty field-name="dataResource"> + <add-error><fail-message message="No data resource found for ID: [$parameters.dataResourceId}]"/></add-error> + </if-empty> + <if-empty field-name="_uploadedFile_fileName" map-name="parameters"> + <add-error><fail-message message="No uploaded content found in context"/></add-error> + </if-empty> + <check-errors/> + + <!-- update the data resource with file data --> + <set from-field="parameters.dataResourceTypeId" field="dataResource.dataResourceTypeId"/> + <set from-field="parameters._uploadedFile_fileName" field="dataResource.dataResourceName"/> + <set from-field="parameters._uploadedFile_contentType" field="dataResource.mimeTypeId"/> + <store-value value-name="dataResource"/> + + <!-- fields serviceName and fileField are required to be set by calling method --> + <set-service-fields service-name="createAudioDataResource" map-name="dataResource" to-map-name="serviceContext"/> + <set from-field="parameters.uploadedFile" field="serviceContext.audioData"/> + <call-service service-name="createAudioDataResource" in-map-name="serviceContext"/> <field-to-result field-name="dataResourceId" map-name="dataResource"/> </simple-method> Modified: ofbiz/trunk/applications/content/servicedef/services_data.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_data.xml?view=diff&rev=512471&r1=512470&r2=512471 ============================================================================== --- ofbiz/trunk/applications/content/servicedef/services_data.xml (original) +++ ofbiz/trunk/applications/content/servicedef/services_data.xml Tue Feb 27 14:53:42 2007 @@ -146,6 +146,50 @@ <auto-attributes include="pk" mode="IN" optional="false"/> </service> + <!-- Video Data Resource services --> + <service name="createVideoDataResource" engine="simple" default-entity-name="VideoDataResource" auth="true" + location="org/ofbiz/content/data/DataServices.xml" invoke="createVideoDataResource"> + <description>Create a VideoDataResource</description> + <permission-service service-name="genericDataResourcePermission" main-action="CREATE"/> + <auto-attributes include="pk" mode="INOUT" optional="true"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="updateVideoDataResource" engine="simple" default-entity-name="VideoDataResource" auth="true" + location="org/ofbiz/content/data/DataServices.xml" invoke="updateImageDataResource"> + <description>Update an VideoDataResource</description> + <permission-service service-name="genericDataResourcePermission" main-action="UPDATE"/> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="removeVideoDataResource" engine="simple" default-entity-name="VideoDataResource" auth="true" + location="org/ofbiz/content/data/DataServices.xml" invoke="removeImageDataResource"> + <description>Remove an VideoDataResource</description> + <permission-service service-name="genericDataResourcePermission" main-action="DELETE"/> + <auto-attributes include="pk" mode="IN" optional="false"/> + </service> + + <!-- Audio Data Resource services --> + <service name="createAudioDataResource" engine="simple" default-entity-name="AudioDataResource" auth="true" + location="org/ofbiz/content/data/DataServices.xml" invoke="createImageDataResource"> + <description>Create an AudioDataResource</description> + <permission-service service-name="genericDataResourcePermission" main-action="CREATE"/> + <auto-attributes include="pk" mode="INOUT" optional="true"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="updateAudioDataResource" engine="simple" default-entity-name="AudioDataResource" auth="true" + location="org/ofbiz/content/data/DataServices.xml" invoke="updateImageDataResource"> + <description>Update an AudioDataResource</description> + <permission-service service-name="genericDataResourcePermission" main-action="UPDATE"/> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="removeAudioDataResource" engine="simple" default-entity-name="AudioDataResource" auth="true" + location="org/ofbiz/content/data/DataServices.xml" invoke="removeImageDataResource"> + <description>Remove an AudioDataResource</description> + <permission-service service-name="genericDataResourcePermission" main-action="DELETE"/> + <auto-attributes include="pk" mode="IN" optional="false"/> + </service> + <!-- Other Data Resource services --> <service name="createOtherDataResource" engine="simple" default-entity-name="OtherDataResource" auth="true" location="org/ofbiz/content/data/DataServices.xml" invoke="createOtherDataResource"> |
Free forum by Nabble | Edit this page |