Changeset 6930
- Timestamp:
- Jun 10, 2015, 11:41:55 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/Base.java
r6921 r6930 806 806 public static ItemContext loadContext(SessionControl sc, int contextId, ItemContext defaultContext) 807 807 { 808 ItemContext cc = sc.loadContext(contextId );808 ItemContext cc = sc.loadContext(contextId, true); 809 809 // Copy default columns so it is always available in other contexts 810 810 if (defaultContext != null && cc != null) -
trunk/src/core/net/sf/basedb/core/ItemContext.java
r6896 r6930 1404 1404 { 1405 1405 return objects == null ? null : objects.remove(name); 1406 } 1407 1408 /** 1409 Copies all objects and temporary filters from this context 1410 to another context. 1411 @since 3.6 1412 */ 1413 public void copyObjectsAndTemporaryFilters(ItemContext other) 1414 { 1415 if (objects != null || objects.size() > 0) 1416 { 1417 if (other.objects == null) other.objects = new HashMap<String, Object>(); 1418 other.objects.putAll(objects); 1419 } 1420 for (PropertyFilterPair filter : propertyFilters.values()) 1421 { 1422 if (filter.temporary != null) 1423 { 1424 other.setPropertyFilter(filter.temporary); 1425 } 1426 } 1406 1427 } 1407 1428 -
trunk/src/core/net/sf/basedb/core/SessionControl.java
r6688 r6930 1381 1381 throws NotLoggedInException, BaseException 1382 1382 { 1383 return loadContext(contextId, false); 1384 } 1385 1386 /** 1387 Load a context and make it the current context, optionally copying 1388 temporary filters and objects from the current context to the loaded context. 1389 If a saved context with the specified ID 1390 doesn't exists, or if the logged in user does't have permission to read it, 1391 null is returned and the current context is left unchanged. 1392 1393 @param contextId The ID of the context to load 1394 @return An <code>ItemContext</code> object or null 1395 @throws NotLoggedInException If no user is logged in 1396 @throws BaseException If there is another error 1397 @see #saveCurrentContextAs(Item, String, boolean, boolean) 1398 @see #getContextNames(Item) 1399 @since 3.6 1400 */ 1401 public ItemContext loadContext(int contextId, boolean copyTemporaryObjects) 1402 throws NotLoggedInException, BaseException 1403 { 1383 1404 updateLastAccess(); 1384 1405 if (!isLoggedIn()) … … 1390 1411 { 1391 1412 ContextKey contextKey = new ContextKey(context.getItemType(), context.getSubContext()); 1392 currentContexts.put(contextKey, context); 1413 ItemContext old = currentContexts.put(contextKey, context); 1414 if (copyTemporaryObjects && old != null) 1415 { 1416 old.copyObjectsAndTemporaryFilters(context); 1417 } 1393 1418 } 1394 1419 return context; 1395 1420 } 1421 1396 1422 1397 1423 /**
Note: See TracChangeset
for help on using the changeset viewer.