Example usage for java.lang Long equals

List of usage examples for java.lang Long equals

Introduction

In this page you can find the example usage for java.lang Long equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:org.sakaiproject.lessonbuildertool.model.SimplePageToolDaoImpl.java

public SimplePageLogEntry getLogEntry(String userId, long itemId, Long studentPageId) {
    if (studentPageId.equals(-1L))
        studentPageId = null;//  w  w  w  .  j av  a2 s.  co m

    DetachedCriteria d = DetachedCriteria.forClass(SimplePageLogEntry.class)
            .add(Restrictions.eq("userId", userId)).add(Restrictions.eq("itemId", itemId));

    if (studentPageId != null) {
        d.add(Restrictions.eq("studentPageId", studentPageId));
    } else {
        d.add(Restrictions.isNull("studentPageId"));
    }

    List l = getHibernateTemplate().findByCriteria(d);

    if (l != null && l.size() > 0) {
        return (SimplePageLogEntry) l.get(0);
    } else {
        return null;
    }
}

From source file:com.evolveum.midpoint.prism.PrismContainer.java

private PrismContainerValue<C> findValue(IdItemPathSegment idSegment) {
    Long id = null;
    if (idSegment != null) {
        id = idSegment.getId();//from w w w .j a  v a 2 s .  c o  m
    }
    // Otherwise descent to the correct value
    if (id == null) {
        if (canAssumeSingleValue()) {
            return getValue();
        } else {
            throw new IllegalArgumentException(
                    "Attempt to get segment without an ID from a multi-valued container " + getElementName());
        }
    } else {
        for (PrismContainerValue<C> pval : getValues()) {
            if (id.equals(pval.getId())) {
                return pval;
            }
        }
        return null;
    }
}

From source file:com.bigdata.dastor.db.ColumnFamilyStore.java

public double getRecentBloomFilterFalseRatio() {
    Long falseCount = 0L;
    Long trueCount = 0L;/*from   w  w w  .ja  v  a2 s  .c o  m*/
    for (SSTableReader sstable : getSSTables()) {
        falseCount += sstable.getRecentBloomFilterFalsePositiveCount();
        trueCount += sstable.getRecentBloomFilterTruePositiveCount();
    }
    if (falseCount.equals(0L) && trueCount.equals(0L))
        return 0d;
    return falseCount.doubleValue() / (trueCount.doubleValue() + falseCount.doubleValue());
}

From source file:com.selfsoft.baseinformation.dao.impl.TbPartInfoDaoImpl.java

/**
 * ?????? -- ???/*w  ww . j  a  v  a  2s .co  m*/
 */
