Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should ApexUML package classes show in the list? #7

Closed
ImJohnMDaniel opened this issue Apr 3, 2014 · 6 comments
Closed

Should ApexUML package classes show in the list? #7

ImJohnMDaniel opened this issue Apr 3, 2014 · 6 comments
Assignees
Milestone

Comments

@ImJohnMDaniel
Copy link
Collaborator

@afawcett - I am seeing that the ApexUML package classes show in the list of classes available? IMO, this should not be the case. I can't think of a use case where we would want that to appear.

Thoughts?

using ApexUML v1.5

@afawcett
Copy link
Owner

afawcett commented Apr 4, 2014

I thought i had it only showing up for Apex classes in the packaging org, not ones from packages installed, is it show up classes for packaged classes installed? If so, need to review the SOQL where class in the selector.

@ImJohnMDaniel
Copy link
Collaborator Author

Yeah, I have v1.5 installed in an org that is clean. There are only a few classes and ApexUML is the only installed package. I can see the ApexUML packaged classes on the left sidebar. I can also select them to the canvas. The second Ajax call to determine relationships fails though (because the code body for those classes cannot be seen).

@afawcett
Copy link
Owner

afawcett commented Apr 4, 2014

Hmmm that's odd, i did some tests with the SOQL query on ApexClass re: BodyLenght in an org with a managed package in and it returned -1, so i figured this would suffice. Trouble with NamespacePrefix (as per v1.4) is it ment that the tool could not be used in managed packages. I'm thinking a more relaiable way would be to provide some kind of custom setting to say, select all none namespaced classes plus ones in this namespace, what do you think?

@ImJohnMDaniel
Copy link
Collaborator Author

Yeah, I see what you are talking about with "body length" of -1.

I ran the following query using SOQLX in my org where I am seeing the issue:

select Id, NamespacePrefix, Name, ApiVersion, Status, IsValid, BodyCrc, Body, LengthWithoutComments, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp from ApexClass
where LengthWithoutComments > 0

....and I see the managed packaged classes from ApexUML.

It would appear that the "-1" is not a real number but rather some sort of "User Interface-ish" type illusion. The same is true for the BodyCrc value.

For the moment, I don't see a way around this. Let me think about it some more.

@ImJohnMDaniel
Copy link
Collaborator Author

So, here is a thought. We could change the ApexClassesSelector.selectAllVisible() method to first query for all ApexClasses and then loop through the result set in the following manner.

list theClasses = [select Id, NamespacePrefix, Name, ApiVersion, Status, IsValid, BodyCrc, Body, LengthWithoutComments, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp from ApexClass];

list theClassesThatAreVisible = new list();

for (ApexClass aClass : theClasses)
{
    if (string.valueOf(aClass.LengthWithoutComments) != '-1')
    {
        theClassesThatAreVisible.add( aClass );
    }
}

While the solution is a tad kludgy, it is the only answer that I can think of for the moment.

Thoughts?

@afawcett
Copy link
Owner

afawcett commented Apr 4, 2014

Sounds good, it's encapsulated at least and does not require end user config, go for it. Will sort you packaging org access as well btw

@ImJohnMDaniel ImJohnMDaniel self-assigned this Apr 5, 2014
ImJohnMDaniel pushed a commit that referenced this issue Apr 5, 2014
Adjusted selectAllVisible() method to query for all classes and then
filter out those where the LengthWithoutComments is '-1'.

This should filter out managed package classes but still allow classes
in the default namespace that are attached to a package visible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants