/** Build an EL path which locates the referred-to entity **/ public String getELPath() { return PathUtil.buildPath(entity.entityname, entity.ID); }
/** * Builds an EL path of from an array of path segments. Particulary good when using * Strings of BeanLocators, Maps, and friends. Assumes none of the segments * have been escaped yet. * * @param segments array of paths * @return el path */ public static String buildPath(String[] segments) { return buildPath(segments, 0, segments.length); }
/** Disused method */ public List getInvalidatingEntries(String path) { ArrayList togo = new ArrayList(); String[] splitEL = PathUtil.splitPath(path); StringList goup = new StringList(); for (int i = 0; i < splitEL.length; ++ i) { goup.add(splitEL[i]); String upstring = PathUtil.buildPath(goup.toStringArray()); List deps = (List) writemap.get(upstring); if (deps != null) { togo.addAll(deps); } } return togo; } }
public int preserveImmediate(BeanLocator source, StringList beannames, String tokenid) { HashMap beans = new HashMap(); for (int i = 0; i < beannames.size(); ++i) { String beanname = beannames.stringAt(i); Object bean = alterer.getBeanValue(beanname, source, null); // This branch generally useful for entity bean locators if (bean instanceof IterableBeanLocator) { IterableBeanLocator iterablebean = (IterableBeanLocator) bean; for (Iterator beanit = iterablebean.iterator(); beanit.hasNext(); ) { String subbeanname = (String) beanit.next(); Object subbean = iterablebean.locateBean(subbeanname); String fullpath = PathUtil.buildPath(beanname, subbeanname); beans.put(fullpath, subbean); } } if (bean != null) { beans.put(beanname, bean); Logger.log.info("BeanCopy preserved to path " + beanname + ": " + bean); } } String token = basekey + tokenid; holder.putTokenState(token, beans); Logger.log.info("BeanCopy saved " + beans.size() + " beans to token " + token); return beans.size(); }
public Object invokeBeanMethod(ShellInfo shells, BeanPredicateModel addressibleModel) { int lastshell = shells.shells.length; Object[] args = new Object[shells.segments.length - lastshell]; for (int i = 0; i < args.length; ++i) { args[i] = fetchArgument(shells.shells[0], shells.segments[i + lastshell], addressibleModel); } Object bean = shells.shells[lastshell - 1]; String methodname = shells.segments[lastshell - 1]; try { return reflectivecache.invokeMethod(bean, methodname, args); } catch (Throwable t) { // Need to grab "NoSuchMethodError" throw UniversalRuntimeException.accumulate(t, "Error invoking method " + methodname + " in bean at path " + PathUtil.buildPath(shells.segments, 0, lastshell)); } }
if (candidates.size() > 1) { Logger.log.warn("Warning: duplicate DataConverter candidates discovered for EL path " + PathUtil.buildPath(shellinfo.segments) + " only the last (probably the most specific) entry will be applied.");
public DataAlterationRequest reshapeDAR(DataAlterationRequest toshape) { if (toshape.type.equals(DataAlterationRequest.ADD)) { String cutback = PathUtil.getToTailPath(toshape.path); // cutback may be null! so examine methods of cutback2. This MUST // be a concrete object!! String cutback2 = PathUtil.getToTailPath(cutback); String membername = PathUtil.getTailPath(cutback); Object lastentity = bma.getBeanValue(cutback2, rbl, addressibleBeanModel); MethodAnalyser ma = mappingcontext.getAnalyser(lastentity.getClass()); AccessMethod sam = ma.getAccessMethod(membername); String entityname = eni.getEntityName(sam.getDeclaredType()); if (entityname == null) { String message = "ID Defunnelling reshaper could not infer entity name for entity of type " + sam.getDeclaredType() + " - make sure to supply an EntityNameInferrer for this type"; Logger.log.warn(message); throw new IllegalArgumentException(message); } Object newentity = null; if (toshape.data != null) { // data has already been conformed in type to "oldvalue" and so is at least scalar String newentitypath = PathUtil.buildPath(entityname, (String)toshape.data); newentity = bma.getBeanValue(newentitypath, rbl, addressibleBeanModel); } DataAlterationRequest togo = new DataAlterationRequest(cutback, newentity); return togo; } else { return toshape; } }