001/* 002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * vpasquier <vpasquier@nuxeo.com> 016 */ 017package org.nuxeo.box.api.service; 018 019import com.google.common.collect.BiMap; 020import org.nuxeo.box.api.folder.adapter.BoxFolderAdapter; 021import org.nuxeo.box.api.marshalling.dao.BoxCollaboration; 022import org.nuxeo.box.api.marshalling.dao.BoxCollection; 023import org.nuxeo.box.api.marshalling.dao.BoxComment; 024import org.nuxeo.box.api.marshalling.dao.BoxFile; 025import org.nuxeo.box.api.marshalling.dao.BoxFolder; 026import org.nuxeo.box.api.marshalling.dao.BoxGroup; 027import org.nuxeo.box.api.marshalling.dao.BoxObject; 028import org.nuxeo.box.api.marshalling.dao.BoxTypedObject; 029import org.nuxeo.box.api.marshalling.dao.BoxUser; 030import org.nuxeo.box.api.marshalling.exceptions.BoxJSONException; 031import org.nuxeo.ecm.core.api.CoreSession; 032import org.nuxeo.ecm.core.api.DocumentModel; 033import org.nuxeo.ecm.core.api.DocumentModelList; 034import org.nuxeo.ecm.core.api.NuxeoGroup; 035import org.nuxeo.ecm.core.api.NuxeoPrincipal; 036import org.nuxeo.ecm.core.api.security.ACE; 037 038import java.util.List; 039 040/** 041 * Box Service Utils 042 * 043 * @since 5.9.3 044 */ 045public interface BoxService { 046 047 BiMap<String, String> getNxBoxRole(); 048 049 BoxCollection searchBox(String term, CoreSession session, String limit, String offset); 050 051 List<BoxTypedObject> getBoxDocumentCollection(DocumentModelList documentModels, String fields); 052 053 BoxCollaboration getBoxCollaboration(BoxFolderAdapter boxItem, ACE ace, String collaborationId); 054 055 String toJSONString(BoxObject boxObject) throws BoxJSONException; 056 057 String getBoxId(DocumentModel doc); 058 059 String getBoxSequenceId(DocumentModel doc); 060 061 String getBoxEtag(DocumentModel doc); 062 063 String getBoxName(DocumentModel doc); 064 065 BoxUser fillUser(NuxeoPrincipal creator); 066 067 BoxGroup fillGroup(NuxeoGroup group); 068 069 BoxFolder getBoxFolder(String jsonBoxFolder) throws BoxJSONException; 070 071 BoxFile getBoxFile(String jsonBoxFile) throws BoxJSONException; 072 073 BoxComment getBoxComment(String jsonBoxComment) throws BoxJSONException; 074 075 BoxCollaboration getBoxCollaboration(String jsonBoxCollaboration) throws BoxJSONException; 076 077 String getJSONFromBox(BoxTypedObject boxTypedObject) throws BoxJSONException; 078 079 String getJSONBoxException(Exception e, int status); 080 081 String[] getCollaborationArrayIds(String collaborationId); 082 083}