Examples of PluginProperty


Examples of com.dotmarketing.plugin.model.PluginProperty

  }

  @Override
  protected PluginProperty getProperty(String pluginId, String propertyKey) {
    String key = propertyGroup + pluginId + ":" + propertyKey;
    PluginProperty value = null;
      try{
        value = (PluginProperty)cache.get(key,propertyGroup);
      }catch (DotCacheException e) {
      Logger.debug(this, "Cache Entry not found", e);
    }
View Full Code Here

Examples of com.dotmarketing.plugin.model.PluginProperty

  /* (non-Javadoc)
   * @see com.dotmarketing.plugin.business.PluginFactory#loadProperty(java.lang.String, java.lang.String)
   */
  @Override
  protected PluginProperty loadProperty(String pluginId, String key) throws DotDataException {
    PluginProperty pluginProp = cache.getProperty(pluginId, key);
    if(pluginProp != null){
      return pluginProp;
    }
    HibernateUtil hu = new HibernateUtil(PluginProperty.class);
    hu.setQuery("from PluginProperty where plugin_id = ? and propkey = ?");
    hu.setParam(pluginId);
    hu.setParam(key);
    pluginProp = (PluginProperty)hu.load();
    if(pluginProp != null && UtilMethods.isSet(pluginProp.getPluginId())){
      cache.addProperty(pluginProp);
    }
    return pluginProp;
  }
View Full Code Here

Examples of com.dotmarketing.plugin.model.PluginProperty

  /* (non-Javadoc)
   * @see com.dotmarketing.plugin.business.PluginAPI#loadProperty(java.lang.String, java.lang.String)
   */
  public String loadProperty(String pluginId, String keythrows DotDataException {
    PluginProperty pp = pluginFac.loadProperty(pluginId, key);
    if(pp!= null){
      return pp.getCurrentValue();
    }else{
      return "";
    }
  }
View Full Code Here

Examples of com.dotmarketing.plugin.model.PluginProperty

  /* (non-Javadoc)
   * @see com.dotmarketing.plugin.business.PluginAPI#saveProperty(java.lang.String, java.lang.String, java.lang.String)
   */
  public void saveProperty(String pluginId, String key, String valuethrows DotDataException {
    PluginProperty pp = pluginFac.loadProperty(pluginId, key);
    if(pp != null && UtilMethods.isSet(pp.getPluginId())){
      pp.setOriginalValue(pp.getCurrentValue());
      pp.setCurrentValue(value);
    }else{
      pp = new PluginProperty();
      pp.setPropkey(key);
      pp.setPluginId(pluginId);
      pp.setOriginalValue(value);
      pp.setCurrentValue(value);
    }
    pluginFac.saveProperty(pp);
  }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.PluginProperty

    }

    @Test
    public void applyConfigurationWithCorrectValuesShouldBeSuccessful() throws PluginConfigurationException {
        List<PluginProperty> properties = new ArrayList<>();
        properties.add(new PluginProperty(KaptchaPlugin.WIDTH_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.HEIGHT_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.LENGTH_PROPERTY, PluginProperty.Type.INT, "4"));
        properties.add(new PluginProperty(KaptchaPlugin.POSSIBLE_SYMBOLS_PROPERTY,
                PluginProperty.Type.STRING, "0123456789"));

        Map<PluginProperty, String> errors = kaptchaPlugin.applyConfiguration(properties);

        assertEquals(errors.size(), 0);
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.PluginProperty

    }

    @Test(expectedExceptions = PluginConfigurationException.class)
    public void applyConfigurationWithInvalidPropertiesShouldBeFailed() throws PluginConfigurationException {
        List<PluginProperty> properties = new ArrayList<>();
        properties.add(new PluginProperty(KaptchaPlugin.WIDTH_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.HEIGHT_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.LENGTH_PROPERTY, PluginProperty.Type.INT, "ABC4"));

        kaptchaPlugin.applyConfiguration(properties);
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.PluginProperty

     */
    @Override
    public void updateProperties(List<PluginProperty> properties) {

        for (PluginProperty property: properties) {
            PluginProperty persistedProperty = (PluginProperty) session().load(property.getClass(), property.getId());
            persistedProperty.setValue(property.getValue());
            session().saveOrUpdate(persistedProperty);
        }

        session().flush();
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.PluginProperty

        return userDto;
    }

    private PluginConfiguration createConfiguration(String url, String login, String password) {

        PluginProperty urlProperty =
                new PluginProperty("URL", STRING, url);
        urlProperty.setName("Url");
        PluginProperty loginProperty = new PluginProperty("LOGIN", STRING, login);
        loginProperty.setName("Login");
        PluginProperty passwordProperty = new PluginProperty("PASSWORD", STRING, password);
        passwordProperty.setName("Password");
        return new PluginConfiguration("Poulpe Auth Plugin", true,
                Arrays.asList(urlProperty, loginProperty, passwordProperty));
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.PluginProperty

        return pluginProperties;
    }

    @Override
    public List<PluginProperty> getDefaultConfiguration() {
        PluginProperty url = new PluginProperty(URL_PROPERTY, STRING, "http://localhost:8080");
        PluginProperty login = new PluginProperty(LOGIN_PROPERTY, STRING, "user");
        PluginProperty password = new PluginProperty(PASSWORD_PROPERTY, STRING, "1234");
        return Arrays.asList(url, login, password);
    }
View Full Code Here

Examples of org.jtalks.jcommune.model.entity.PluginProperty

    @Test
    public void updateConfigurationShouldSaveConfigurationProperties()
            throws NotFoundException, UnexpectedErrorException {
        //GIVEN
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        PluginConfiguration configuration = new PluginConfiguration("Dummy", false, properties);
        when(pluginLoader.getPlugins()).thenReturn(Arrays.asList((Plugin) new DummyPlugin("Dummy")));
        //WHEN
        pluginService.updateConfiguration(configuration, FAKE_COMPONENT_ID);
        //THEN
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.