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:jp.co.opentone.bsol.linkbinder.view.correspon.CorresponIndexPage.java

/**
 * Group??.//from  w ww  .  java 2 s  . c  o m
 * @param id ??ID
 * @return Group
 */
private String getViewGroupName(Long id) {
    if (id != null) {
        for (CorresponGroup g : groupList) {
            if (id.equals(g.getId())) {
                return g.getName();
            }
        }
        return SystemConfig.getValue(KEY_UNKNOWN_TXT);
    }
    return null;
}

From source file:jp.co.opentone.bsol.linkbinder.view.correspon.CorresponIndexPage.java

/**
 * LearningTag??.//from w w w . j  ava2  s . c o  m
 * @param id id
 * @return 
 */
private String getViewLearningTag(Long id) {
    if (id != null) {
        for (LearningTag label : learningTagList) {
            if (id.equals(label.getId())) {
                return label.getName();
            }
        }
        return SystemConfig.getValue(KEY_UNKNOWN_TXT);
    }
    return null;
}

From source file:jp.co.opentone.bsol.linkbinder.view.correspon.CorresponIndexPage.java

/**
 * LearningLabel??./*from   w  w w .  j  av  a 2  s  . c  om*/
 * @param id id
 * @return 
 */
private String getViewLearningLabel(Long id) {
    if (id != null) {
        for (LearningLabel label : learningLabelList) {
            if (id.equals(label.getId())) {
                return label.getName();
            }
        }
        return SystemConfig.getValue(KEY_UNKNOWN_TXT);
    }
    return null;
}

From source file:org.alfresco.repo.domain.node.AbstractNodeDAOImpl.java

@Override
public boolean updateNode(Long nodeId, QName nodeTypeQName, Locale nodeLocale) {
    // Get the existing node; we need to check for a change in store or UUID
    Node oldNode = getNodeNotNull(nodeId, true);
    final Long nodeTypeQNameId;
    if (nodeTypeQName == null) {
        nodeTypeQNameId = oldNode.getTypeQNameId();
    } else {//from   w ww .j  a va2  s  .  co  m
        nodeTypeQNameId = qnameDAO.getOrCreateQName(nodeTypeQName).getFirst();
    }
    final Long nodeLocaleId;
    if (nodeLocale == null) {
        nodeLocaleId = oldNode.getLocaleId();
    } else {
        nodeLocaleId = localeDAO.getOrCreateLocalePair(nodeLocale).getFirst();
    }

    // Wrap all the updates into one
    NodeUpdateEntity nodeUpdate = new NodeUpdateEntity();
    nodeUpdate.setId(nodeId);
    nodeUpdate.setStore(oldNode.getStore()); // Need node reference
    nodeUpdate.setUuid(oldNode.getUuid()); // Need node reference
    // TypeQName (if necessary)
    if (!nodeTypeQNameId.equals(oldNode.getTypeQNameId())) {
        nodeUpdate.setTypeQNameId(nodeTypeQNameId);
        nodeUpdate.setUpdateTypeQNameId(true);
    }
    // Locale (if necessary)
    if (!nodeLocaleId.equals(oldNode.getLocaleId())) {
        nodeUpdate.setLocaleId(nodeLocaleId);
        nodeUpdate.setUpdateLocaleId(true);
    }

    return updateNodeImpl(oldNode, nodeUpdate, null);
}

From source file:jp.co.opentone.bsol.linkbinder.view.correspon.CorresponIndexPage.java

/**
 * ?????.//  w  w w  .  j  a  v a  2  s.  c o m
 * @return ???
 */
public String getCustomFieldText() {
    if (condition != null) {
        Long customFieldCondition = condition.getCustomFieldNo();
        if (customFieldCondition != null && customFieldCondition > 0 && customFieldList.size() > 0) {
            for (CustomField cf : customFieldList) {
                if (customFieldCondition.equals(cf.getProjectCustomFieldId())) {
                    return cf.getLabel();
                }
            }
            return SystemConfig.getValue(KEY_UNKNOWN_TXT);
        }
    }
    return null; // ???????NULL???
}

