Package com.dotmarketing.business

Examples of com.dotmarketing.business.LayoutAPI


  public List<Map<String, Object>> getAllLayouts() throws DotDataException, LanguageException, DotRuntimeException, PortalException, SystemException {

    List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();

    LayoutAPI layoutAPI = APILocator.getLayoutAPI();

    List<Layout> layouts = layoutAPI.findAllLayouts();
    for(Layout l: layouts) {
      Map<String, Object> layoutMap = l.toMap();
      layoutMap.put("portletTitles", getPorletTitlesFromLayout(l));
      list.add(layoutMap);
    }
View Full Code Here


  }

  public List<Map<String, Object>> loadRoleLayouts(String roleId) throws DotDataException {
    List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();

    LayoutAPI layoutAPI = APILocator.getLayoutAPI();
    RoleAPI roleAPI = APILocator.getRoleAPI();
    Role role = roleAPI.loadRoleById(roleId);

    List<Layout> layouts = layoutAPI.loadLayoutsForRole(role);
    for(Layout l : layouts) {
      list.add(l.toMap());
    }

    return list;
View Full Code Here

  }

  public void saveRoleLayouts(String roleId, String[] layoutIds) throws DotDataException {

    LayoutAPI layoutAPI = APILocator.getLayoutAPI();
    RoleAPI roleAPI = APILocator.getRoleAPI();
    Role role = roleAPI.loadRoleById(roleId);

    List<Layout> layouts = layoutAPI.loadLayoutsForRole(role);

    //Looking for removed layouts
    for(Layout l : layouts) {
      boolean found = false;
      for(String changedLayout: layoutIds) {
        if(changedLayout.equals(l.getId())) {
          found = true;
          break;
        }
      }
      if(!found) {
        roleAPI.removeLayoutFromRole(l, role);
      }
    }

    //Looking for added layouts
    for(String changedLayout : layoutIds) {
      boolean found = false;
      for(Layout l : layouts) {
        if(changedLayout.equals(l.getId())) {
          found = true;
          break;
        }
      }
      Layout layout = layoutAPI.loadLayout(changedLayout);
      if(!found) {
        roleAPI.addLayoutToRole(layout, role);
      }
    }
  }
View Full Code Here

    return listOfPortletsInfo;
  }

  public Map<String, Object> addNewLayout(String layoutName, String layoutDescription, int order, List<String> portletIds) throws DotDataException, LanguageException, DotRuntimeException, PortalException, SystemException {

    LayoutAPI layoutAPI = APILocator.getLayoutAPI();
    Layout newLayout = new Layout();
    newLayout.setName(layoutName);
    newLayout.setDescription(layoutDescription);
    newLayout.setTabOrder(order);
    layoutAPI.saveLayout(newLayout);

    layoutAPI.setPortletIdsToLayout(newLayout, portletIds);

    Map<String, Object> layoutMap =  newLayout.toMap();
    layoutMap.put("portletTitles", getPorletTitlesFromLayout(newLayout));
    return layoutMap;
View Full Code Here

  }


  public void updateLayout(String layoutId, String layoutName, String layoutDescription, int order, List<String> portletIds) throws DotDataException {

    LayoutAPI layoutAPI = APILocator.getLayoutAPI();

    Layout layout = layoutAPI.findLayout(layoutId);
    layout.setName(layoutName);
    layout.setTabOrder(order);
    layout.setDescription(layoutDescription);
    layoutAPI.saveLayout(layout);

    layoutAPI.setPortletIdsToLayout(layout, portletIds);

  }
View Full Code Here

    layoutAPI.setPortletIdsToLayout(layout, portletIds);

  }
  public void deleteLayout(String layoutId) throws DotDataException {

    LayoutAPI layoutAPI = APILocator.getLayoutAPI();
    Layout layout = layoutAPI.loadLayout(layoutId);
    layoutAPI.removeLayout(layout);

  }
View Full Code Here

public class Task00006CreateSystemLayout implements StartupTask {
  List<String> missingPortlets=new ArrayList<String>();
  public void executeUpgrade() throws DotDataException, DotRuntimeException {
    try {
      Layout layout=getAdminLayout();
      LayoutAPI api=APILocator.getLayoutAPI();
      List<String> portletIds=layout.getPortletIds();
      if (portletIds==null) {
        portletIds=new ArrayList<String>();
      }
      portletIds.addAll(missingPortlets);
      api.setPortletIdsToLayout(layout, portletIds);
    } catch (DotDataException e) {
      Logger.warn(Task00006CreateSystemLayout.class, "DotDataException: " + e.getMessage(), e);
    }
  }
View Full Code Here

TOP

Related Classes of com.dotmarketing.business.LayoutAPI

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.