groovy DAO, access to BDM on an actor filter groovy

Hello!!!

I have a question, i have tried in a lot of ways to make the connection to the BDM on a java class actor filter implementation.

Looking on the package explorer, i can see this is a groovy script and that is my question, is there posible to connect to the BDM on a groovy script.

My class is

package org.mycompany.connector;

import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;

import org.bonitasoft.engine.connector.ConnectorValidationException;
import org.bonitasoft.engine.exception.BonitaException;
import org.bonitasoft.engine.filter.UserFilterException;
import org.bonitasoft.engine.api.IdentityAPI
import org.bonitasoft.engine.api.LoginAPI
import org.bonitasoft.engine.bdm.BusinessObjectDAOFactory
import org.bonitasoft.engine.session.APISession;

import com.company.model.usersDAO;
import com.company.model.users;


public class UseridbynameImpl extends AbstractUseridbynameImpl {

	@Override
	public void validateInputParameters() throws ConnectorValidationException {
		//TODO validate input parameters here 	
		
	}

	@Override
	//@CompileStatic
    public List<Long> filter(final String actorName) throws UserFilterException {
        try {
              final long processInstanceId = getExecutionContext().getProcessInstanceId();
              long processInitiator = getAPIAccessor().getProcessAPI().getProcessInstance(processInstanceId).getStartedBy();
              String UserInitiator=getAPIAccessor().getIdentityAPI().getUser(processInitiator).getUserName();
        	    	  Logger logger = Logger.getLogger("org.bonitasoft");
        	    	  logger.severe("Usuario Iniciador: " + UserInitiator);
        	      String reviewname="";
        	            
        	      def us = usersDAO.buscauser("juan", 0, 100);
        	      logger.severe("Cantidad: " + us.size());
        	      reviewname = "juan";
        	      
        		  logger.severe("Usuario Revisor: " + reviewname);
        		  long IdManager=getAPIAccessor().getIdentityAPI().getUserByUserName(reviewname).getId();
        		  
        		  
        	      return Arrays.asList(IdManager);
        } catch (final BonitaException e) {
             throw new UserFilterException(e);
        }
    }

	@Override
	public boolean shouldAutoAssignTaskIfSingleResult() {
		// If this method returns true, the step will be assigned to 
		//the user if there is only one result returned by the filter method
		return super.shouldAutoAssignTaskIfSingleResult();
	
	}

}

the problem is when i run the process, the engine log is

groovy.lang.MissingMethodException: No signature of method: static com.company.model.usersDAO.buscauser() is applicable for argument types: (java.lang.String, java.lang.Integer, java.lang.Integer) values: [alejandro, 0, 100]

i don’t know what else to do, maybe i need to make a connection or something before to call the method, maybe create a variable on a UI or something, please help.

If anybody please can help me telling me how to do this step by step, i am really desperate, 3 days and i can’t to make this work.

Hi, try to stick to one thread instead of creating new ones for the same subject :slight_smile: see:

https://community.bonitasoft.com/node/28849#node-28866