Re: svn commit: r1326064 - in /ofbiz/trunk/framework: base/src/org/ofbiz/base/util/FileUtil.java catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java

2012-05-01 Thread Jacques Le Roux

From: "Scott Gray" 
That's an understatement and could actually be said of every patch in jira, shall we just go ahead and commit them all?  We can 
improve them later right?


Reading an xml file character by character to find something is like driving in a nail with the claw side of a hammer.  It sort of 
works, but I wouldn't put the end result in my display cabinet.  Did you not review this before committing or is treating an xml 
file like plain text an acceptable approach to you?


I thought it was enough for that case since we don't need to read any values. So I simply put a comment in ofbiz-containier. I will 
improve.


Jacques


Thanks
Scott

On 1/05/2012, at 5:52 AM, Jacques Le Roux wrote:


You are right Scott, this can be improved...

Jacques

From: "Scott Gray" 

This is not a good implementation, simply searching the web.xml file for a string containing 
"" is not good
enough.  It'll find the tag even if commented out and and won't find the tag "" (space before closing, 
perfectly

valid).  I'm surprised this got past you Jacques.

Regards
Scott

On 1/05/2012, at 1:31 AM, Jacques Le Roux wrote:


Pierre,

I did not test, but I believe it's only used in a clustered environment and 
should have any impacts in other cases.
It makes only a webapp distributable. Before we added this, all were 
distributable by default, which could annoying in certain
circumstances.
So adding it in web.xml files should not changes from previous behaviour. Which 
makes me believe it's safe... (see commit for
more)

Jacque

From: "Pierre Smits" 

Jacques,

If I have this tag in the web.xml, but the change is tested in an
unclustered environment what do you thing the result would be? Is it of no
effect, would it fail?

Regards,

Pierre

2012/4/30 Jacques Le Roux 


Hi Sam,

Yes: http://tomcat.apache.org/**tomcat-6.0-doc/cluster-howto.**
html#Cluster_Basics
http://wiki.metawerx.net/Wiki.**jsp?page=web.xml.Distributable

Also consider


(false by default)

If you use sticky sessions all above is not an issue...

Maybe we should ask a comment in *-containers.xml BTW... Feel free to
provide one ;o)

Jacques


Sam Hamilton wrote:


Hi Jacques,

Quick question - does this setting mean that now if you uncomment
framework/config/ofbiz-**containers.xml cluster settings it wont
cluster and that you should also add a  tag to all the
web.xml files?

Thanks
Sam


On 14 Apr 2012, at 15:30, jler...@apache.org wrote:

Author: jleroux

Date: Sat Apr 14 07:30:30 2012
New Revision: 1326064

URL: 
http://svn.apache.org/viewvc?**rev=1326064&view=rev
Log:
Adapted by hand from Lon F. Binder "CatalinaContainer Doesn't Respect
 Node for web.xml files."
https://issues.apache.org/**jira/browse/OFBIZ-4242

Per the servlet specification, the web.xml file should allow an optional
 node to indicate that the application
is clusterable. Currently, OFBiz does not respect this setting and
assumes all applications should be distributed if any cluster
configuration is provided in the ofbiz-containers.xml file. As a result,
if, for example, the DeltaManager is enable, all
applications attempt to cluster and communicate via DeltaManager.

The expected and proper functionality is to check the individual
application's web.xml file for the  node and
only use the DeltaManager if found; otherwise the StandardManager should
be used for sessions.

jleroux: replaced some tabs, reformatted, added a comment about
 in the *-containers.file

Modified:
ofbiz/trunk/framework/base/**src/org/ofbiz/base/util/**FileUtil.java
ofbiz/trunk/framework/**catalina/src/org/ofbiz/**catalina/container/**
CatalinaContainer.java

Modified: ofbiz/trunk/framework/base/**src/org/ofbiz/base/util/**
FileUtil.java
URL:
http://svn.apache.org/viewvc/**ofbiz/trunk/framework/base/**
src/org/ofbiz/base/util/**FileUtil.java?rev=1326064&r1=**
1326063&r2=1326064&view=diff
==**==**==
---
ofbiz/trunk/framework/base/**src/org/ofbiz/base/util/**FileUtil.java
(original) +++
ofbiz/trunk/framework/base/**src/org/ofbiz/base/util/**FileUtil.java
Sat Apr 14 07:30:30 2012 @@ -29,6 +29,7 @@ import
java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.Reader;
import java.io.Writer;
import java.net.**MalformedURLException;
import java.util.List;
@@ -67,7 +68,7 @@ public class FileUtil {

 /**
  * Converts a file path to one that is compatible with the host
operating system.
- *
+ *
  * @param path The file path to convert.
  * @return The converted file path.
  */