public List getPartInfoReFlowDetailStat(String partInfoIds, Long elementType,
        TbPartInfoReFlowStatVo tbPartInfoReFlowStatVo) {
    StringBuilder sql = new StringBuilder();
    if (elementType == null || elementType.equals(20L)) {
        sql.append(
                "select m.stock_out_date , 20 tp ,m.part_quantity , m.price ,part_quantity*m.price , c.customer_Name , null , ci.id,ci.license_Code,ci.chassis_Code");
        sql.append(" from TB_MAINTAIN_PART_CONTENT m  ,TB_FIX_ENTRUST fe , tb_customer c , TB_CAR_INFO ci");
        sql.append(
                " where fe.CUSTOMER_ID = c.id and fe.id = m.entrust_id and m.is_confirm not in (8000) and fe.CAR_INFO_ID = ci.id");
        if (StringUtils.isNotBlank(partInfoIds))
            sql.append(" and m.part_id in (").append(partInfoIds + ")");
        if (tbPartInfoReFlowStatVo != null) {
            if (StringUtils.isNotBlank(tbPartInfoReFlowStatVo.getBeginDate())) {
                sql.append(" and m.stock_out_date >= '").append(tbPartInfoReFlowStatVo.getBeginDate())
                        .append("'");
            }
            if (StringUtils.isNotBlank(tbPartInfoReFlowStatVo.getEndDate())) {
                sql.append(" and m.stock_out_date <= '").append(tbPartInfoReFlowStatVo.getEndDate())
                        .append("'");
            }
            if (StringUtils.isNotBlank(tbPartInfoReFlowStatVo.getLicenseCode())) {
                sql.append(" and ci.license_Code like '%").append(tbPartInfoReFlowStatVo.getLicenseCode())
                        .append("%'");
            }
        }
        sql.append(" union all");
    }
    sql.append(
            " select si.arrive_date,si.in_type tp,sid.quantity,sid.price,sid.quantity*sid.price , c.customer_Name , u.user_real_name,null,null,null");
    sql.append(
            " from  tm_stockin_detail sid ,tm_user u , tm_stock_in si left join tb_customer c on c.id = si.supplier_id ");
    sql.append(" where si.id = sid.stock_id and u.id = si.user_id and si.is_confirm not in (8000) ");
    if (StringUtils.isNotBlank(partInfoIds))
        sql.append(" and sid.partinfo_id in (").append(partInfoIds + ")");
    if (elementType != null)
        sql.append(" and si.in_type = ").append(elementType);
    if (tbPartInfoReFlowStatVo != null) {
        if (StringUtils.isNotBlank(tbPartInfoReFlowStatVo.getBeginDate())) {
            sql.append(" and si.arrive_date >= '").append(tbPartInfoReFlowStatVo.getBeginDate()).append("'");
        }
        if (StringUtils.isNotBlank(tbPartInfoReFlowStatVo.getEndDate())) {
            sql.append(" and si.arrive_date <= '").append(tbPartInfoReFlowStatVo.getEndDate()).append("'");
        }
    }
    sql.append(" union all");
    sql.append(
            " select so.stock_out_date , so.out_type , sod.quantity ,sod.price ,sod.quantity*sod.price , c.customer_Name , u.user_real_name,null,null,null");
    sql.append(
            " from tm_stockout_detail sod , tm_user u , tm_stock_out so left join  tb_customer c on c.id = so.customer_bill ");
    sql.append(" where so.id = sod.stockout_id and  u.id = so.user_id and so.is_confirm not in (8000) ");
    if (StringUtils.isNotBlank(partInfoIds))
        sql.append(" and sod.partinfo_id in (").append(partInfoIds + ")");
    if (elementType != null)
        sql.append(" and so.out_type = ").append(elementType);
    if (tbPartInfoReFlowStatVo != null) {
        if (StringUtils.isNotBlank(tbPartInfoReFlowStatVo.getBeginDate())) {
            sql.append(" and so.stock_out_date >= '").append(tbPartInfoReFlowStatVo.getBeginDate()).append("'");
        }
        if (StringUtils.isNotBlank(tbPartInfoReFlowStatVo.getEndDate())) {
            sql.append(" and so.stock_out_date <= '").append(tbPartInfoReFlowStatVo.getEndDate()).append("'");
        }
    }
    List result = this.findByOriginSql(sql.toString(), null);

    return result;
}

From source file:com.selfsoft.business.dao.impl.TbMaintainPartContentDaoImpl.java

public List<TbMaintianVo> getTbMaintianDetailVos(String maintainCode, Long entrustId, Long balanceId,
        Long balanceType) {

    StringBuilder hql = new StringBuilder();
    hql.append("select new com.selfsoft.business.vo.TbMaintianVo(t.partId,t.partQuantity,t.price,");
    hql.append(/*from  ww w  .  j  av  a 2  s.c  om*/
            "pi.partCode,pi.partName,pi.tmStoreHouse.houseCode,pi.tmStoreHouse.houseName,pi.tmUnit.unitName,");
    hql.append("t.cliamPartPersonId,u.userRealName,t.maintainCode,t.isFree,fe.tbCustomer.customerName,");
    hql.append(
            "fe.tbCarInfo.licenseCode,fe.tmFixType.fixType,fe.fixDate,t.balanceId,fe.entrustCode,pi.storeLocation,t.totalPrice,t.zl,t.xmlx,t.projectType,t.isPrint,t.id)");
    hql.append(" from TbMaintainPartContent t , TbPartInfo pi , TmUser u,TbFixEntrust fe");
    hql.append(" where t.partId = pi.id and t.cliamPartPersonId = u.id and t.entrustId = fe.id");
    if (StringUtils.isNotBlank(maintainCode))
        hql.append(" and t.maintainCode = '").append(maintainCode).append("'");
    if (entrustId != null)
        hql.append(" and t.entrustId = " + entrustId);
    if (balanceId != null)
        hql.append(" and t.balanceId = " + balanceId);
    //else 

    if (balanceType != null) {
        if (balanceType.equals(Constants.BALANCE_ALL)) {
            // ???
        }
        if (balanceType.equals(Constants.BALANCE_ISNULL)) {
            //
            hql.append(" and t.balanceId is null");
        }
        if (balanceType.equals(Constants.BALANCE_NOTNULL)) {
            //
            hql.append(" and t.balanceId is not null");
        }
    }

    hql.append(" order by t.id ");
    List<TbMaintianVo> result = this.getHibernateTemplate().find(hql.toString());
    return result;

    /*StringBuilder hql = new StringBuilder();
    hql.append("select m.part_id,m.part_Quantity,m.price,pi.part_Code,pi.part_Name,sh.house_Code,sh.house_Name,un.unit_name,");
    hql.append("m.cliam_Part_Person_Id,u.user_Real_Name,m.maintain_Code,m.is_Free,c.customer_name,");
    hql.append("ci.license_Code,ft.fix_type,fe.fix_date,m.balance_Id,fe.entrust_Code,pi.store_Location,");
    hql.append("m.total_Price,m.zl,m.xmlx,m.project_Type,m.is_Print,m.id ");
    hql.append("from tb_maintain_part_content m , tb_part_info pi ,tm_Store_House sh , tm_user u ,tb_fix_entrust fe,");
    hql.append("tm_unit un,tb_car_info ci,tb_customer c,tm_fix_type ft ");
    hql.append("where m.part_id = pi.id and m.cliam_Part_Person_Id=u.id and m.entrust_id=fe.id and fe.fix_type_id = ft.id ");
    hql.append("and pi.store_house_id=sh.id and pi.unit_id = un.id and ci.id = fe.car_info_id and c.id = fe.customer_id ");
            
    if(StringUtils.isNotBlank(maintainCode))
       hql.append(" and m.maintain_Code = '").append(maintainCode).append("'");
    if(entrustId != null)
       hql.append(" and m.entrust_Id = "+ entrustId);
    if(balanceId != null)
       hql.append(" and m.balance_Id = "+ balanceId);
            
    if(balanceType != null){
       if(balanceType.equals(Constants.BALANCE_ALL)){
    // ???
       }
       if(balanceType.equals(Constants.BALANCE_ISNULL)){
    //
    hql.append(" and m.balance_Id is null");
       }
       if(balanceType.equals(Constants.BALANCE_NOTNULL)){
    //
    hql.append(" and m.balance_Id is not null");
       }
    }
            
    hql.append(" order by m.id ");
    List<TbMaintianVo> result = this.findTbMaintainBySql(hql.toString());
    return result;*/

}

