Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Copyright 2007 - 2008 Pentaho Corporation.  All rights reserved.
   * This software was developed by Pentaho Corporation and is provided under the terms 
   * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
   * this file except in compliance with the license. If you need a copy of the license, 
   * please go to The Original Code is the Pentaho 
   * BI Platform.  The Initial Developer is Pentaho Corporation.
   * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
  * the license for the specific language governing your rights and limitations.
 /* Copyright 2004, 2005 Acegi Technology Pty Limited
  * Licensed 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
  * 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.
Property editor to assist with the setup of a UserRoleListEnhancedUserMap.

The format of entries should be:


The password must always be the first entry after the equals. The enabled or disabled keyword can appear anywhere (apart from the first entry reserved for the password). If neither enabled or disabled appear, the default is enabled. At least one granted authority must be listed.

The username represents the key and duplicates are handled the same was as duplicates would be in Java Properties files.

If the above requirements are not met, the invalid entry will be silently ignored.

This editor always assumes each entry has a non-expired account and non-expired credentials. However, it does honour the user enabled/disabled flag as described above.

Ben Alex
$Id:,v 1.1 2006/04/19 04:57:50 mbatchelor Exp $
   // ~ Methods
   // ================================================================
   public void setAsText(final String sthrows IllegalArgumentException {
     UserRoleListEnhancedUserMap userRoleListEnhanceduserMap = new UserRoleListEnhancedUserMap();
     if ((s == null) || "".equals(s)) { //$NON-NLS-1$
       // Leave value in property editor null
     } else {
       // Use properties editor to tokenize the string
       PropertiesEditor propertiesEditor = new PropertiesEditor();
       Properties props = (PropertiespropertiesEditor.getValue();
      final Properties props) {
    // Now we have properties, process each one individually
    UserAttributeEditor configAttribEd = new UserAttributeEditor();
    for (Object element : props.keySet()) {
      String username = (Stringelement;
      String value = props.getProperty(username);
      // Convert value to a password, enabled setting, and list of granted
      // authorities
      UserAttribute attr = (UserAttributeconfigAttribEd.getValue();
      // Make a user object, assuming the properties were properly
      // provided
      if (attr != null) {
        UserDetails user = new User(usernameattr.getPassword(), attr.isEnabled(), truetruetrueattr
    return userMap;
New to GrepCode? Check out our FAQ X