Package com.germinus.ecm.bean

Examples of com.germinus.ecm.bean.ConfigFileHandler


       if (pwd.compareTo(undefined)==0) {
         out.write(callback + "('" + index + "', null, 500, 'password not specified', 500)");
         return;
       }
      
       ConfigFileHandler cfh = new ConfigFileHandler("repositoriesNum.properties","repositories",
        "repositoryInfo", "repositoryCapabilities", "uriTemplates", "contentTypes", "metainfo");
       //String filePath = getServletContext().getRealPath("WEB-INF/classes") +"/";   
       String filePath = getServletContext().getRealPath("WEB-INF") +"/";


       int repositories = cfh.getNumberOfRepositories(filePath);

       //JSONObject resultsByContent = new JSONObject();
       JSONArray resultsByContent = new JSONArray();
       JSONObject resultsByContentType = new JSONObject();
       String contentTypeName = new String();
       String ticket = "";
       String urlLoginService = "";
      
       // Search by repository
       for (int repo=1; repo<repositories+1; repo++) {
            ECMRepository ecm = new ECMRepository(user, pwd);
        
            JSONObject repoConfig = cfh.getRepositoryConfig(filePath, repo);
            JSONObject uriTemplates = repoConfig.getJSONObject("uriTemplates");
            String urlQueryService = uriTemplates.getString("query");
      int pos = urlQueryService.indexOf("{q}");
      urlQueryService = urlQueryService.substring(0, pos);
        
View Full Code Here


    if (indexAux>-1){
      indexAux++;
      index = callback.substring(indexAux);
    }
   
    ConfigFileHandler cfh = new ConfigFileHandler("repositoriesNum.properties","repositories",
        "repositoryInfo", "repositoryCapabilities", "uriTemplates", "contentTypes", "metainfo");
    //String filePath = getServletContext().getRealPath("/WEB-INF/classes") +"/";
    String filePath = getServletContext().getRealPath("/WEB-INF") +"/";
       
    int repoSize = cfh.getNumberOfRepositories(filePath);
    JSONArray repositories = new JSONArray();
    for (int i=1; i<repoSize+1; i++) {
      repositories.add(cfh.getRepositoryConfig(filePath, i));
    }
   
    String resp = callback + "('" + index + "', "+ repositories.toString() +", 200, null, 200)";
   
    out.println(resp);
View Full Code Here

            }
            String user = "admin";
            String pwd = "admin";


            ConfigFileHandler cfh = new ConfigFileHandler(
                            "repositoriesNum.properties", "repositories", "repositoryInfo",
                            "repositoryCapabilities", "uriTemplates", "contentTypes",
                            "metainfo");
            String filePath = getServletContext().getRealPath("WEB-INF") + "/";

            int repositories = cfh.getNumberOfRepositories(filePath);

            // JSONObject resultsByContent = new JSONObject();
            JSONArray resultsByContent = new JSONArray();
            JSONObject resultsByContentType = new JSONObject();
            String contentTypeName = new String();
            String ticket = "";
            String urlLoginService = "";
            String queryGetContent = "";

            JSONObject jsonType = new JSONObject();

            // Search by repository
            for (int repo = 1; repo < repositories + 1; repo++) {
                ECMRepository ecm = new ECMRepository(user, pwd);

                JSONObject repoConfig = cfh.getRepositoryConfig(filePath, repo);
                JSONObject uriTemplates = repoConfig.getJSONObject("uriTemplates");
                String urlQueryService = uriTemplates.getString("query");
                int pos = urlQueryService.indexOf("{q}");
                urlQueryService = urlQueryService.substring(0, pos);
View Full Code Here

                    out.write(callback + "('" + index + "', null, 500, 'RespositoryInfo URL not specified', 500)");
                    return;
                }

                ECMRepository ecm = new ECMRepository(user, password);
                ConfigFileHandler cfh = new ConfigFileHandler("repositoriesNum.properties","repositories","repositoryInfo", "repositoryCapabilities", "uriTemplates", "contentTypes", "metainfo");
                //String filePath = getServletContext().getRealPath("/WEB-INF/classes") +"/";
                String filePath = getServletContext().getRealPath("/WEB-INF") +"/";
   
                // getting Repository Info
                RequestOptions requestOptions = ecm.createRequestOptions();
                ClientResponse cResp = ecm.getRequest(urlRepositoryInfo, requestOptions);
                Document<Service> doc = cResp.getDocument();
                Service ecmInfo = doc.getRoot();
                JSONObject ecmInfoJSON = cfh.getRepositoryInfo(ecmInfo);

                // ADD: getting cmis:folder type

                // getting getTypes uri
                JSONObject uriTemplates = JSONObject.fromObject(ecmInfoJSON.get("uriTemplates"));
                String urlService = uriTemplates.get("typebyid").toString();
                CharSequence target = "{id}";
    CharSequence replacement = "cmis:document";
    urlService = urlService.replace(target, replacement);
    urlService += "/children";

                /*// getFolderTypes
                String urlFolderTypeService = uriTemplates.getString("typebyid").toString();
                target = "{id}";
    replacement = "cmis:folder";
    urlFolderTypeService = urlFolderTypeService.replace(target, replacement);
    urlFolderTypeService += "/children";
                //System.out.println("urlFolderTypeService: "+ urlFolderTypeService);*/

    // getting Content Types
    JSONObject contentTypes = new JSONObject();
    //String[] exclTypes = {":wcm:",":inwf:",":fm:",":bpm:",":lnk:",":cm:",":imap:",":wca:",":ia:"};
                String[] exclTypes = {":wcm:",":inwf:",":fm:",":bpm:",":lnk:",":cm:",":imap:",":wca:",":ia:",":trx:",":rma:",":dl:",":ws:"};
                Feed feed = ecm.getFeed(urlService);
    List<Entry> typesList = ecm.getTypes(feed, exclTypes);
    Entry type;
    for (int i=0; i<typesList.size(); i++) {
      type = typesList.get(i);
      contentTypes.put("ctype" + String.valueOf(i), type.getContent());
    }
               
                /*// getting Folder Content Types
                Feed feedFolder = ecm.getFeed(urlFolderTypeService);
                typesList = ecm.getTypes(feedFolder, exclTypes);
                System.out.println("typesList: "+ typesList);
                for (int i=0; i<typesList.size(); i++) {
      type = typesList.get(i);
      contentTypes.put("ctype" + String.valueOf(contentTypes.size()), type.getContent());
    }*/


    // getting Metadata Content Types
    String getTypeDefURL = uriTemplates.get("typebyid").toString();
   
    JSONObject metadataTypes = new JSONObject();
    ECMRepository repo = new ECMRepository(user, password);
    for (int i=0; i<contentTypes.size(); i++) {
      urlService = getTypeDefURL;
      String typeName = contentTypes.getString("ctype"+ String.valueOf(i));
      replacement = typeName;
      urlService = urlService.replace(target, replacement);
      urlService += "?includeInheritedProperties=true";

      Entry entry = repo.getEntry(urlService);
      AtomToJSON atom2json = new AtomToJSON();
      JSONObject json = atom2json.entry2JSON(entry);
     
      JSONObject typeTag = json.getJSONObject("type");
        metadataTypes.put("metainfo-ctype"+ String.valueOf(i), typeTag.toString());
    }
   
    String msg = "'"+ cfh.setRepositoryConfig(filePath, ecmInfoJSON, contentTypes, metadataTypes) +"'";
    String resp = callback + "('" + index + "', "+ msg +", 200, null, 200)";
    out.println(resp);
    out.close();
  }
View Full Code Here

TOP

Related Classes of com.germinus.ecm.bean.ConfigFileHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.