1 /**
2 * Copyright 2014-2024 Bloomreach B.V. (<a href="https://www.bloomreach.com">https://www.bloomreach.com</a>)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.onehippo.forge.exdocpicker.api;
17
18 import java.io.Serializable;
19
20 /**
21 * The implementation of this interface is responsible for getting currently-selected external documents from the context document node
22 * and setting new external documents into the context document node.
23 *
24 * @param <T> Domain specific external document POJO type which must be serializable.
25 */
26 public interface ExternalDocumentFieldService<T extends Serializable> {
27
28 /**
29 * Gets the currently-selected external documents from the context CMS document node and returns them in {@link ExternalDocumentCollection}.
30 * @param context ExternalDocumentServiceContext instance
31 * @return document collection
32 */
33 public ExternalDocumentCollection<T> getFieldExternalDocuments(ExternalDocumentServiceContext context);
34
35 /**
36 * Sets the new external documents (<code>exdocs</code>) into the context CMS document.
37 * @param context ExternalDocumentServiceContext instance
38 * @param exdocs document collection
39 */
40 public void setFieldExternalDocuments(ExternalDocumentServiceContext context, ExternalDocumentCollection<T> exdocs);
41
42 }