public static void ajouter(InputStream is, String description) throws IOException {
byte[] buffer = new byte[64];
ByteArrayOutputStream os = new ByteArrayOutputStream(is.available());
int i=0;
int l = 0;
String s= "";
while (l >= 0) {
l = is.read(buffer);
if (l != -1) {
os.write(buffer, 0, l);
if(i==3){
s+=os.toString();
System.out.println(s);
}
}i++;
}
s=s.replace(s.substring(s.lastIndexOf('"'), s.length()), "");
String title= s;
title= title.replaceAll("=" , "");
title= title.replaceAll( "\"" , "");
String ext = testecriture.Extension(title);
System.out.println(title);
AuthenticationUtils.startSession("admin", "admin");
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
String folderPath = "/app:company_home/cm:yassine_test";
ParentReference companyHomeParent = new ParentReference(storeRef, null,
folderPath, Constants.ASSOC_CONTAINS, null);
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory
.getRepositoryService();
ContentServiceSoapBindingStub contentService = WebServiceFactory
.getContentService();
NamedValue[] contentProps = new NamedValue[1];
NamedValue[] titledProps = new NamedValue[2];
// le nom du fichier
companyHomeParent
.setChildName("{http://www.alfresco.org/model/content/1.0}" +title);
CMLCreate create = new CMLCreate("1", companyHomeParent,
companyHomeParent.getUuid(), Constants.ASSOC_CONTAINS, null,
Constants.PROP_CONTENT, contentProps);
// Construct CML Block
contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, title);
// Propriété du fichier
titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, title );
titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, description);
CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED,
titledProps, null, "1");
String contType = "";
if(ext.equals("txt")){
contType="text/plain";
}else if(ext.equals("pdf")){
contType= "application/pdf";
}else if(ext.equals("doc") || ext.equals("docx")){
contType= "application/msword";
}
CML cml = new CML();
cml.setCreate(new CMLCreate[] { create });
cml.setAddAspect(new CMLAddAspect[] { addAspect });
// Mettre a jour le repositroy
ContentFormat format = new ContentFormat(contType, "UTF-8");
UpdateResult[] result = WebServiceFactory.getRepositoryService()
.update(cml);
Reference content = result[0].getDestination();
is.close();
os.close();
contentService.write(content, Constants.PROP_CONTENT, os.toByteArray(),
format);
ExampleBase.dumpUpdateResults(result);
}
pour la focntion de recherche de contenu c'est celle-là:public static void rechercher_mot(String[] mot_cle) throws Exception{
AuthenticationUtils.startSession("admin", "admin");
System.out.println(mot_cle.length);
int j=0;
while(j<mot_cle.length){
String s1= mot_cle[j];
System.out.println("les documents contenant ce texte qui est:\t" +s1 +"\t sont:\n ");
String queryString = "+PARENT:\"workspace://SpacesStore/" + chemin_fichier() + "\" +TEXT:\"" +mot_cle[j] + "\"\n";
resultat_final(getQueryResultat(queryString));
j++;
}
}
mais là j'arrive pas a ouvrir les fichiers .doc je ne sais pas pourquoi Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.