directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-core git commit: FC-191 - code cleanup - remove entanglements
Date Sun, 09 Oct 2016 13:13:49 GMT
Repository: directory-fortress-core
Updated Branches:
  refs/heads/master 6a38b86e3 -> 42d14165b


FC-191 - code cleanup - remove entanglements


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/42d14165
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/42d14165
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/42d14165

Branch: refs/heads/master
Commit: 42d14165b68eecf89123b0e0c0ab57ef5cc3e715
Parents: 6a38b86
Author: Shawn McKinney <smckinney@apache.org>
Authored: Sun Oct 9 08:13:39 2016 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Sun Oct 9 08:13:39 2016 -0500

----------------------------------------------------------------------
 .../directory/fortress/core/ConfigMgr.java      |   1 -
 .../fortress/core/GroupMgrFactory.java          |   1 -
 .../fortress/core/ant/FortressAntTask.java      |   2 +-
 .../directory/fortress/core/ant/UserAnt.java    |   2 +-
 .../core/cli/CommandLineInterpreter.java        |   2 +-
 .../fortress/core/impl/AdminMgrImpl.java        |   2 +-
 .../fortress/core/impl/AdminRoleDAO.java        |   2 +-
 .../directory/fortress/core/impl/ConfigDAO.java |   2 +-
 .../fortress/core/impl/DelAdminMgrImpl.java     |   2 +-
 .../directory/fortress/core/impl/GroupDAO.java  |   1 +
 .../directory/fortress/core/impl/GroupP.java    |   1 +
 .../directory/fortress/core/impl/PermDAO.java   |   2 +-
 .../directory/fortress/core/impl/RoleDAO.java   |   2 +-
 .../directory/fortress/core/impl/UserDAO.java   |   4 +-
 .../directory/fortress/core/impl/UserP.java     |   5 +-
 .../fortress/core/ldap/LdapDataProvider.java    |   2 +-
 .../fortress/core/model/AdminRole.java          |   1 +
 .../fortress/core/model/ConstraintUtil.java     | 353 ------------------
 .../directory/fortress/core/model/Group.java    |   2 +
 .../directory/fortress/core/model/PropUtil.java | 141 --------
 .../directory/fortress/core/model/Role.java     |   2 +
 .../directory/fortress/core/model/Session.java  |   1 -
 .../fortress/core/model/UserAdminRole.java      |   1 +
 .../directory/fortress/core/model/UserRole.java |   1 +
 .../fortress/core/util/ConstraintUtil.java      | 355 +++++++++++++++++++
 .../directory/fortress/core/util/PropUtil.java  | 140 ++++++++
 .../directory/fortress/core/util/VUtil.java     |   1 -
 .../fortress/core/GroupMgrConsole.java          |   2 +-
 .../fortress/core/example/ExampleDAO.java       |   2 +-
 .../fortress/core/impl/AdminMgrImplTest.java    |   2 +-
 30 files changed, 521 insertions(+), 516 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java b/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java
index 4002d49..591fb63 100755
--- a/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java
@@ -20,7 +20,6 @@
 package org.apache.directory.fortress.core;
 
 
-import org.apache.directory.fortress.core.SecurityException;
 
 import java.util.Properties;
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/GroupMgrFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/GroupMgrFactory.java b/src/main/java/org/apache/directory/fortress/core/GroupMgrFactory.java
index 1de82df..6a880bb 100755
--- a/src/main/java/org/apache/directory/fortress/core/GroupMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/GroupMgrFactory.java
@@ -20,7 +20,6 @@
 package org.apache.directory.fortress.core;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.api.util.Strings;
 import org.apache.directory.fortress.core.impl.GroupMgrImpl;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.rest.GroupMgrRestImpl;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java b/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
index 1d1eff0..49e7f13 100755
--- a/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
+++ b/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
@@ -52,7 +52,7 @@ import org.apache.directory.fortress.core.model.OrganizationalUnit;
 import org.apache.directory.fortress.core.model.PermGrant;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.apache.directory.fortress.core.model.PwPolicy;
 import org.apache.directory.fortress.core.model.Relationship;
 import org.apache.directory.fortress.core.model.Role;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java b/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
index f55e206..c58dd94 100755
--- a/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
+++ b/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
@@ -23,7 +23,7 @@ package org.apache.directory.fortress.core.ant;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.directory.fortress.core.model.User;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java b/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
index 111e28f..b8c8724 100755
--- a/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
+++ b/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
@@ -42,7 +42,7 @@ import org.apache.directory.fortress.core.GroupMgrFactory;
 import org.apache.directory.fortress.core.model.Address;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.SDSet;
 import org.apache.directory.fortress.core.model.Session;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
index 5c62899..77e8923 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
@@ -31,7 +31,7 @@ import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.SecurityException;
 
 import org.apache.directory.fortress.core.model.AdminRole;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.Group;
 import org.apache.directory.fortress.core.model.Hier;
 import org.apache.directory.fortress.core.model.PermObj;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java
index c33c029..cdb850e 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java
@@ -45,7 +45,7 @@ import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.apache.directory.fortress.core.model.AdminRole;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.Graphable;
 import org.apache.directory.fortress.core.model.ObjectFactory;
 import org.apache.directory.fortress.core.model.Role;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
