 
					
				
		
12-03-2007 07:20 AM
 
					
				
		
12-03-2007 08:29 AM
12-03-2007 08:38 AM
 
					
				
		
12-03-2007 08:41 AM
12-03-2007 08:45 AM
il me semblait qu'on pouvait le faire avec des fichier csv
 
					
				
		
12-03-2007 08:50 AM
 
					
				
		
12-03-2007 10:44 AM
 
					
				
		
12-03-2007 10:51 AM
 
					
				
		
12-03-2007 10:54 AM
 
					
				
		
12-05-2007 04:22 AM
   public Reference GestObject(Reference objTarget, String objType, List<NamedValue> objProperties) {// throws Exception
      return GestObject(objTarget.getPath(), objType, objProperties);
   }
   public Reference GestObject(String objTarget, String objType, List<NamedValue> objProperties) {
      String objName = getProperty(getQName("cm:name"), objProperties);   //Constants.PROP_NAME
      if (objName == null || objName.equals("")) {
         System.out.println("ERROR - '" + getQName("cm:name") + "' must be set in object properties");
         return null;
      }
      
      try {
            // Check to see if the object has already been created or not
            String Path = objTarget + "/*[@cm:name=\"" + objName + "\"]";
         Reference objRef = new Reference(STORE, null, Path);
            //System.out.println("Path : " + Path);
            Node[] results = WebServiceFactory.getRepositoryService().get(new Predicate(new Reference[]{objRef}, STORE, null));
            System.out.println("Object yet created");
          return results[0].getReference();
        } catch (Exception e) {
          // Create parent reference to company home
          ParentReference parentReference = new ParentReference(
                STORE,
                null, 
                objTarget,
                Constants.ASSOC_CONTAINS, 
                Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, objName));
          // Create object
          CMLCreate create = new CMLCreate("1", parentReference, null, null, null, objType, (NamedValue[])objProperties.toArray(new NamedValue[objProperties.size()]));
          CML cml = new CML();
          cml.setCreate(new CMLCreate[]{create});
          try {
             UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);       
              System.out.println("Object created");
              return results[0].getDestination();
          } catch (Exception e2) {
              System.out.println("ERROR - creating object : objType = '" + objType + "'");
              e2.printStackTrace();
              return null;
          }
       }
    }
   
    public Reference AddContent(Reference objRef, String docContent) {
      try {
         char in = 0x19;
         char out = 0x20;
         docContent = docContent.replace(in, out);
          // Define the content format for the content we are adding
          ContentFormat contentFormat = new ContentFormat("text/html", "ISO-8859-1");
      
          // Get the content service
          ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
             // Write the content
          Content content = contentService.write(objRef, Constants.PROP_CONTENT, docContent.getBytes(), contentFormat);
          
          // Get a reference to the newly created content
          return content.getNode();
      } catch (Exception e) {
          System.out.println("ERROR - add content to node");
          return null;
      }
   }   
   
    public Reference AddFile(Reference objRef, String imageName) {
      try {
         //take the 3 last letter of the imageName to have the extension
         StringBuilder sb = new StringBuilder(imageName);
         String extension = sb.substring(imageName.length()-3, imageName.length());
         // Create the format
         //ContentFormat format = new ContentFormat("image/"+extension, "UTF-8");  
         ContentFormat format = new ContentFormat((extension == "xls" ? "application/excel" : (extension == "doc" ? "application/msword" : "image/"+extension)), "UTF-8");
         // Open the file and convert to byte array
         File ffile = new File(imageName);
         FileInputStream fis = new FileInputStream(ffile);          
         byte[] bytes = ContentUtils.convertToByteArray(fis);
         fis.close();
         // Get the content service
         ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
         // Write the content
         Content content = contentService.write(objRef, Constants.PROP_CONTENT, bytes, format);
          // Get a reference to the newly created content
          return content.getNode();
      } catch (Exception e) {
          System.out.println("ERROR - add file");
          e.printStackTrace();
          return null;
      }
   }   
 
					
				
				
			
		
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.