コード例 #1
0
 @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();
   }
 }
コード例 #2
0
 @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);
   }
 }
コード例 #3
0
 static {
   // Index:OCLASS_ATTRS.indexOf(OClassPrototyper.NAME)+1
   OCLASS_ATTRS.add(2, CustomAttributes.DESCRIPTION.getName());
   OCLASS_ATTRS.add(CustomAttributes.PROP_NAME.getName());
   OCLASS_ATTRS.add(CustomAttributes.PROP_PARENT.getName());
   OCLASS_ATTRS.add(CustomAttributes.TAB.getName());
   OCLASS_ATTRS.add(CustomAttributes.ON_CREATE_FIELDS.getName());
   OCLASS_ATTRS.add(CustomAttributes.ON_CREATE_IDENTITY_TYPE.getName());
 }
コード例 #4
0
 @Override
 protected void onConfigure() {
   super.onConfigure();
   String critery = getPropertyObject();
   if (OClassPrototyper.SUPER_CLASSES.equals(critery)) {
     Collection<OClass> superClasses = (Collection<OClass>) getEnteredValue();
     AbstractMetaPanel<OClass, String, ?> onCreateFieldsPanel =
         getMetaComponent(CustomAttributes.ON_CREATE_FIELDS.getName());
     AbstractMetaPanel<OClass, String, ?> onCreateIdentityTypePanel =
         getMetaComponent(CustomAttributes.ON_CREATE_IDENTITY_TYPE.getName());
     if (onCreateFieldsPanel != null || onCreateIdentityTypePanel != null) {
       boolean visibility = false;
       for (OClass superClass : superClasses) {
         if (visibility = superClass.isSubClassOf(OSecurityShared.RESTRICTED_CLASSNAME)) break;
       }
       if (onCreateFieldsPanel != null) onCreateFieldsPanel.setVisibilityAllowed(visibility);
       if (onCreateIdentityTypePanel != null)
         onCreateIdentityTypePanel.setVisibilityAllowed(visibility);
     }
   }
 }