Package org.internna.iwebmvc.model

Examples of org.internna.iwebmvc.model.DomainEntity


  }

  @Override
    public void doTag() throws JspException {
    try {
      DomainEntity entity = entityClass.newInstance();
          Boolean required = entity != null ? entity.isCaptchaRequired() : Boolean.FALSE;
          getJspContext().setAttribute(property, required);
    } catch (Exception ex) {
      throw new JspException(ex);
    }
    }
View Full Code Here


    @Override
    @RemoteMethod
    @SuppressWarnings("unchecked")
    public List<ValuePair<String, String>> fetchReferences(Class<?> clazz, String path, String query, int count, int number) throws Exception {
        Assert.isEncrypted(decipherer, path);
        DomainEntity parent = (DomainEntity) ClassUtils.instantiateClass(clazz);
        Selectable entity = (Selectable) ClassUtils.instantiateClass(new BeanWrapperImpl(parent).getPropertyType(decipherer.decrypt(path)));
        if (entity == null) entity = (Selectable) parent;
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("query", query + "%");
        List<ValuePair<String, String>> result = new ArrayList<ValuePair<String, String>>(number);
View Full Code Here

    @SuppressWarnings("unchecked")
    public boolean update(Class entityClass, UpdateDataDTO[] data) throws Exception {
        Assert.notNull(entityClass);
        for (UpdateDataDTO dto : data) {
            Assert.isEncrypted(decipherer, dto.getPrimaryKey());
            DomainEntity o = dao.find(entityClass, new UUID(decipherer.decrypt(dto.getPrimaryKey())));
            BeanWrapper w = new BeanWrapperImpl(o);
            w.setPropertyValue(dto.getPath(), dto.getValue());
            dao.update(o);
        }
        return true;
View Full Code Here

        return e.getFieldErrors(path);
    }

    @SuppressWarnings("unchecked")
    protected Errors doValidation(Class clazz, String path, Object value) throws Exception {
        DomainEntity object = (DomainEntity) ClassUtils.instantiateClass(clazz);
        object.initialize(contextHolder);
        BeanWrapper validatable = new BeanWrapperImpl(object);
        validatable.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), false));
        validatable.setPropertyValue(path, value);
        Errors errors = new BeanPropertyBindingResult(object, "target");
        validator.validate(object, errors);
View Full Code Here

                if (!captchaService.validateResponse(captchaId, captcha.getInput())) {
                    throw new SecurityException("Captcha validation failed! This should be investigated further");
                }
            }
        }
        DomainEntity binded = parse(entity);
        Map<String, InvalidValue> errors = validate(binded);
        if (CollectionUtils.isEmpty(errors))
            errors = entity.getId() == null ? proceedWithNewEntity(entity): proceedWithExistingEntity(entity);
        if (!CollectionUtils.isEmpty(errors)) throw new RollbackException(errors);
        return errors;
View Full Code Here

                            dao.update(element);
                        }
                    }
                    reverseSetter = null;
                    for (DomainEntity element : newCollection) {
                        DomainEntity newElement = dao.find(ClassUtils.getActualClass(element), element.getId());
                        oldCollection.add(newElement);
                        if (reverseSetter == null) reverseSetter = getReverseSetter(ClassUtils.getActualClass(entity), ClassUtils.getActualClass(newElement), property.getName());
                        if (reverseSetter != null) {
                            reverseSetter.invoke(newElement, entity);
                            dao.update(newElement);
View Full Code Here

     *
     * @param file the transferred data
     */
    @RemoteMethod
    @Override public Object upload(FileTransfer file) throws Exception {
      DomainEntity e = Document.fromFileTransfer(userManager.getActiveUser(), file);
      dao.create(e);
      return e;
    }
View Full Code Here

    @RemoteMethod
    @Transactional
    @Override public void trash(Class<? extends DomainEntity> entityClass, UUID pk, String path) throws Exception {
        Assert.notNull(entityClass);
        if (pk != null) {
            DomainEntity entity = dao.find(entityClass, pk);
            if (entity != null) {
                PropertyDescriptor property = BeanUtils.getPropertyDescriptor(entityClass, path);
                if ((property != null) && (Document.class.isAssignableFrom(property.getPropertyType()))) {
                    Document doc = (Document) property.getReadMethod().invoke(entity);
                    if (doc != null) {
View Full Code Here

TOP

Related Classes of org.internna.iwebmvc.model.DomainEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.