Class LayoutStorageValidator
java.lang.Object
io.meeds.layout.util.LayoutStorageValidator
Checks that the storage ids a layout draft save carries name windows and
containers the edited page or site already holds. The storage saves an
element carrying a positive storage id as an update of the stored window or
container with that id, so a draft save may only carry the ids of the
layout it replaces; an element without such an id is created.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidvalidateHeldStorageIds(Collection<? extends org.exoplatform.portal.config.model.ModelObject> storedElements, Collection<? extends org.exoplatform.portal.config.model.ModelObject> submittedElements, String errorCode) Refuses a submitted layout that carries a window or container storage id the stored layout does not hold.
-
Method Details
-
validateHeldStorageIds
public static void validateHeldStorageIds(Collection<? extends org.exoplatform.portal.config.model.ModelObject> storedElements, Collection<? extends org.exoplatform.portal.config.model.ModelObject> submittedElements, String errorCode) Refuses a submitted layout that carries a window or container storage id the stored layout does not hold. Windows and containers are stored under two id sequences, so a window id is only accepted on a window and a container id (a page or site body placeholder included) only on a container. A window's state id must name the same held window as its storage id: the storage updates a window by its storage id, while a submitted layout used as is, the meta portal's after its save, renders the window and stores its preferences through its state id. The layout REST builds the state id from the storage id. Ids are read as the storage reads them: an id that does not parse to a positive number is not an update and is not checked.- Parameters:
storedElements- the root elements of the stored layout, null elements ignoredsubmittedElements- the root elements of the layout to save, null elements ignorederrorCode- the message code of the refusal, the one the save raises for an outdated layout- Throws:
IllegalStateException- when a submitted id is not held by the stored layout: the submitted layout was not built from it
-