Error 'unknown MongoDB operation 'aggregate'' when using aggregate in WSo2 Integration Studio? - wso2

I am working Wso2 Integration Studio 8.1 version. I want to using aggregate query. But Wso2 Integration Studip giving error as DS Fault Message: Error in MongoQuery.runQuery: DS Fault Message: Unknown MongoDB operation 'aggregate'

I'm afraid it seems the Micro Integrator doesn't support it at the moment. This is from the code which supports the following operations.
private DBConstants.MongoDB.MongoOperation convertToMongoOp(String operation) throws DataServiceFault {
if (DBConstants.MongoDB.MongoOperationLabels.COUNT.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.COUNT;
} else if (DBConstants.MongoDB.MongoOperationLabels.DROP.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.DROP;
} else if (DBConstants.MongoDB.MongoOperationLabels.FIND.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.FIND;
} else if (DBConstants.MongoDB.MongoOperationLabels.FIND_ONE.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.FIND_ONE;
} else if (DBConstants.MongoDB.MongoOperationLabels.INSERT.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.INSERT;
} else if (DBConstants.MongoDB.MongoOperationLabels.REMOVE.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.REMOVE;
} else if (DBConstants.MongoDB.MongoOperationLabels.UPDATE.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.UPDATE;
} else if (DBConstants.MongoDB.MongoOperationLabels.EXISTS.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.EXISTS;
} else if (DBConstants.MongoDB.MongoOperationLabels.CREATE.equals(operation)) {
return DBConstants.MongoDB.MongoOperation.CREATE;
} else {
throw new DataServiceFault("Unknown MongoDB operation '" + operation + "'");
}
}
Even the MongoDB connector doesn't support Aggregate operation, hence your best option is to write a Custom mediator to get this done or try to improve the existing connector.

Related

Where to see all possible error code of AwsServiceException?

I want to handle AwsServiceException based on the error code returned.
Where web page lists out all those possible error code? I cannot find it in the java doc.
https://sdk.amazonaws.com/java/api/2.0.0/software/amazon/awssdk/awscore/exception/AwsServiceException.html
private RuntimeException handleS3Exception(final AwsServiceException exception) {
if (exception.awsErrorDetails().errorCode().equals("NoSuchKey")) {
return new ObjectNotFoundException();
} else {
return exception;
}
}
Thank you!

Apache Beam: Why does it write to Spanner twice on REPORT_FAILURES mode?

I found interesting write operation codes while looking at SpannerIO, and want to understand reasons.
On write(WriteToSpannerFn) and REPORT_FAILURES failure mode, it seems trying to write failed mutations twice.
I think it's for logging each mutation's exceptions. Is it a correct assumption, and is there any workaround?
Below, I removed some lines for simplicity.
public void processElement(ProcessContext c) {
Iterable<MutationGroup> mutations = c.element();
boolean tryIndividual = false;
try {
Iterable<Mutation> batch = Iterables.concat(mutations);
spannerAccessor.getDatabaseClient().writeAtLeastOnce(batch);
} catch (SpannerException e) {
if (failureMode == FailureMode.REPORT_FAILURES) {
tryIndividual = true;
} else {
...
}
}
if (tryIndividual) {
for (MutationGroup mg : mutations) {
try {
spannerAccessor.getDatabaseClient().writeAtLeastOnce(mg);
} catch (SpannerException e) {
LOG.warn("Failed to submit the mutation group", e);
c.output(failedTag, mg);
}
}
}
}
So rather than write each Mutation individually to the database, the SpannerIO.write() connector tries to write a batch of Mutations in a single transaction for efficiency.
If just one of these Mutations in the batch fails, then the whole transaction fails, so in REPORT_FAILURES mode, the mutations are re-tried individually to find which Mutation(s) are the problematic ones...

Cannot create new opportunity in Vtiger? incorrect integer value

