@Override
 public RepositoryFile createFile(
     Serializable parentFolderId,
     RepositoryFile file,
     IRepositoryFileData data,
     String versionMessage) {
   if (data instanceof NodeRepositoryFileData) {
     return repositoryFileAdapter.unmarshal(
         repoWebService.createFile(
             parentFolderId != null ? parentFolderId.toString() : null,
             repositoryFileAdapter.marshal(file),
             nodeRepositoryFileDataAdapter.marshal((NodeRepositoryFileData) data),
             versionMessage));
   } else if (data instanceof SimpleRepositoryFileData) {
     SimpleRepositoryFileData simpleData = (SimpleRepositoryFileData) data;
     return repositoryFileAdapter.unmarshal(
         repoWebService.createBinaryFile(
             parentFolderId != null ? parentFolderId.toString() : null,
             repositoryFileAdapter.marshal(file),
             SimpleRepositoryFileDataDto.convert(simpleData),
             versionMessage));
   } else {
     throw new IllegalArgumentException();
   }
 }
 @Override
 public RepositoryFile createFolder(
     Serializable parentFolderId, RepositoryFile file, String versionMessage) {
   return repositoryFileAdapter.unmarshal(
       repoWebService.createFolder(
           parentFolderId != null ? parentFolderId.toString() : null,
           repositoryFileAdapter.marshal(file),
           versionMessage));
 }
 @Override
 public RepositoryFile createFolder(
     final Serializable parentFolderId,
     final RepositoryFile file,
     final RepositoryFileAcl acl,
     final String versionMessage) {
   return repositoryFileAdapter.unmarshal(
       repoWebService.createFolderWithAcl(
           parentFolderId != null ? parentFolderId.toString() : null,
           repositoryFileAdapter.marshal(file),
           repositoryFileAclAdapter.marshal(acl),
           versionMessage));
 }
 @Override
 public RepositoryFile getFileAtVersion(Serializable fileId, Serializable versionId) {
   return repositoryFileAdapter.unmarshal(
       repoWebService.getFileAtVersion(
           fileId != null ? fileId.toString() : null,
           versionId != null ? versionId.toString() : null));
 }
 @Override
 @SuppressWarnings("unchecked")
 public <T extends IRepositoryFileData> java.util.List<T> getDataForReadInBatch(
     final List<RepositoryFile> files, final Class<T> dataClass) {
   List<RepositoryFileDto> fileDtos = new ArrayList<RepositoryFileDto>(files.size());
   for (RepositoryFile file : files) {
     fileDtos.add(repositoryFileAdapter.marshal(file));
   }
   if (dataClass.equals(NodeRepositoryFileData.class)) {
     List<NodeRepositoryFileDataDto> nodeData =
         repoWebService.getDataAsNodeForReadInBatch(fileDtos);
     List<T> data = new ArrayList<T>(nodeData.size());
     for (NodeRepositoryFileDataDto node : nodeData) {
       data.add((T) nodeRepositoryFileDataAdapter.unmarshal(node));
     }
     return data;
   } else if (dataClass.equals(SimpleRepositoryFileData.class)) {
     List<SimpleRepositoryFileDataDto> nodeData =
         repoWebService.getDataAsBinaryForReadInBatch(fileDtos);
     List<T> data = new ArrayList<T>(nodeData.size());
     for (SimpleRepositoryFileDataDto node : nodeData) {
       data.add((T) SimpleRepositoryFileDataDto.convert(node));
     }
     return data;
   } else {
     throw new IllegalArgumentException();
   }
 }
 private List<RepositoryFile> unmarshalFiles(List<RepositoryFileDto> dtos) {
   List<RepositoryFile> files = new ArrayList<RepositoryFile>();
   for (RepositoryFileDto dto : dtos) {
     files.add(repositoryFileAdapter.unmarshal(dto));
   }
   return files;
 }
 @Override
 public List<VersionSummary> getVersionSummaryInBatch(final List<RepositoryFile> files) {
   List<RepositoryFileDto> fileDtos = new ArrayList<RepositoryFileDto>(files.size());
   for (RepositoryFile file : files) {
     fileDtos.add(repositoryFileAdapter.marshal(file));
   }
   return unmarshalVersionSummaries(repoWebService.getVersionSummaryInBatch(fileDtos));
 }
  @Override
  public List<RepositoryFile> getReferrers(Serializable fileId) {
    List<RepositoryFile> fileList = new ArrayList<RepositoryFile>();

    for (RepositoryFileDto fileDto :
        repoWebService.getReferrers(fileId != null ? fileId.toString() : null)) {
      fileList.add(repositoryFileAdapter.unmarshal(fileDto));
    }
    return fileList;
  }
 @Override
 public RepositoryFile updateFile(
     RepositoryFile file, IRepositoryFileData data, String versionMessage) {
   if (data instanceof NodeRepositoryFileData) {
     return repositoryFileAdapter.unmarshal(
         repoWebService.updateFile(
             repositoryFileAdapter.marshal(file),
             nodeRepositoryFileDataAdapter.marshal((NodeRepositoryFileData) data),
             versionMessage));
   } else if (data instanceof SimpleRepositoryFileData) {
     SimpleRepositoryFileData simpleData = (SimpleRepositoryFileData) data;
     return repositoryFileAdapter.unmarshal(
         repoWebService.updateBinaryFile(
             repositoryFileAdapter.marshal(file),
             SimpleRepositoryFileDataDto.convert(simpleData),
             versionMessage));
   } else {
     throw new IllegalArgumentException();
   }
 }
 @Override
 public RepositoryFile updateFolder(RepositoryFile folder, String versionMessage) {
   return repositoryFileAdapter.unmarshal(
       repoWebService.updateFolder(repositoryFileAdapter.marshal(folder), versionMessage));
 }
 @Override
 public RepositoryFile getFileById(Serializable fileId) {
   return repositoryFileAdapter.unmarshal(
       repoWebService.getFileById(fileId != null ? fileId.toString() : null, false, null));
 }
 @Override
 public RepositoryFile getFile(String path) {
   // path = path.replaceAll( ";", "/" ); //Why is it here?
   return repositoryFileAdapter.unmarshal(repoWebService.getFile(path, false, null));
 }