From source file:jp.primecloud.auto.service.impl.InstanceServiceImpl.java

/**
 * {@inheritDoc}//from   ww w. j  a v a 2 s  .c  om
 */
@Override
public void updateNiftyInstance(Long instanceNo, String instanceName, String comment, String instanceType,
        Long keyPairNo) {
    // ?
    updateInstance(instanceNo, instanceName, comment);

    // ?
    if (instanceNo == null) {
        throw new AutoApplicationException("ECOMMON-000003", "instanceNo");
    }
    if (instanceType == null || instanceType.length() == 0) {
        throw new AutoApplicationException("ECOMMON-000003", "instanceType");
    }
    if (keyPairNo == null) {
        throw new AutoApplicationException("ECOMMON-000003", "keyPairNo");
    }

    // ??
    Instance instance = instanceDao.read(instanceNo);
    if (instance == null) {
        throw new AutoApplicationException("ESERVICE-000403", instanceNo);
    }

    // ??
    Platform platform = platformDao.read(instance.getPlatformNo());
    if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platform.getPlatformType()) == false) {
        throw new AutoApplicationException("ESERVICE-000410", instance.getInstanceName());
    }

    // ??????
    NiftyInstance niftyInstance = niftyInstanceDao.read(instanceNo);
    if (InstanceStatus.fromStatus(instance.getStatus()) != InstanceStatus.STOPPED) {
        // ??????????????????
        if (!StringUtils.equals(niftyInstance.getInstanceType(), instanceType)
                || !keyPairNo.equals(niftyInstance.getKeyPairNo())) {
            throw new AutoApplicationException("ESERVICE-000407", instance.getInstanceName());
        }
    }

    // ?????????
    if (StringUtils.isNotEmpty(niftyInstance.getInstanceId())) {
        // ???????
        if (!niftyInstance.getKeyPairNo().equals(keyPairNo)) {
            // ??????
            throw new AutoApplicationException("ESERVICE-000411", instance.getInstanceName());
        }
    }

    // Nifty?
    niftyInstance.setInstanceType(instanceType);
    niftyInstance.setKeyPairNo(keyPairNo);
    niftyInstanceDao.update(niftyInstance);

    // 
    Farm farm = farmDao.read(instance.getFarmNo());
    eventLogger.log(EventLogLevel.INFO, farm.getFarmNo(), farm.getFarmName(), null, null, instanceNo,
            instanceName, "InstanceUpdate", instanceType, instance.getPlatformNo(), null);
}

From source file:jp.primecloud.auto.service.impl.InstanceServiceImpl.java

protected void updateInstance(Long instanceNo, String instanceName, String comment) {
    // ?//from  w w  w. ja v  a2  s .  co m
    if (instanceNo == null) {
        throw new AutoApplicationException("ECOMMON-000003", "instanceNo");
    }
    if (instanceName == null || instanceName.length() == 0) {
        throw new AutoApplicationException("ECOMMON-000003", "instanceName");
    }

    // ??
    if (!Pattern.matches("^[0-9a-z]|[0-9a-z][0-9a-z-]*[0-9a-z]$", instanceName)) {
        throw new AutoApplicationException("ECOMMON-000012", "instanceName");
    }

    // TODO: ??

    // ??
    Instance instance = instanceDao.read(instanceNo);
    if (instance == null) {
        // ?????
        throw new AutoApplicationException("ESERVICE-000403", instanceNo);
    }

    // ??????
    if (InstanceStatus.fromStatus(instance.getStatus()) != InstanceStatus.STOPPED) {
        // ??????????????????
        if (!StringUtils.equals(instance.getInstanceName(), instanceName)) {
            throw new AutoApplicationException("ESERVICE-000407", instance.getInstanceName());
        }
    }

    // ????
    if (!StringUtils.equals(instance.getInstanceName(), instanceName)) {
        // ?????
        Instance checkInstance = instanceDao.readByFarmNoAndInstanceName(instance.getFarmNo(), instanceName);
        if (checkInstance != null && !instanceNo.equals(checkInstance.getInstanceNo())) {
            // ???????
            throw new AutoApplicationException("ESERVICE-000401", instanceName);
        }

        // ?????
        LoadBalancer checkLoadBalancer = loadBalancerDao.readByFarmNoAndLoadBalancerName(instance.getFarmNo(),
                instanceName);
        if (checkLoadBalancer != null) {
            // ????????
            throw new AutoApplicationException("ESERVICE-000417", instanceName);
        }
    }

    // ?
    Farm farm = farmDao.read(instance.getFarmNo());

    instance.setInstanceName(instanceName);
    instance.setComment(comment);
    instance.setFqdn(instanceName + "." + farm.getDomainName());
    instanceDao.update(instance);
}

