/** * Constructs a new {@code BeanModuleDescriptor} instance. * * @param name * the name of the descriptor (the actual module class name). * @param moduleObjectReferencedDescriptor * the component descriptor of the module object. */ protected BeanModuleDescriptor(String name, IComponentDescriptor<?> moduleObjectReferencedDescriptor) { super(name); BasicReferencePropertyDescriptor<Object> moduleObjectDescriptor = new BasicReferencePropertyDescriptor<>(); moduleObjectDescriptor .setReferencedDescriptor(moduleObjectReferencedDescriptor); moduleObjectDescriptor.setName(BeanModule.MODULE_OBJECT); List<IPropertyDescriptor> propertyDescriptors = new ArrayList<>( getPropertyDescriptors()); propertyDescriptors.add(moduleObjectDescriptor); setPropertyDescriptors(propertyDescriptors); }
private IReferencePropertyDescriptor<IComponent> createEntityRefQueryDescriptor( IComponentDescriptor<? extends IComponent> descriptor, Map<String, Object> initMapping) { IReferencePropertyDescriptor<IComponent> refQueryDescriptor = null; if (descriptor != null) { refQueryDescriptor = new BasicReferencePropertyDescriptor<>(); ((BasicReferencePropertyDescriptor<IComponent>) refQueryDescriptor).setReferencedDescriptor(descriptor); ((BasicReferencePropertyDescriptor<IComponent>) refQueryDescriptor).setInitializationMapping(initMapping); } return refQueryDescriptor; }
/** * Create a basic query component reference descriptor. * <p/> * {@inheritDoc} */ @Override public IReferencePropertyDescriptor<IQueryComponent> createQueryComponentReferenceDescriptor( String referencePropertyName, IComponentDescriptorProvider<IComponent> componentDescriptorProvider) { BasicReferencePropertyDescriptor<IQueryComponent> referencePropertyDescriptor = new BasicReferencePropertyDescriptor<>(); referencePropertyDescriptor.setName(referencePropertyName); referencePropertyDescriptor.setMandatory(false); // since it cannot be auto-created by the framework referencePropertyDescriptor.setReferencedDescriptor(createQueryComponentDescriptor(componentDescriptorProvider)); return referencePropertyDescriptor; }
.createQueryDescriptor(); BasicReferencePropertyDescriptor<E> queryDescriptor = new BasicReferencePropertyDescriptor<>(); queryDescriptor.setName(defaultQueryDescriptor.getName()); queryDescriptor.setI18nNameKey(defaultQueryDescriptor.getI18nNameKey()); queryDescriptor.setDescription(defaultQueryDescriptor.getDescription()); queryDescriptor.setGrantedRoles(defaultQueryDescriptor.getGrantedRoles()); queryDescriptor.setMandatory(defaultQueryDescriptor.isMandatory()); queryDescriptor.setReadabilityGates(defaultQueryDescriptor .getReadabilityGates()); queryDescriptor.setReadOnly(defaultQueryDescriptor.isReadOnly()); queryDescriptor.setSqlName(defaultQueryDescriptor.getSqlName()); queryDescriptor.setWritabilityGates(defaultQueryDescriptor .getWritabilityGates()); queryDescriptor.setDelegateClassName(defaultQueryDescriptor .getDelegateClassName()); queryDescriptor.setComputed(defaultQueryDescriptor.isComputed()); queryDescriptor.setReferencedDescriptor(getReferencedDescriptor() .getElementDescriptor().createQueryDescriptor()); return queryDescriptor;
BasicReferencePropertyDescriptor<Module> parentDescriptor = new BasicReferencePropertyDescriptor<Module>(); parentDescriptor.setName("parent"); parentDescriptor.setReferencedDescriptor(this); i18nDescriptionDescriptor.setName("i18nDescription"); parentDescriptor.setReverseRelationEnd(subModulesDescriptor); subModulesDescriptor.setReverseRelationEnd(parentDescriptor);
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public BasicReferencePropertyDescriptor<E> createQueryDescriptor() { BasicReferencePropertyDescriptor<E> queryDescriptor = (BasicReferencePropertyDescriptor<E>) super .createQueryDescriptor(); IComponentDescriptor<? extends E> realReferencedDescriptor = /*queryDescriptor .*/getReferencedDescriptor(); IComponentDescriptor<? extends E> queryReferencedDescriptor = realReferencedDescriptor .createQueryDescriptor(); queryDescriptor.setReferencedDescriptor(queryReferencedDescriptor); return queryDescriptor; }
IReferencePropertyDescriptor<IComponent> refinedErqDescriptor = ((BasicReferencePropertyDescriptor<IComponent>) erqDescriptor) .clone(); ((BasicReferencePropertyDescriptor<IComponent>) refinedErqDescriptor).setReferencedDescriptor( (IComponentDescriptor<? extends IComponent>) getComponentDescriptorRegistry() .getComponentDescriptor(erqDescriptor.getModelType()));
basicRefPropDesc.setReferencedDescriptor(createOrGetRefQueryDescriptor(referencedDescriptor, referencedType));
(IReferencePropertyDescriptor<IComponent>) modelDescriptor) .clone(); ((BasicReferencePropertyDescriptor<IComponent>) returnedDescriptor).setInitializationMapping( initializationMapping);
BasicReferencePropertyDescriptor<Module> parentDescriptor = new BasicReferencePropertyDescriptor<>(); parentDescriptor.setName(Module.PARENT); parentDescriptor.setReferencedDescriptor(this); i18nDescriptionDescriptor.setName(Module.I18N_DESCRIPTION); parentDescriptor.setReverseRelationEnd(subModulesDescriptor); subModulesDescriptor.setReverseRelationEnd(parentDescriptor);
/** * Constructs a new <code>BeanModuleDescriptor</code> instance. * * @param name * the name of the descriptor (the actual module class name). * @param moduleObjectReferencedDescriptor * the component descriptor of the module object. */ protected BeanModuleDescriptor(String name, IComponentDescriptor<Object> moduleObjectReferencedDescriptor) { super(name); BasicReferencePropertyDescriptor<Object> moduleObjectDescriptor = new BasicReferencePropertyDescriptor<Object>(); moduleObjectDescriptor .setReferencedDescriptor(moduleObjectReferencedDescriptor); moduleObjectDescriptor.setName("moduleObject"); List<IPropertyDescriptor> propertyDescriptors = new ArrayList<IPropertyDescriptor>( getPropertyDescriptors()); propertyDescriptors.add(moduleObjectDescriptor); setPropertyDescriptors(propertyDescriptors); }
/** * Gets the entityRefQueryDescriptor. * * @param context * the action context. * @return the entityRefQueryDescriptor. */ @SuppressWarnings("unchecked") protected IReferencePropertyDescriptor<IEntity> getEntityRefQueryDescriptor( Map<String, Object> context) { if (entityDescriptor != null) { if (entityRefQueryDescriptor == null) { entityRefQueryDescriptor = new BasicReferencePropertyDescriptor<IEntity>(); ((BasicReferencePropertyDescriptor<IEntity>) entityRefQueryDescriptor) .setReferencedDescriptor(entityDescriptor); ((BasicReferencePropertyDescriptor<IEntity>) entityRefQueryDescriptor) .setInitializationMapping(initializationMapping); } return entityRefQueryDescriptor; } IModelDescriptor modelDescriptor = (IModelDescriptor) context .get(ActionContextConstants.MODEL_DESCRIPTOR); if (modelDescriptor instanceof IReferencePropertyDescriptor) { return (IReferencePropertyDescriptor<IEntity>) modelDescriptor; } return null; }
/** * Constructs a new <code>FilterableBeanCollectionModuleDescriptor</code> * instance. * * @param name * the name of the descriptor (the actual module class name). * @param moduleObjectReferencedDescriptor * the component descriptor of the module objects. * @param moduleFilterReferencedDescriptor * the component descriptor for the filter object. */ protected FilterableBeanCollectionModuleDescriptor(String name, IComponentDescriptor<Object> moduleObjectReferencedDescriptor, IComponentDescriptor<Object> moduleFilterReferencedDescriptor) { super(name, moduleObjectReferencedDescriptor); BasicReferencePropertyDescriptor<IQueryComponent> filterDescriptor = new BasicReferencePropertyDescriptor<IQueryComponent>(); filterDescriptor.setReferencedDescriptor(new BasicQueryComponentDescriptor( moduleFilterReferencedDescriptor)); filterDescriptor.setName("filter"); List<IPropertyDescriptor> propertyDescriptors = new ArrayList<IPropertyDescriptor>( getPropertyDescriptors()); propertyDescriptors.add(filterDescriptor); setPropertyDescriptors(propertyDescriptors); }
/** * Gets the entityRefQueryDescriptor. * * @param context * the action context. * @return the entityRefQueryDescriptor. */ @SuppressWarnings("unchecked") protected IReferencePropertyDescriptor<IEntity> getEntityRefQueryDescriptor( Map<String, Object> context) { if (entityDescriptor != null) { if (entityRefQueryDescriptor == null) { entityRefQueryDescriptor = new BasicReferencePropertyDescriptor<IEntity>(); ((BasicReferencePropertyDescriptor<IEntity>) entityRefQueryDescriptor) .setReferencedDescriptor(entityDescriptor); ((BasicReferencePropertyDescriptor<IEntity>) entityRefQueryDescriptor) .setInitializationMapping(initializationMapping); } return entityRefQueryDescriptor; } IModelDescriptor modelDescriptor = (IModelDescriptor) context .get(ActionContextConstants.MODEL_DESCRIPTOR); if (modelDescriptor instanceof IReferencePropertyDescriptor) { return (IReferencePropertyDescriptor<IEntity>) modelDescriptor; } return null; }
/** * Constructs a new {@code FilterableBeanCollectionModuleDescriptor} * instance. * * @param name * the name of the descriptor (the actual module class name). * @param moduleObjectReferencedDescriptor * the component descriptor of the module objects. * @param moduleFilterReferencedDescriptor * the component descriptor for the filter object. */ protected FilterableBeanCollectionModuleDescriptor(String name, IComponentDescriptor<?> moduleObjectReferencedDescriptor, IComponentDescriptor<IQueryComponent> moduleFilterReferencedDescriptor) { super(name, moduleObjectReferencedDescriptor); setDescription(""); BasicReferencePropertyDescriptor<IQueryComponent> filterDescriptor = new BasicReferencePropertyDescriptor<>(); filterDescriptor.setReferencedDescriptor(moduleFilterReferencedDescriptor); filterDescriptor.setName(FILTER); List<IPropertyDescriptor> propertyDescriptors = new ArrayList<>(getPropertyDescriptors()); propertyDescriptors.add(filterDescriptor); setPropertyDescriptors(propertyDescriptors); List<IComponentDescriptor<?>> ancestorDescriptors = new ArrayList<>(); ancestorDescriptors.add(PageableDescriptor.INSTANCE); setAncestorDescriptors(ancestorDescriptors); }
/** * Gets the entityRefQueryDescriptor. * * @param context * the action context. * @return the entityRefQueryDescriptor. */ @SuppressWarnings("unchecked") protected IReferencePropertyDescriptor<IEntity> getEntityRefQueryDescriptor( Map<String, Object> context) { if (entityDescriptor != null) { if (entityRefQueryDescriptor == null) { entityRefQueryDescriptor = new BasicReferencePropertyDescriptor<IEntity>(); ((BasicReferencePropertyDescriptor<IEntity>) entityRefQueryDescriptor) .setReferencedDescriptor(entityDescriptor); ((BasicReferencePropertyDescriptor<IEntity>) entityRefQueryDescriptor) .setInitializationMapping(initializationMapping); } return entityRefQueryDescriptor; } IModelDescriptor modelDescriptor = (IModelDescriptor) context .get(ActionContextConstants.MODEL_DESCRIPTOR); if (modelDescriptor instanceof IReferencePropertyDescriptor) { return (IReferencePropertyDescriptor<IEntity>) modelDescriptor; } return null; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public IReferencePropertyDescriptor<IDescriptor> createLovReferenceDescriptor() { BasicReferencePropertyDescriptor<IDescriptor> enumRefPropertyDescriptor = new BasicReferencePropertyDescriptor<>(); enumRefPropertyDescriptor.setName(getName()); BasicComponentDescriptor<IDescriptor> elementDescriptor = (BasicComponentDescriptor<IDescriptor>) ( (BasicComponentDescriptor<IDescriptor>) BasicDescriptorDescriptor.INSTANCE) .clone(); elementDescriptor.setI18nNameKey(getName()); elementDescriptor.setRenderedProperties(Arrays.asList("description")); BasicPropertyDescriptor descriptionDescriptor = (BasicPropertyDescriptor) elementDescriptor.getPropertyDescriptor("description").clone(); descriptionDescriptor.setI18nNameKey(getName()); Collection<IPropertyDescriptor> pds = elementDescriptor.getPropertyDescriptors(); pds.add(descriptionDescriptor); elementDescriptor.setPropertyDescriptors(pds); enumRefPropertyDescriptor.setReferencedDescriptor(elementDescriptor); return enumRefPropertyDescriptor; } }