@MetaProperty @Override public UUID getId() { return id; }
@Nullable protected Datatype getAdaptiveDatatype(AnnotatedElement annotatedElement) { com.haulmont.chile.core.annotations.MetaProperty annotation = annotatedElement.getAnnotation(com.haulmont.chile.core.annotations.MetaProperty.class); return annotation != null && !annotation.datatype().equals("") ? datatypes.get(annotation.datatype()) : null; }
protected void loadPropertyAnnotations(MetaProperty metaProperty, AnnotatedElement annotatedElement) { for (Annotation annotation : annotatedElement.getAnnotations()) { MetaAnnotation metaAnnotation = AnnotationUtils.findAnnotation(annotation.getClass(), MetaAnnotation.class); if (metaAnnotation != null) { Map<String, Object> attributes = new LinkedHashMap<>(AnnotationUtils.getAnnotationAttributes(annotatedElement, annotation)); metaProperty.getAnnotations().put(annotation.annotationType().getName(), attributes); } } com.haulmont.chile.core.annotations.MetaProperty metaPropertyAnnotation = annotatedElement.getAnnotation(com.haulmont.chile.core.annotations.MetaProperty.class); if (metaPropertyAnnotation != null) { String[] related = metaPropertyAnnotation.related(); if (!(related.length == 1 && related[0].equals(""))) { metaProperty.getAnnotations().put("relatedProperties", Joiner.on(',').join(related)); } } loadBeanValidationAnnotations(metaProperty, annotatedElement); }
protected boolean isMandatory(Field field) { OneToMany oneToManyAnnotation = field.getAnnotation(OneToMany.class); ManyToMany manyToManyAnnotation = field.getAnnotation(ManyToMany.class); if (oneToManyAnnotation != null || manyToManyAnnotation != null) { return false; } Column columnAnnotation = field.getAnnotation(Column.class); OneToOne oneToOneAnnotation = field.getAnnotation(OneToOne.class); ManyToOne manyToOneAnnotation = field.getAnnotation(ManyToOne.class); com.haulmont.chile.core.annotations.MetaProperty metaPropertyAnnotation = field.getAnnotation(com.haulmont.chile.core.annotations.MetaProperty.class); boolean superMandatory = (metaPropertyAnnotation != null && metaPropertyAnnotation.mandatory()) || (field.getAnnotation(NotNull.class) != null && isDefinedForDefaultValidationGroup(field.getAnnotation(NotNull.class))); // @NotNull without groups return (columnAnnotation != null && !columnAnnotation.nullable()) || (oneToOneAnnotation != null && !oneToOneAnnotation.optional()) || (manyToOneAnnotation != null && !manyToOneAnnotation.optional()) || superMandatory; }
/** * @return locked object id */ @MetaProperty public String getEntityId() { return entityId; }
@MetaProperty public boolean isDeniedAll() { return (createPermissionVariant == PermissionVariant.DISALLOWED) && (readPermissionVariant == PermissionVariant.DISALLOWED) && (updatePermissionVariant == PermissionVariant.DISALLOWED) && (deletePermissionVariant == PermissionVariant.DISALLOWED); }
/** * @return when the lock occurred */ @MetaProperty public Date getSince() { return since; }
@MetaProperty(related = "snapshotDate") public Date getChangeDate() { return this.snapshotDate; }
@MetaProperty public String name() { if (beanName != null && methodName != null) { return beanName + "." + methodName; } else if (className != null) { return className; } else { return scriptName; } }
/** * @return locked object type */ @MetaProperty public String getEntityName() { return entityName; }
@MetaProperty public void setLabel(String label) { this.label = label; }
@MetaProperty public String getAfterString() { return ""; }
/** * @return a user which holds the lock */ @MetaProperty public User getUser() { return user; }
@Override @MetaProperty public boolean isAssigned() { return (createPermissionVariant != PermissionVariant.NOTSET) || (readPermissionVariant != PermissionVariant.NOTSET) || (updatePermissionVariant != PermissionVariant.NOTSET) || (deletePermissionVariant != PermissionVariant.NOTSET); }
@MetaProperty public boolean isAllowedAll() { return (createPermissionVariant == PermissionVariant.ALLOWED) && (readPermissionVariant == PermissionVariant.ALLOWED) && (updatePermissionVariant == PermissionVariant.ALLOWED) && (deletePermissionVariant == PermissionVariant.ALLOWED); }
@MetaProperty public String getName() { return propertyCaption; }
@MetaProperty public String getBeforeString() { return ""; }
@MetaProperty public ItemState getItemState() { return ItemState.Normal; }
@MetaProperty public void setName(String name) { propertyCaption = name; }
@MetaProperty public String getLabel() { return label; }