[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2023-07-27 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17748226#comment-17748226
 ] 

ASF subversion and git services commented on OFBIZ-9403:


Commit e87b1994836ca88c3ba04fadef33f7bb8e828511 in ofbiz-framework's branch 
refs/heads/trunk from Cheng Hu Shan
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=e87b199483 ]

Improved: Refactored DataResourceWorker getMimeType (OFBIZ-9403)

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Martin Becker
>Assignee: Chenghu Shan
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker_GetMimeType.patch, 
> OFBIZ-9403_DataResourceWorker_GetMimeType_with_defaultMimeTypeId.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2023-07-27 Thread Chenghu Shan (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17748182#comment-17748182
 ] 

Chenghu Shan commented on OFBIZ-9403:
-

[~mbrohl] I created a new pull request. The method getMimeType that does not 
use a fallback now uses content.property defaultMimeType as fallback instead. 
Notice that the defaultMimeType there is text/html instead of octet-stream.

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Martin Becker
>Assignee: Chenghu Shan
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker_GetMimeType.patch, 
> OFBIZ-9403_DataResourceWorker_GetMimeType_with_defaultMimeTypeId.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2023-07-27 Thread Michael Brohl (Jira)


[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17748111#comment-17748111
 ] 

Michael Brohl commented on OFBIZ-9403:
--

[~cshan]  I think we should take the defaultMimeType from 
applications/content/config/content.properties instead of a hard coded one, can 
you please change it accordingly?

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Martin Becker
>Assignee: Michael Brohl
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker_GetMimeType.patch, 
> OFBIZ-9403_DataResourceWorker_GetMimeType_with_defaultMimeTypeId.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2018-02-04 Thread Martin Becker (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351816#comment-16351816
 ] 

Martin Becker commented on OFBIZ-9403:
--

Added to patch files, one with and one without a defaultMimeType Parameter.

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk
>Reporter: Martin Becker
>Assignee: Deepak Dixit
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker_GetMimeType.patch, 
> OFBIZ-9403_DataResourceWorker_GetMimeType_with_defaultMimeTypeId.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2018-01-15 Thread Deepak Dixit (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16326808#comment-16326808
 ] 

Deepak Dixit commented on OFBIZ-9403:
-

Thanks Martin,

I think no need to pass default parameter in method.

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk
>Reporter: Martin Becker
>Assignee: Deepak Dixit
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker-getMimeType.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2018-01-15 Thread Martin Becker (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16326282#comment-16326282
 ] 

Martin Becker commented on OFBIZ-9403:
--

Hi Deepak,

yes, you are right, (now) I would name it getMimeType, too.

I had chosen getMimeTypeFromFileName inspired by getMimeTypeFromImageFileName 
in the same class, I think.

 

The returning of the default mime-type octet-stream is because I did not want 
to change the behavior of the getMimeType method like it was before my 
refactoring, which actually returns this default if there is no mimeTypeId 
defined at the DataResource and therefore the method looks for a mimeType 
determined from filename (so it assumes it is a file and returns octet-stream 
if there is no special mimeType by file extension).

Maybe we should add a default parameter to the method signatures to optionally 
give in a default mime type if the caller needs one.

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk
>Reporter: Martin Becker
>Assignee: Deepak Dixit
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker-getMimeType.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2017-07-09 Thread Deepak Dixit (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16079500#comment-16079500
 ] 

Deepak Dixit commented on OFBIZ-9403:
-

Hi Martin,

Why we are returning default mime type id in this methods?

I think it should not return default mime type, instead  it should return null 
so that at the calling end we can take decision accordingly  

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk
>Reporter: Martin Becker
>Assignee: Deepak Dixit
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker-getMimeType.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2017-06-11 Thread Jacques Le Roux (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16046041#comment-16046041
 ] 

Jacques Le Roux commented on OFBIZ-9403:


Hi Deepak, Martin,

Reading Deepak's comment, I had a mixed feeling, but after reading 
https://softwareengineering.stackexchange.com/questions/132369/should-we-rename-overloaded-methods
https://blog.jooq.org/2015/07/28/java-8s-method-references-put-further-restrictions-on-overloading/
I tend to lean in favour of renaming :) A very moot point in this case anyway...

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk
>Reporter: Martin Becker
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker-getMimeType.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (OFBIZ-9403) DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted (refactored) code from getMimeType(...) method

2017-06-10 Thread Deepak Dixit (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-9403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16045518#comment-16045518
 ] 

Deepak Dixit commented on OFBIZ-9403:
-

Hi [~mbecker],

I think we can use getMimeType as method name instead getMimeTypeFromFileName, 
method overloading :)

> DataResourceWorker: New method getMimeTypeFromFileName(...) with extracted 
> (refactored) code from getMimeType(...) method
> -
>
> Key: OFBIZ-9403
> URL: https://issues.apache.org/jira/browse/OFBIZ-9403
> Project: OFBiz
>  Issue Type: Improvement
>  Components: content
>Affects Versions: Trunk
>Reporter: Martin Becker
>Priority: Trivial
> Attachments: OFBIZ-9403_DataResourceWorker-getMimeType.patch
>
>
> The method DataResourceWorker.getMimeType(GenericValue) has been refactored 
> into two separate methods. The new additional method 
> getMimeTypeFromFileName(Delegator,Filename) solely focuses on getting the 
> MimeType from the file extension and is invoked by getMimeType(GenericValue) 
> if needed. getMimeType returns the type if possible via the data resource. 
> This results in cleaner code with the responsibility of both methods clearly 
> defined by the methods names.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)