Search in sources :

Example 1 with UserInfoQuery

use of net.geoprism.registry.UserInfoQuery in project geoprism-registry by terraframe.

the class UserInfoPatch method doIt.

@Transaction
private void doIt() {
    UserInfoQuery query = new UserInfoQuery(new QueryFactory());
    try (OIterator<? extends UserInfo> it = query.getIterator()) {
        while (it.hasNext()) {
            UserInfo info = it.next();
            info.appLock();
            info.apply();
        }
    }
    // Ensure all geoprism users have a user info
    GeoprismUserQuery gQuery = new GeoprismUserQuery(new QueryFactory());
    try (OIterator<? extends GeoprismUser> it = gQuery.getIterator()) {
        while (it.hasNext()) {
            GeoprismUser user = it.next();
            UserInfo info = UserInfo.getByUser(user);
            if (info == null) {
                info = new UserInfo();
                info.setGeoprismUser(user);
                info.apply();
            }
        }
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) GeoprismUserQuery(net.geoprism.GeoprismUserQuery) UserInfo(net.geoprism.registry.UserInfo) GeoprismUser(net.geoprism.GeoprismUser) UserInfoQuery(net.geoprism.registry.UserInfoQuery) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

Transaction (com.runwaysdk.dataaccess.transaction.Transaction)1 QueryFactory (com.runwaysdk.query.QueryFactory)1 GeoprismUser (net.geoprism.GeoprismUser)1 GeoprismUserQuery (net.geoprism.GeoprismUserQuery)1 UserInfo (net.geoprism.registry.UserInfo)1 UserInfoQuery (net.geoprism.registry.UserInfoQuery)1