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