Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2009 Mysema Ltd.
  * All rights reserved.
  *
  */
 package com.mysema.query.jdoql.dml;
 
 import java.util.List;
 
UpdateClause implementation for JDO

Author(s):
tiwe
public class JDOQLUpdateClause implements UpdateClause<JDOQLUpdateClause>{
    private final QueryMetadata metadata = new DefaultQueryMetadata();
//    private final PersistenceManager persistenceManager;
//
//    private final JDOQLTemplates templates;
//    public JDOQLUpdateClause(PersistenceManager persistenceManager, PEntity<?> entity){
//        this(persistenceManager, entity, JDOQLTemplates.DEFAULT);
//    }
//
//    public JDOQLUpdateClause(PersistenceManager persistenceManager, PEntity<?> entity, JDOQLTemplates templates){
//        this.persistenceManager = persistenceManager;
//        this.templates = templates;
//        metadata.addFrom(entity);
//    }
    @Override
    public long execute() {
        // TODO : implement
        throw new UnsupportedOperationException("Not yet implemented");
    }
    @SuppressWarnings("unchecked")
    @Override
    public JDOQLUpdateClause set(List<? extends Path<?>> pathsList<?> values) {
        for (int i = 0; i < paths.size(); i++){
            if (values.get(i) != null){
                .addProjection(((Expr)paths.get(i).asExpr()).eq(values.get(i)));
            }else{
                .addProjection(((Expr)paths.get(i).asExpr()).eq(new NullExpr(paths.get(i).getType())));
            }
        }
        return this;
    }
    @Override
    public <T> JDOQLUpdateClause set(Path<T> path, T value) {
        if (value != null){
            .addProjection(path.asExpr().eq(value));
        }else{
            .addProjection(path.asExpr().eq(new NullExpr<T>(path.getType())));
        }
        return this;
    }
    @Override
    public JDOQLUpdateClause where(EBoolean... o) {
        .addWhere(o);
        return this;
    }
New to GrepCode? Check out our FAQ X