use of org.wso2.carbon.registry.core.Collection in project siddhi by wso2.
the class ExhaustiveCollectionExecutor method findEvents.
public Collection<StreamEvent> findEvents(StateEvent matchingEvent, Collection<StreamEvent> preProcessedstoreEvents) {
HashSet<StreamEvent> streamEvents = new HashSet<StreamEvent>();
for (StreamEvent storeEvent : preProcessedstoreEvents) {
matchingEvent.setEvent(storeEventIndex, storeEvent);
if ((Boolean) expressionExecutor.execute(matchingEvent)) {
streamEvents.add(storeEvent);
}
matchingEvent.setEvent(storeEventIndex, null);
}
return streamEvents;
}
use of org.wso2.carbon.registry.core.Collection in project siddhi by wso2.
the class ExhaustiveCollectionExecutor method delete.
@Override
public void delete(StateEvent deletingEvent, IndexedEventHolder indexedEventHolder) {
Collection<StreamEvent> storeEvents = indexedEventHolder.getAllEvents();
Set<StreamEvent> toDeleteEvents = new HashSet<StreamEvent>();
for (StreamEvent storeEvent : storeEvents) {
deletingEvent.setEvent(storeEventIndex, storeEvent);
if ((Boolean) expressionExecutor.execute(deletingEvent)) {
toDeleteEvents.add(storeEvent);
}
deletingEvent.setEvent(storeEventIndex, null);
}
indexedEventHolder.deleteAll(toDeleteEvents);
}
use of org.wso2.carbon.registry.core.Collection in project carbon-apimgt by wso2.
the class DynamicHtmlGenTestCase method testToApiName.
@Test
public void testToApiName() throws Exception {
DynamicHtmlGen htmlGen = new DynamicHtmlGen();
final String originalTag = "API (Collection)";
String sanitised = htmlGen.sanitizeTag(originalTag);
Assert.assertEquals(sanitised, "APICollection");
String retrievedTag = htmlGen.toApiName(sanitised);
Assert.assertEquals(retrievedTag, originalTag);
sanitised = htmlGen.toApiFilename(originalTag);
Assert.assertEquals(sanitised, "APICollection");
}
use of org.wso2.carbon.registry.core.Collection in project wso2-dss-connectors by wso2-attic.
the class MongoDBDataSource method decodeQuery.
private Object[] decodeQuery(String query) throws DataServiceFault {
int i1 = query.indexOf('.');
if (i1 == -1) {
throw new DataServiceFault("The MongoDB Collection not specified in the query '" + query + "'");
}
String collection = query.substring(0, i1).trim();
int i2 = query.indexOf('(', i1);
if (i2 == -1 || i2 - i1 <= 1) {
throw new DataServiceFault("Invalid MongoDB operation in the query '" + query + "'");
}
String operation = query.substring(i1 + 1, i2).trim();
int i3 = query.lastIndexOf(')');
if (i3 == -1) {
throw new DataServiceFault("Invalid MongoDB operation in the query '" + query + "'");
}
String opQuery = null;
if (i3 - i2 > 1) {
opQuery = query.substring(i2 + 1, i3).trim();
}
MongoOperation mongoOp = this.convertToMongoOp(operation);
if (mongoOp == MongoOperation.UPDATE) {
List<Object> result = new ArrayList<Object>();
result.add(collection);
result.add(mongoOp);
result.addAll(parseInsertQuery(opQuery));
return result.toArray();
} else {
return new Object[] { collection, mongoOp, this.checkAndCleanOpQuery(opQuery) };
}
}
use of org.wso2.carbon.registry.core.Collection in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method getFailedActivitiesForInstance.
/**
* Get Failed Activities for give instance id.
*
* @param instanceID
* @return
* @throws InstanceManagementException
*/
@Override
public ActivityRecoveryInfoType[] getFailedActivitiesForInstance(final long instanceID) throws InstanceManagementException {
try {
isOperationIsValidForTheCurrentTenant(instanceID);
} catch (IllegalAccessException ex) {
handleError(ex);
}
ActivityRecoveryInfoType[] activityRecoveryInfoTypes = null;
try {
BpelDatabase bpelDb = bpelServer.getODEBPELServer().getBpelDb();
Object result = bpelDb.exec(new BpelDatabase.Callable<Object>() {
public Object run(BpelDAOConnection conn) throws InstanceManagementException {
ProcessInstanceDAO instance = conn.getInstance(instanceID);
Collection<ActivityRecoveryDAO> activityRecoveries = instance.getActivityRecoveries();
return activityRecoveries;
}
});
ArrayList<ActivityRecoveryDAO> activityRecoveryDAOs = (ArrayList<ActivityRecoveryDAO>) result;
if (activityRecoveryDAOs != null) {
activityRecoveryInfoTypes = new ActivityRecoveryInfoType[activityRecoveryDAOs.size()];
for (int i = 0; i < activityRecoveryDAOs.size(); i++) {
ActivityRecoveryDAO activityRecovery = activityRecoveryDAOs.get(i);
ActivityRecoveryInfoType info = new ActivityRecoveryInfoType();
info.setActions(activityRecovery.getActions());
info.setActivityID(activityRecovery.getActivityId());
info.setDateTime(String.valueOf(activityRecovery.getDateTime()));
info.setInstanceID(instanceID);
info.setReason(activityRecovery.getReason());
info.setRetires(activityRecovery.getRetries());
activityRecoveryInfoTypes[i] = info;
}
}
} catch (Exception e) {
String errMsg = "Error occurred while retrieving failed activity information for instance id " + instanceID;
log.error(errMsg, e);
throw new InstanceManagementException(errMsg, e);
}
return activityRecoveryInfoTypes;
}
Aggregations