Yeah Tony…that is what i am trying to do..But do they have function to retrieve name property. I have seen JsonObject returned only aspect or types but no name of contents. Can you please share it in details with me.
my java class is like this as below:
package org.alfresco.web.evaluator.doclib.action;
import java.util.List;
import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase;
import org.alfresco.service.cmr.action.ActionCondition;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.ui.common.component.evaluator.BaseEvaluator;
import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.ParameterizedItemAbstractBase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.util.I18NUtil;
import com.skandia.wcm.models.SkandiaContentModel;
public class NameEqualsEvaluator extends BaseEvaluator {
ParameterizedItemAbstractBase base ;
public static final String NAME = "has-name";
public static final String PARAM_NAME = "name";
private static final Log logger = LogFactory.getLog(NameEqualsEvaluator.class);
private NodeService nodeService;
public NodeService getNodeService() {
return nodeService;
}
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
public boolean evaluateImpl(ActionCondition ruleCondition, NodeRef actionedUponNodeRef)
{
boolean result = false;
if (this.nodeService.exists(actionedUponNodeRef) == true)
{
if (this.hasName(actionedUponNodeRef, (QName)ruleCondition.getParameterValue("name")) == true)
{
result = true;
}
}
return result;
}
private boolean hasName(NodeRef actionedUponNodeRef, QName parameterValue) {
boolean value = false;
String name = nodeService.getProperty(actionedUponNodeRef, SkandiaContentModel.QTYPE_NAME_KEY).toString();
System.out.println("name is:-"+name);
if(name.equals(parameterValue)){
System.out.println("parameterValue is:-"+parameterValue);
value = true;
}
return value;
}
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{
paramList.add(new ParameterDefinitionImpl("name", DataTypeDefinition.QNAME, true, getParamDisplayLabel("name"), true, "name"));
}
protected String getParamDisplayLabel(String paramName)
{
return I18NUtil.getMessage(this.PARAM_NAME + "." + paramName + "." + "display-label");
}
@Override
public boolean evaluate() {
logger.info("evaluator initiated");
return true;
}
}
and bean defined in custom slingshot is as in the attachment.
It is giving error as bean property with name as "name" not defined
Thanks in advance