@@ -341,4 +342,57 @@ public cl

Re: Inconsistency between StringToList and ListToString

2012-05-01 Thread Rishi Solanki
Nicolas,
Please have a look into the method specified urlEncodeArgs() of UtilHttp
class. It takes the Map as argument and if while conversion it gives you '{
}' then it is fine. You just need to use map converter instead of list
converter.
It should works perfectly then. Assuming you are talking about the
StringUtil.toList method, and I'm redirecting to you to use
StringUtil.toMap method.

HTH!

--
Rishi Solanki
Manager, Enterprise Software Development
HotWax Media Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxmedia.com


On Fri, Apr 27, 2012 at 8:42 PM, Nicolas Malin <
malin.nico...@librenberry.net> wrote:

> Hi, I would like to explain a little problem with OFBiz convert where I
> don't found a clean solution.
>
> To start : a search form with a multiple drop-down  that call a perform
> service with an attribute List
> the form :
> 
> ...
>
> the service :
> 
>  optional="true"/> ...
>
> When I execute the research, the service get the list but the paginate
> lost it.
> On the queryString the list is encoded like this : "{element1, element2}",
> but the service use Converter class to load it and search : "[element1,
> element2]".
>
> The queryString is encoded by UtilHttp.urlEncodeArgs :
> if (value instanceof String) {
> valueStr = (String) value;
> } else {
> valueStr = value.toString();
> }
> which generate "{element1, element2}"
>
> And converter StringToList :
> if (obj.startsWith("[") && obj.endsWith("]")) {
> return StringUtil.toList(obj);
>
> Other point, converter ListToString use also value.toString();
>
> Do you think it is better to extend StringToList to support "{}" or to
> correct encode and convert process to use "[]" ?
>
> Nicolas
>
>
> -- Nicolas MALIN Consultant Tél : 06.17.66.40.06 Site projet :
> http://www.neogia.org/ --- Société LibrenBerry Tél : 02.48.02.56.12
> Site : http://www.librenberry.net/
>


Re: Inconsistency between StringToList and ListToString

2012-05-01 Thread Nicolas Malin

Hi Rishi,

Thanks for your time

Yes the urlEncodeArgs() convert the Map very well, but the list present 
in the map isn't convert to string as OFbiz converter wait it.


If I follow your suggest, and use StringUtil.toMap instead of 
StringUtil.toList in the CollectionConverter.java to convert, I will 
generate an IllegalArgumentException.


To solve my problem I make the choice to extend StringToList convert to 
support two notation with [] as UEL and {} as generate by toString() 
function.



Index: 
framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java

===
--- 
framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java(révision 
1332225)
+++ 
framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java(copie 
de travail)

@@ -146,7 +146,8 @@

 @Override
 public List convert(String obj) throws 
ConversionException {

-if (obj.startsWith("[") && obj.endsWith("]")) {
+if ((obj.startsWith("[") && obj.endsWith("]"))
+|| (obj.startsWith("{") && obj.endsWith("}"))) {
 return StringUtil.toList(obj);
 } else {
 return super.convert(obj);
Index: framework/base/src/org/ofbiz/base/util/StringUtil.java
===
--- framework/base/src/org/ofbiz/base/util/StringUtil.java(révision 
1332225)
+++ framework/base/src/org/ofbiz/base/util/StringUtil.java(copie de 
travail)

@@ -396,7 +396,8 @@
  */
 public static List toList(String s) {
 List newList = FastList.newInstance();
-if (s.startsWith("[") && s.endsWith("]")) {
+if ((s.startsWith("[") && s.endsWith("]"))
+|| (s.startsWith("{") && s.endsWith("}"))) {
 s = s.substring(1, s.length() - 1);
 String[] entries = s.split("\\,\\s");
 for (String entry: entries) {

Nicolas

 Le 01/05/2012 16:44, Rishi Solanki a écrit :

Nicolas,
Please have a look into the method specified urlEncodeArgs() of UtilHttp
class. It takes the Map as argument and if while conversion it gives you '{
}' then it is fine. You just need to use map converter instead of list
converter.
It should works perfectly then. Assuming you are talking about the
StringUtil.toList method, and I'm redirecting to you to use
StringUtil.toMap method.

HTH!

--
Rishi Solanki
Manager, Enterprise Software Development
HotWax Media Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxmedia.com


On Fri, Apr 27, 2012 at 8:42 PM, Nicolas Malin<
malin.nico...@librenberry.net>  wrote:


Hi, I would like to explain a little problem with OFBiz convert where I
don't found a clean solution.

To start : a search form with a multiple drop-down  that call a perform
service with an attribute List
the form :

...

the service :

  ...

When I execute the research, the service get the list but the paginate
lost it.
On the queryString the list is encoded like this : "{element1, element2}",
but the service use Converter class to load it and search : "[element1,
element2]".

The queryString is encoded by UtilHttp.urlEncodeArgs :
if (value instanceof String) {
valueStr = (String) value;
} else {
valueStr = value.toString();
}
which generate "{element1, element2}"

And converter StringToList :
if (obj.startsWith("[")&&  obj.endsWith("]")) {
return StringUtil.toList(obj);

Other point, converter ListToString use also value.toString();

Do you think it is better to extend StringToList to support "{}" or to
correct encode and convert process to use "[]" ?

Nicolas


-- Nicolas MALIN Consultant Tél : 06.17.66.40.06 Site projet :
http://www.neogia.org/ --- Société LibrenBerry Tél : 02.48.02.56.12
Site : http://www.librenberry.net/




--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
---
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/



Re: Inconsistency between StringToList and ListToString

2012-05-01 Thread Jacques Le Roux

Don't we need an adater?  http://en.wikipedia.org/wiki/Adapter_pattern
Maybe too heavy, just popped in my mind, did not look at code

Jacques

From: "Nicolas Malin" 

Hi Rishi,

Thanks for your time

Yes the urlEncodeArgs() convert the Map very well, but the list present in the map isn't convert to string as OFbiz converter wait 
it.


If I follow your suggest, and use StringUtil.toMap instead of StringUtil.toList in the CollectionConverter.java to convert, I will 
generate an IllegalArgumentException.


To solve my problem I make the choice to extend StringToList convert to support two notation with [] as UEL and {} as generate by 
toString() function.



Index: framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
===
--- 
framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java(révision 1332225)

+++ framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
(copie de travail)
@@ -146,7 +146,8 @@

 @Override
 public List convert(String obj) throws ConversionException {
-if (obj.startsWith("[") && obj.endsWith("]")) {
+if ((obj.startsWith("[") && obj.endsWith("]"))
+|| (obj.startsWith("{") && obj.endsWith("}"))) {
 return StringUtil.toList(obj);
 } else {
 return super.convert(obj);
Index: framework/base/src/org/ofbiz/base/util/StringUtil.java
===
--- framework/base/src/org/ofbiz/base/util/StringUtil.java(révision 1332225)
+++ framework/base/src/org/ofbiz/base/util/StringUtil.java(copie de travail)
@@ -396,7 +396,8 @@
  */
 public static List toList(String s) {
 List newList = FastList.newInstance();
-if (s.startsWith("[") && s.endsWith("]")) {
+if ((s.startsWith("[") && s.endsWith("]"))
+|| (s.startsWith("{") && s.endsWith("}"))) {
 s = s.substring(1, s.length() - 1);
 String[] entries = s.split("\\,\\s");
 for (String entry: entries) {

Nicolas

 Le 01/05/2012 16:44, Rishi Solanki a écrit :

Nicolas,
Please have a look into the method specified urlEncodeArgs() of UtilHttp
class. It takes the Map as argument and if while conversion it gives you '{
}' then it is fine. You just need to use map converter instead of list
converter.
It should works perfectly then. Assuming you are talking about the
StringUtil.toList method, and I'm redirecting to you to use
StringUtil.toMap method.

HTH!

--
Rishi Solanki
Manager, Enterprise Software Development
HotWax Media Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxmedia.com


On Fri, Apr 27, 2012 at 8:42 PM, Nicolas Malin<
malin.nico...@librenberry.net>  wrote:


Hi, I would like to explain a little problem with OFBiz convert where I
don't found a clean solution.

To start : a search form with a multiple drop-down  that call a perform
service with an attribute List
the form :

...

the service :

  ...

When I execute the research, the service get the list but the paginate
lost it.
On the queryString the list is encoded like this : "{element1, element2}",
but the service use Converter class to load it and search : "[element1,
element2]".

The queryString is encoded by UtilHttp.urlEncodeArgs :
if (value instanceof String) {
valueStr = (String) value;
} else {
valueStr = value.toString();
}
which generate "{element1, element2}"

And converter StringToList :
if (obj.startsWith("[")&&  obj.endsWith("]")) {
return StringUtil.toList(obj);

Other point, converter ListToString use also value.toString();

Do you think it is better to extend StringToList to support "{}" or to
correct encode and convert process to use "[]" ?

Nicolas


-- Nicolas MALIN Consultant Tél : 06.17.66.40.06 Site projet :
http://www.neogia.org/ --- Société LibrenBerry Tél : 02.48.02.56.12
Site : http://www.librenberry.net/




--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
---
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/



Re: Inconsistency between StringToList and ListToString

2012-05-01 Thread Jacques Le Roux

Don't we need an Object Adapter?  http://en.wikipedia.org/wiki/Adapter_pattern
Maybe too heavy, just popped in my mind, did not look at code

Jacques

From: "Nicolas Malin" 

Hi Rishi,

Thanks for your time

Yes the urlEncodeArgs() convert the Map very well, but the list present in the 
map isn't convert to string as OFbiz converter wait
it.

If I follow your suggest, and use StringUtil.toMap instead of StringUtil.toList 
in the CollectionConverter.java to convert, I will
generate an IllegalArgumentException.

To solve my problem I make the choice to extend StringToList convert to support 
two notation with [] as UEL and {} as generate by
toString() function.


Index: framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
===
--- 
framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java(révision 1332225)

+++ framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java
(copie de travail)
@@ -146,7 +146,8 @@

 @Override
 public List convert(String obj) throws ConversionException {
-if (obj.startsWith("[") && obj.endsWith("]")) {
+if ((obj.startsWith("[") && obj.endsWith("]"))
+|| (obj.startsWith("{") && obj.endsWith("}"))) {
 return StringUtil.toList(obj);
 } else {
 return super.convert(obj);
Index: framework/base/src/org/ofbiz/base/util/StringUtil.java
===
--- framework/base/src/org/ofbiz/base/util/StringUtil.java(révision 1332225)
+++ framework/base/src/org/ofbiz/base/util/StringUtil.java(copie de travail)
@@ -396,7 +396,8 @@
  */
 public static List toList(String s) {
 List newList = FastList.newInstance();
-if (s.startsWith("[") && s.endsWith("]")) {
+if ((s.startsWith("[") && s.endsWith("]"))
+|| (s.startsWith("{") && s.endsWith("}"))) {
 s = s.substring(1, s.length() - 1);
 String[] entries = s.split("\\,\\s");
 for (String entry: entries) {

Nicolas

 Le 01/05/2012 16:44, Rishi Solanki a écrit :

Nicolas,
Please have a look into the method specified urlEncodeArgs() of UtilHttp
class. It takes the Map as argument and if while conversion it gives you '{
}' then it is fine. You just need to use map converter instead of list
converter.
It should works perfectly then. Assuming you are talking about the
StringUtil.toList method, and I'm redirecting to you to use
StringUtil.toMap method.

HTH!

--
Rishi Solanki
Manager, Enterprise Software Development
HotWax Media Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxmedia.com


On Fri, Apr 27, 2012 at 8:42 PM, Nicolas Malin<
malin.nico...@librenberry.net>  wrote:


Hi, I would like to explain a little problem with OFBiz convert where I
don't found a clean solution.

To start : a search form with a multiple drop-down  that call a perform
service with an attribute List
the form :

...

the service :

  ...

When I execute the research, the service get the list but the paginate
lost it.
On the queryString the list is encoded like this : "{element1, element2}",
but the service use Converter class to load it and search : "[element1,
element2]".

The queryString is encoded by UtilHttp.urlEncodeArgs :
if (value instanceof String) {
valueStr = (String) value;
} else {
valueStr = value.toString();
}
which generate "{element1, element2}"

And converter StringToList :
if (obj.startsWith("[")&&  obj.endsWith("]")) {
return StringUtil.toList(obj);

Other point, converter ListToString use also value.toString();

Do you think it is better to extend StringToList to support "{}" or to
correct encode and convert process to use "[]" ?

Nicolas


-- Nicolas MALIN Consultant Tél : 06.17.66.40.06 Site projet :
http://www.neogia.org/ --- Société LibrenBerry Tél : 02.48.02.56.12
Site : http://www.librenberry.net/




--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
---
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/



help for security system

2012-05-01 Thread rahul das probal
sir,
when i create an user as employee of company x and give him permission
to access and create "organization GL" like chart of account or
transaction the employee of company x can make it  not from only
company x but also from others company. eg though he is an employee of
company x he can manage transaction or chart of account from company y
,z etc.

   is it possible that one employee of a certain company cannot
access or cannot see or can't transaction the char of account,billing
account,or financial account of other company?


[eg. when i give permission to employee of company x that he can only
set the chart of account he can set the chart of account not only of
company x but also of other companies i want that he only see and can
set or manage the chart of account of company x cannot access or
manage the other companies' chart of accounts or transactions.]

thank you