Dashboard > BobsGear Main Space > Home > Confluence Plugin Development Diary > Can an macro execute routine know the name of the macro that caused it to be called
Can an macro execute routine know the name of the macro that caused it to be called
Added by Garnet R. Chaney, last edited by Garnet R. Chaney on May 28, 2007
Labels: 
(None)


The answer is apparently not. I put the following code at the start of an execute routine, and I was not able to find the name of the calling macro:

    public String execute(Map parameters, String body, RenderContext renderContext) throws MacroException
    {
        // Get the keys for the Map parameters
        String sResult = "";

/*  Source 1.3 doesn't allow either of these:

        for (KeyType key : parameters.keySet())
           {
             if (sResult.length()>0)
                { sResult=sResult+", ";
                }
             sResult += +key;
           }

       for (Iterator<String> it = m.keySet().iterator(); it.hasNext(); )
*/
       for (Iterator it = parameters.keySet().iterator(); it.hasNext(); )
          // if (it.next().isBogus())
          // it.remove();
           { String key = (String)it.next();
             if (sResult.length()>0)
                { sResult=sResult+", ";
                }
             sResult += key;
           }

        String sRaw = (String)
        parameters.get(": = | RAW | = :");

        if (1==1)
                {
        return  "Raw parameter:<hr>"+sRaw+"<hr>"+
                "Body:<hr>"+body+"<hr>Keys in parameters:"+sResult;
                }

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.4.3 Build:#705 Mar 21, 2007) - Bug/feature request - Contact Administrators
Complete Wiki Notation Guide