@Override public void setMethodStorage(MethodStorage methodStorage) { this.methodStorage = methodStorage; reload(); }
public AbstractOMethodDefinitionStorage(MethodStorage storage) { setMethodStorage(storage); }
@Override public boolean isSupportedMethod(IMethodContext dataObject) { if (getFilters()!=null){ for (IMethodFilter iMethodFilter : getFilters()) { if (!iMethodFilter.isSupportedMethod(dataObject)){ return false; } } } return true; } }
@Override protected List<IMethodFilter> makeFilters(OFilter[] filters) { List<IMethodFilter> ret = super.makeFilters(filters); if(getSelector().isEmpty()) ret.add(new SelectorFilter().setFilterData(javaClass.getSimpleName())); return ret; }
@Override public void reload() { definitions = new HashSet<IMethodDefinition>(); for (Class<?> class1 : methodStorage.getMethodClasses()) { if (JavaClassOMethodDefinition.isSupportedClass(class1)){ definitions.add(new JavaClassOMethodDefinition(class1)); } } } }
private OMethodsManager() { methodStorage = new MethodStorage(); definitionsStorages = new HashSet<IMethodDefinitionStorage>(); addDefinitionsStorage(new JavaClassOMethodDefinitionStorage(methodStorage)); addDefinitionsStorage(new JavaMethodOMethodDefinitionStorage(methodStorage)); }
@Override public IMethod getMethod(IMethodContext dataObject) { try { IMethod newMethod=null; if(MethodPlace.DATA_TABLE.equals(dataObject.getPlace())){ newMethod = getTableIMethodClass().newInstance(); }else{ newMethod = getIMethodClass().newInstance(); } if (newMethod!=null){ newMethod.init(this, dataObject); return newMethod; } } catch (InstantiationException | IllegalAccessException e) { LOG.error("Can't obtain a method", e); } return null; }
protected List<IMethodFilter> makeFilters(OFilter[] filters){ ArrayList<IMethodFilter> result = new ArrayList<IMethodFilter>(filters.length); for (OFilter iMethodFilter : filters) { IMethodFilter newFilter; try { newFilter = iMethodFilter.fClass().newInstance(); newFilter.setFilterData(iMethodFilter.fData()); result.add(newFilter); } catch (InstantiationException | IllegalAccessException e) { LOG.error("Can't make a filter", e); } } if (!getSelector().isEmpty()){ result.add(new SelectorFilter().setFilterData(getSelector())); } if (!getPermission().isEmpty()){ result.add(new PermissionFilter().setFilterData(getPermission())); } return result; }
String titleKey = getConfig().getTitleKey(); if (titleKey.isEmpty()){ titleKey = getConfig().getMethodId();
@Override public List<IMethodFilter> getFilters() { if (filters == null){ filters = makeFilters(oMethod.filters()); } return filters; } @Override
@Override public void reload() { definitions = new HashSet<IMethodDefinition>(); for (java.lang.reflect.Method f : methodStorage.getMethodFields()) { definitions.add(new JavaMethodOMethodDefinition(f)); } }
@Override public Command<?> getWrappedCommand(String id) { try { Constructor<?> c = javaClass.getConstructor(String.class, IModel.class); return (Command<?>) c.newInstance(id, getContext().getDisplayObjectModel()); } catch (Exception e) { LOG.error("Can't create a command", e); return null; } } };
@Override protected void performMultiAction(AjaxRequestTarget target, List<ODocument> objects) { for (ODocument curDoc : objects) { invoke(curDoc); } if (getConfig().isResetSelection()){ resetSelection(); } } };