logger.debug("OUT");
return toReturn;
}
public SDKDocumentParameter[] getDocumentParameters(Integer documentId, String roleName) throws NonExecutableDocumentException {
SDKDocumentParameter parameters[] = null;
logger.debug("IN: documentId = [" + documentId + "]; roleName = [" + roleName + "]");
try {
IEngUserProfile profile = getUserProfile();
BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(documentId);
if (!ObjectsAccessVerifier.canSee(obj, profile)) {
logger.error("User [" + ((UserProfile) profile).getUserName() + "] cannot execute document with id = [" + documentId + "]");
throw new NonExecutableDocumentException();
}
List correctRoles = ObjectsAccessVerifier.getCorrectRolesForExecution(documentId, profile);
if (correctRoles == null || correctRoles.size() == 0) {
logger.error("User [" + ((UserProfile) profile).getUserName() + "] has no roles to execute document with id = [" + documentId + "]");
throw new NonExecutableDocumentException();
}
if (!correctRoles.contains(roleName)) {
logger.error("Role [" + roleName + "] is not a valid role for executing document with id = [" + documentId + "] for user [" + ((UserProfile) profile).getUserName() + "]");
throw new NonExecutableDocumentException();
}
obj = DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByIdAndRole(obj.getId(), roleName);
List parametersList = obj.getBiObjectParameters();
List toReturn = new ArrayList();
if (parametersList != null) {
SDKDocumentParameter aDocParameter;
Iterator it = parametersList.iterator();
while (it.hasNext()) {
BIObjectParameter parameter = (BIObjectParameter)it.next();
aDocParameter = new SDKObjectsConverter().fromBIObjectParameterToSDKDocumentParameter(parameter);
toReturn.add(aDocParameter);