Le 04/04/2018 à 09:26, Yudhi Karunia Surtan a écrit :
> Guys,
>
> Finally make my first commit to apache git repository.
> Thanks for guide me until here.
>
>
> I also find there are some duplication for some code like this :
>
> Properties properties = null;
> List<Props.Entry> props = inProps.getEntry();
> if ( props.size() > 0 )
> {
> properties = new Properties();
> //int size = props.size();
> for ( Props.Entry entry : props )
> {
> String key = entry.getKey();
> String val = entry.getValue();
> properties.setProperty( key, val );
> }
> }
> return properties;
>
>
> at org.apache.directory.fortress.core.model.Group,
> org.apache.directory.fortress.core.model.Permission,
> org.apache.directory.fortress.core.model.PermObj,
> org.apache.directory.fortress.core.model.Role,
> org.apache.directory.fortress.core.model.User.
>
> Currently we have RestUtils.getProperties What do you think if above
> classes using RestUtils method to remove duplication? However, if we do
> that from the dependency point of view, i think it is a bit awkward because
> "model" package depends on "rest" package.
I do think an utility function should be added to fortress-core, as each
project depends on it. It makes no sense to move that to the
fortress-rest module, IMHO.
One more thing :
if ( props.size() > 0 )
should be
if ( !props.isEmpty() )
And, yes, +1 to remove code duplication :-)
--
Emmanuel Lecharny
Symas.com
directory.apache.org