package de.heise.cmisserver;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
import org.apache.chemistry.opencmis.commons.data.ObjectData;
import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
import org.apache.chemistry.opencmis.commons.enums.CapabilityAcl;
import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges;
import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates;
import org.apache.chemistry.opencmis.commons.enums.CapabilityJoin;
import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;

public class HeiseServiceImpl extends AbstractCmisService {

	@Override
	public ObjectInFolderList getChildren(String arg0, String arg1,
			String arg2, String arg3, Boolean arg4, IncludeRelationships arg5,
			String arg6, Boolean arg7, BigInteger arg8, BigInteger arg9,
			ExtensionsData arg10) {
		
		return null;
	}

	@Override
	public ObjectData getObject(String arg0, String arg1, String arg2,
			Boolean arg3, IncludeRelationships arg4, String arg5, Boolean arg6,
			Boolean arg7, ExtensionsData arg8) {
		
		return null;
	}

	@Override
	public List<ObjectParentData> getObjectParents(String arg0, String arg1,
			String arg2, Boolean arg3, IncludeRelationships arg4, String arg5,
			Boolean arg6, ExtensionsData arg7) {
		
		return null;
	}

	@Override
	public List<RepositoryInfo> getRepositoryInfos(ExtensionsData arg0) {
		
		RepositoryInfoImpl repoInfo = new RepositoryInfoImpl();
        String rootFolderId = "4711";

        // set capabilities
        RepositoryCapabilitiesImpl caps = new RepositoryCapabilitiesImpl();
        caps.setAllVersionsSearchable(false);
        caps.setCapabilityAcl(CapabilityAcl.NONE);
        caps.setCapabilityChanges(CapabilityChanges.NONE);
        caps.setCapabilityContentStreamUpdates(
					CapabilityContentStreamUpdates.NONE);
        caps.setCapabilityJoin(CapabilityJoin.NONE);
        caps.setCapabilityQuery(CapabilityQuery.NONE);
        caps.setCapabilityRendition(CapabilityRenditions.NONE);
        caps.setIsPwcSearchable(false);
        caps.setIsPwcUpdatable(false);
        caps.setSupportsGetDescendants(true);
        caps.setSupportsGetFolderTree(true);
        caps.setSupportsMultifiling(false);
        caps.setSupportsUnfiling(false);
        caps.setSupportsVersionSpecificFiling(false);

        repoInfo.setId("heise");
        repoInfo.setName("Heise-Repository");
        repoInfo.setDescription("Heise Developer CMIS Demo");
        repoInfo.setCmisVersionSupported("1.0");
        repoInfo.setCapabilities(caps);
        repoInfo.setRootFolder(rootFolderId);
        repoInfo.setPrincipalAnonymous("anonymous");
        repoInfo.setPrincipalAnyone("anyone");
        repoInfo.setThinClientUri(null);
        repoInfo.setChangesIncomplete(Boolean.TRUE);
        repoInfo.setChangesOnType(null);
        repoInfo.setLatestChangeLogToken(null);
        repoInfo.setVendorName("Heise Demo");
        repoInfo.setProductName("Heise-Developer Demo-Server");
        repoInfo.setProductVersion("1.0");
        repoInfo.setAclCapabilities(null);
        
        List<RepositoryInfo> repoInfoList = new ArrayList<RepositoryInfo>();
        repoInfoList.add(repoInfo);
        return repoInfoList;

	}

	@Override
	public TypeDefinitionList getTypeChildren(String arg0, String arg1,
			Boolean arg2, BigInteger arg3, BigInteger arg4, ExtensionsData arg5) {
		
		return null;
	}

	@Override
	public TypeDefinition getTypeDefinition(String arg0, String arg1,
			ExtensionsData arg2) {
		
		return null;
	}

}
