Changeset 795:115d093b990d
- Timestamp:
- 01/20/12 09:05:29 (4 months ago)
- Branch:
- default
- Children:
- 797:1cd75f3ad1a9, 798:18dc986d4e82
- Parents:
- 794:ff94810e0e84 (diff), 793:e9056273c248 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kraken-dom/src/main/java/org/krakenapps/dom/api/impl/UserApiImpl.java
r792 r795 30 30 import org.apache.felix.ipojo.annotations.Validate; 31 31 import org.krakenapps.confdb.Config; 32 import org.krakenapps.confdb.ConfigIterator; 32 33 import org.krakenapps.confdb.ConfigTransaction; 33 34 import org.krakenapps.confdb.Predicate; … … 271 272 @Override 272 273 public void entityRemoving(String domain, OrganizationUnit orgUnit, ConfigTransaction xact, Object state) { 273 boolean remove = (state != null) && (state instanceof Boolean) && ((Boolean) state); 274 275 for (User user : getUsers(domain, orgUnit.getGuid(), false)) { 276 Config c = xact.getDatabase().findOne(cls, getPred(user.getLoginName())); 277 278 if (remove) { 279 xact.getDatabase().remove(xact, c, true); 280 } else { 274 boolean move = (state != null) && (state instanceof Boolean) && ((Boolean) state); 275 276 List<Predicate> preds = new ArrayList<Predicate>(); 277 for (User user : getUsers(domain, orgUnit.getGuid(), false)) 278 preds.add(getPred(user.getLoginName())); 279 280 ConfigIterator it = xact.getDatabase().find(cls, Predicates.or(preds.toArray(new Predicate[0]))); 281 while (it.hasNext()) { 282 Config c = it.next(); 283 User user = c.getDocument(User.class); 284 285 if (move) { 281 286 user.setOrgUnit(null); 282 287 xact.getDatabase().update(xact, c, user, true); 288 } else { 289 xact.getDatabase().remove(xact, c, true); 283 290 } 284 291 } -
kraken-dom/src/main/java/org/krakenapps/dom/api/impl/UserApiImpl.java
r794 r795 46 46 import org.osgi.framework.ServiceReference; 47 47 import org.osgi.util.tracker.ServiceTracker; 48 import org.slf4j.Logger; 49 import org.slf4j.LoggerFactory; 48 50 49 51 @Component(name = "dom-user-api") 50 52 @Provides 51 53 public class UserApiImpl extends DefaultEntityEventProvider<User> implements UserApi, EntityEventListener<OrganizationUnit> { 54 private final Logger logger = LoggerFactory.getLogger(UserApiImpl.class.getName()); 52 55 private static final Class<User> cls = User.class; 53 56 private static final String NOT_FOUND = "user-not-found"; … … 213 216 Random rand = new Random(); 214 217 char[] c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".toCharArray(); 215 for (int i = 0; i < getSaltLength(domain); i++) 218 219 int saltLength = getSaltLength(domain); 220 logger.trace("kraken dom: salt length [{}]", saltLength); 221 222 for (int i = 0; i < saltLength; i++) 216 223 salt.append(c[rand.nextInt(c.length)]); 217 224 return salt.toString();
Note: See TracChangeset
for help on using the changeset viewer.