index e765762..43b54b8 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
@@ -38,7 +38,7 @@ import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.apache.directory.fortress.core.util.Config;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java
index ab8041a..c2abddb 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java
@@ -30,7 +30,7 @@ import org.apache.directory.fortress.core.DelAdminMgr;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.model.AdminRole;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.Hier;
 import org.apache.directory.fortress.core.model.OrgUnit;
 import org.apache.directory.fortress.core.model.PermObj;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
index 26519a8..08c332b 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
@@ -46,6 +46,7 @@ import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.apache.directory.fortress.core.model.*;
 import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java b/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
index d284cdc..7c9d05a 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
@@ -30,6 +30,7 @@ import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.ValidationException;
 import org.apache.directory.fortress.core.model.*;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.util.VUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
index 3eea0f3..6a82190 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
@@ -57,7 +57,7 @@ import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
 import org.apache.directory.fortress.core.model.PermissionAttribute;
 import org.apache.directory.fortress.core.model.PermissionAttributeSet;
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.User;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
index a79dc03..1de1a66 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
@@ -44,7 +44,7 @@ import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.Graphable;
 import org.apache.directory.fortress.core.model.Group;
 import org.apache.directory.fortress.core.model.ObjectFactory;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
index 6493487..ef5a7d9 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
@@ -62,10 +62,10 @@ import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.apache.directory.fortress.core.model.Address;
 import org.apache.directory.fortress.core.model.AdminRole;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.ObjectFactory;
 import org.apache.directory.fortress.core.model.OrgUnit;
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.apache.directory.fortress.core.model.PwMessage;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.RoleConstraint;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
index 93ca00b..710daf5 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
@@ -34,10 +34,9 @@ import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.ValidationException;
 import org.apache.directory.fortress.core.model.AdminRole;
 import org.apache.directory.fortress.core.model.Administrator;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.ObjectFactory;
 import org.apache.directory.fortress.core.model.OrgUnit;
-import org.apache.directory.fortress.core.model.PermissionAttributeSet;
 import org.apache.directory.fortress.core.model.PwPolicy;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.RoleConstraint;
