Package com.dotmarketing.portlets.hostvariable.model

Examples of com.dotmarketing.portlets.hostvariable.model.HostVariable


       Iterator hostvars = hvars.iterator();
   
     sb.append("#set ($host_variable = $contents.getEmptyMap())");
     int counter=1;
    while (hostvars.hasNext()) {
      HostVariable next = (HostVariable) hostvars.next();
      sb.append("#set ($_dummy  = $host_variable.put(\"" ).append( String.valueOf(next.getKey())).append( "\", \"" ).append( String.valueOf(UtilMethods.espaceForVelocity(next.getValue()))).append( "\"))");
     
      counter++;       
     
       }
    }
View Full Code Here


    HostVariableAPI hostVariableAPI = APILocator.getHostVariableAPI();

    List<HostVariable> variables = hostVariableAPI.getVariablesForHost(hostId, user, false);

    HostVariable hostVariable = null;
    for (HostVariable next : variables) {
      if (next.getKey().equals(key) && !next.getId().equals(id)) {
        return LanguageUtil.get(user, "message.hostvariables.exist.error.key");
      }
      if(UtilMethods.isSet(id) && next.getId().equals(id)) {
        hostVariable = next;
      }
    }
   
    if(hostVariable == null) {
      hostVariable = new HostVariable();
    }

    hostVariable.setId(id);
    hostVariable.setHostId(hostId);
    hostVariable.setName(name);
    hostVariable.setKey(key);
    hostVariable.setValue(value);
    hostVariable.setLastModifierId(user.getUserId());
    hostVariable.setLastModDate(new Date());
    try {
      hostVariableAPI.save(hostVariable, user, respectFrontendRoles);
    } catch (DotSecurityException e) {
      return LanguageUtil.get(user, "message.hostvariables.permission.error.save");
    }
View Full Code Here

    UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
    User user = userWebAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(req);

    HostVariableAPI hostVariableAPI = APILocator.getHostVariableAPI();
    HostVariable hvar = hostVariableAPI.find(hvarId, user, respectFrontendRoles);
    hostVariableAPI.delete(hvar, user, respectFrontendRoles);

  }
View Full Code Here

    CacheLocator.getHostVariablesCache().clearCache();
  }
 
 
  protected HostVariable find (String id) throws DotDataException {
     HostVariable hvar= new HostVariable();
      try {
        hvar = (HostVariable) HibernateUtil.load(HostVariable.class, id);
      } catch (DotHibernateException e) {
        if(!(e.getCause() instanceof ObjectNotFoundException))
          throw e;
View Full Code Here

    String id = object.getId();
   
    if( InodeUtils.isSet(id)) {
      try
      {
        HostVariable hvar = (HostVariable) HibernateUtil.load(HostVariable.class, id);
        BeanUtils.copyProperties(hvar,object);
        HibernateUtil.saveOrUpdate(hvar)
      }catch(Exception ex){
        throw new DotDataException(ex.getMessage(),ex);
      }
View Full Code Here

   
  }
 
  public HostVariable find(String id, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException {
   
    HostVariable hvar = hvarFactory.find(id);
    Host host = hostAPI.find(hvar.getHostId(), user, respectFrontendRoles);
    if(!perAPI.doesUserHavePermission(host, PermissionAPI.PERMISSION_USE, user, respectFrontendRoles))
      throw new DotSecurityException("User doesn't have permission to read the host variable = " + hvar.getId());
    return hvar;
   
  }
View Full Code Here

  public HostVariable copy(HostVariable sourceVariable, Host destinationHost, User user, boolean respectFrontendRoles)
      throws DotDataException, DotSecurityException {
    if(!perAPI.doesUserHavePermission(destinationHost, PermissionAPI.PERMISSION_EDIT, user, respectFrontendRoles))
      throw new DotSecurityException("User doesn't have permission to edit the host = " + destinationHost.getIdentifier());
    HostVariable newVariable = new HostVariable();
    newVariable.setHostId(destinationHost.getIdentifier());
    newVariable.setKey(sourceVariable.getKey());
    newVariable.setLastModDate(new Date());
    newVariable.setLastModifierId(user.getUserId());
    newVariable.setName(sourceVariable.getName());
    newVariable.setValue(sourceVariable.getValue());
    hvarFactory.save(newVariable)
;    return newVariable;
  }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.hostvariable.model.HostVariable

Copyright © 2018 www.massapicom. 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.