use of com.pogeyan.cmis.data.mongo.services.MongoClientFactory in project copper-cms by PogeyanOSS.
the class App method main.
public static void main(String[] args) throws Exception, ExpressionParserException, ExpressionParserInternalError, ExceptionVisitExpression {
RepositoryManagerFactory.getInstance().init(new LocalRepoImpl());
MongoClientFactory dbFactory = (MongoClientFactory) MongoClientFactory.createDatabaseService();
MDocumentObjectDAOImpl dao = (MDocumentObjectDAOImpl) dbFactory.getObjectService("TestRepo", MDocumentObjectDAO.class);
Query<MDocumentObject> query = dao.createQuery();
// String filterExpressionQuery = "name eq 'fd' and name ne 'sd'";
String filterExpressionQuery = "contains(name, 'fd')";
FilterExpression expression = UriParser.parseFilter(filterExpressionQuery);
Object filterExp = expression.accept(new MongoExpressionVisitor<MDocumentObject>(query));
System.out.print("output: " + filterExp != null ? filterExp.toString() : "error");
String orderByExpressionQuery = "name asc, repositoryId desc";
OrderByExpression orderByExpression = UriParser.parseOrderBy(orderByExpressionQuery);
Object orderByExp = orderByExpression.accept(new MongoExpressionVisitor<MDocumentObject>(query));
System.out.print("output: " + orderByExp != null ? orderByExp.toString() : "error");
}
Aggregations