From source file:com.selfsoft.business.service.impl.TbBusinessBalanceServiceImpl.java

public List<StatisticsTbFixBusinessVo> statisticsPayed(TbBusinessBalance tbBusinessBalance, Long type) {

    List<TbBusinessBalance> tbBusinessBalanceList = null;

    List<StatisticsTbFixBusinessVo> statisticsTbFixBusinessVoList = new ArrayList<StatisticsTbFixBusinessVo>();

    if (type.equals(1L)) {

        tbBusinessBalanceList = this.findTbBusinessBalanceNoOweGroup(tbBusinessBalance);

    } else {//from  w ww .j  a v a2s.  c  o  m
        tbBusinessBalanceList = this.findTbBusinessBalanceOweGroup(tbBusinessBalance);
    }

    if (null != tbBusinessBalanceList && tbBusinessBalanceList.size() > 0) {

        BigDecimal d1 = new BigDecimal("0.00");

        BigDecimal d2 = new BigDecimal("0.00");

        BigDecimal d1_owe = new BigDecimal("0.00");

        BigDecimal d2_owe = new BigDecimal("0.00");

        StatisticsTbFixBusinessVo statisticsTbFixBusinessVo1 = new StatisticsTbFixBusinessVo();

        StatisticsTbFixBusinessVo statisticsTbFixBusinessVo2 = new StatisticsTbFixBusinessVo();

        int i1 = 0;

        int i2 = 0;

        for (TbBusinessBalance t : tbBusinessBalanceList) {

            if (null != t.getTbFixEntrust()) {

                d1 = d1.add(new BigDecimal(String.valueOf(t.getBalanceTotalAll())));

                d1_owe = d1_owe.add(new BigDecimal(String.valueOf(t.getOweAmount())));

                i1++;
            } else {

                d2 = d2.add(new BigDecimal(String.valueOf(t.getBalanceTotalAll())));

                d2_owe = d2_owe.add(new BigDecimal(String.valueOf(t.getOweAmount())));

                i2++;
            }

        }

        statisticsTbFixBusinessVo1.setBalanceItemName("?");

        statisticsTbFixBusinessVo1.setCountNum(i1);

        statisticsTbFixBusinessVo1.setBalanceItemAmount(d1.doubleValue());

        statisticsTbFixBusinessVo1.setBalanceItemOweAmount(d1_owe.doubleValue());

        statisticsTbFixBusinessVo2.setBalanceItemName("?");

        statisticsTbFixBusinessVo2.setCountNum(i2);

        statisticsTbFixBusinessVo2.setBalanceItemAmount(d2.doubleValue());

        statisticsTbFixBusinessVoList.add(statisticsTbFixBusinessVo1);

        statisticsTbFixBusinessVoList.add(statisticsTbFixBusinessVo2);

        statisticsTbFixBusinessVo2.setBalanceItemOweAmount(d2_owe.doubleValue());
    }

    return statisticsTbFixBusinessVoList;
}

From source file:com.ah.be.admin.restoredb.RestoreAdmin.java

