/** * Get target. * Try tracking. * * @param user the target's user * @param used the target's owner * @return target */ protected static Object getTarget(ControllerContext user, ControllerContext used) { if (used instanceof ContextTracking) { ContextTracking ct = ContextTracking.class.cast(used); return ct.getTarget(user); } else { return used.getTarget(); } }
/** * Get target. * * @param context the context to get target from * @param isInstallPhase is it install phase * @return context's target */ protected Object getTarget(ControllerContext context, boolean isInstallPhase) { Object target; if (isInstallPhase) { if (context instanceof ContextTracking && owner instanceof ControllerContext) target = ContextTracking.class.cast(context).getTarget(ControllerContext.class.cast(owner)); else target = context.getTarget(); } else { if (context instanceof ContextTracking && owner instanceof ControllerContext) target = ContextTracking.class.cast(context).ungetTarget(ControllerContext.class.cast(owner)); else target = context.getTarget(); } return target; }