04-18-2018 03:27 AM
Hello,
I'm trying to create a popup window with a form for editing a conqueror property.
Unfortunately I'm experiencing this error:
ERROR [scripts.forms.FormUIGet] [http-bio-8081-exec-3] org.alfresco.repo.forms.FormNotFoundException: 03180002 A form could not be found for item: [action] edit_uzivatele
The form I have created and "itemId" and "condition" is the same.
share-config-custom.xml
Button definition
<config evaluator="string-compare" condition="DocLibActions">
<!-- Action definitions -->
<actions>
<!-- Publish Document -->
<action id="pridat-jmeno-uzivatele" icon="ic-publish" type="javascript" label="Upravit uzivatele">
<param name="function">onActionFormDialog</param>
<param name="itemKind">action</param>
<param name="itemId">upravit_uzivatele</param>
<param name="mode">create</param>
<param name="destination">{node.nodeRef}</param>
<param name="successMessage">Hotovo</param>
<param name="failureMessage">Chyba</param>
</action>
</actions>
<actionGroups>
<!-- For action button to show up at document level -->
<actionGroup id="document-browse">
<action index="460" id="pridat-jmeno-uzivatele" />
</actionGroup>
<actionGroup id="document-details">
<action index="400" id="pridat-jmeno-uzivatele" />
</actionGroup>
<!-- For action button to show up at Folder level -->
<actionGroup id="folder-browse">
<action index="460" id="pridat-jmeno-uzivatele" />
</actionGroup>
<actionGroup id="folder-details">
<action index="400" id="pridat-jmeno-uzivatele" />
</actionGroup>
</actionGroups>
</config>
Form definition
<config evaluator="string-compare" condition="upravit_uzivatele"> <!-- ID for the Repository Action that this form is associated with -->
<forms>
<form>
<field-visibility>
<show id="test:uzivatele" />
</field-visibility>
<appearance>
</appearance>
</form>
</forms>
</config>
After click on the button: "Upravit uzivatele"
Can anyone advise me, please?
Thank you
04-27-2018 03:45 AM
If you would like to update the properties than you can use the edit properties form ,using it it was simple configuration only.
If you would like to update it using your custom action,you need to code it inside java file.
Fetch the entered value in java code.
set the value to document using nodeService in javafile.
04-18-2018 03:45 AM
You need to create action-executor with the bean id as "upravit_uzivatele".
Below link contains all details on this.
Adding new actions to the Document Library | Alfresco Documentation
04-18-2018 09:22 AM
thank you for answer
I created a bean in a file: service-context.xml
like this
<bean id="upravit_uzivatele"
class="???"
parent="action-executer">
<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>
but I do not know what to write to class="? ??"
action definition I have in share-config-custom.xml
04-19-2018 01:55 AM
It should be path to java class. for example If you are creating java class which is sending an email inside com.email package and Class name is SendEmailActionExecutor than the value should be com.email.SendEmailActionExecutor
You need to define the java class also ,in above case it will be like below.
public class SendEmailActionExecutor extends ActionExecuterAbstractBase
{
@Override
public void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{
}
}
04-27-2018 03:02 AM
Thank you very much for your advice.
I created a java class:
upravitUzivatele.java
package cz.digipaper.tutorial.doclibaction.evaluator;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import java.util.*;
/**
* Alfresco Repository Action that can send emails with file attachments.
*
* @author martin.bergljung@alfresco.com
*/
public class upravitUzivatele extends ActionExecuterAbstractBase {
@Override
public void executeImpl(Action action, NodeRef actionedUponNodeRef) {
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
}
}
and I edit bean like this:
<bean id="upravit_uzivatele"
class="cz.digipaper.tutorial.doclibaction.evaluator.upravitUzivatele"
parent="action-executer">
</bean>
Now I don't have any error. The form is probably linked. Unfortunately, it does not appear property:
<show id="test:uzivatele" />
But in form definition is:
<config evaluator="string-compare" condition="upravit_uzivatele"> <!-- ID for the Repository Action that this form is associated with -->
<forms>
<form>
<field-visibility>
<show id="test:uzivatele" />
</field-visibility>
<appearance>
<!-- <field id="test:uzivatele" label-id="Uzivatele">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field> -->
</appearance>
</form>
</forms>
</config>
04-27-2018 03:06 AM
You need to define field in below section as well.
<appearance>
<!-- <field id="test:uzivatele" label-id="Uzivatele">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field> -->
</appearance>
04-27-2018 03:39 AM
It's starting to look good 😄
Unfortunately, after pressing the button, the value does not go into the property.
<config evaluator="string-compare" condition="upravit_uzivatele"> <!-- ID for the Repository Action that this form is associated with -->
<forms>
<form>
<field-visibility>
<show id="test:uzivatele" />
</field-visibility>
<appearance>
<field id="test:uzivatele" label-id="Uzivatele">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
04-27-2018 03:45 AM
If you would like to update the properties than you can use the edit properties form ,using it it was simple configuration only.
If you would like to update it using your custom action,you need to code it inside java file.
Fetch the entered value in java code.
set the value to document using nodeService in javafile.
05-02-2018 05:13 AM
Hi, thank you very much for the answer.
I would like update property by using custom action. I have created a solution that writes "test" to the property test:uzivatele
Unfortunately I do not know how Fetch the entered value from my text field in form. Can you please help me with this?
upravitUzivatele.java
public class upravitUzivatele extends ActionExecuterAbstractBase {
private ServiceRegistry serviceRegistry;
/** The NodeService to be used by the bean */
protected NodeService nodeService;
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
String novaHodnota = "test";
QName TYPE_DIGIPAPER_UZIVATELE_PROPERTA = QName.createQName(DigipaperXmlModel.NAMESPACE_DIGIPAPER_MODEL,"uzivatele");
serviceRegistry.getNodeService().setProperty(actionedUponNodeRef, TYPE_DIGIPAPER_UZIVATELE_PROPERTA,novaHodnota);
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
}
/**
* @param nodeService
* The NodeService to set.
*/
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
public void setServiceRegistry(ServiceRegistry serviceRegistry) {
this.serviceRegistry = serviceRegistry;
}
}
DigipaperXmlModel.java
package cz.digipaper.tutorial.doclibaction.evaluator;
import org.alfresco.service.namespace.QName;
public class DigipaperXmlModel { //třída pro vytvoření struktury XML
//Konstanty, ktere odpovidaji aspektum v alfresu
public static final String NAMESPACE_DIGIPAPER_MODEL = "http://www.digipaper.cz/model/test/1.0";
public static final QName TYPE_DIGIPAPER_UZIVATELE_PROPERTA = QName.createQName(NAMESPACE_DIGIPAPER_MODEL, "uzivatele");
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.