Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hi,
I am having some difficulty with the AuditBridge class on Machine cloud 6.8.2, i believe the following line of code:
foundEntries = AuditBridge.find(ac)
is giving me this error:
No signature of method: static com.axeda.sdk.v2.bridge.AuditBridge.find() is applicable for argument types: (com.axeda.services.v2.AuditCriteria) values: [com.axeda.services.v2.AuditCriteria@50bd993e[assetId=<null>,fromDate=Tue Jun 16 00:00:00 GMT 2015,toDate=Tue Jun 16 10:32:03 GMT 2015,usernames=[],categories=[],pageSize=<null>,pageNumber=1,sortAscending=true,sortPropertyName=date]] Possible solutions: find(), find(groovy.lang.Closure), findAll(), any(), print(java.lang.Object), is(java.lang.Object)
Can anyone see my mistake?
Full Code:
import com.axeda.sdk.v2.bridge.AuditBridge import static com.axeda.sdk.v2.dsl.Bridges.*; import com.axeda.services.v2.*; import groovy.xml.MarkupBuilder; import java.text.SimpleDateFormat; import java.util.Date; import org.codehaus.groovy.runtime.TimeCategory; def writer def xml try { writer = new StringWriter() xml = new MarkupBuilder(writer) SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss") SimpleDateFormat rsdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss") AuditCriteria ac = new AuditCriteria() ac.sortAscending = true ac.sortPropertyName = 'date' ac.fromDate = sdf.parse(parameters.RXS_fromDate) use(TimeCategory) { ac.toDate = new Date() - 10.minutes } xml.root() { for (int i = 1; i <= Math.ceil( AuditBridge.find(ac).getTotalCount() / ac.getPageSize()); i++) { ac.setPageNumber(i) foundEntries = AuditBridge.find(ac) List aList = foundEntries.getAudits() for (a in aList) { xml.Alarm() { AuditDate(rsdf.format(a.date)) Msg(a.message) Category(a.category) ID(a.asset.systemId) UserName(a.user.fullName) UserLogic(a.user.username) } } if (i == 20) { break } } } } catch (Exception ex) { writer = new StringWriter() xml = new MarkupBuilder(writer) xml.Response() { Fault { Code('Groovy Exception') Message(ex.getMessage()) StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); Detail(sw.toString()) } } } return ['Content-Type': 'text/xml', 'Content': writer.toString()]
Solved! Go to Solution.
We found the issue, using multiple imports of AuditBridge.
Full explanation:
Customer had the following lines:
import com.axeda.sdk.v2.bridge.AuditBridge
import static com.axeda.sdk.v2.dsl.Bridges.*
Two symbols are now in the groovy namespace that can match "[Aa]uditBridge":
com.axeda.sdk.v2.bridge.AuditBridge (which is of type Groovy:java.lang.Class
and
auditBridge, which is an alias for the static import of com.axeda.sdk.v2.dsl.Bridges.getAuditBridge().
The former does not have a method signature of find(AuditCriteria), while the second does. The former, however, takes precedence.
Hello, Alan:
I believe this is a defect. I have created a case for you in the Support Portal to track this with R&D.
Regards,
-Chris Kaminski
PTC Customer Support
ah
Can you tell me the reference of the case you have raised so i can raise a case visible to us for tracking?
Thanks!
Alan
Nevermind - i see it now!
We found the issue, using multiple imports of AuditBridge.
Full explanation:
Customer had the following lines:
import com.axeda.sdk.v2.bridge.AuditBridge
import static com.axeda.sdk.v2.dsl.Bridges.*
Two symbols are now in the groovy namespace that can match "[Aa]uditBridge":
com.axeda.sdk.v2.bridge.AuditBridge (which is of type Groovy:java.lang.Class
and
auditBridge, which is an alias for the static import of com.axeda.sdk.v2.dsl.Bridges.getAuditBridge().
The former does not have a method signature of find(AuditCriteria), while the second does. The former, however, takes precedence.