• Copy metadata of documents enregistred yet to new document

  • OpenKM a de nombreuses fonctionnalités interessantes, mais demande un minimum de configuration pour être pleinement exploité.
OpenKM a de nombreuses fonctionnalités interessantes, mais demande un minimum de configuration pour être pleinement exploité.

Moderator: dedisoft

Forum rules: Avant de poser une question, merci de regarder la documentation du wiki ou d'utiliser la fonction recherche du forum. Et rappelez vous que nous n'avons ni boule de cristal ni possibilité de lire dans les pensées, aussi pensez à spécifier quelle version d'OpenKM vous utilisez ainsi que la version du navigateur web et du système d'exploitation. Pour de plus amples informations lisez Comment reporter un bug efficacement (anglais).
 #45948  by lnovoa
 
You have to add the import to the code.
Code: Select all
import com.openkm.api.OKMPropertyGroup;
import java.util.Map; 

String uuid_origin = "222bd16a-01f1-4b5b-89b7-be72183706bc";
String uuid_destination = "73a99248-6364-4443-b407-e3584c921fc1";
Map properties = OKMPropertyGroup.getInstance().getPropertiesSimple(null, uuid_origin, "okg:cdapodoc"); ......

How do you check that the code is correct before execute it in openkm?
 #45950  by cherifmad
 
lnovoa wrote: Fri May 25, 2018 9:03 am You have to add the import to the code.
Code: Select all
import com.openkm.api.OKMPropertyGroup;
import java.util.Map; 

String uuid_origin = "222bd16a-01f1-4b5b-89b7-be72183706bc";
String uuid_destination = "73a99248-6364-4443-b407-e3584c921fc1";
Map properties = OKMPropertyGroup.getInstance().getPropertiesSimple(null, uuid_origin, "okg:cdapodoc"); ......

How do you check that the code is correct before execute it in openkm?
Hi Inovoa,
I just used the script that you gave me by modifying the uuid (origins and destinations). also about the OKG of metadata in my house, it's abc:abc. ( NB: I'm not a developer and I'm still learning to be one).
Do you have a way to check for errors?
Or if you wnat, how did you manage to run the script in your openkm ( if it worked) step by step ( with your metadata properties)
Thanks you for your supporting
 #45951  by lnovoa
 
We have a development environment, which consists of a VM in Linux.
This environment has already installed and configured everything you need to modify your own version of openkm.
The Eclipse IDE also has it configured ready to compile and develop.
One way to test your code is to create a main class in the eclipse and develop your code there.
From there you can access classes and methods and check that your code has no errors.
Then you just have to run it in your current openkm.
I give you a link:
Community development environment
https://www.openkm.com/en/download.html


About your code, I think that with the mistakes you have made should work.
 #45952  by cherifmad
 
lnovoa wrote: Fri May 25, 2018 10:04 am We have a development environment, which consists of a VM in Linux.
This environment has already installed and configured everything you need to modify your own version of openkm.
The Eclipse IDE also has it configured ready to compile and develop.
One way to test your code is to create a main class in the eclipse and develop your code there.
From there you can access classes and methods and check that your code has no errors.
Then you just have to run it in your current openkm.
I give you a link:
Community development environment
https://www.openkm.com/en/download.html


About your code, I think that with the mistakes you have made should work.
Dear Inovoa, I have it, some error are there when we use his portable's Eclispe version.
later I will use Virtualbox.
I have a other question, When I finish to install the OpenKM version for developper in VirtualBox, Where Can I test My script?
 #45953  by lnovoa
 
You do not have to install anything, just
1. Open eclipse
2. Inside src / test / java you create a java class and make the check public static void main
3. Add your code and correct errors, add the necessary import, etc.
4. Execute the script in your openkm
 #45964  by jllort
 
You can check the script from Administration > Scripting or if you have created a jar ( consider looking crontab task https://docs.openkm.com/kcenter/view/ok ... b-job.html then -> register as a crontab ). I'm not 100% sure if in community version exists this option Administration > tools > execute jar
 #45970  by cherifmad
 
@Jlort and @Inovoa.
I would like to know if you have created a script that can solve this problem (Copy the old metadata still saved in openkm to a new downloaded document).
If so, can you explain all the steps to do it?
Thank you for your understanding.
 #45973  by jllort
 
The code what shared before lnova contains almost what you need ( get the metadata of some document ). The only what you need now is set to the destination document ( where properties are the metadata values map from original document ).
Code: Select all
OKMPropertyGroup.getInstance().setPropertiesSimple(null, uuid_destination,"okg:cdapodoc", properties);    
You should consider devoting some time to control of the OpenKM API https://docs.openkm.com/kcenter/view/ok ... ption.html

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.