@@ -72,8 +71,8 @@ final class UserP
 {
     //private static final boolean IS_SESSION_PROPS_ENABLED = Config.getBoolean( "user.session.props.enabled", false );
     private static final String CLS_NM = UserP.class.getName();
-    private static UserDAO uDao;
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
+    private UserDAO uDao;
     private PolicyP policyP;
     private AdminRoleP admRoleP;
     private OrgUnitP orgUnitP;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
index c2b955e..1356fd8 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
@@ -64,7 +64,7 @@ import org.apache.directory.api.ldap.model.message.controls.ProxiedAuthzImpl;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.model.Constraint;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.FortEntity;
 import org.apache.directory.fortress.core.model.Hier;
 import org.apache.directory.fortress.core.model.Relationship;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java b/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
index 0e8020d..5a3ccbc 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
@@ -29,6 +29,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/ConstraintUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/ConstraintUtil.java b/src/main/java/org/apache/directory/fortress/core/model/ConstraintUtil.java
deleted file mode 100644
index 35327b7..0000000
--- a/src/main/java/org/apache/directory/fortress/core/model/ConstraintUtil.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- *   Licensed to the Apache Software Foundation (ASF) under one
- *   or more contributor license agreements.  See the NOTICE file
- *   distributed with this work for additional information
- *   regarding copyright ownership.  The ASF licenses this file
- *   to you under the Apache License, Version 2.0 (the
- *   "License"); you may not use this file except in compliance
- *   with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing,
- *   software distributed under the License is distributed on an
- *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *   KIND, either express or implied.  See the License for the
- *   specific language governing permissions and limitations
- *   under the License.
- *
- */
-package org.apache.directory.fortress.core.model;
-
-import java.util.StringTokenizer;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.directory.fortress.core.ValidationException;
-import org.apache.directory.fortress.core.util.Config;
-import org.apache.directory.fortress.core.util.VUtil;
-
-/**
- *  Utilities to copy constraints attributes between entities.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class ConstraintUtil
-{
-
-    private static final ConstraintValidator constraintValidator = VUtil.getConstraintValidator();
-
-    /**
-     * Copy source constraint to target. Both must be created before calling this utility.
-     *
-     * @param srcC contains constraint source.
-     * @param trgC contains target constraint.
-     */
-    public static void copy( Constraint srcC, Constraint trgC )
-    {
-        // Both variables must be instantiated before being passed in to this method.
-        trgC.setTimeout( srcC.getTimeout() );
-
-        if ( StringUtils.isNotEmpty( srcC.getName() ) )
-        {
-            trgC.setName( srcC.getName() );
-        }
-        if ( StringUtils.isNotEmpty( srcC.getBeginTime() ) )
-        {
-            trgC.setBeginTime( srcC.getBeginTime() );
-        }
-        if ( StringUtils.isNotEmpty( srcC.getEndTime() ) )
-        {
-            trgC.setEndTime( srcC.getEndTime() );
-        }
-        if ( StringUtils.isNotEmpty( srcC.getDayMask() ) )
-        {
-            trgC.setDayMask( srcC.getDayMask() );
-        }
-        if ( StringUtils.isNotEmpty( srcC.getBeginDate() ) )
-        {
-            trgC.setBeginDate( srcC.getBeginDate() );
-        }
-        if ( StringUtils.isNotEmpty( srcC.getEndDate() ) )
-        {
-            trgC.setEndDate( srcC.getEndDate() );
-        }
-        if ( StringUtils.isNotEmpty( srcC.getBeginLockDate() ) )
-        {
-            trgC.setBeginLockDate( srcC.getBeginLockDate() );
-        }
-        if ( StringUtils.isNotEmpty( srcC.getEndLockDate() ) )
-        {
-            trgC.setEndLockDate( srcC.getEndLockDate() );
-        }
-    }
-
-
-    /**
-     * Validate the non-null attributes on the constraint.
-     *
-     * @param c1 contains the temporal values associated with an entity.
-     * @throws org.apache.directory.fortress.core.ValidationException on first invalid attribute found.
-     */
-    public static void validate( Constraint c1 )
-        throws ValidationException
-    {
-        if ( c1.getTimeout() != null )
-        {
-            constraintValidator.timeout( c1.getTimeout() );
-        }
-        if ( StringUtils.isNotEmpty( c1.getBeginTime() ) )
-        {
-            constraintValidator.beginTime( c1.getBeginTime() );
-        }
-        if ( StringUtils.isNotEmpty( c1.getEndTime() ) )
-        {
-            constraintValidator.endTime( c1.getEndTime() );
-        }
-        if ( StringUtils.isNotEmpty( c1.getBeginDate() ) )
-        {
-            constraintValidator.beginDate( c1.getBeginDate() );
-        }
-        if ( StringUtils.isNotEmpty( c1.getEndDate() ) )
-        {
-            constraintValidator.endDate( c1.getEndDate() );
-        }
-        if ( StringUtils.isNotEmpty( c1.getDayMask() ) )
-        {
-            constraintValidator.dayMask( c1.getDayMask() );
-        }
-        if ( StringUtils.isNotEmpty( c1.getBeginLockDate() ) )
-        {
-            constraintValidator.beginDate( c1.getBeginLockDate() );
-        }
-        if ( StringUtils.isNotEmpty( c1.getEndLockDate() ) )
-        {
-            constraintValidator.endDate( c1.getEndLockDate() );
-        }
-    }
-    /**
-     * Used by DAO utilities to convert from a string with comma delimited values to fortress internal format {@link Constraint}.
-     *
-     * @param inputString contains raw data format which is comma delimited containing temporal data.
-     * @param constraint  used by internal processing to perform validations.
-     */
-    public static void setConstraint( String inputString, Constraint constraint )
-    {
-        if ( StringUtils.isNotEmpty( inputString ) )
-        {
-            StringTokenizer tkn = new StringTokenizer( inputString, Config.getInstance().getDelimiter(), true );
-            if ( tkn.countTokens() > 0 )
-            {
-                int count = tkn.countTokens();
-                int index = 0;
-                boolean previousTokenWasDelimiter = false;
-                for ( int i = 0; i < count; i++ )
-                {
-                    String szValue = tkn.nextToken();
-                    if ( szValue.equals( Config.getInstance().getDelimiter() ) && !previousTokenWasDelimiter )
-                    {
-                        previousTokenWasDelimiter = true;
-                    }
-                    else if ( szValue.equals( Config.getInstance().getDelimiter() ) )
-                    {
-                        previousTokenWasDelimiter = true;
-                        index++;
-                    }
-                    else
-                    {
-                        previousTokenWasDelimiter = false;
-                        switch ( index++ )
-                        {
-                            case 0:
-                                // only set the name attr if it isn't already set:
-                                if ( ( constraint.getName() == null ) || ( constraint.getName().length() == 0 ) )
-                                {
-                                    constraint.setName( szValue );
-                                }
-
-                                break;
-                            case 1:
-                                constraint.setTimeout( Integer.parseInt( szValue ) );
-                                break;
-                            case 2:
-                                constraint.setBeginTime( szValue );
-                                break;
-                            case 3:
-                                constraint.setEndTime( szValue );
-                                break;
-                            case 4:
-                                constraint.setBeginDate( szValue );
-                                break;
-                            case 5:
-                                constraint.setEndDate( szValue );
-                                break;
-                            case 6:
-                                constraint.setBeginLockDate( szValue );
-                                break;
-                            case 7:
-                                constraint.setEndLockDate( szValue );
-                                break;
-                            case 8:
-                                constraint.setDayMask( szValue );
-                                break;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Convert from fortress {@link Constraint} to comma delimited ldap format.
-     *
-     * @param constraint contains the temporal data.
-     * @return string containing raw data bound for ldap.
-     */
-    public static String setConstraint( Constraint constraint )
-    {
-        String szConstraint = null;
-        String delimiter = Config.getInstance().getDelimiter();
-        if ( constraint != null )
-        {
-            StringBuilder sb = new StringBuilder();
-            sb.append( constraint.getName() );
-            sb.append( delimiter );
-
-            if ( constraint.getTimeout() != null )
-            {
-                sb.append( constraint.getTimeout() );
-            }
-
-            sb.append( delimiter );
-
-            if ( constraint.getBeginTime() != null )
-            {
-                sb.append( constraint.getBeginTime() );
-            }
-
-            sb.append( delimiter );
-
-            if ( constraint.getEndTime() != null )
-            {
-                sb.append( constraint.getEndTime() );
-            }
-
-            sb.append( delimiter );
-
-            if ( constraint.getBeginDate() != null )
-            {
-                sb.append( constraint.getBeginDate() );
-            }
-
-            sb.append( delimiter );
-
-            if ( constraint.getEndDate() != null )
-            {
-                sb.append( constraint.getEndDate() );
-            }
-
-            sb.append( delimiter );
-
-            if ( constraint.getBeginLockDate() != null )
-            {
-                sb.append( constraint.getBeginLockDate() );
-            }
-
-            sb.append( delimiter );
-
-            if ( constraint.getEndLockDate() != null )
-            {
-                sb.append( constraint.getEndLockDate() );
-            }
-
-            sb.append( delimiter );
-
-            if ( constraint.getDayMask() != null )
-            {
-                sb.append( constraint.getDayMask() );
-            }
-
-            szConstraint = sb.toString();
-        }
-        return szConstraint;
-    }
-
-
-    /**
-     * Utility is used during processing of constraint values.  The rule used here is if the target constraint will
-     * accept the source constraint attribute only when not set initially.  If target constraint's attribute is set,
-     * validation on the constraint will be performed.
-     *
-     * @param srcC Contains instantiated constraint with one or more attributes to be copied.
-     * @param trgC instantiated object may contain zero or more attributes set.  Copy will not be performed on set attrs.
-     * @throws org.apache.directory.fortress.core.ValidationException on first invalid attribute found.
-     */
-    public static void validateOrCopy( Constraint srcC, Constraint trgC )
-        throws ValidationException
-    {
-        if ( trgC.getTimeout() != null )
-        {
-            srcC.setTimeout( trgC.getTimeout() );
-        }
-        else if ( srcC.getTimeout() != null )
-        {
-            trgC.setTimeout( srcC.getTimeout() );
-        }
-        if ( StringUtils.isNotEmpty( trgC.getBeginTime() ) )
-        {
-            constraintValidator.beginTime( trgC.getBeginTime() );
-        }
-        else if ( StringUtils.isNotEmpty( srcC.getBeginTime() ) )
-        {
-            trgC.setBeginTime( srcC.getBeginTime() );
-        }
-        if ( StringUtils.isNotEmpty( trgC.getEndTime() ) )
-        {
-            constraintValidator.endTime( trgC.getEndTime() );
-        }
-        else if ( StringUtils.isNotEmpty( srcC.getEndTime() ) )
-        {
-            trgC.setEndTime( srcC.getEndTime() );
-        }
-        if ( StringUtils.isNotEmpty( trgC.getBeginDate() ) )
-        {
-            constraintValidator.beginDate( trgC.getBeginDate() );
-        }
-        else if ( StringUtils.isNotEmpty( srcC.getBeginDate() ) )
-        {
-            trgC.setBeginDate( srcC.getBeginDate() );
-        }
-        if ( StringUtils.isNotEmpty( trgC.getEndDate() ) )
-        {
-            constraintValidator.endDate( trgC.getEndDate() );
-        }
-        else if ( StringUtils.isNotEmpty( srcC.getEndDate() ) )
-        {
-            trgC.setEndDate( srcC.getEndDate() );
-        }
-        if ( StringUtils.isNotEmpty( trgC.getDayMask() ) )
-        {
-            constraintValidator.dayMask( trgC.getDayMask() );
-        }
-        else if ( StringUtils.isNotEmpty( srcC.getDayMask() ) )
-        {
-            trgC.setDayMask( srcC.getDayMask() );
-        }
-        if ( StringUtils.isNotEmpty( trgC.getBeginLockDate() ) )
-        {
-            constraintValidator.beginDate( trgC.getBeginLockDate() );
-        }
-        else if ( StringUtils.isNotEmpty( srcC.getBeginLockDate() ) )
-        {
-            trgC.setBeginLockDate( srcC.getBeginLockDate() );
-        }
-        if ( StringUtils.isNotEmpty( trgC.getEndLockDate() ) )
-        {
-            constraintValidator.endDate( trgC.getEndLockDate() );
-        }
-        else if ( StringUtils.isNotEmpty( srcC.getEndLockDate() ) )
-        {
-            trgC.setEndLockDate( srcC.getEndLockDate() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/Group.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/Group.java b/src/main/java/org/apache/directory/fortress/core/model/Group.java
index 46b459e..3bc932f 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/Group.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/Group.java
@@ -20,6 +20,8 @@
 package org.apache.directory.fortress.core.model;
 
 
+import org.apache.directory.fortress.core.util.PropUtil;
+
 import javax.xml.bind.annotation.*;
 import java.io.Serializable;
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java b/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java
deleted file mode 100644
index 914f989..0000000
--- a/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *   Licensed to the Apache Software Foundation (ASF) under one
- *   or more contributor license agreements.  See the NOTICE file
- *   distributed with this work for additional information
- *   regarding copyright ownership.  The ASF licenses this file
- *   to you under the Apache License, Version 2.0 (the
- *   "License"); you may not use this file except in compliance
- *   with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing,
- *   software distributed under the License is distributed on an
- *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *   KIND, either express or implied.  See the License for the
- *   specific language governing permissions and limitations
- *   under the License.
- *
- */
-package org.apache.directory.fortress.core.model;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.util.Config;
-
-/**
- *  Utilities to convert to/from property formats.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public final class PropUtil
-{
-    /**
-     * Convert from a {@link java.util.List} of properties stored as name:value pairs to
-     * a {@link java.util.Properties}.
-     *
-     * @param propList contains a list of name-value pairs separated by a ':'.
-     * @return reference to a Properties collection.
-     */
-    public static Properties getProperties(List<String> propList)
-    {
-        return getProperties(propList, GlobalIds.PROP_SEP );
-    }
-
-    /**
-     * Convert from a {@link java.util.List} of properties stored as name:value pairs to
-     * a {@link java.util.Properties}.
-     *
-     * @param propList contains a list of name-value pairs separated by a ':'.
-     * @param separator contains char to be used to separate key and value.
-     * @return reference to a Properties collection.
-     */
-    public static Properties getProperties( List<String> propList, char separator )
-    {
-        Properties props = null;
-        if (propList != null && propList.size() > 0)
-        {
-            props = new Properties();
-            propList.size();
-            for (String raw : propList)
-            {
-                int indx = raw.indexOf(separator);
-                if (indx >= 1)
-                {
-                    props.setProperty(raw.substring(0, indx), raw.substring(indx + 1));
-                }
-            }
-        }
-        return props;
-    }
-
-    /**
-     * Convert from a comma delimited list of name-value pairs separated by a ':'.  Return the pros as {@link java.util.Properties}.
-     *
-     * @param inputString contains comma delimited list of properties.
-     * @return java collection class containing props.
-     */
-    public static Properties getProperties( String inputString )
-    {
-        return getProperties( inputString, GlobalIds.PROP_SEP );
-    }
-
-    /**
-     * Convert from a comma delimited list of name-value pairs separated by a ':'.  Return the pros as {@link java.util.Properties}.
-     *
-     * @param inputString contains comma delimited list of properties.
-     * @param separator contains char to be used to separate key and value.
-     * @return java collection class containing props.
-     */
-    public static Properties getProperties( String inputString, char separator )
-    {
-        return getProperties( inputString, separator, Config.getInstance().getDelimiter() );
-    }
-
-    /**
-     * Convert from a comma delimited list of name-value pairs separated by a ':'.  Return the pros as {@link java.util.Properties}.
-     *
-     * @param inputString contains comma delimited list of properties.
-     * @param separator contains char to be used to separate key and value.
-     * @param delimiter contains a single char specifying delimiter between properties.
-     * @return java collection class containing props.
-     */
-    public static Properties getProperties( String inputString, char separator, String delimiter )
-    {
-        Properties props = new Properties();
-        if (inputString != null && inputString.length() > 0)
-        {
-            StringTokenizer maxTkn = new StringTokenizer(inputString, delimiter);
-            if (maxTkn.countTokens() > 0)
-            {
-                while (maxTkn.hasMoreTokens())
-                {
-                    String val = maxTkn.nextToken();
-                    int indx = val.indexOf(separator);
-                    if (indx >= 1)
-                    {
-                        String name = val.substring(0, indx).trim();
-                        String value = val.substring(indx + 1).trim();
-                        props.setProperty(name, value);
-                    }
-                }
-            }
-        }
-        return props;
-    }
-
-
-    /**
-     * Method will return true if props is not null or empty.
-     *
-     * @param props contains the reference to props.
-     * @return boolean if validation succeeds.
-     */
-    public static boolean isNotEmpty( Properties props )
-    {
-        return ( props != null ) && ( props.size() > 0 );
-    }
-}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/Role.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/Role.java b/src/main/java/org/apache/directory/fortress/core/model/Role.java
index f86012f..3f0a981 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/Role.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/Role.java
@@ -20,6 +20,8 @@
 package org.apache.directory.fortress.core.model;
 
 
+import org.apache.directory.fortress.core.util.ConstraintUtil;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/Session.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/Session.java b/src/main/java/org/apache/directory/fortress/core/model/Session.java
index 12ff328..8c69ca2 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/Session.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/Session.java
@@ -236,7 +236,6 @@ public class Session  extends FortEntity implements PwMessage, Serializable
         //this.sessionId = inSession.getSessionId();
         this.lastAccess = inSession.getLastAccess();
         this.timeout = inSession.getTimeout();
-/*        this.warningId = inSession.getWarningId();*/
         this.errorId = inSession.getErrorId();
         this.graceLogins = inSession.getGraceLogins();
         this.expirationSeconds = inSession.expirationSeconds;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java b/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
index 84e7d8d..e63db7e 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
@@ -32,6 +32,7 @@ import javax.xml.bind.annotation.XmlType;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/model/UserRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/UserRole.java b/src/main/java/org/apache/directory/fortress/core/model/UserRole.java
index 9dedd8f..fa3bf5b 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/UserRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/UserRole.java
@@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlType;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/util/ConstraintUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/ConstraintUtil.java b/src/main/java/org/apache/directory/fortress/core/util/ConstraintUtil.java
new file mode 100644
index 0000000..9631314
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/util/ConstraintUtil.java
@@ -0,0 +1,355 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.fortress.core.util;
+
+import java.util.StringTokenizer;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.directory.fortress.core.ValidationException;
+import org.apache.directory.fortress.core.model.Constraint;
+import org.apache.directory.fortress.core.model.ConstraintValidator;
+import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.util.VUtil;
+
+/**
+ *  Utilities to copy constraints attributes between entities.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ConstraintUtil
+{
+
+    private static final ConstraintValidator constraintValidator = VUtil.getConstraintValidator();
+
+    /**
+     * Copy source constraint to target. Both must be created before calling this utility.
+     *
+     * @param srcC contains constraint source.
+     * @param trgC contains target constraint.
+     */
+    public static void copy( Constraint srcC, Constraint trgC )
+    {
+        // Both variables must be instantiated before being passed in to this method.
+        trgC.setTimeout( srcC.getTimeout() );
+
+        if ( StringUtils.isNotEmpty( srcC.getName() ) )
+        {
+            trgC.setName( srcC.getName() );
+        }
+        if ( StringUtils.isNotEmpty( srcC.getBeginTime() ) )
+        {
+            trgC.setBeginTime( srcC.getBeginTime() );
+        }
+        if ( StringUtils.isNotEmpty( srcC.getEndTime() ) )
+        {
+            trgC.setEndTime( srcC.getEndTime() );
+        }
+        if ( StringUtils.isNotEmpty( srcC.getDayMask() ) )
+        {
+            trgC.setDayMask( srcC.getDayMask() );
+        }
+        if ( StringUtils.isNotEmpty( srcC.getBeginDate() ) )
+        {
+            trgC.setBeginDate( srcC.getBeginDate() );
+        }
+        if ( StringUtils.isNotEmpty( srcC.getEndDate() ) )
+        {
+            trgC.setEndDate( srcC.getEndDate() );
+        }
+        if ( StringUtils.isNotEmpty( srcC.getBeginLockDate() ) )
+        {
+            trgC.setBeginLockDate( srcC.getBeginLockDate() );
+        }
+        if ( StringUtils.isNotEmpty( srcC.getEndLockDate() ) )
+        {
+            trgC.setEndLockDate( srcC.getEndLockDate() );
+        }
+    }
+
+
+    /**
+     * Validate the non-null attributes on the constraint.
+     *
+     * @param c1 contains the temporal values associated with an entity.
+     * @throws org.apache.directory.fortress.core.ValidationException on first invalid attribute found.
+     */
+    public static void validate( Constraint c1 )
+        throws ValidationException
+    {
+        if ( c1.getTimeout() != null )
+        {
+            constraintValidator.timeout( c1.getTimeout() );
+        }
+        if ( StringUtils.isNotEmpty( c1.getBeginTime() ) )
+        {
+            constraintValidator.beginTime( c1.getBeginTime() );
+        }
+        if ( StringUtils.isNotEmpty( c1.getEndTime() ) )
+        {
+            constraintValidator.endTime( c1.getEndTime() );
+        }
+        if ( StringUtils.isNotEmpty( c1.getBeginDate() ) )
+        {
+            constraintValidator.beginDate( c1.getBeginDate() );
+        }
+        if ( StringUtils.isNotEmpty( c1.getEndDate() ) )
+        {
+            constraintValidator.endDate( c1.getEndDate() );
+        }
+        if ( StringUtils.isNotEmpty( c1.getDayMask() ) )
+        {
+            constraintValidator.dayMask( c1.getDayMask() );
+        }
+        if ( StringUtils.isNotEmpty( c1.getBeginLockDate() ) )
+        {
+            constraintValidator.beginDate( c1.getBeginLockDate() );
+        }
+        if ( StringUtils.isNotEmpty( c1.getEndLockDate() ) )
+        {
+            constraintValidator.endDate( c1.getEndLockDate() );
+        }
+    }
+    /**
+     * Used by DAO utilities to convert from a string with comma delimited values to fortress internal format {@link Constraint}.
+     *
+     * @param inputString contains raw data format which is comma delimited containing temporal data.
+     * @param constraint  used by internal processing to perform validations.
+     */
+    public static void setConstraint( String inputString, Constraint constraint )
+    {
+        if ( StringUtils.isNotEmpty( inputString ) )
+        {
+            StringTokenizer tkn = new StringTokenizer( inputString, Config.getInstance().getDelimiter(), true );
+            if ( tkn.countTokens() > 0 )
+            {
+                int count = tkn.countTokens();
+                int index = 0;
+                boolean previousTokenWasDelimiter = false;
+                for ( int i = 0; i < count; i++ )
+                {
+                    String szValue = tkn.nextToken();
+                    if ( szValue.equals( Config.getInstance().getDelimiter() ) && !previousTokenWasDelimiter )
+                    {
+                        previousTokenWasDelimiter = true;
+                    }
+                    else if ( szValue.equals( Config.getInstance().getDelimiter() ) )
+                    {
+                        previousTokenWasDelimiter = true;
+                        index++;
+                    }
+                    else
+                    {
+                        previousTokenWasDelimiter = false;
+                        switch ( index++ )
+                        {
+                            case 0:
+                                // only set the name attr if it isn't already set:
+                                if ( ( constraint.getName() == null ) || ( constraint.getName().length() == 0 ) )
+                                {
+                                    constraint.setName( szValue );
+                                }
+
+                                break;
+                            case 1:
+                                constraint.setTimeout( Integer.parseInt( szValue ) );
+                                break;
+                            case 2:
+                                constraint.setBeginTime( szValue );
+                                break;
+                            case 3:
+                                constraint.setEndTime( szValue );
+                                break;
+                            case 4:
+                                constraint.setBeginDate( szValue );
+                                break;
+                            case 5:
+                                constraint.setEndDate( szValue );
+                                break;
+                            case 6:
+                                constraint.setBeginLockDate( szValue );
+                                break;
+                            case 7:
+                                constraint.setEndLockDate( szValue );
+                                break;
+                            case 8:
+                                constraint.setDayMask( szValue );
+                                break;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Convert from fortress {@link Constraint} to comma delimited ldap format.
+     *
+     * @param constraint contains the temporal data.
+     * @return string containing raw data bound for ldap.
+     */
+    public static String setConstraint( Constraint constraint )
+    {
+        String szConstraint = null;
+        String delimiter = Config.getInstance().getDelimiter();
+        if ( constraint != null )
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.append( constraint.getName() );
+            sb.append( delimiter );
+
+            if ( constraint.getTimeout() != null )
+            {
+                sb.append( constraint.getTimeout() );
+            }
+
+            sb.append( delimiter );
+
+            if ( constraint.getBeginTime() != null )
+            {
+                sb.append( constraint.getBeginTime() );
+            }
+
+            sb.append( delimiter );
+
+            if ( constraint.getEndTime() != null )
+            {
+                sb.append( constraint.getEndTime() );
+            }
+
+            sb.append( delimiter );
+
+            if ( constraint.getBeginDate() != null )
+            {
+                sb.append( constraint.getBeginDate() );
+            }
+
+            sb.append( delimiter );
+
+            if ( constraint.getEndDate() != null )
+            {
+                sb.append( constraint.getEndDate() );
+            }
+
+            sb.append( delimiter );
+
+            if ( constraint.getBeginLockDate() != null )
+            {
+                sb.append( constraint.getBeginLockDate() );
+            }
+
+            sb.append( delimiter );
+
+            if ( constraint.getEndLockDate() != null )
+            {
+                sb.append( constraint.getEndLockDate() );
+            }
+
+            sb.append( delimiter );
+
+            if ( constraint.getDayMask() != null )
+            {
+                sb.append( constraint.getDayMask() );
+            }
+
+            szConstraint = sb.toString();
+        }
+        return szConstraint;
+    }
+
+
+    /**
+     * Utility is used during processing of constraint values.  The rule used here is if the target constraint will
+     * accept the source constraint attribute only when not set initially.  If target constraint's attribute is set,
+     * validation on the constraint will be performed.
+     *
+     * @param srcC Contains instantiated constraint with one or more attributes to be copied.
+     * @param trgC instantiated object may contain zero or more attributes set.  Copy will not be performed on set attrs.
+     * @throws org.apache.directory.fortress.core.ValidationException on first invalid attribute found.
+     */
+    public static void validateOrCopy( Constraint srcC, Constraint trgC )
+        throws ValidationException
+    {
+        if ( trgC.getTimeout() != null )
+        {
+            srcC.setTimeout( trgC.getTimeout() );
+        }
+        else if ( srcC.getTimeout() != null )
+        {
+            trgC.setTimeout( srcC.getTimeout() );
+        }
+        if ( StringUtils.isNotEmpty( trgC.getBeginTime() ) )
+        {
+            constraintValidator.beginTime( trgC.getBeginTime() );
+        }
+        else if ( StringUtils.isNotEmpty( srcC.getBeginTime() ) )
+        {
+            trgC.setBeginTime( srcC.getBeginTime() );
+        }
+        if ( StringUtils.isNotEmpty( trgC.getEndTime() ) )
+        {
+            constraintValidator.endTime( trgC.getEndTime() );
+        }
+        else if ( StringUtils.isNotEmpty( srcC.getEndTime() ) )
+        {
+            trgC.setEndTime( srcC.getEndTime() );
+        }
+        if ( StringUtils.isNotEmpty( trgC.getBeginDate() ) )
+        {
+            constraintValidator.beginDate( trgC.getBeginDate() );
+        }
+        else if ( StringUtils.isNotEmpty( srcC.getBeginDate() ) )
+        {
+            trgC.setBeginDate( srcC.getBeginDate() );
+        }
+        if ( StringUtils.isNotEmpty( trgC.getEndDate() ) )
+        {
+            constraintValidator.endDate( trgC.getEndDate() );
+        }
+        else if ( StringUtils.isNotEmpty( srcC.getEndDate() ) )
+        {
+            trgC.setEndDate( srcC.getEndDate() );
+        }
+        if ( StringUtils.isNotEmpty( trgC.getDayMask() ) )
+        {
+            constraintValidator.dayMask( trgC.getDayMask() );
+        }
+        else if ( StringUtils.isNotEmpty( srcC.getDayMask() ) )
+        {
+            trgC.setDayMask( srcC.getDayMask() );
+        }
+        if ( StringUtils.isNotEmpty( trgC.getBeginLockDate() ) )
+        {
+            constraintValidator.beginDate( trgC.getBeginLockDate() );
+        }
+        else if ( StringUtils.isNotEmpty( srcC.getBeginLockDate() ) )
+        {
+            trgC.setBeginLockDate( srcC.getBeginLockDate() );
+        }
+        if ( StringUtils.isNotEmpty( trgC.getEndLockDate() ) )
+        {
+            constraintValidator.endDate( trgC.getEndLockDate() );
+        }
+        else if ( StringUtils.isNotEmpty( srcC.getEndLockDate() ) )
+        {
+            trgC.setEndLockDate( srcC.getEndLockDate() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/util/PropUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/PropUtil.java b/src/main/java/org/apache/directory/fortress/core/util/PropUtil.java
new file mode 100644
index 0000000..3b18265
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/util/PropUtil.java
@@ -0,0 +1,140 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.fortress.core.util;
+
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.apache.directory.fortress.core.GlobalIds;
+
+/**
+ *  Utilities to convert to/from property formats.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class PropUtil
+{
+    /**
+     * Convert from a {@link java.util.List} of properties stored as name:value pairs to
+     * a {@link java.util.Properties}.
+     *
+     * @param propList contains a list of name-value pairs separated by a ':'.
+     * @return reference to a Properties collection.
+     */
+    public static Properties getProperties(List<String> propList)
+    {
+        return getProperties(propList, GlobalIds.PROP_SEP );
+    }
+
+    /**
+     * Convert from a {@link java.util.List} of properties stored as name:value pairs to
+     * a {@link java.util.Properties}.
+     *
+     * @param propList contains a list of name-value pairs separated by a ':'.
+     * @param separator contains char to be used to separate key and value.
+     * @return reference to a Properties collection.
+     */
+    public static Properties getProperties( List<String> propList, char separator )
+    {
+        Properties props = null;
+        if (propList != null && propList.size() > 0)
+        {
+            props = new Properties();
+            propList.size();
+            for (String raw : propList)
+            {
+                int indx = raw.indexOf(separator);
+                if (indx >= 1)
+                {
+                    props.setProperty(raw.substring(0, indx), raw.substring(indx + 1));
+                }
+            }
+        }
+        return props;
+    }
+
+    /**
+     * Convert from a comma delimited list of name-value pairs separated by a ':'.  Return the pros as {@link java.util.Properties}.
+     *
+     * @param inputString contains comma delimited list of properties.
+     * @return java collection class containing props.
+     */
+    public static Properties getProperties( String inputString )
+    {
+        return getProperties( inputString, GlobalIds.PROP_SEP );
+    }
+
+    /**
+     * Convert from a comma delimited list of name-value pairs separated by a ':'.  Return the pros as {@link java.util.Properties}.
+     *
+     * @param inputString contains comma delimited list of properties.
+     * @param separator contains char to be used to separate key and value.
+     * @return java collection class containing props.
+     */
+    public static Properties getProperties( String inputString, char separator )
+    {
+        return getProperties( inputString, separator, Config.getInstance().getDelimiter() );
+    }
+
+    /**
+     * Convert from a comma delimited list of name-value pairs separated by a ':'.  Return the pros as {@link java.util.Properties}.
+     *
+     * @param inputString contains comma delimited list of properties.
+     * @param separator contains char to be used to separate key and value.
+     * @param delimiter contains a single char specifying delimiter between properties.
+     * @return java collection class containing props.
+     */
+    public static Properties getProperties( String inputString, char separator, String delimiter )
+    {
+        Properties props = new Properties();
+        if (inputString != null && inputString.length() > 0)
+        {
+            StringTokenizer maxTkn = new StringTokenizer(inputString, delimiter);
+            if (maxTkn.countTokens() > 0)
+            {
+                while (maxTkn.hasMoreTokens())
+                {
+                    String val = maxTkn.nextToken();
+                    int indx = val.indexOf(separator);
+                    if (indx >= 1)
+                    {
+                        String name = val.substring(0, indx).trim();
+                        String value = val.substring(indx + 1).trim();
+                        props.setProperty(name, value);
+                    }
+                }
+            }
+        }
+        return props;
+    }
+
+
+    /**
+     * Method will return true if props is not null or empty.
+     *
+     * @param props contains the reference to props.
+     * @return boolean if validation succeeds.
+     */
+    public static boolean isNotEmpty( Properties props )
+    {
+        return ( props != null ) && ( props.size() > 0 );
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/VUtil.java b/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
index 3b3cf12..2f748fb 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
@@ -39,7 +39,6 @@ import org.apache.directory.fortress.core.model.Constraint;
 import org.apache.directory.fortress.core.model.ConstraintValidator;
 import org.apache.directory.fortress.core.model.Group;
 import org.apache.directory.fortress.core.model.ObjectFactory;
-import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.UserRole;
 import org.apache.directory.fortress.core.model.Warning;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java b/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
index 0ba4040..083d26b 100755
--- a/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
+++ b/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
@@ -26,7 +26,7 @@ import org.apache.directory.fortress.core.model.Group;
 import java.util.Enumeration;
 import java.util.List;
 
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.PropUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java b/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
index e46d2d2..beaa3f4 100755
--- a/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
+++ b/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
@@ -42,7 +42,7 @@ import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.util.Config;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/42d14165/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java b/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java
index 7699943..195e761 100755
--- a/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java
+++ b/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java
@@ -28,7 +28,7 @@ import org.apache.directory.fortress.core.AdminMgrFactory;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.ReviewMgr;
 import org.apache.directory.fortress.core.SecurityException;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.util.ConstraintUtil;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
 import org.apache.directory.fortress.core.model.PermissionAttribute;


Mime
View raw message