当前位置: 首页>>代码示例>>Java>>正文


Java Query.executeWithArray方法代码示例

本文整理汇总了Java中javax.jdo.Query.executeWithArray方法的典型用法代码示例。如果您正苦于以下问题:Java Query.executeWithArray方法的具体用法?Java Query.executeWithArray怎么用?Java Query.executeWithArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jdo.Query的用法示例。


在下文中一共展示了Query.executeWithArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFilteredRequesters

import javax.jdo.Query; //导入方法依赖的package包/类
public Collection<String> getFilteredRequesters(String requester, Long domainId) {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  Query query = null;
  List<String> queryList = new ArrayList<>(0);
  try {
    if (StringUtils.isNotEmpty(requester)) {
      query = pm.newQuery("javax.jdo.query.SQL",
          "SELECT DISTINCT CREATED_BY FROM ORDER_APPROVAL_MAPPING WHERE "
              + "EXISTS (SELECT 1 from USERACCOUNT_DOMAINS WHERE CREATED_BY = USERID_OID "
              + "AND DOMAIN_ID = ?) "
              + "AND CREATED_BY in (SELECT USERID from USERACCOUNT WHERE NNAME like ?) limit 10");
      List results = (List) query.executeWithArray(domainId, requester.toLowerCase() + "%");
      if(results != null && !results.isEmpty()) {
        queryList = new ArrayList<>(results.size());
        for(Object o : results) {
          queryList.add((String)o);
        }
      }
    }
  } finally {
    if (query != null) {
      query.closeAll();
    }
    pm.close();
  }
  return queryList;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:28,代码来源:ApprovalsDao.java

示例2: getFilteredApprovers

import javax.jdo.Query; //导入方法依赖的package包/类
public Collection<String> getFilteredApprovers(String requester, Long domainId) {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  Query query = null;
  List<String> queryList = new ArrayList<>(0);
  try {
    if (StringUtils.isNotEmpty(requester)) {
      query = pm.newQuery("javax.jdo.query.SQL",
          "SELECT DISTINCT UID FROM APPROVERS WHERE "
              + "EXISTS (SELECT 1 from USERACCOUNT_DOMAINS WHERE UID = USERID_OID "
              + "AND DOMAIN_ID = ?) "
              + "AND UID in (SELECT USERID from USERACCOUNT WHERE NNAME like ?) limit 10");
      List results = (List) query.executeWithArray(domainId, requester.toLowerCase()+"%");
      if(results != null && !results.isEmpty()) {
        queryList = new ArrayList<>(results.size());
        for(Object o : results) {
          queryList.add((String)o);
        }
      }
    }
  } finally {
    if (query != null) {
      query.closeAll();
    }
    pm.close();
  }
  return queryList;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:28,代码来源:ApprovalsDao.java

示例3: getShipmentsByOrderId

import javax.jdo.Query; //导入方法依赖的package包/类
/**
 * Get all shipment for a specific order
 *
 * @param orderId Order Id
 * @return -
 */
@Override
@SuppressWarnings("unchecked")
public List<IShipment> getShipmentsByOrderId(Long orderId, PersistenceManager pm) {
  Query query = null;
  try {
    query = pm.newQuery("javax.jdo.query.SQL", "SELECT * FROM SHIPMENT WHERE ORDERID = ?");
    query.setClass(JDOUtils.getImplClass(IShipment.class));
    List list = (List) query.executeWithArray(orderId);
    List<IShipment> shipments = new ArrayList<>(list.size());
    for (Object shipment : list) {
      shipments.add((IShipment) shipment);
    }
    return shipments;
  } catch (Exception e) {
    xLogger.severe("Error while fetching shipments by order id: {0}", orderId, e);
  } finally {
    if (query != null) {
      query.closeAll();
    }
  }
  return null;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:29,代码来源:ShipmentService.java

示例4: fetchMinMaxLog

import javax.jdo.Query; //导入方法依赖的package包/类
/**
 * Fetch the List<IInventoryMinMaxLog> for a given inventoryId
 */
public List<IInventoryMinMaxLog> fetchMinMaxLog(String invId) {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  Query query = null;
  List<IInventoryMinMaxLog> logs = null;
  try {
    String sqlQuery = "SELECT * FROM INVENTORYMINMAXLOG WHERE invId =? ORDER BY T DESC limit 50";
    query = pm.newQuery("javax.jdo.query.SQL", sqlQuery);
    query.setClass(JDOUtils.getImplClass(IInventoryMinMaxLog.class));
    logs = (List<IInventoryMinMaxLog>) query.executeWithArray(invId);
    logs = (List<IInventoryMinMaxLog>) pm.detachCopyAll(logs);

  } catch (Exception e) {
    xLogger.warn("Exception {0} when getting InvntryItem for invId {1}. Message: {2}",
        e.getClass().getName(), invId, e.getMessage());
    return null;
  } finally {
    if (query != null) {
      query.closeAll();
    }
    pm.close();
  }

  return logs;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:28,代码来源:InventoryManagementServiceImpl.java

示例5: getHandlingUnitDataByMaterialId

import javax.jdo.Query; //导入方法依赖的package包/类
@Override
public Map<String, String> getHandlingUnitDataByMaterialId(Long materialId) {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  Query query = null;
  try {
    query =
        pm.newQuery("javax.jdo.query.SQL",
            "SELECT ID,(SELECT NAME FROM HANDLINGUNIT WHERE ID=HU_ID_OID) NAME, QUANTITY, HU_ID_OID FROM HANDLINGUNITCONTENT HUC WHERE HUC.TY = '0' AND HUC.CNTID = ?");
    List data = (List) query.executeWithArray(materialId);
    if (data == null || data.size() == 0) {
      return null;
    }
    Map<String, String> huMap = new HashMap<>(3);
    Object[] o = (Object[]) data.get(0);
    huMap.put(IHandlingUnit.NAME, String.valueOf(o[1]));
    huMap.put(IHandlingUnit.QUANTITY,
        new BigDecimal(String.valueOf(o[2])).stripTrailingZeros().toPlainString());
    huMap.put(IHandlingUnit.HUID, String.valueOf(o[3]));
    return huMap;
  } finally {
    if (query != null) {
      try {
        query.closeAll();
      } catch (Exception ignored) {
        xLogger.warn("Exception while closing query", ignored);
      }
    }
    pm.close();
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:31,代码来源:HandlingUnitServiceImpl.java

示例6: hasAccessToKiosk

import javax.jdo.Query; //导入方法依赖的package包/类
public Integer hasAccessToKiosk(String userId, Long kioskId) {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  Query query = null;
  try {
    String
        qry =
        "SELECT IF(R = 'c,v' OR R = 'v,c',GREATEST(C, V),IF(R = 'c', C, V)) Perm FROM(SELECT (SELECT GROUP_CONCAT(KL.LINKTYPE) R FROM KIOSKLINK KL WHERE KL.LINKEDKIOSKID = ?"
            +
            " AND KL.KIOSKID = K.KIOSKID) R,K.CPERM C,K.VPERM V FROM KIOSK K, (SELECT KIOSKID FROM USERTOKIOSK UK WHERE KIOSKID IN (SELECT DISTINCT KL.LINKEDKIOSKID FROM KIOSKLINK KL WHERE KIOSKID = ?)"
            +
            " AND USERID = ?) UK WHERE K.KIOSKID = UK.KIOSKID AND (K.CPERM > 0 OR K.VPERM > 0)) PERM limit 1";
    query = pm.newQuery("javax.jdo.query.SQL", qry);
    query.setUnique(true);
    Integer hasAccess = (Integer) query.executeWithArray(kioskId, kioskId, userId);
    if (hasAccess != null && hasAccess > 0) {
      return hasAccess;
    } else {
      return 0;
    }
  } finally {
    if (query != null) {
      try {
        query.closeAll();
      } catch (Exception ignored) {
        xLogger.warn("Exception while closing query", ignored);
      }
    }
    pm.close();
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:31,代码来源:EntitiesServiceImpl.java

示例7: getEnabledUserIdsWithTags

import javax.jdo.Query; //导入方法依赖的package包/类
/**
 * Get the list of enabled userIds from the given tagNames
 */
public List<String> getEnabledUserIdsWithTags(List<String> tagNames, Long domainId) {
  List<String> uIds = null;
  if (tagNames != null && tagNames.size() > 0) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    String tagName = MessageUtil.getCSVWithEnclose(tagNames);
    String query = "SELECT UA.USERID FROM USERACCOUNT UA,USER_TAGS UT WHERE "
        + "UT.ID IN (SELECT ID FROM TAG WHERE NAME IN (" + tagName + ") AND TYPE=4)"
        + " AND UT.USERID = UA.USERID AND UA.ISENABLED = 1 AND UA.SDID = ?";
    Query q = pm.newQuery("javax.jdo.query.SQL", query);
    try {
      List l = (List) q.executeWithArray(domainId);
      uIds = new ArrayList<>(l.size());
      for (Object o : l) {
        uIds.add((String) o);
      }
    } catch (Exception e) {
      xLogger.warn("Error while getting enabled user by tags {0}", tagName, e);
    } finally {
      try {
        q.closeAll();
      } catch (Exception ignored) {
        xLogger.warn("Exception while closing query", ignored);
      }
      pm.close();
    }
  }
  return uIds;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:32,代码来源:UsersServiceImpl.java

示例8: getMigratoryOrders

import javax.jdo.Query; //导入方法依赖的package包/类
@Override
public List<IOrder> getMigratoryOrders(Integer offset, Integer size, String cutoffDate) {

  PersistenceManager pm = null;
  Query query = null;
  List<IOrder> retlist = null;
  List<String> params = new ArrayList<>();
  try {
    String
        squery =
        " SELECT * FROM  logistimo.ORDER ord LEFT JOIN logistimo.ORDER_JOB_STATUS ojs ON (ord.ID = ojs.ID) "
            +
            " WHERE ord.CON <= ? AND ojs.STATUS NOT IN ('COMPLETED','FAILED') OR ojs.STATUS is null "
            +
            " ORDER BY ord.ID ASC limit " + offset + CharacterConstants.COMMA + size;
    params.add(cutoffDate);
    pm = PMF.get().getPersistenceManager();
    query = pm.newQuery("javax.jdo.query.SQL", squery);
    query.setClass(Order.class);
    retlist = (List<IOrder>) query.executeWithArray(params.toArray());
    retlist = (List<IOrder>) pm.detachCopyAll(retlist);

  } catch (Exception e) {
    xlogger.warn("Error encountered during order migrations", e);
  } finally {
    if (query != null) {
      query.closeAll();
    }
    if (pm != null) {
      pm.close();
    }
  }
  return retlist;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:35,代码来源:OrderDao.java

示例9: getDemandItems

import javax.jdo.Query; //导入方法依赖的package包/类
/**
 * Get all demand items by order Id
 *
 * @param orderId Order Id
 * @return -
 */
@Override
public List<IDemandItem> getDemandItems(Long orderId, PersistenceManager pm) {
  PersistenceManager localPM = pm;
  boolean useLocalPM = false;
  if (localPM == null) {
    localPM = PMF.get().getPersistenceManager();
    useLocalPM = true;
  }
  Query q = null;
  try {
    q = localPM.newQuery("javax.jdo.query.SQL", "SELECT * FROM DEMANDITEM WHERE OID=?");
    q.setClass(JDOUtils.getImplClass(IDemandItem.class));
    List<IDemandItem> items = (List<IDemandItem>) q.executeWithArray(orderId);
    if (items != null) {
      items = (List<IDemandItem>) localPM.detachCopyAll(items);
    }
    return items;
  } catch (Exception e) {
    xLogger.severe("Error while fetching demand items for order {0}", orderId, e);
  } finally {
    if (q != null) {
      q.closeAll();
    }
    if (useLocalPM) {
      localPM.close();
    }
  }
  return null;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:36,代码来源:DemandService.java

示例10: includeShipmentItems

import javax.jdo.Query; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void includeShipmentItems(IShipment shipment, PersistenceManager pm) {
  if (shipment == null) {
    return;
  }
  Query src = null;
  try {
    src = pm.newQuery("javax.jdo.query.SQL", "SELECT * FROM SHIPMENTITEM WHERE sid = ?");
    src.setClass(JDOUtils.getImplClass(IShipmentItem.class));
    shipment
        .setShipmentItems((List<IShipmentItem>) src.executeWithArray(shipment.getShipmentId()));
    shipment
        .setShipmentItems((List<IShipmentItem>) pm.detachCopyAll(shipment.getShipmentItems()));
    src = pm.newQuery("javax.jdo.query.SQL", "SELECT * FROM SHIPMENTITEMBATCH WHERE siId = ?");
    src.setClass(JDOUtils.getImplClass(IShipmentItemBatch.class));
    for (IShipmentItem iShipmentItem : shipment.getShipmentItems()) {
      List<IShipmentItemBatch>
          sb =
          (List<IShipmentItemBatch>) src.executeWithArray(iShipmentItem.getShipmentItemId());
      iShipmentItem.setShipmentItemBatch((List<IShipmentItemBatch>) pm.detachCopyAll(sb));
    }
  } catch (Exception e) {
    xLogger
        .severe("Error while fetching shipment items for shipment: {0}", shipment.getShipmentId(),
            e);
  } finally {
    if (src != null) {
      src.closeAll();
    }
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:32,代码来源:ShipmentService.java

示例11: getInventory

import javax.jdo.Query; //导入方法依赖的package包/类
@Override
public Results getInventory(InventoryFilters inventoryFilters, PageParams pageParams,
                            PersistenceManager pm)
    throws ServiceException {
  Query query = null;
  Query cntQuery = null;
  List<Invntry> inventoryList = null;
  int count = 0;
  try {
    QueryParams
        sqlQueryModel = buildInventoryQuery(inventoryFilters, false);
    String executeQuery = sqlQueryModel.query;
    if (pageParams != null) {
      executeQuery += " LIMIT " + pageParams.getOffset() + CharacterConstants.COMMA
          + pageParams.getSize();
    }
    query = pm.newQuery("javax.jdo.query.SQL", executeQuery);
    query.setClass(Invntry.class);
    inventoryList = (List<Invntry>) query.executeWithArray(
        sqlQueryModel.listParams.toArray());
    inventoryList = (List<Invntry>) pm.detachCopyAll(inventoryList);
    QueryParams cntSqlQueryModel = buildInventoryQuery(inventoryFilters, true);
    cntQuery = pm.newQuery("javax.jdo.query.SQL", cntSqlQueryModel.query);
    count =
        ((Long) ((List) cntQuery.executeWithArray(cntSqlQueryModel.listParams.toArray())).iterator().next())
            .intValue();

  } catch (Exception e){
    xLogger.severe("Error while reading inventory data", e);
  } finally {
    if (query != null) {
      query.closeAll();
    }
    if (cntQuery != null) {
      cntQuery.closeAll();
    }
  }
  return new Results(inventoryList, null, count,
      pageParams == null ? 0 : pageParams.getOffset());
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:41,代码来源:InvntryDao.java

示例12: validateEntityBatchManagementUpdate

import javax.jdo.Query; //导入方法依赖的package包/类
@Override
public boolean validateEntityBatchManagementUpdate(Long kioskId, PersistenceManager pm) throws ServiceException {
  if (kioskId == null) {
    throw new ServiceException("Invalid or null kioskId {0} while changing batch management on entity", kioskId);
  }
  boolean useLocalPm = false;
  if (pm == null) {
    pm = PMF.get().getPersistenceManager();
    useLocalPm = true;
  }

  Query query = null;
  List<String> parameters = new ArrayList<>(1);
  try {
    StringBuilder sqlQuery = new StringBuilder("SELECT 1 FROM INVNTRY I, MATERIAL M WHERE I.MID = M.MATERIALID AND M.BM = 1 AND I.STK > 0 AND I.KID = ").append(CharacterConstants.QUESTION);
    parameters.add(String.valueOf(kioskId));
    sqlQuery.append( " LIMIT 1");
    query = pm.newQuery("javax.jdo.query.SQL", sqlQuery.toString());
    query.setUnique(true);
    Long hasInv = (Long) query.executeWithArray(parameters.toArray());
    return (hasInv == null);
  } finally {
    if (query != null) {
      try {
        query.closeAll();
      } catch (Exception ignored) {
        xLogger.warn("Exception while closing query", ignored);
      }
    }
    if (useLocalPm) {
      pm.close();
    }
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:35,代码来源:InvntryDao.java

示例13: validateMaterialBatchManagementUpdate

import javax.jdo.Query; //导入方法依赖的package包/类
@Override
public boolean validateMaterialBatchManagementUpdate(Long materialId, PersistenceManager pm) throws ServiceException {
  if (materialId == null) {
    throw new ServiceException("Invalid or null materialId {0} while changing batch management on material", materialId);
  }
  boolean useLocalPm = false;
  if (pm == null) {
    pm = PMF.get().getPersistenceManager();
    useLocalPm = true;
  }

  Query query = null;
  List<String> parameters = new ArrayList<>(1);
  try {
    StringBuilder sqlQuery = new StringBuilder("SELECT 1 FROM INVNTRY I, MATERIAL M WHERE I.MID = M.MATERIALID AND M.MATERIALID = ").append(CharacterConstants.QUESTION);
    parameters.add(String.valueOf(materialId));
    sqlQuery.append(" AND I.STK > 0 LIMIT 1");
    query = pm.newQuery("javax.jdo.query.SQL", sqlQuery.toString());
    query.setUnique(true);
    Long hasInv = (Long) query.executeWithArray(parameters.toArray());
    return (hasInv == null);
  } finally {
    if (query != null) {
      try {
        query.closeAll();
      } catch (Exception ignored) {
        xLogger.warn("Exception while closing query", ignored);
      }
    }
    if (useLocalPm) {
      pm.close();
    }
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:35,代码来源:InvntryDao.java

示例14: getInvMaterialCount

import javax.jdo.Query; //导入方法依赖的package包/类
/**
 * Method to get the count of unique materials for a given domain id
 *
 * @param domainId Domain Id
 * @return Count of unique materials
 */
public Long getInvMaterialCount(Long domainId, Long tagId) throws ServiceException {
  if (domainId == null) {
    return 0L;
  }
  StringBuilder
      queryBuilder =
      new StringBuilder(
          "SELECT COUNT(DISTINCT(MID)) FROM INVNTRY WHERE KID IN (SELECT KIOSKID_OID FROM KIOSK_DOMAINS WHERE DOMAIN_ID=?)");
  Long count;
  try {
    List<String> parameters = new ArrayList<>(2);
    PersistenceManager pm = PMF.get().getPersistenceManager();
    Query query;
    if (tagId != null) {
      queryBuilder.append(" AND MID IN (SELECT MATERIALID FROM MATERIAL_TAGS WHERE ID=?)");
      parameters.add(String.valueOf(tagId));
    }
    query = pm.newQuery("javax.jdo.query.SQL", queryBuilder.toString());
    parameters.add(String.valueOf(domainId));
    query.setUnique(true);
    count = (Long) query.executeWithArray(parameters.toArray());
  } catch (Exception e) {
    xLogger.warn("Exception fetching the count", e);
    throw new ServiceException("Failed to fetch count");
  }
  return count;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:34,代码来源:InventoryManagementServiceImpl.java

示例15: getResults

import javax.jdo.Query; //导入方法依赖的package包/类
private static Object getResults(QueryParams qp, Query q) {
  Object results;
  if (qp.params != null && !qp.params.isEmpty()) {
    results = q.executeWithMap(qp.params);
  } else if (qp.listParams != null && !qp.listParams.isEmpty()) {
    results = q.executeWithArray(qp.listParams.toArray());
  } else {
    results = q.execute();
  }
  return results;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:12,代码来源:JDOUtils.java


注:本文中的javax.jdo.Query.executeWithArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。