Ejemplo n.º 1
0
 @Override
 public String toHTML(
     Strings strings, Locale locale, String extension, String name, String value) {
   try {
     PropertyExtensionDescriptor descriptor =
         extensionManager.getPropertyExtensionDescriptor(extension, name);
     return descriptor.toHTML(strings, locale, value);
   } catch (PropertyExtensionNotFoundException e) {
     return StringEscapeUtils.escapeHtml4(value);
   }
 }
Ejemplo n.º 2
0
 @Override
 @Transactional(readOnly = true)
 public String editHTML(
     Strings strings, Locale locale, Entity entity, int entityId, String extension, String name) {
   // Gets the property value
   String value = getPropertyValue(entity, entityId, extension, name);
   // Gets the descriptor for this property
   PropertyExtensionDescriptor descriptor =
       extensionManager.getPropertyExtensionDescriptor(extension, name);
   // OK
   return descriptor.editHTML(strings, locale, value);
 }
Ejemplo n.º 3
0
 @Override
 @Transactional
 public void createProperties(Entity entity, int entityId, PropertiesCreationForm properties) {
   // For all properties
   if (properties != null) {
     for (PropertyCreationForm propertyCreationForm : properties.getList()) {
       String extension = propertyCreationForm.getExtension();
       String name = propertyCreationForm.getName();
       String value = propertyCreationForm.getValue();
       // Gets the property extension descriptor
       PropertyExtensionDescriptor propertyExtensionDescriptor =
           extensionManager.getPropertyExtensionDescriptor(extension, name);
       // Checks the entity scope
       if (!propertyExtensionDescriptor.getScope().contains(entity)) {
         throw new PropertyScopeException(extension, name, entity);
       }
       // Validates the value
       propertyExtensionDescriptor.validate(value);
       // Saves the value
       propertyDao.saveProperty(entity, entityId, extension, name, value);
     }
   }
 }