diff --git a/src/main/api/studio-api.yaml b/src/main/api/studio-api.yaml
index ec85208c2b..599f332df1 100644
--- a/src/main/api/studio-api.yaml
+++ b/src/main/api/studio-api.yaml
@@ -2449,46 +2449,6 @@ paths:
'401':
$ref: '#/components/responses/Unauthorized'
- /api/1/services/api/1/content/get-item-orders.json:
- get:
- tags:
- - content
- summary: Get item orders.
- description: "Required role: N/A"
- operationId: getItemOrders
- parameters:
- - name: site_id
- in: query
- description: Project/Site ID to use
- required: true
- schema:
- type: string
- - name: path
- in: query
- schema:
- type: string
- description: Path of the content
- required: true
- example: /site/website/style/index.xml
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- properties:
- item:
- $ref: '#/components/schemas/ContentItemV1'
- versions:
- type: array
- items:
- $ref: '#/components/schemas/ContentItemOrder'
- '400':
- $ref: '#/components/responses/api1BadRequest'
- '401':
- $ref: '#/components/responses/Unauthorized'
-
/api/1/services/api/1/content/get-items-tree.json:
get:
tags:
@@ -2529,43 +2489,6 @@ paths:
'401':
$ref: '#/components/responses/Unauthorized'
- /api/1/services/api/1/content/get-next-item-order.json:
- get:
- tags:
- - content
- summary: Get next item order.
- description: "Required role: N/A"
- operationId: getNextItemOrder
- parameters:
- - name: site_id
- in: query
- description: Project/Site ID to use
- required: true
- schema:
- type: string
- - name: path
- in: query
- schema:
- type: string
- description: Path of the parent item
- required: true
- example: /site/website/index.xml
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- properties:
- nextValue:
- type: number
- example: 1000.0
- '400':
- $ref: '#/components/responses/api1BadRequest'
- '401':
- $ref: '#/components/responses/Unauthorized'
-
/api/1/services/api/1/content/get-pages.json:
get:
tags:
@@ -2615,59 +2538,6 @@ paths:
'401':
$ref: '#/components/responses/Unauthorized'
- /api/1/services/api/1/content/reorder-items.json:
- get:
- tags:
- - content
- summary: Reorder content items.
- description: "Required role: N/A"
- operationId: reorderItems
- parameters:
- - name: site_id
- in: query
- description: Project/Site ID to use
- required: true
- schema:
- type: string
- - name: path
- in: query
- schema:
- type: string
- description: Path of the content
- required: true
- example: /site/website/health/index.xml
- - name: before
- in: query
- schema:
- type: string
- description: Item before the item with given path
- required: true
- example: 1
- - name: after
- in: query
- schema:
- type: string
- description: Item after the item with given path
- required: true
- example: default
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- properties:
- orderValue:
- type: number
- example: 10500.0
- '400':
- $ref: '#/components/responses/api1BadRequest'
- '401':
- $ref: '#/components/responses/Unauthorized'
- '500':
- $ref: '#/components/responses/api1InternalServerError'
-
/api/2/search/search:
post:
tags:
@@ -5451,6 +5321,121 @@ paths:
'500':
$ref: '#/components/responses/InternalServerError'
+ /api/2/content/{siteId}/order:
+ get:
+ tags:
+ - content
+ summary: Get the existing items order for a given parent path
+ description: 'Required permission "content_read"'
+ operationId: getItemsOrder
+ parameters:
+ - name: siteId
+ in: path
+ required: true
+ schema:
+ type: string
+ description: Site ID
+ - name: parentPath
+ in: query
+ required: true
+ schema:
+ type: string
+ description: Parent path
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: object
+ properties:
+ response:
+ $ref: '#/components/schemas/ApiResponse'
+ path:
+ type: string
+ order:
+ type: number
+ format: double
+ label:
+ type: string
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '404':
+ $ref: '#/components/responses/NotFound'
+ '500':
+ $ref: '#/components/responses/InternalServerError'
+
+ /api/2/content/{siteId}/order/reorder:
+ post:
+ tags:
+ - content
+ summary: Calculates the order value so the item is placed at the selected location.
+ description: 'Required permission "content_read"'
+ operationId: reorderItem
+ parameters:
+ - name: siteId
+ in: path
+ required: true
+ schema:
+ type: string
+ description: Site ID
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ discriminator:
+ propertyName: type
+ mapping:
+ addBefore: '#/components/schemas/ReorderItemReferencePathRequest'
+ insertBetween: '#/components/schemas/ReorderItemInsertBetweenRequest'
+ addAfter: '#/components/schemas/ReorderItemReferencePathRequest'
+ oneOf:
+ - $ref: '#/components/schemas/ReorderItemInsertBetweenRequest'
+ - $ref: '#/components/schemas/ReorderItemReferencePathRequest'
+ examples:
+ addBefore:
+ summary: Add before reference item
+ value:
+ type: addBefore
+ referencePath: /site/website/article1/index.xml
+ insertBetween:
+ summary: Insert between two reference items
+ value:
+ type: insertBetween
+ previousPath: /site/website/article1/index.xml
+ nextPath: /site/website/article2/index.xml
+ addAfter:
+ summary: Add after reference item
+ value:
+ type: addAfter
+ referencePath: /site/website/article1/index.xml
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ response:
+ $ref: '#/components/schemas/ApiResponse'
+ order:
+ type: integer
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '404':
+ $ref: '#/components/responses/NotFound'
+ '500':
+ $ref: '#/components/responses/InternalServerError'
+
+
/api/2/dependency/{siteId}/publish_dependencies:
post:
tags:
@@ -10762,6 +10747,60 @@ components:
new:
type: boolean
+ ReorderItemRequestBase:
+ type: object
+ properties:
+ parentPath:
+ type: string
+ description: The path of the parent item
+ type:
+ type: string
+ description: The type of the reorder request
+ enum:
+ - addBefore
+ - insertBetween
+ - addAfter
+ required:
+ - parentPath
+ - type
+
+ ReorderItemReferencePathRequest:
+ allOf:
+ - $ref: '#/components/schemas/ReorderItemRequestBase'
+ - type: object
+ properties:
+ type:
+ type: string
+ enum:
+ - addBefore
+ - addAfter
+ referencePath:
+ type: string
+ description: The reference path to reorder
+ required:
+ - referencePath
+ - type
+
+ ReorderItemInsertBetweenRequest:
+ allOf:
+ - $ref: '#/components/schemas/ReorderItemRequestBase'
+ - type: object
+ properties:
+ type:
+ type: string
+ enum:
+ - insertBetween
+ previousPath:
+ type: string
+ description: The sibling item that is expected to be before the current item
+ nextPath:
+ type: string
+ description: The sibling item that is expected to be after the current item
+ required:
+ - previousPath
+ - nextPath
+ - type
+
ContentItemOrder:
type: object
properties:
diff --git a/src/main/java/org/craftercms/studio/api/v1/dal/NavigationOrderSequence.java b/src/main/java/org/craftercms/studio/api/v1/dal/NavigationOrderSequence.java
deleted file mode 100644
index 1adb3a273f..0000000000
--- a/src/main/java/org/craftercms/studio/api/v1/dal/NavigationOrderSequence.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.craftercms.studio.api.v1.dal;
-
-import java.io.Serializable;
-
-public class NavigationOrderSequence implements Serializable {
-
- private static final long serialVersionUID = 3646263089226872560L;
-
- protected String folderId;
- protected String site;
- protected String path;
- protected double maxCount;
-
- public String getFolderId() {
- return folderId;
- }
-
- public void setFolderId(String folderId) {
- this.folderId = folderId;
- }
-
- public String getSite() {
- return site;
- }
-
- public void setSite(String site) {
- this.site = site;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public double getMaxCount() {
- return maxCount;
- }
-
- public void setMaxCount(double maxCount) {
- this.maxCount = maxCount;
- }
-}
diff --git a/src/main/java/org/craftercms/studio/api/v1/dal/NavigationOrderSequenceMapper.java b/src/main/java/org/craftercms/studio/api/v1/dal/NavigationOrderSequenceMapper.java
deleted file mode 100644
index 7e840e7a0b..0000000000
--- a/src/main/java/org/craftercms/studio/api/v1/dal/NavigationOrderSequenceMapper.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.craftercms.studio.api.v1.dal;
-
-import org.apache.ibatis.annotations.Param;
-
-import java.util.Map;
-
-public interface NavigationOrderSequenceMapper {
-
- String SITE = "site";
- String SOURCE_PATH = "sourcePath";
- String TARGET_PATH = "targetPath";
-
- void insert(NavigationOrderSequence navigationOrderSequence);
-
- void update(NavigationOrderSequence navigationOrderSequence);
-
- NavigationOrderSequence getPageNavigationOrderForSiteAndPath(Map params);
-
- void deleteSequencesForSite(Map params);
-
- /**
- * Moves the navigation order from one path to another.
- *
- * @param site the site id
- * @param sourcePath the previous path to update
- * @param targetPath the new path
- */
- void move(@Param(SITE) String site,
- @Param(SOURCE_PATH) String sourcePath,
- @Param(TARGET_PATH) String targetPath);
-
- /**
- * Copies the navigation order from one path to another.
- *
- * @param site the site id
- * @param sourcePath the path to copy from
- * @param targetPath the path to copy to
- */
- void copy(@Param(SITE) String site,
- @Param(SOURCE_PATH) String sourcePath,
- @Param(TARGET_PATH) String targetPath);
-}
diff --git a/src/main/java/org/craftercms/studio/api/v1/service/content/ContentService.java b/src/main/java/org/craftercms/studio/api/v1/service/content/ContentService.java
index 9b8524aee1..cf50e31aab 100644
--- a/src/main/java/org/craftercms/studio/api/v1/service/content/ContentService.java
+++ b/src/main/java/org/craftercms/studio/api/v1/service/content/ContentService.java
@@ -170,7 +170,4 @@ public interface ContentService {
List getItemOrders(String site, String path) throws ContentNotFoundException;
- double reorderItems(String site, String relativePath, String before, String after, String orderName)
- throws ServiceLayerException;
-
}
diff --git a/src/main/java/org/craftercms/studio/api/v1/service/content/DmPageNavigationOrderService.java b/src/main/java/org/craftercms/studio/api/v1/service/content/DmPageNavigationOrderService.java
deleted file mode 100644
index 5f0f72ad4e..0000000000
--- a/src/main/java/org/craftercms/studio/api/v1/service/content/DmPageNavigationOrderService.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.craftercms.studio.api.v1.service.content;
-
-
-import org.dom4j.Document;
-
-/**
- * Order Service for Navigation Pages
- *
- * @author shankark
- * @author Dejan Brkic
- */
-public interface DmPageNavigationOrderService {
-
- /**
- * Return new navigation order
- */
- double getNewNavOrder(String site, String path);
-
-
- double getNewNavOrder(String site, String path, double currentMaxNavOrder);
-
- /**
- * Always adds/overwrites the Document element with new unique nav order
- *
- * @param doc
- * @return true if document was updated with new nav order
- */
- boolean addNavOrder(String site, String path, Document doc);
-
- /**
- * Updates the Document element with new unique nav order if one does not exist
- *
- * @param document
- * @return true if document was updated with new nav order
- */
- boolean updateNavOrder(String site, String path, Document document);
-
- void deleteSequencesForSite(String site);
-
- int getPageNavigationOrderIncrement();
-
- /**
- * Moves the navigation order from one path to another.
- *
- * @param siteId the site id
- * @param sourcePath the previous path to update
- * @param targetPath the new path
- */
- void move(String siteId, String sourcePath, String targetPath);
-
- /**
- * Copies the navigation order from one path to another.
- *
- * @param siteId the site id
- * @param sourcePath the path to copy from
- * @param targetPath the path to copy to
- */
- void copy(String siteId, String sourcePath, String targetPath);
-}
diff --git a/src/main/java/org/craftercms/studio/controller/rest/v2/ContentController.java b/src/main/java/org/craftercms/studio/controller/rest/v2/ContentController.java
index 49b29eac49..b6d8c998da 100644
--- a/src/main/java/org/craftercms/studio/controller/rest/v2/ContentController.java
+++ b/src/main/java/org/craftercms/studio/controller/rest/v2/ContentController.java
@@ -50,6 +50,7 @@
import org.craftercms.studio.model.rest.clipboard.PasteRequest;
import org.craftercms.studio.model.rest.content.*;
import org.craftercms.studio.model.rest.content.GetChildrenBulkRequest.PathParams;
+import org.craftercms.studio.model.rest.content.order.ReorderItemRequest;
import org.dom4j.Document;
import org.eclipse.jgit.lib.Constants;
import org.springframework.core.io.Resource;
@@ -338,8 +339,8 @@ public ResultList getHistory(@ValidSiteId @RequestParam(value = REQ
@GetMapping(SITE_HISTORY)
public ResultList history(@ValidSiteId @PathVariable String siteId,
- @NotEmpty @RequestParam(defaultValue = Constants.HEAD) String start,
- @Positive @RequestParam(defaultValue = "10") int limit) throws ServiceLayerException {
+ @NotEmpty @RequestParam(defaultValue = Constants.HEAD) String start,
+ @Positive @RequestParam(defaultValue = "10") int limit) throws ServiceLayerException {
ResultList result = new ResultList<>();
result.setEntities(RESULT_KEY_ITEMS, contentService.getHistory(siteId, start, limit));
result.setResponse(OK);
@@ -369,4 +370,21 @@ public Result createFolder(@ValidSiteId @PathVariable String siteId, @Valid @Req
result.setResponse(CREATED);
return result;
}
+
+ // Get the existing items order for a given parent path
+ // Return an array of objects with:
+ // - item path
+ // - item order value
+ // - item label
+ @GetMapping(GET_ITEMS_ORDER)
+ public Result getItemsOrder(@ValidSiteId @PathVariable String siteId, @NotEmpty @ValidExistingContentPath @RequestParam String parentPath) {
+ // TODO
+ return null;
+ }
+
+ @PostMapping(REORDER_ITEM)
+ public Result reorderItem(@ValidSiteId @PathVariable String siteId, @Valid @RequestBody ReorderItemRequest request) {
+ // TODO
+ return null;
+ }
}
diff --git a/src/main/java/org/craftercms/studio/controller/rest/v2/RequestMappingConstants.java b/src/main/java/org/craftercms/studio/controller/rest/v2/RequestMappingConstants.java
index 7d9c34d073..424f480f1b 100644
--- a/src/main/java/org/craftercms/studio/controller/rest/v2/RequestMappingConstants.java
+++ b/src/main/java/org/craftercms/studio/controller/rest/v2/RequestMappingConstants.java
@@ -67,6 +67,8 @@ public final class RequestMappingConstants {
public static final String FOLDER = SITE_ID + "/folder";
public static final String ITEM_HISTORY = "/item_history";
public static final String SITE_HISTORY = SITE_ID + "/history";
+ public static final String GET_ITEMS_ORDER = SITE_ID + "/order";
+ public static final String REORDER_ITEM = SITE_ID + "/order/reorder";
/**
* Groups controller
diff --git a/src/main/java/org/craftercms/studio/impl/v1/service/content/ContentServiceImpl.java b/src/main/java/org/craftercms/studio/impl/v1/service/content/ContentServiceImpl.java
index 3a282afe70..2474a10186 100644
--- a/src/main/java/org/craftercms/studio/impl/v1/service/content/ContentServiceImpl.java
+++ b/src/main/java/org/craftercms/studio/impl/v1/service/content/ContentServiceImpl.java
@@ -32,7 +32,6 @@
import org.craftercms.studio.api.v1.service.configuration.ServicesConfig;
import org.craftercms.studio.api.v1.service.content.ContentService;
import org.craftercms.studio.api.v1.service.content.ContentTypeService;
-import org.craftercms.studio.api.v1.service.content.DmPageNavigationOrderService;
import org.craftercms.studio.api.v1.to.ContentItemTO;
import org.craftercms.studio.api.v1.to.ContentTypeConfigTO;
import org.craftercms.studio.api.v1.to.DmOrderTO;
@@ -101,7 +100,6 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa
private GitContentRepository contentRepository;
protected ServicesConfig servicesConfig;
- protected DmPageNavigationOrderService dmPageNavigationOrderService;
protected StudioConfiguration studioConfiguration;
protected ContentTypeService contentTypeService;
protected ItemService itemService;
@@ -931,55 +929,6 @@ private List getOrders(String site, String relativePath, String order
return null;
}
- @Override
- @Valid
- public double reorderItems(@ValidateStringParam String site,
- @ValidateSecurePathParam() String relativePath,
- @ValidateSecurePathParam() String before,
- @ValidateSecurePathParam() String after,
- @ValidateStringParam() String orderName) {
- Double beforeOrder = null;
- Double afterOrder = null;
- DmOrderTO beforeOrderTO = null;
- DmOrderTO afterOrderTO = null;
- // get the order of the content before
- // if the path is not provided, the order is 0
- if (!isEmpty(before)) {
- ContentItemTO beforeItem = getContentItem(site, before, 0);
- beforeOrder = beforeItem.getOrder(orderName);
- beforeOrderTO = new DmOrderTO();
- beforeOrderTO.setId(before);
- if (beforeOrder != null && beforeOrder > 0) {
- beforeOrderTO.setOrder(beforeOrder);
- }
- }
- // get the order of the content after
- // if the path is not provided, the order is the order of before +
- // ORDER_INCREMENT
- if (!isEmpty(after)) {
- ContentItemTO afterItem = getContentItem(site, after, 0);
- afterOrder = afterItem.getOrder(orderName);
- afterOrderTO = new DmOrderTO();
- afterOrderTO.setId(after);
- if (afterOrder != null && afterOrder > 0) {
- afterOrderTO.setOrder(afterOrder);
- }
- }
-
- // if no after and before provided, the initial value is ORDER_INCREMENT
- if (afterOrder == null && beforeOrder == null) {
- return dmPageNavigationOrderService.getNewNavOrder(site,
- ContentUtils.getParentUrl(relativePath));
- } else if (beforeOrder == null) {
- return (0 + afterOrder) / 2;
- } else if (afterOrder == null) {
- return dmPageNavigationOrderService.getNewNavOrder(site,
- ContentUtils.getParentUrl(relativePath), beforeOrder);
- } else {
- //return (beforeOrder + afterOrder) / 2;
- return computeReorder(site, relativePath, beforeOrderTO, afterOrderTO, orderName);
- }
- }
/**
* Will need to include the floating pages as well for orderValue computation
@@ -1010,11 +959,6 @@ public void setServicesConfig(ServicesConfig servicesConfig) {
this.servicesConfig = servicesConfig;
}
- @SuppressWarnings("unused")
- public void setDmPageNavigationOrderService(DmPageNavigationOrderService dmPageNavigationOrderService) {
- this.dmPageNavigationOrderService = dmPageNavigationOrderService;
- }
-
public void setStudioConfiguration(StudioConfiguration studioConfiguration) {
this.studioConfiguration = studioConfiguration;
}
diff --git a/src/main/java/org/craftercms/studio/impl/v1/service/content/DmPageNavigationOrderServiceImpl.java b/src/main/java/org/craftercms/studio/impl/v1/service/content/DmPageNavigationOrderServiceImpl.java
deleted file mode 100644
index db9c2ea911..0000000000
--- a/src/main/java/org/craftercms/studio/impl/v1/service/content/DmPageNavigationOrderServiceImpl.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2007-2023 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.craftercms.studio.impl.v1.service.content;
-
-import org.apache.commons.lang3.StringUtils;
-import org.craftercms.commons.validation.annotations.param.ValidateSecurePathParam;
-import org.craftercms.commons.validation.annotations.param.ValidateStringParam;
-import org.craftercms.studio.api.v1.constant.DmXmlConstants;
-import org.craftercms.studio.api.v1.dal.NavigationOrderSequence;
-import org.craftercms.studio.api.v1.dal.NavigationOrderSequenceMapper;
-import org.craftercms.studio.api.v1.service.AbstractRegistrableService;
-import org.craftercms.studio.api.v1.service.GeneralLockService;
-import org.craftercms.studio.api.v1.service.content.ContentService;
-import org.craftercms.studio.api.v1.service.content.DmPageNavigationOrderService;
-import org.craftercms.studio.api.v1.to.ContentItemTO;
-import org.craftercms.studio.api.v2.dal.RetryingDatabaseOperationFacade;
-import org.craftercms.studio.api.v2.utils.StudioConfiguration;
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.Node;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import jakarta.validation.Valid;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import static org.craftercms.studio.api.v2.utils.StudioConfiguration.PAGE_NAVIGATION_ORDER_INCREMENT;
-
-public class DmPageNavigationOrderServiceImpl extends AbstractRegistrableService
- implements DmPageNavigationOrderService {
-
- private static final Logger logger = LoggerFactory.getLogger(DmPageNavigationOrderServiceImpl.class);
-
- protected GeneralLockService generalLockService;
- protected ContentService contentService;
- protected StudioConfiguration studioConfiguration;
- protected NavigationOrderSequenceMapper navigationOrderSequenceMapper;
- protected RetryingDatabaseOperationFacade retryingDatabaseOperationFacade;
-
- @Override
- public void register() {
- this._servicesManager.registerService(DmPageNavigationOrderService.class, this);
- }
-
- @Override
- @Valid
- public double getNewNavOrder(@ValidateStringParam String site,
- @ValidateSecurePathParam String path) {
- return getNewNavOrder(site, path, -1);
- }
-
- @Override
- @Valid
- public double getNewNavOrder(@ValidateStringParam String site,
- @ValidateSecurePathParam String path,
- double currentMaxNavOrder) {
- double lastNavOrder = 1000D;
- try {
- Map params = new HashMap<>();
- params.put("site", site);
- params.put("path", path);
- NavigationOrderSequence navigationOrderSequence =
- navigationOrderSequenceMapper.getPageNavigationOrderForSiteAndPath(params);
- if (navigationOrderSequence == null) {
- navigationOrderSequence = getNewNavigationOrderSequence(site, path, currentMaxNavOrder);
- NavigationOrderSequence finalNavOrderSequence = navigationOrderSequence;
- retryingDatabaseOperationFacade.retry(() -> navigationOrderSequenceMapper.insert(finalNavOrderSequence));
- } else {
- double newMaxCount = navigationOrderSequence.getMaxCount() + getPageNavigationOrderIncrement();
- navigationOrderSequence.setMaxCount(newMaxCount);
- NavigationOrderSequence finalNavOrderSequence = navigationOrderSequence;
- retryingDatabaseOperationFacade.retry(() -> navigationOrderSequenceMapper.update(finalNavOrderSequence));
- }
- lastNavOrder = navigationOrderSequence.getMaxCount();
- } catch (Exception e) {
- logger.error("Failed to get the new NavOrder for site '{}' path '{}'", site, path, e);
- }
- return lastNavOrder;
-
- }
-
- private NavigationOrderSequence getNewNavigationOrderSequence(final String site, final String path, final double currentMaxNavOrder) {
- NavigationOrderSequence navigationOrderSequence;
- navigationOrderSequence = new NavigationOrderSequence();
- navigationOrderSequence.setSite(site);
- navigationOrderSequence.setPath(path);
- ContentItemTO itemTreeTO = contentService.getContentItemTree(site, path, 1);
- if (itemTreeTO == null) {
- navigationOrderSequence.setMaxCount(0F);
- } else {
- if (StringUtils.isEmpty(itemTreeTO.getNodeRef())) {
- navigationOrderSequence.setFolderId(UUID.randomUUID().toString());
- } else {
- navigationOrderSequence.setFolderId(itemTreeTO.getNodeRef());
- }
- if (currentMaxNavOrder < 0) {
- navigationOrderSequence.setMaxCount(1000F * itemTreeTO.getNumOfChildren());
- } else {
- double newMaxCount = currentMaxNavOrder + getPageNavigationOrderIncrement();
- navigationOrderSequence.setMaxCount(newMaxCount);
- }
- }
- return navigationOrderSequence;
- }
-
- @Override
- @Valid
- public boolean addNavOrder(@ValidateStringParam String site,
- @ValidateSecurePathParam String path, Document document) {
- boolean docUpdated = false;
- Element root = document.getRootElement();
- Node navOrderNode = root.selectSingleNode("//" + DmXmlConstants.ELM_ORDER_DEFAULT);
-
- //skip if order value element does not exist
- if (navOrderNode != null) {
- String newOrder = String.valueOf(getNewNavOrder(site, path));
- ((Element) navOrderNode).setText(newOrder);
- docUpdated = true;
- }
- return docUpdated;
- }
-
- @Override
- @Valid
- public boolean updateNavOrder(@ValidateStringParam String site,
- @ValidateSecurePathParam String path, Document document) {
- boolean docUpdated = false;
- Element root = document.getRootElement();
- Node navOrderNode = root.selectSingleNode("//" + DmXmlConstants.ELM_ORDER_DEFAULT);
-
- // Skip if order value element does not exist
- if (navOrderNode != null) {
- String value = ((Element) navOrderNode).getText();
-
- // Skip if order value already exist
- if (StringUtils.isEmpty(value)) {
- String newOrder = String.valueOf(getNewNavOrder(site, path));
- ((Element) navOrderNode).setText(newOrder);
- docUpdated = true;
- } else {
- logger.debug("NavOrder value already exist for site '{}' path '{}' value '{}'",
- site, path, value);
- }
- }
- return docUpdated;
- }
-
- @Override
- @Valid
- public void deleteSequencesForSite(@ValidateStringParam String site) {
- Map params = new HashMap<>();
- params.put("site", site);
- retryingDatabaseOperationFacade.retry(() -> navigationOrderSequenceMapper.deleteSequencesForSite(params));
- }
-
- @Override
- public int getPageNavigationOrderIncrement() {
- int toReturn = Integer.parseInt(studioConfiguration.getProperty(PAGE_NAVIGATION_ORDER_INCREMENT));
- return toReturn;
- }
-
- @Override
- public void move(String siteId, String sourcePath, String targetPath) {
- retryingDatabaseOperationFacade.retry(() -> navigationOrderSequenceMapper.move(siteId, sourcePath, targetPath));
- }
-
- @Override
- public void copy(String siteId, String sourcePath, String targetPath) {
- retryingDatabaseOperationFacade.retry(() -> navigationOrderSequenceMapper.copy(siteId, sourcePath, targetPath));
- }
-
- public GeneralLockService getGeneralLockService() {
- return generalLockService;
- }
-
- public void setGeneralLockService(GeneralLockService generalLockService) {
- this.generalLockService = generalLockService;
- }
-
- public ContentService getContentService() {
- return contentService;
- }
-
- public void setContentService(ContentService contentService) {
- this.contentService = contentService;
- }
-
- public StudioConfiguration getStudioConfiguration() {
- return studioConfiguration;
- }
-
- public void setStudioConfiguration(StudioConfiguration studioConfiguration) {
- this.studioConfiguration = studioConfiguration;
- }
-
- public NavigationOrderSequenceMapper getNavigationOrderSequenceMapper() {
- return navigationOrderSequenceMapper;
- }
-
- public void setNavigationOrderSequenceMapper(NavigationOrderSequenceMapper navigationOrderSequenceMapper) {
- this.navigationOrderSequenceMapper = navigationOrderSequenceMapper;
- }
-
- public RetryingDatabaseOperationFacade getRetryingDatabaseOperationFacade() {
- return retryingDatabaseOperationFacade;
- }
-
- public void setRetryingDatabaseOperationFacade(RetryingDatabaseOperationFacade retryingDatabaseOperationFacade) {
- this.retryingDatabaseOperationFacade = retryingDatabaseOperationFacade;
- }
-}
diff --git a/src/main/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImpl.java b/src/main/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImpl.java
index db0941372c..2afea71c6e 100644
--- a/src/main/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImpl.java
+++ b/src/main/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImpl.java
@@ -42,7 +42,6 @@
import org.craftercms.studio.api.v1.exception.security.UserNotFoundException;
import org.craftercms.studio.api.v1.service.GeneralLockService;
import org.craftercms.studio.api.v1.service.configuration.ServicesConfig;
-import org.craftercms.studio.api.v1.service.content.DmPageNavigationOrderService;
import org.craftercms.studio.api.v1.to.CopyDependencyConfigTO;
import org.craftercms.studio.api.v2.content.ContentLifecycle;
import org.craftercms.studio.api.v2.content.LifecycleContent;
@@ -191,7 +190,6 @@ public class ContentServiceInternalImpl implements ContentService, ApplicationEv
private final ContentLifecycle contentLifecycle;
private final ContentLifecycle assetLifecycle;
private final PermissionEvaluator permissionEvaluator;
- private final DmPageNavigationOrderService pageNavOrderService;
private final PlatformTransactionManager transactionManager;
private final RetryingDatabaseOperationFacade retryingDatabaseOperationFacade;
private final ServicesConfig servicesConfig;
@@ -201,7 +199,7 @@ public class ContentServiceInternalImpl implements ContentService, ApplicationEv
@ConstructorProperties({"transactionManager", "studioConfiguration", "siteService",
"retryingDatabaseOperationFacade", "publishService",
- "permissionEvaluator", "pageNavOrderService", "itemService",
+ "permissionEvaluator", "itemService",
"itemDao", "generalLockService", "dependencyService",
"contentRepository", "contentLifecycle",
"auditService", "assetLifecycle",
@@ -211,7 +209,7 @@ public ContentServiceInternalImpl(PlatformTransactionManager transactionManager,
SitesService siteService,
RetryingDatabaseOperationFacade retryingDatabaseOperationFacade, PublishService publishService,
PermissionEvaluator permissionEvaluator,
- DmPageNavigationOrderService pageNavOrderService, ItemService itemService,
+ ItemService itemService,
ItemDAO itemDao, GeneralLockService generalLockService,
DependencyService dependencyService,
GitContentRepository contentRepository, ContentLifecycle contentLifecycle,
@@ -224,7 +222,6 @@ public ContentServiceInternalImpl(PlatformTransactionManager transactionManager,
this.retryingDatabaseOperationFacade = retryingDatabaseOperationFacade;
this.publishService = publishService;
this.permissionEvaluator = permissionEvaluator;
- this.pageNavOrderService = pageNavOrderService;
this.itemService = itemService;
this.itemDao = itemDao;
this.generalLockService = generalLockService;
@@ -497,7 +494,7 @@ protected LifecycleContent runLifecycle(final String siteId, final String source
}
String contentType = document.getRootElement().valueOf(CONTENT_TYPE);
if (isPageDescriptor(path)) {
- pageNavOrderService.updateNavOrder(siteId, path, document);
+ updateNavOrder(siteId, path, document);
}
Map dependencies = updateContentOnWrite(siteId, sourcePath, path, newItemLabel, operation, document.getRootElement());
Path tempFile = createTempFile(path, document);
@@ -529,6 +526,11 @@ protected LifecycleContent runLifecycle(final String siteId, final String source
return lifecycleContent;
}
+ private boolean updateNavOrder(String siteId, String path, Document document) {
+ // TODO: Check the nav order exists in the document, if not, add it with the next item order value
+ return false;
+ }
+
/**
* Update the XML content objectId and groupId fields
*/
@@ -1159,9 +1161,9 @@ protected PasteContentResult copyInternal(Site site, String sourcePath, String t
String newLabel, LifecycleOperation operation)
throws ServiceLayerException, UserNotFoundException, AuthenticationException {
String siteId = site.getSiteId();
- if (underPagesRoot(sourcePath)) {
- pageNavOrderService.copy(siteId, sourcePath, targetPath);
- }
+// if (underPagesRoot(sourcePath)) {
+// pageNavOrderService.copy(siteId, sourcePath, targetPath);
+// }
Map lifecycleItems = mergeLifecycleContents(lifecycleContents);
Map dependencies =
lifecycleContents.stream()
@@ -2058,9 +2060,9 @@ protected PasteContentResult moveInternal(final Site site, final String sourcePa
Collection lifecycleContents, Set sourcePathChildren)
throws ServiceLayerException, UserNotFoundException, AuthenticationException, DocumentException, IOException {
String siteId = site.getSiteId();
- if (underPagesRoot(sourcePath)) {
- pageNavOrderService.move(siteId, sourcePath, targetPath);
- }
+// if (underPagesRoot(sourcePath)) {
+// pageNavOrderService.move(siteId, sourcePath, targetPath);
+// }
updateNavOrderForMove(siteId, sourcePath, lifecycleContents, sourcePathChildren);
// Consolidate the items into a single map
Map lifecycleItems = mergeLifecycleContents(lifecycleContents);
@@ -2287,7 +2289,7 @@ protected void updateNavOrderForMove(String siteId, String targetPath, Collectio
for (ContentLifecycleItem navUpdated : itemsToUpdate) {
Document document = navUpdated.contentAsDocument();
- if (pageNavOrderService.updateNavOrder(siteId, navUpdated.repoPath(), document)) {
+ if (updateNavOrder(siteId, navUpdated.repoPath(), document)) {
// This will update the ContentLifecycleItem and clean the resources of the previous version
lifecycleContent.write(navUpdated.repoPath(), document);
}
diff --git a/src/main/java/org/craftercms/studio/model/rest/content/order/ReorderItemRequest.java b/src/main/java/org/craftercms/studio/model/rest/content/order/ReorderItemRequest.java
new file mode 100644
index 0000000000..75d89284b1
--- /dev/null
+++ b/src/main/java/org/craftercms/studio/model/rest/content/order/ReorderItemRequest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2007-2026 Crafter Software Corporation. All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.craftercms.studio.model.rest.content.order;
+
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import jakarta.validation.constraints.NotBlank;
+import org.craftercms.commons.validation.annotations.param.ValidExistingContentPath;
+
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.NAME,
+ property = "type"
+)
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = ReorderItemRequest.AddBefore.class, name = "addBefore"),
+ @JsonSubTypes.Type(value = ReorderItemRequest.Insert.class, name = "insertBetween"),
+ @JsonSubTypes.Type(value = ReorderItemRequest.AddAfter.class, name = "addAfter")
+})
+public sealed abstract class ReorderItemRequest {
+ @NotBlank
+ @ValidExistingContentPath
+ protected String parentPath;
+
+ public String getParentPath() {
+ return parentPath;
+ }
+
+ public void setParentPath(String parentPath) {
+ this.parentPath = parentPath;
+ }
+
+ public static sealed abstract class ReferenceReorderItemRequest extends ReorderItemRequest {
+ @NotBlank
+ @ValidExistingContentPath
+ protected String referencePath;
+
+ public String getReferencePath() {
+ return referencePath;
+ }
+
+ public void setReferencePath(String referencePath) {
+ this.referencePath = referencePath;
+ }
+ }
+
+ public static final class AddBefore extends ReferenceReorderItemRequest {
+ }
+
+ public static final class AddAfter extends ReferenceReorderItemRequest {
+ }
+
+ public static final class Insert extends ReorderItemRequest {
+ @NotBlank
+ @ValidExistingContentPath
+ protected String previousPath;
+ @NotBlank
+ @ValidExistingContentPath
+ protected String nextPath;
+
+ public String getNextPath() {
+ return nextPath;
+ }
+
+ public void setNextPath(String nextPath) {
+ this.nextPath = nextPath;
+ }
+
+ public String getPreviousPath() {
+ return previousPath;
+ }
+
+ public void setPreviousPath(String previousPath) {
+ this.previousPath = previousPath;
+ }
+ }
+}
diff --git a/src/main/resources/crafter/studio/database-context.xml b/src/main/resources/crafter/studio/database-context.xml
index 0de65062d8..7c604924e1 100644
--- a/src/main/resources/crafter/studio/database-context.xml
+++ b/src/main/resources/crafter/studio/database-context.xml
@@ -120,11 +120,6 @@
-
-
-
-
-
diff --git a/src/main/resources/crafter/studio/studio-services-context.xml b/src/main/resources/crafter/studio/studio-services-context.xml
index a07fd0c9cc..e1fa1c2ac4 100644
--- a/src/main/resources/crafter/studio/studio-services-context.xml
+++ b/src/main/resources/crafter/studio/studio-services-context.xml
@@ -81,7 +81,6 @@
-
@@ -161,15 +160,6 @@
-
-
-
-
-
-
-
-
diff --git a/src/main/resources/org/craftercms/studio/api/v1/dal/NavigationOrderSequenceMapper.xml b/src/main/resources/org/craftercms/studio/api/v1/dal/NavigationOrderSequenceMapper.xml
deleted file mode 100644
index ece7029295..0000000000
--- a/src/main/resources/org/craftercms/studio/api/v1/dal/NavigationOrderSequenceMapper.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- INSERT INTO navigation_order_sequence
- (folder_id, site, path, max_count)
- VALUES (#{folderId}, #{site}, #{path}, #{maxCount})
-
-
-
- UPDATE
- navigation_order_sequence
- SET site= #{site},
- path = #{path},
- max_count = #{maxCount}
- WHERE folder_id = #{folderId}
-
-
-
- DELETE
- FROM navigation_order_sequence
- WHERE site = #{site}
-
-
-
- UPDATE navigation_order_sequence
- SET path = CASE
- WHEN path = #{sourcePath} THEN #{targetPath}
- WHEN path LIKE CONCAT(TRIM(TRAILING '/' FROM #{sourcePath}), '/%')
- THEN CONCAT(#{targetPath}, TRIM(LEADING #{sourcePath} FROM path))
- ELSE path
- END
- WHERE site = #{site}
- AND (path LIKE CONCAT(TRIM(TRAILING '/' FROM #{sourcePath}), '/%')
- OR path = #{sourcePath})
-
-
-
- INSERT INTO navigation_order_sequence
- (folder_id, site, path, max_count)
- SELECT UUID(), #{site}, CONCAT(#{targetPath}, TRIM(LEADING #{sourcePath} FROM path)), max_count
- FROM navigation_order_sequence
- WHERE site = #{site}
- AND (path LIKE CONCAT(TRIM(TRAILING '/' FROM #{sourcePath}), '/%')
- OR path = #{sourcePath})
-
-
diff --git a/src/main/webapp/default-site/scripts/api/ContentServices.groovy b/src/main/webapp/default-site/scripts/api/ContentServices.groovy
index ff6c276506..5102783c6d 100644
--- a/src/main/webapp/default-site/scripts/api/ContentServices.groovy
+++ b/src/main/webapp/default-site/scripts/api/ContentServices.groovy
@@ -43,17 +43,6 @@ class ContentServices {
return contentServicesImpl.getContentItemTree(site, path, depth)
}
- /**
- * get content orders for a given path (usually used for navigation)
- * @param site - the project ID
- * @param path - the parent path containing the ordered objects
- * @oaran context - container for passing request, token and other values that may be needed by the implementation
- */
- static getItemOrders(context, site, path) {
- def contentServicesImpl = ServiceFactory.getContentServices(context)
- return contentServicesImpl.getItemOrders(site, path)
- }
-
/**
* Get the content for a specific version
* @param site - the project ID
@@ -70,9 +59,4 @@ class ContentServices {
def contentTypeServicesImpl = ServiceFactory.getContentTypeServices(context);
return contentTypeServicesImpl.getContentType(site, type)
}
-
- static reorderItems(context, site, path, before, after) {
- def contentServicesImpl = ServiceFactory.getContentServices(context);
- return contentServicesImpl.reorderItems(site, path, before, after);
- }
}
diff --git a/src/main/webapp/default-site/scripts/api/PageNavigationOrderServices.groovy b/src/main/webapp/default-site/scripts/api/PageNavigationOrderServices.groovy
deleted file mode 100644
index 0e432e4764..0000000000
--- a/src/main/webapp/default-site/scripts/api/PageNavigationOrderServices.groovy
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package scripts.api;
-
-import scripts.api.ServiceFactory;
-
-class PageNavigationOrderServices {
-
- /**
- * create the context object
- * @param applicationContext - studio application's contect (spring container etc)
- * @param request - web request if in web request context
- */
- static createContext(applicationContext, request) {
- return ServiceFactory.createContext(applicationContext, request)
- }
-
- static getNextItemOrder(context, site, path) {
- def pageNavigationOrderServicesImpl = ServiceFactory.getPageNavigationOrderServices(context);
- return pageNavigationOrderServicesImpl.getNewNavOrder(site, path);
- }
-}
diff --git a/src/main/webapp/default-site/scripts/api/ServiceFactory.groovy b/src/main/webapp/default-site/scripts/api/ServiceFactory.groovy
index 266ff280a3..1a83304055 100644
--- a/src/main/webapp/default-site/scripts/api/ServiceFactory.groovy
+++ b/src/main/webapp/default-site/scripts/api/ServiceFactory.groovy
@@ -16,13 +16,12 @@
package scripts.api
-import scripts.libs.Cookies
import scripts.api.impl.content.SpringContentServices
import scripts.api.impl.content.SpringContentTypeServices
-import scripts.api.impl.content.SpringPageNavigationOrderServices
import scripts.api.impl.security.SpringSecurityServices
import scripts.api.impl.site.SpringSiteServices
import scripts.api.impl.user.SpringUserServices
+import scripts.libs.Cookies
/**
* Class is a factory used by the API wrappers to find their implementation
@@ -80,16 +79,6 @@ class ServiceFactory {
return new SpringSiteServices(context)
}
- /**
- * return the implementation for nav services
- *
- * @param context site context
- * @return Nav Services
- */
- static getPageNavigationOrderServices(context) {
- return new SpringPageNavigationOrderServices(context)
- }
-
/**
* return the implementation for user services
*
diff --git a/src/main/webapp/default-site/scripts/api/impl/content/SpringContentServices.groovy b/src/main/webapp/default-site/scripts/api/impl/content/SpringContentServices.groovy
index 177f163e30..81f9f39426 100644
--- a/src/main/webapp/default-site/scripts/api/impl/content/SpringContentServices.groovy
+++ b/src/main/webapp/default-site/scripts/api/impl/content/SpringContentServices.groovy
@@ -40,16 +40,6 @@ class SpringContentServices {
return springBackedService.getContentItemTree(site, path, depth)
}
- /**
- * get content orders for a given path (usually used for navigation)
- * @param site - the project ID
- * @param path - the parent path containing the ordered objects
- */
- def getItemOrders(site, path) {
- def springBackedService = this.context.applicationContext.get(CONTENT_SERVICES_BEAN)
- return springBackedService.getItemOrders(site, path);
- }
-
/**
* Get the content for a specific version
* @param site - the project ID
@@ -60,9 +50,4 @@ class SpringContentServices {
def springBackedService = this.context.applicationContext.get(CONTENT_SERVICES_BEAN)
return springBackedService.getContentVersionAsString(site, path, version)
}
-
- def reorderItems(site, path, before, after) {
- def springBackendService = this.context.applicationContext.get(CONTENT_SERVICES_BEAN);
- return springBackendService.reorderItems(site, path, before, after, "default");
- }
}
diff --git a/src/main/webapp/default-site/scripts/api/impl/content/SpringPageNavigationOrderServices.groovy b/src/main/webapp/default-site/scripts/api/impl/content/SpringPageNavigationOrderServices.groovy
deleted file mode 100644
index ed51b4aa76..0000000000
--- a/src/main/webapp/default-site/scripts/api/impl/content/SpringPageNavigationOrderServices.groovy
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package scripts.api.impl.content
-
-class SpringPageNavigationOrderServices {
-
- static PAGENAVORDER_SERVICES_BEAN = "cstudioPageNavOrderService"
-
- def context = null
-
- def SpringPageNavigationOrderServices(context) {
- this.context = context
- }
-
- def getNewNavOrder(site, path) {
- def springBackedService = this.context.applicationContext.get(PAGENAVORDER_SERVICES_BEAN);
- return springBackedService.getNewNavOrder(site, path);
- }
-}
diff --git a/src/main/webapp/default-site/scripts/rest/api/1/content/get-item-orders.get.groovy b/src/main/webapp/default-site/scripts/rest/api/1/content/get-item-orders.get.groovy
deleted file mode 100644
index d95cba3a93..0000000000
--- a/src/main/webapp/default-site/scripts/rest/api/1/content/get-item-orders.get.groovy
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-
-import org.apache.commons.lang3.StringUtils
-import scripts.api.ContentServices
-
-def result = [:]
-def site = params.site_id
-def path = params.path
-
-/** Validate Parameters */
-def invalidParams = false
-def paramsList = []
-
-// site_id
-try {
- if (StringUtils.isEmpty(site)) {
- site = params.site
- if (StringUtils.isEmpty(site)) {
- invalidParams = true
- paramsList.add("site_id")
- }
- }
-} catch (Exception e) {
- invalidParams = true
- paramsList.add("site_id")
-}
-
-if (invalidParams) {
- response.setStatus(400)
- result.message = "Invalid parameter(s): " + paramsList
-} else {
- def context = ContentServices.createContext(applicationContext, request)
-
- result.order = ContentServices.getItemOrders(context, site, path)
-
-}
-return result
diff --git a/src/main/webapp/default-site/scripts/rest/api/1/content/get-next-item-order.get.groovy b/src/main/webapp/default-site/scripts/rest/api/1/content/get-next-item-order.get.groovy
deleted file mode 100644
index c940d89854..0000000000
--- a/src/main/webapp/default-site/scripts/rest/api/1/content/get-next-item-order.get.groovy
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-
-import org.apache.commons.lang3.StringUtils
-import scripts.api.PageNavigationOrderServices
-
-def result = [:]
-def site = params.site_id
-def path = params.parentpath
-
-/** Validate Parameters */
-def invalidParams = false
-def paramsList = []
-
-// site_id
-try {
- if (StringUtils.isEmpty(site)) {
- site = params.site
- if (StringUtils.isEmpty(site)) {
- invalidParams = true
- paramsList.add("site_id")
- }
- }
-} catch (Exception e) {
- invalidParams = true
- paramsList.add("site_id")
-}
-
-if (invalidParams) {
- response.setStatus(400)
- result.message = "Invalid parameter(s): " + paramsList
-} else {
- def context = PageNavigationOrderServices.createContext(applicationContext, request)
- result.nextValue = PageNavigationOrderServices.getNextItemOrder(context, site, path)
-
-}
-return result
diff --git a/src/main/webapp/default-site/scripts/rest/api/1/content/reorder-items.get.groovy b/src/main/webapp/default-site/scripts/rest/api/1/content/reorder-items.get.groovy
deleted file mode 100644
index 632890376d..0000000000
--- a/src/main/webapp/default-site/scripts/rest/api/1/content/reorder-items.get.groovy
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-
-import org.apache.commons.lang3.StringUtils
-import scripts.api.ContentServices
-
-def result = [:]
-def site = params.site_id
-def path = params.path
-def after = params.after
-def before = params.before
-
-/** Validate Parameters */
-def invalidParams = false
-def paramsList = []
-
-// site_id
-try {
- if (StringUtils.isEmpty(site)) {
- site = params.site
- if (StringUtils.isEmpty(site)) {
- invalidParams = true
- paramsList.add("site_id")
- }
- }
-} catch (Exception e) {
- invalidParams = true
- paramsList.add("site_id")
-}
-
-if (invalidParams) {
- response.setStatus(400)
- result.message = "Invalid parameter(s): " + paramsList
-} else {
- def context = ContentServices.createContext(applicationContext, request)
- result.orderValue = ContentServices.reorderItems(context, site, path, before, after)
-
-}
-return result
diff --git a/src/test/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImplTest.java b/src/test/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImplTest.java
index 22f43960fb..66ca5309c7 100644
--- a/src/test/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImplTest.java
+++ b/src/test/java/org/craftercms/studio/impl/v2/service/content/internal/ContentServiceInternalImplTest.java
@@ -27,7 +27,6 @@
import org.craftercms.studio.api.v1.exception.security.AuthenticationException;
import org.craftercms.studio.api.v1.exception.security.UserNotFoundException;
import org.craftercms.studio.api.v1.service.GeneralLockService;
-import org.craftercms.studio.api.v1.service.content.DmPageNavigationOrderService;
import org.craftercms.studio.api.v2.content.ContentLifecycle;
import org.craftercms.studio.api.v2.content.LifecycleContent;
import org.craftercms.studio.api.v2.content.LifecycleContent.ContentLifecycleItem;
@@ -135,9 +134,6 @@ public class ContentServiceInternalImplTest {
@Mock
protected DependencyService dependencyService;
- @Mock
- protected DmPageNavigationOrderService pageNavOrderService;
-
@Mock
protected SitesService siteService;
@@ -395,8 +391,6 @@ public void testMovePageSuccess() throws Exception {
verify(contentRepository, times(1)).moveContent(eq(SITE_ID), eq(sourceFolder), eq(targetFolder), anyCollection(), anySet());
- verify(pageNavOrderService).move(SITE_ID, sourceFolder, targetFolder);
-
verify(serviceInternal, times(3)).runLifecycle(
eq(SITE_ID), any(), anyString(), any(), any(), any()
);