Page 1 of 1

Automation not work - need help

PostPosted:Mon Jun 29, 2015 7:54 pm
by skorpion78
hello,
I wanted to create a task which, after a document is created in the directory will automatically assign property groups. Unfortunately, I failed.
I made the following steps:
1.) I made this tutorial http://wiki.openkm.com/index.php/Enable_automation

2.) I added task automation addProperityGroup
pic. 1.png and 2.png
not working :(

3.) I made this tutorial:

http://wiki.openkm.com/index.php/Increm ... utonumeric
continue after the creation of the document does not produce jobs.


thank you in advance for your answer

greetings
Sebastian

Re: Automation not work - need help

PostPosted:Mon Jun 29, 2015 10:08 pm
by skorpion78
hello again ,

I do not know what I did but had started to work.

Unfortunately, I do not know how to add a group with specific properties. I am using a script :
Code: Select all
import com.openkm.bean.Document;
import com.openkm.module.db.stuff.DbSessionManager;
import com.openkm.api.OKMDocument;
import com.openkm.api.OKMRepository;
import com.openkm.omr.OMRHelper;
 
long omId= 4;
String systemToken = DbSessionManager.getInstance().getSystemToken();
String docPath = OKMRepository.getInstance().getNodePath(systemToken, uuid);
Document doc = OKMDocument.getInstance().getProperties(systemToken, docPath);
 
if (OMRHelper.isValid(doc)) {
    OMRHelper.processAndStoreMetadata(omId, uuid);	
}
Does anyone can help me how to assign the appropriate values ​​form groups .

properties of the group :
Code: Select all
<property-group label="Technology" name="okg:technology">
    <select label="Type" name="okp:technology.type" type="multiple">
      <option label="Alfa" value="t1"/>
      <option label="Beta" value="t2" />
      <option label="Omega" value="t3" />
    </select>
    <select label="Language" name="okp:technology.language" type="simple">
      <option label="Java" value="java"/>
      <option label="Python" value="python"/>
      <option label="PHP" value="php" />
    </select>
    <input label="Comment" name="okp:technology.comment"/>
    <textarea label="Description" name="okp:technology.description"/>
    <input label="Link" type="link" name="okp:technology.link"/>
  </property-group>

Re: Automation not work - need help

PostPosted:Tue Jun 30, 2015 8:01 pm
by jllort
After you create a class that implements Automation ( http://wiki.openkm.com/index.php/Extend_automation_6.0 ), you should register this class in database. Unfortunatelly only on professional version we've yet implemented the automation based on plugins ( jars ), in version 6.3 and older the classes must be registered in database.

Take a look for example this insert query:
Code: Select all
INSERT INTO OKM_AUTO_METADATA (AMD_AT, AMD_CLASS_NAME, AMD_NAME, AMD_GROUP, AMD_TYPE00, AMD_SRC00, AMD_DESC00, AMD_TYPE01, AMD_SRC01, AMD_DESC01) VALUES ('post', 'com.openkm.automation.action.AddCategoryToWizard', 'AddCategoryToWizard', 'action', '', '', '', '', '', '');
post indicate the action can only be executed after the event.
com.openkm.automation.action.AddCategoryToWizard the class name
AddCategoryToWizard the name shown in automation list
action indicate is an action
The other fields are used to indicate will be required parameters from Automation view ( in your case I think will be blank like this ones ).

Take a look at this two classes:
https://sourceforge.net/p/openkm/code/H ... izard.java
https://sourceforge.net/p/openkm/code/H ... egory.java

Also could be interesting take a look at this class https://sourceforge.net/p/openkm/code/H ... Utils.java