From source file:com.selfsoft.business.dao.impl.TbMaintainPartContentDaoImpl.java

public List<TbMaintianVo> getTbMaintianDetailVosByPrint(String maintainCode, Long entrustId, Long balanceId,
        Long balanceType) {

    StringBuilder hql = new StringBuilder();
    hql.append("select new com.selfsoft.business.vo.TbMaintianVo(t.partId,t.partQuantity,t.price,");
    hql.append(// ww w. j av a 2s  . co  m
            "pi.partCode,pi.partName,pi.tmStoreHouse.houseCode,pi.tmStoreHouse.houseName,pi.tmUnit.unitName,");
    hql.append("t.cliamPartPersonId,u.userRealName,t.maintainCode,t.isFree,fe.tbCustomer.customerName,");
    hql.append(
            "fe.tbCarInfo.licenseCode,fe.tmFixType.fixType,fe.fixDate,t.balanceId,fe.entrustCode,pi.storeLocation,t.totalPrice,t.zl,t.xmlx,t.projectType,t.isPrint,t.id)");
    hql.append(" from TbMaintainPartContent t , TbPartInfo pi , TmUser u,TbFixEntrust fe");
    hql.append(
            " where t.partId = pi.id and t.cliamPartPersonId = u.id and t.entrustId = fe.id and t.isPrint='Y'");
    if (StringUtils.isNotBlank(maintainCode))
        hql.append(" and t.maintainCode = '").append(maintainCode).append("'");
    if (entrustId != null)
        hql.append(" and t.entrustId = " + entrustId);
    if (balanceId != null)
        hql.append(" and t.balanceId = " + balanceId);
    //else 

    if (balanceType != null) {
        if (balanceType.equals(Constants.BALANCE_ALL)) {
            // ???
        }
        if (balanceType.equals(Constants.BALANCE_ISNULL)) {
            //
            hql.append(" and t.balanceId is null");
        }
        if (balanceType.equals(Constants.BALANCE_NOTNULL)) {
            //
            hql.append(" and t.balanceId is not null");
        }
    }

    hql.append(" order by t.id ");
    List<TbMaintianVo> result = this.getHibernateTemplate().find(hql.toString());
    return result;
}

From source file:ome.logic.AdminImpl.java

