Add get available layouts endpoint
This commit is contained in:
parent
ad80551db7
commit
834dcc26f0
|
@ -120,6 +120,11 @@ public class CommunityController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/layouts", method = RequestMethod.GET)
|
||||||
|
public List<Layout> getAvailableLayouts() {
|
||||||
|
return this.layoutService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/{pid}/layout", method = RequestMethod.GET)
|
@RequestMapping(value = "/{pid}/layout", method = RequestMethod.GET)
|
||||||
public Layout getLayoutForCommunity(@PathVariable(value = "pid") String pid) {
|
public Layout getLayoutForCommunity(@PathVariable(value = "pid") String pid) {
|
||||||
Portal portal = portalService.getPortal(pid);
|
Portal portal = portalService.getPortal(pid);
|
||||||
|
|
|
@ -12,30 +12,11 @@ public class Layout {
|
||||||
@Id
|
@Id
|
||||||
@JsonProperty("_id")
|
@JsonProperty("_id")
|
||||||
private String id;
|
private String id;
|
||||||
// private String mainColor;
|
|
||||||
// private String secondaryColor;
|
|
||||||
// private Panel panel;
|
|
||||||
// private Box box;
|
|
||||||
// private Links links;
|
|
||||||
// private Buttons buttons;
|
|
||||||
|
|
||||||
private String portalPid;
|
private String portalPid;
|
||||||
private Object layoutOptions;
|
private Object layoutOptions;
|
||||||
|
|
||||||
public Layout() { }
|
public Layout() { }
|
||||||
|
|
||||||
public Layout(String id, String mainColor, String secondaryColor, Panel panel, Box box, Links links, Buttons buttons, String portalPid) {
|
|
||||||
this.id = id;
|
|
||||||
// this.mainColor = mainColor;
|
|
||||||
// this.secondaryColor = secondaryColor;
|
|
||||||
// this.panel = panel;
|
|
||||||
// this.box = box;
|
|
||||||
// this.links = links;
|
|
||||||
// this.buttons = buttons;
|
|
||||||
|
|
||||||
this.portalPid = portalPid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -44,54 +25,6 @@ public class Layout {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public String getMainColor() {
|
|
||||||
// return mainColor;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setMainColor(String mainColor) {
|
|
||||||
// this.mainColor = mainColor;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getSecondaryColor() {
|
|
||||||
// return secondaryColor;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setSecondaryColor(String secondaryColor) {
|
|
||||||
// this.secondaryColor = secondaryColor;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public Panel getPanel() {
|
|
||||||
// return panel;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setPanel(Panel panel) {
|
|
||||||
// this.panel = panel;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public Box getBox() {
|
|
||||||
// return box;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setBox(Box box) {
|
|
||||||
// this.box = box;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public Links getLinks() {
|
|
||||||
// return links;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setLinks(Links links) {
|
|
||||||
// this.links = links;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public Buttons getButtons() {
|
|
||||||
// return buttons;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setButtons(Buttons buttons) {
|
|
||||||
// this.buttons = buttons;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String getPortalPid() {
|
public String getPortalPid() {
|
||||||
return portalPid;
|
return portalPid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class LayoutService {
|
public class LayoutService {
|
||||||
private final Logger log = Logger.getLogger(this.getClass());
|
private final Logger log = Logger.getLogger(this.getClass());
|
||||||
|
@ -13,6 +15,10 @@ public class LayoutService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private LayoutDAO layoutDAO;
|
private LayoutDAO layoutDAO;
|
||||||
|
|
||||||
|
public List<Layout> findAll() {
|
||||||
|
return this.layoutDAO.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
public void updatePid(String old_pid, String new_pid) {
|
public void updatePid(String old_pid, String new_pid) {
|
||||||
log.debug("layout service: updatePid");
|
log.debug("layout service: updatePid");
|
||||||
Layout layout = layoutDAO.findByPortalPid(old_pid);
|
Layout layout = layoutDAO.findByPortalPid(old_pid);
|
||||||
|
@ -26,7 +32,6 @@ public class LayoutService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteByPid(String pid) {
|
public void deleteByPid(String pid) {
|
||||||
// TODO check maybe we can delete by portalId without find first
|
|
||||||
Layout layout = layoutDAO.findByPortalPid(pid);
|
Layout layout = layoutDAO.findByPortalPid(pid);
|
||||||
if(layout != null) {
|
if(layout != null) {
|
||||||
layoutDAO.delete(layout.getId());
|
layoutDAO.delete(layout.getId());
|
||||||
|
|
Loading…
Reference in New Issue