Could you please give me a hand to correct the error when I created new opportunity in Vtiger CRM.
The cause is "incorrect integer value '' when system insert '' into int field.
There is solution to solve it by set sql mode. But I'm using shared hosting. Provider cannot to do this one.
In vtiger by default it use mysqli as DB type which will be defined in config.inc.php file
$dbconfig['db_type'] = 'mysqli';
I would suggest you to set SQL mode runtime by defining this line in Library file which vtiger using for DB connection
\vtiger\libraries\adodb\drivers\adodb-mysqli.inc.php
Add on line code at line no 126
Previous code
if ($ok) {
if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
} else {
if ($this->debug)
ADOConnection::outp("Could't connect : " . $this->ErrorMsg());
$this->_connectionID = null;
return false;
}
Latest Code
if ($ok) {
mysqli_query($this->_connectionID, "SET SESSION sql_mode = 'TRADITIONAL'");
if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
} else {
if ($this->debug)
ADOConnection::outp("Could't connect : " . $this->ErrorMsg());
$this->_connectionID = null;
return false;
}
Hope this helps you

get the list of source files from existing eclipse project using CDT

i am working on CDT eclipse plug in development, i am trying to get the list of sources files which exist in eclipse project explorer using CDT code using following code ,which results null.
Case1:
IFile[] files2 = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(new URI("file:/"+workingDirectory));
for (IFile file : files2) {
System.out.println("fullpath " +file.getFullPath());
}
Case2:
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(getProject().getRawLocationURI());
for (IFile file : files) {
System.out.println("fullpath " +file.getFullPath());
}
Case3:
IFile[] files3 = ResourceLookup.findFilesByName(getProject().getFullPath(),ResourcesPlugin.getWorkspace().getRoot().getProjects(),false);
for (IFile file : files3) {
System.out.println("fullpath " +file.getFullPath());
}
Case4:
IFolder srcFolder = project.getFolder("src");
Case 1 ,2,3 giving me output null, where i am expecting list of files;
in Case 4: i am getting the list of "helloworld/src" files, but i am expecting to get the files from the existing project mean main root ,ex:"helloworld"
please suggest me on this.
You can either walk through the worspace resources tree using IResourceVisitor - or you can walk through CDT model:
private void findSourceFiles(final IProject project) {
final ICProject cproject = CoreModel.getDefault().create(project);
if (cproject != null) {
try {
cproject.accept(new ICElementVisitor() {
#Override
public boolean visit(final ICElement element) throws CoreException {
if (element.getElementType() == ICElement.C_UNIT) {
ITranslationUnit unit = (ITranslationUnit) element;
if (unit.isSourceUnit()) {
System.out.printf("%s, %s, %s\n", element.getElementName(), element.getClass(), element
.getUnderlyingResource().getFullPath());
}
return false;
} else {
return true;
}
}
});
} catch (final CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Note there may be more source files then you actually want (e.g. you may not care system about headers) - you can filter them by checking what the underlying resource is.

J2ME Stub generates an unknown exception with JPA Entity types

I created a web service stub using NetBeans 7.0 and when I try using it, it throws an unknown Exception. I don't even know what part of my code to show here, all I know is that bolded line generates an unknown Exception:
public Businesses[] findBusiness(String query) throws java.rmi.RemoteException {
Object inputObject[] = new Object[]{
query
};
Operation op = Operation.newInstance(_qname_operation_findBusiness, _type_findBusiness, _type_findBusinessResponse);
_prepOperation(op);
op.setProperty(Operation.SOAPACTION_URI_PROPERTY, "");
Object resultObj;
try {
resultObj = op.invoke(inputObject);
} catch (JAXRPCException e) {
Throwable cause = e.getLinkedCause();
if (cause instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) cause;
}
throw e;
}
return businesses_ArrayfromObject((Object[]) resultObj);
}
private static Businesses[] businesses_ArrayfromObject(Object obj[]) {
if (obj == null) {
return null;
}
Businesses result[] = new Businesses[obj.length];
for (int i = 0; i < obj.length; i++) {
result[i] = new Businesses();
Object[] oo = (Object[]) obj[i];
result[i].setAddress((String) oo[0]); // **exception here**
result[i].setEmail((String) oo[1]);
result[i].setId((Integer) oo[2]);
result[i].setName((String) oo[3]);
result[i].setPhoneno((String) oo[4]);
result[i].setProducts((String) oo[5]);
}
return result;
}`
I tried to consume the same webservice using a web application and it works quite well. I don't have a single clue to what is causing this exception. Any comment would be appreciated.
Update
I tried other services that return a String data type and it works fine. So I thought maybe J2ME has issues with JPA Entity types.
So my question is how do I return the data properly so that the J2ME client can read it well?