@RolesAllowed("user")
@Transactional(readOnly = false)//from ww  w .j  a v a2s  . c o  m
public void updateExperimenter(@NotNull final Experimenter experimenter) {

    try {
        adminOrPiOfUser(experimenter);
        String name = experimenter.getOmeName();
        copyAndSaveExperimenter(experimenter);
        getBeanHelper().getLogger().info("Updated user info for " + name);
    } catch (SecurityViolation sv) {
        final Long currentID = getEventContext().getCurrentUserId();
        final Long experimenterID = experimenter.getId();

        // If we're not an admin, allow for the possibility
        // of delegating to updateSelf.
        if (currentID.equals(experimenterID)) {
            updateSelf(experimenter);
        } else {
            // But throw if that's not the case.
            throw sv;
        }
    }
}

From source file:controllers.core.PortfolioEntryDeliveryController.java

/**
 * Form to manage a deliverable.//from   w  ww .j a  v  a 2s  .  c o  m
 * 
 * @param id
 *            the portfolio entry id
 * @param deliverableId
 *            the deliverable id (0 for create case)
 */
@With(CheckPortfolioEntryExists.class)
@Dynamic(IMafConstants.PORTFOLIO_ENTRY_EDIT_DYNAMIC_PERMISSION)
public Result manageDeliverable(Long id, Long deliverableId) {

    // get the portfolioEntry
    PortfolioEntry portfolioEntry = PortfolioEntryDao.getPEById(id);

    // initiate the form with the template
    Form<DeliverableFormData> deliverableForm = deliverableFormTemplate;

    boolean isOwner = false;

    if (!deliverableId.equals(Long.valueOf(0))) { // edit

        PortfolioEntryDeliverable portfolioEntryDeliverable = DeliverableDAO
                .getPortfolioEntryDeliverableById(id, deliverableId);
        Deliverable deliverable = portfolioEntryDeliverable.getDeliverable();

        deliverableForm = deliverableFormTemplate
                .fill(new DeliverableFormData(deliverable, portfolioEntryDeliverable));

        isOwner = portfolioEntryDeliverable.type.equals(PortfolioEntryDeliverable.Type.OWNER);

        // add the custom attributes values
        this.getCustomAttributeManagerService().fillWithValues(deliverableForm, Deliverable.class,
                deliverableId);

    } else { // create

        // add the custom attributes default values
        this.getCustomAttributeManagerService().fillWithValues(deliverableForm, Deliverable.class, null);

        isOwner = true;
    }

    return ok(views.html.core.portfolioentrydelivery.deliverable_manage.render(portfolioEntry, deliverableForm,
            isOwner));

}

From source file:core.dao.PagesDAOHibernate.java

@Override
@Transactional(readOnly = true)//www.j  a v  a2  s. c o m
public List<T> getAllParentsRecursive(Long id, String[] propertyNames, String[] propertyAliases) {
    if (id == null || propertyAliases == null || propertyNames == null
            || propertyNames.length != propertyAliases.length)
        return null;
    //forming hql----------------------------------------------------
    StringBuilder baseHQL = new StringBuilder();
    HQLPartGenerator.getValuesListWithAliases(propertyNames, propertyAliases, baseHQL);
    baseHQL.append(" FROM ");
    baseHQL.append(this.entityName);
    baseHQL.append(" WHERE ");
    baseHQL.append("id = :id");
    String hql = baseHQL.toString();
    baseHQL = null;
    //---------------------------------------------------------------
    List<T> rez = new ArrayList<T>();
    Session sess = this.getSessionFactory().getCurrentSession();
    AliasToBeanResultTransformer trans = new AliasToBeanResultTransformer(persistentClass);

    boolean completed = false;
    Long cur_id = id;
    T p = null;
    //TODO: check recursion
    while (!completed) {
        p = (T) sess.createQuery(hql).setParameter("id", cur_id).setResultTransformer(trans).uniqueResult();
        if (p == null)
            return rez;
        rez.add(p);
        cur_id = p.getId_pages();
        if (cur_id == null || id.equals(cur_id))
            completed = true;
    }
    return rez;
}

From source file:ome.adapters.pojos.itests.PojosServiceTest.java

@Test
public void testAndSaveSomtheingWithParents() throws Exception {
    saveImage();//  ww  w.  j a va 2s . c o m
    ds = img.linkedDatasetIterator().next();
    Long id = ds.getId();

    // another copy
    Image img2 = (Image) iQuery.findAllByQuery(
            "select i from Image i " + "left outer join fetch i.datasetLinks " + "where i.id = :id",
            new Parameters().addId(img.getId())).get(0);
    assertTrue("It better have a dataset link too", img2.sizeOfDatasetLinks() > 0);
    Dataset ds2 = img2.linkedDatasetIterator().next();
    assertTrue("And the ids have to be the same", id.equals(ds2.getId()));
}