@Override
 protected void setValue(OClass entity, String critery, V value) {
   ODatabaseDocument db = OrientDbWebSession.get().getDatabase();
   db.commit();
   try {
     CustomAttributes custom;
     if (OClassPrototyper.CLUSTER_SELECTION.equals(critery)) {
       if (value != null) entity.setClusterSelection(value.toString());
     } else if ((CustomAttributes.ON_CREATE_FIELDS.getName().equals(critery))
         && (custom = CustomAttributes.fromString(critery)) != null) {
       custom.setValue(entity, value != null ? Joiner.on(",").join((List<String>) value) : null);
     } else if ((custom = CustomAttributes.fromString(critery)) != null) {
       custom.setValue(entity, value);
     } else if (OClassPrototyper.SUPER_CLASSES.equals(critery)) {
       if (value != null) entity.setSuperClasses((List<OClass>) value);
     } else {
       PropertyResolver.setValue(
           critery,
           entity,
           value,
           new PropertyResolverConverter(
               Application.get().getConverterLocator(), Session.get().getLocale()));
     }
   } finally {
     db.begin();
   }
 }
 @SuppressWarnings("unchecked")
 @Override
 protected V getValue(OClass entity, String critery) {
   CustomAttributes custom;
   if ("clusterSelection".equals(critery)) {
     OClusterSelectionStrategy strategy = entity.getClusterSelection();
     return (V) (strategy != null ? strategy.getName() : null);
   } else if (OClassPrototyper.SUPER_CLASSES.equals(critery)) {
     List<OClass> superClasses = entity.getSuperClasses();
     // Additional wrapping to ArrayList is required , because getSuperClasses return unmodifiable
     // list
     return (V)
         (superClasses != null ? new ArrayList<OClass>(superClasses) : new ArrayList<OClass>());
   } else if ((CustomAttributes.ON_CREATE_FIELDS.getName().equals(critery))
       && (custom = CustomAttributes.fromString(critery)) != null) {
     String onCreateFields = custom.getValue(entity);
     return (V)
         (!Strings.isNullOrEmpty(onCreateFields)
             ? Lists.newArrayList(onCreateFields.split(","))
             : new ArrayList<String>());
   } else if ((custom = CustomAttributes.fromString(critery)) != null) {
     return custom.getValue(entity);
   } else {
     return (V) PropertyResolver.getValue(critery, entity);
   }
 }
  @SuppressWarnings("unchecked")
  @Override
  protected Component resolveComponent(String id, DisplayMode mode, String critery) {
    if (DisplayMode.EDIT.equals(mode)
        && !OSecurityHelper.isAllowed(
            ORule.ResourceGeneric.SCHEMA, null, OrientPermission.UPDATE)) {
      mode = DisplayMode.VIEW;
    }
    if (DisplayMode.VIEW.equals(mode)) {
      if (CustomAttributes.match(
          critery, CustomAttributes.PROP_NAME, CustomAttributes.PROP_PARENT)) {
        return new OPropertyViewPanel(id, (IModel<OProperty>) getModel());
      } else if (OClassPrototyper.SUPER_CLASSES.equals(critery)) {
        return new MultipleOClassesViewPanel(id, (IModel<List<OClass>>) getModel());
      }
      if (OClassPrototyper.ABSTRACT.equals(critery)
          || OClassPrototyper.STRICT_MODE.equals(critery)) {
        return new BooleanViewPanel(id, (IModel<Boolean>) getModel()).setHideIfFalse(true);
      } else {
        return new Label(id, getModel());
      }
    } else if (DisplayMode.EDIT.equals(mode)) {
      if (OClassPrototyper.NAME.equals(critery) || OClassPrototyper.SHORT_NAME.equals(critery)) {
        return new TextField<V>(id, getModel())
            .setType(String.class)
            .add((IValidator<V>) OSchemaNamesValidator.CLASS_NAME_VALIDATOR);
      } else if (OClassPrototyper.ABSTRACT.equals(critery) || "strictMode".equals(critery)) {
        return new BooleanEditPanel(id, (IModel<Boolean>) getModel());
      } else if (OClassPrototyper.OVER_SIZE.equals(critery)) {
        return new TextField<V>(id, getModel()).setType(Float.class);
      } else if (OClassPrototyper.SUPER_CLASSES.equals(critery)) {
        return new Select2MultiChoice<OClass>(
                id, (IModel<Collection<OClass>>) getModel(), OClassTextChoiceProvider.INSTANCE)
            .add(new DragAndDropBehavior())
            .add(new RefreshMetaContextOnChangeBehaviour());
      } else if (OClassPrototyper.CLUSTER_SELECTION.equals(critery)) {
        return new DropDownChoice<String>(id, (IModel<String>) getModel(), CLUSTER_SELECTIONS);
      } else if (CustomAttributes.match(critery, CustomAttributes.PROP_NAME)) {
        return new DropDownChoice<OProperty>(
            id, (IModel<OProperty>) getModel(), new ListOPropertiesModel(getEntityModel(), null));
      } else if (CustomAttributes.match(critery, CustomAttributes.PROP_PARENT)) {
        return new DropDownChoice<OProperty>(
                id,
                (IModel<OProperty>) getModel(),
                new ListOPropertiesModel(getEntityModel(), null) {

                  @Override
                  protected Predicate<? super OProperty> getFilterPredicate() {
                    return IS_LINK_PROPERTY;
                  }
                })
            .setNullValid(true);
      } else if (CustomAttributes.match(critery, CustomAttributes.DESCRIPTION)) {
        return new TextArea<V>(id, getModel());
      } else if (CustomAttributes.match(critery, CustomAttributes.TAB)) {
        return new TextField<V>(id, getModel());
      } else if (CustomAttributes.match(critery, CustomAttributes.ON_CREATE_FIELDS)) {
        return new Select2MultiChoice<String>(
            id, (IModel<Collection<String>>) getModel(), OnCreateFieldsTextChoiceProvider.INSTANCE);
      } else if (CustomAttributes.match(critery, CustomAttributes.ON_CREATE_IDENTITY_TYPE)) {
        return new DropDownChoice<String>(
                id, (IModel<String>) getModel(), ON_CREATE_IDENTITY_SELECTIONS)
            .setNullValid(true);
      } else {
        return new Label(id, getModel());
      }
    } else return null;
  }