Copy metadata of documents enregistred yet to new document
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).
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).
Re: Copy metadata of documents enregistred yet to new document
Please can you help me to obtain good result ?
Re: Copy metadata of documents enregistred yet to new document
You have to add the import to the code.
How do you check that the code is correct before execute it in openkm?
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"); ......
Re: Copy metadata of documents enregistred yet to new document
Hi Inovoa,lnovoa wrote: ↑Fri May 25, 2018 9:03 amYou have to add the import to the code.
How do you check that the code is correct before execute it in openkm?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"); ......
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
Re: Copy metadata of documents enregistred yet to new document
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.
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.
Re: Copy metadata of documents enregistred yet to new document
Dear Inovoa, I have it, some error are there when we use his portable's Eclispe version.lnovoa wrote: ↑Fri May 25, 2018 10:04 amWe 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.
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?
Re: Copy metadata of documents enregistred yet to new document
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
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
-
- Moderator
- Posts: 10455
- Joined: Fri Dec 21, 2007 11:23 am
- Location: Sineu - ( Illes Balears ) - Spain
- Contact:
Re: Copy metadata of documents enregistred yet to new document
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
Re: Copy metadata of documents enregistred yet to new document
@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.
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.
-
- Moderator
- Posts: 10455
- Joined: Fri Dec 21, 2007 11:23 am
- Location: Sineu - ( Illes Balears ) - Spain
- Contact:
Re: Copy metadata of documents enregistred yet to new document
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 ).
You should consider devoting some time to control of the OpenKM API https://docs.openkm.com/kcenter/view/ok ... ption.html
Code: Select all
OKMPropertyGroup.getInstance().setPropertiesSimple(null, uuid_destination,"okg:cdapodoc", properties);
Who is online
Users browsing this forum: No registered users and 1 guest