private static void updateDefaultUserGroupInstancePermission(HmUserGroup userGroup) {
    HmPermission mapPermission = new HmPermission();
    if (userGroup.isAdministrator() || userGroup.getGroupName().equalsIgnoreCase(HmUserGroup.CONFIG)
            || userGroup.getGroupName().equalsIgnoreCase(HmUserGroup.PLANNING)) {
        mapPermission.addOperation(HmPermission.OPERATION_READ);
        mapPermission.addOperation(HmPermission.OPERATION_WRITE);
    } else if (userGroup.getGroupName().equalsIgnoreCase(HmUserGroup.MONITOR)) {
        mapPermission.addOperation(HmPermission.OPERATION_READ);
    } else {//w w  w  .  j  av  a2s .  c o  m
        return;
    }

    List<?> mapNodeList = mapContainerNodeMap.get(userGroup.getOwner());
    if (mapNodeList == null) {
        mapNodeList = QueryUtil.executeQuery("select id from " + MapContainerNode.class.getSimpleName(), null,
                null, userGroup.getOwner().getId());
        mapContainerNodeMap.put(userGroup.getOwner(), mapNodeList);
    }

    for (Object object : mapNodeList) {
        Long id = (Long) object;
        if (id.equals(BoMgmt.getMapMgmt().getRootMapId())) {
            continue;
        }
        userGroup.getInstancePermissions().put(id, mapPermission);
    }

    // try {
    // // update Monitor group instance permission;
    // HmUserGroup group = QueryUtil.findBoByAttribute(HmUserGroup.class,
    // "groupName", HmUserGroup.MONITOR, AhRestoreDBTools.HM_RESTORE_DOMAIN.getId());
    // if (null != group) {
    // HmPermission mapPermission = new HmPermission();
    // mapPermission.addOperation(HmPermission.OPERATION_READ);
    // for (Object object : boIds) {
    // Long id = (Long) object;
    // if (id.equals(MapMgmtImpl.getInstance().getRootMapId())) {
    // continue;
    // }
    // group.getInstancePermissions().put(id, mapPermission);
    // }
    // QueryUtil.updateBo(group);
    // }
    // } catch (Exception e) {
    // BeLogTools.restoreLog(BeLogTools.ERROR, "update default monitor group error", e);
    // }
    // try {
    // // update Configuration & Monitor group instance permission;
    // HmUserGroup group = QueryUtil.findBoByAttribute(HmUserGroup.class,
    // "groupName", HmUserGroup.CONFIG, AhRestoreDBTools.HM_RESTORE_DOMAIN.getId());
    // if (null != group) {
    // HmPermission mapPermission = new HmPermission();
    // mapPermission.addOperation(HmPermission.OPERATION_READ);
    // mapPermission.addOperation(HmPermission.OPERATION_WRITE);
    // for (Object object : boIds) {
    // Long id = (Long) object;
    // if (id.equals(MapMgmtImpl.getInstance().getRootMapId())) {
    // continue;
    // }
    // group.getInstancePermissions().put(id, mapPermission);
    // }
    // QueryUtil.updateBo(group);
    // }
    // } catch (Exception e) {
    // BeLogTools.restoreLog(BeLogTools.ERROR, "update default config group error", e);
    // }
    //
    // // update super user instance permission
    // try {
    // HmUserGroup group = QueryUtil.findBoByAttribute(HmUserGroup.class,
    // "groupName", HmUserGroup.ADMINISTRATOR, AhRestoreDBTools.HM_RESTORE_DOMAIN
    // .getId());
    // if (null != group) {
    // HmPermission mapPermission = new HmPermission();
    // mapPermission.addOperation(HmPermission.OPERATION_READ);
    // mapPermission.addOperation(HmPermission.OPERATION_WRITE);
    // for (Object object : boIds) {
    // Long id = (Long) object;
    // if (id.equals(MapMgmtImpl.getInstance().getRootMapId())) {
    // continue;
    // }
    // group.getInstancePermissions().put(id, mapPermission);
    // }
    // QueryUtil.updateBo(group);
    // }
    // } catch (Exception e) {
    // BeLogTools.restoreLog(BeLogTools.ERROR, "update default super user group error", e);
    // }
}