Package com.dotmarketing.portlets.hostvariable.bussiness

Examples of com.dotmarketing.portlets.hostvariable.bussiness.HostVariableAPI


  @SuppressWarnings("unchecked")
  public static InputStream buildStream(Host host, boolean EDIT_MODE) throws DotDataException, DotSecurityException {
   
    InputStream result;
    StringBuilder sb = new StringBuilder();
    HostVariableAPI hostVariableAPI = APILocator. getHostVariableAPI();
    UserAPI userAPI=APILocator.getUserAPI();
    User user=userAPI.getSystemUser();
    List hvars= hostVariableAPI.getVariablesForHost(host.getIdentifier(), user, false);
   
    if( hvars.size()>0 ){
       Iterator hostvars = hvars.iterator();
   
     sb.append("#set ($host_variable = $contents.getEmptyMap())");
View Full Code Here


    if (RegEX.contains(key, "[^A-Za-z0-9]")) {
      return LanguageUtil.get(user, "message.hostvariables.exist.error.regex");
    }

    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");
    }
   
    return null;
View Full Code Here

    HttpServletRequest req = ctx.getHttpServletRequest();
    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

    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
    User user = userWebAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(req);
    HostVariableAPI hostVariableAPI = APILocator.getHostVariableAPI();
   
    List<Map<String, Object>> resultList = new LinkedList<Map<String,Object>>();
    List<HostVariable> hvars = hostVariableAPI.getVariablesForHost(hostId, user, respectFrontendRoles);
    for(HostVariable variable : hvars) {
      Map<String, Object> variableMap = variable.getMap();
      User variableLastModifier = userWebAPI.loadUserById(variable.getLastModifierId(), userWebAPI.getSystemUser(), false);
      String lastModifierFullName = "Unknown";
      if(variableLastModifier != null)
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.hostvariable.bussiness.HostVariableAPI

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.