Function function = getOrCreateFunction(functionNumber);
Function function = Common.getFunction(signet, functionNumber);
  private Assignment getOrCreateAssignment    (PrivilegedSubject  grantor,     int                subjectNumber,     int                functionNumber,     int[]              limitValueNumbers)  throws  	SignetAuthorityException,  	ObjectNotFoundException  {    TreeNode rootNode = getRoot(tree);    Subject subject = Common.getSubject(signet, subjectNumber);    PrivilegedSubject pSubject = signet.getPrivilegedSubject(subject);    Function function = getOrCreateFunction(functionNumber);    Limit[] limitsInDisplayOrder      = Common.getLimitsInDisplayOrder(function.getLimits());        Set limitValues = new HashSet();    for (int i = 0; i < limitValueNumbers.length; i++)    {      Limit limit = limitsInDisplayOrder[i];      int limitChoiceNumber = limitValueNumbers[i];      String value = makeChoiceValue(subjectNumber, limitChoiceNumber);      LimitValue limitValue = new LimitValue(limit, value);      limitValues.add(limitValue);    }        // Before granting this new Assignment, let's see if it already exists    // in the database.        Set assignmentsReceived = pSubject.getAssignmentsReceived();    assignmentsReceived      = Common.filterAssignments(assignmentsReceived, Status.ACTIVE);    assignmentsReceived      = Common.filterAssignments(assignmentsReceived, this.subsystem);    assignmentsReceived      = Common.filterAssignments(assignmentsReceived, function);        Iterator assignmentsReceivedIterator = assignmentsReceived.iterator();    while (assignmentsReceivedIterator.hasNext())    {      Assignment assignmentReceived      	= (Assignment)(assignmentsReceivedIterator.next());            if (assignmentReceived.getScope().equals(rootNode)          && (assignmentReceived.getLimitValues().size()              == limitValues.size()))      {        return assignmentReceived;      }    }        // If we've gotten this far, we must not have this Assignment yet.        Assignment assignment    	= grantor.grant    			(pSubject,    	     rootNode,    	     function,    	     limitValues,    	     Constants.ASSIGNMENT_CANUSE,    	     Constants.ASSIGNMENT_CANGRANT,           Constants.YESTERDAY,           Constants.TOMORROW);        return assignment;  }