001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     vpasquier <vpasquier@nuxeo.com>
018 */
019package org.nuxeo.box.api.service;
020
021import com.google.common.collect.BiMap;
022import org.nuxeo.box.api.folder.adapter.BoxFolderAdapter;
023import org.nuxeo.box.api.marshalling.dao.BoxCollaboration;
024import org.nuxeo.box.api.marshalling.dao.BoxCollection;
025import org.nuxeo.box.api.marshalling.dao.BoxComment;
026import org.nuxeo.box.api.marshalling.dao.BoxFile;
027import org.nuxeo.box.api.marshalling.dao.BoxFolder;
028import org.nuxeo.box.api.marshalling.dao.BoxGroup;
029import org.nuxeo.box.api.marshalling.dao.BoxObject;
030import org.nuxeo.box.api.marshalling.dao.BoxTypedObject;
031import org.nuxeo.box.api.marshalling.dao.BoxUser;
032import org.nuxeo.box.api.marshalling.exceptions.BoxJSONException;
033import org.nuxeo.ecm.core.api.CoreSession;
034import org.nuxeo.ecm.core.api.DocumentModel;
035import org.nuxeo.ecm.core.api.DocumentModelList;
036import org.nuxeo.ecm.core.api.NuxeoGroup;
037import org.nuxeo.ecm.core.api.NuxeoPrincipal;
038import org.nuxeo.ecm.core.api.security.ACE;
039
040import java.util.List;
041
042/**
043 * Box Service Utils
044 *
045 * @since 5.9.3
046 */
047public interface BoxService {
048
049    BiMap<String, String> getNxBoxRole();
050
051    BoxCollection searchBox(String term, CoreSession session, String limit, String offset);
052
053    List<BoxTypedObject> getBoxDocumentCollection(DocumentModelList documentModels, String fields);
054
055    BoxCollaboration getBoxCollaboration(BoxFolderAdapter boxItem, ACE ace, String collaborationId);
056
057    String toJSONString(BoxObject boxObject) throws BoxJSONException;
058
059    String getBoxId(DocumentModel doc);
060
061    String getBoxSequenceId(DocumentModel doc);
062
063    String getBoxEtag(DocumentModel doc);
064
065    String getBoxName(DocumentModel doc);
066
067    BoxUser fillUser(NuxeoPrincipal creator);
068
069    BoxGroup fillGroup(NuxeoGroup group);
070
071    BoxFolder getBoxFolder(String jsonBoxFolder) throws BoxJSONException;
072
073    BoxFile getBoxFile(String jsonBoxFile) throws BoxJSONException;
074
075    BoxComment getBoxComment(String jsonBoxComment) throws BoxJSONException;
076
077    BoxCollaboration getBoxCollaboration(String jsonBoxCollaboration) throws BoxJSONException;
078
079    String getJSONFromBox(BoxTypedObject boxTypedObject) throws BoxJSONException;
080
081    String getJSONBoxException(Exception e, int status);
082
083    String[] getCollaborationArrayIds(String collaborationId);
084
085}