Example usage for java.math BigInteger intValue

List of usage examples for java.math BigInteger intValue

Introduction

In this page you can find the example usage for java.math BigInteger intValue.

Prototype

public int intValue() 

Source Link

Document

Converts this BigInteger to an int .

Usage

From source file:eu.europa.ec.markt.tlmanager.core.validation.Validation.java

/**
 * The SequenceNumber must be an integer and equal or greater than 1.
 *//*from   w  w  w  . j av a2s .  c  om*/
private void checkRuleSequenceNumberFormat() {
    BigInteger tslSequenceNumber = schemeInformation.getTSLSequenceNumber();
    if (tslSequenceNumber.intValue() < 1) {
        logger.error(QNames._TSLSequenceNumber + uiKeys.getString("Validation.rule.sequenceNumberFormat"), tsl);
    }
}

From source file:service.actions.OrderSearch.java

private List<OrderListData> transformBySqlMap(List<Map> mapList) {
    Map<Long, OrderListData> dataMap = new LinkedHashMap();
    int n = 1;/*from   w  w w.j  a v  a 2s. c o m*/
    for (Map map : mapList) {
        Long orderId = getLong(map.get("order_id"));
        String subject = (String) map.get("subject");
        Date orderDate = (Date) map.get("order_date");
        Date deadlineDate = (Date) map.get("deadline_date");
        Date realDate = (Date) map.get("real_date");
        String clientFio = (String) map.get("client_fio");
        String clientPhone = (String) map.get("client_phone");
        String clientEmail = (String) map.get("client_email");
        String city = (String) map.get("city");
        Double cost = (Double) map.get("cost");
        Double authorSalary = (Double) map.get("author_salary");
        Boolean firstFlag = (Boolean) map.get("first_flag");
        Boolean secondFlag = (Boolean) map.get("second_flag");
        Boolean statusOfUser = (Boolean) map.get("status_of_user");
        String statusStr = (String) map.get("status");
        Long otherOrderId = getLong(map.get("other_order_id"));
        Long branchId = getLong(map.get("branch_id"));
        String branchName = (String) map.get("branch_name");
        Long directionId = getLong(map.get("direction_id"));
        String directionName = (String) map.get("direction_name");
        Long orderTypeId = getLong(map.get("order_type_id"));
        String orderTypeName = (String) map.get("order_type_name");
        Long authorId = getLong(map.get("author_id"));
        String authorLogin = (String) map.get("author_login");
        BigInteger bi = (BigInteger) map.get("count_mess");
        Integer countMess = (bi != null ? bi.intValue() : null);
        String abbrevation = (String) map.get("abbrevation");
        String comment = (String) map.get("comment");
        String oldId = (String) map.get("old_id");
        String authorComment = (String) map.get("author_comment");
        Date readyDate = (Date) map.get("ready_date");
        Long otherOrderBranchId = getLong(map.get("other_order_branch_id"));
        String otherOrderOldId = (String) map.get("other_order_old_id");
        String authorName = (String) map.get("author_name");
        String authorSurname = (String) map.get("author_surname");
        Long authorSalaryId = getLong(map.get("author_salary_id"));
        Double authorSalaryCost = (Double) map.get("author_salary_cost");
        Double paymentSum = (Double) map.get("payment_sum");
        String commentToAuthorSalary = (String) map.get("comment_to_author_salary");
        BigInteger countAllAuthorMess = (BigInteger) map.get("count_author_mess_all");
        BigInteger countAllAdminMess = (BigInteger) map.get("count_admin_mess_all");
        BigInteger countNotReadyAdminMess = (BigInteger) map.get("count_admin_mess_not_ready");
        Boolean unloadedInShop = (Boolean) map.get("unloaded_in_shop");
        Long parentOrderId = getLong(map.get("parent_order_id"));
        Boolean selected = (Boolean) map.get("selected");
        Boolean childSelected = (Boolean) map.get("child_selected");
        BigInteger countAllDelegateMess = (BigInteger) map.get("delegate_mess_all");
        BigInteger countNotReadyDelegateMess = (BigInteger) map.get("delegate_mess_not_ready");

        if (!dataMap.containsKey(orderId)) {

            Order order = new Order();
            order.setOrderId(orderId);
            order.setCity(city);
            order.setSubject(subject);
            order.setOrderDate(orderDate);
            order.setDeadlineDate(deadlineDate);
            order.setRealDate(realDate);
            order.setClientFio(clientFio);
            order.setClientPhone(clientPhone);
            order.setClientEmail(clientEmail);
            order.setCost(cost);
            order.setAuthor_salary(authorSalary);
            order.setFirstFlag(firstFlag);
            order.setSecondFlag(secondFlag);
            order.setComment(comment);
            order.setAuthorComment(authorComment);
            order.setReadyDate(readyDate);
            order.setCommentToAuthorSalary(commentToAuthorSalary);
            order.setUnloadedInShop(unloadedInShop);
            order.setSelected(selected);
            order.setChildSelected(childSelected);
            order.setStatusOfUser(statusOfUser);
            order.setOldId(oldId);
            if (parentOrderId != null) {
                Order parentOrder = new Order();
                parentOrder.setOrderId(parentOrderId);
                order.setParentOrder(parentOrder);
            }

            OrderStatus orderStatus = null;
            try {
                orderStatus = OrderStatus.valueOf(statusStr);
            } catch (Exception e) {
                log.warn(StringAdapter.getStackExeption(e));
            }
            order.setStatus(orderStatus);

            entity.Branch branch = new entity.Branch();
            branch.setBranchId(branchId);
            branch.setName(branchName);
            branch.setAbbrevation(abbrevation);
            order.setBranch(branch);

            entity.OrderType orderType = new entity.OrderType();
            orderType.setOrderTypeId(orderTypeId);
            orderType.setName(orderTypeName);
            order.setOrderType(orderType);

            Author author = null;
            if (authorId != null) {
                author = new Author();
                author.setUserId(authorId);
                author.setLogin(authorLogin);
                author.setName(authorName);
                author.setSurname(authorSurname);
                order.setAuthor(author);
            }

            OrderListData data = new OrderListData();
            data.order = order;

            data.countNotReadyAuthorMessages = 0;
            if (countMess != null) {
                data.countNotReadyAuthorMessages += countMess;
            }
            if (countNotReadyDelegateMess != null) {
                data.countNotReadyAuthorMessages += countNotReadyDelegateMess.intValue();
            }

            if (paymentSum != null) {
                data.paymentSum = paymentSum;
            }
            data.countAllAuthorMesages = 0;
            if (countAllAuthorMess != null) {
                data.countAllAuthorMesages += countAllAuthorMess.intValue();
            }
            if (countAllDelegateMess != null) {
                data.countAllAuthorMesages += countAllDelegateMess.intValue();
            }
            if (countAllAdminMess != null) {
                data.countAllAdminMessages = countAllAdminMess.intValue();
            }
            if (countNotReadyAdminMess != null) {
                data.countNotReadyAdminMessages = countNotReadyAdminMess.intValue();
            }

            dataMap.put(orderId, data);
        }

        OrderListData data = dataMap.get(orderId);

        if (authorSalaryId != null) {
            AuthorSalary authorSalaryObj = new AuthorSalary();
            authorSalaryObj.setAuthorSalaryId(authorSalaryId);
            authorSalaryObj.setCost(authorSalaryCost);
            if (!containsAuthorSalary(data.order, authorSalaryObj)) {
                data.order.addAuthorSalary(authorSalaryObj);
            }
        }

        if (otherOrderId != null) {
            Order otherOrder = new Order();
            otherOrder.setOrderId(otherOrderId);
            Branch otherOrderBranch = new Branch();
            otherOrderBranch.setBranchId(otherOrderBranchId);
            otherOrder.setBranch(otherOrderBranch);
            otherOrder.setOldId(otherOrderOldId);
            if (!containsOtherOrder(data, otherOrder)) {
                data.otherOrders.add(otherOrder);
            }
        }

        if (directionId != null) {
            Direction dir = new Direction();
            dir.setDirectionId(directionId);
            dir.setName(directionName);
            if (!containsDirection(data.order, dir)) {
                data.order.addDirection(dir);
            }
        }
        n++;
    }
    List<OrderListData> dataList = new ArrayList();
    dataList.addAll(dataMap.values());
    setOrderViews(dataList);
    setInfoAboutReject(dataList);
    return dataList;
}

From source file:com.openkm.cmis.CmisRepository.java

/**
 * CMIS getDescendants./* www  .ja v  a 2 s .c o m*/
 */
public List<ObjectInFolderContainer> getDescendants(CallContext context, String folderId, BigInteger depth,
        String filter, Boolean includeAllowableActions, Boolean includePathSegment,
        ObjectInfoHandler objectInfos, boolean foldersOnly) {
    log.debug("getDescendants or getFolderTree");

    // check depth
    int d = (depth == null ? 2 : depth.intValue());
    if (d == 0) {
        throw new CmisInvalidArgumentException("Depth must not be 0!");
    }
    if (d < -1) {
        d = -1;
    }

    // split filter
    Set<String> filterCollection = splitFilter(filter);

    // set defaults if values not set
    boolean iaa = (includeAllowableActions == null ? false : includeAllowableActions.booleanValue());
    boolean ips = (includePathSegment == null ? false : includePathSegment.booleanValue());

    try {
        if (!OKMFolder.getInstance().isValid(null, folderId)) {
            throw new CmisObjectNotFoundException("Not a folder!");
        }

        // get the folder
        Folder fld = OKMFolder.getInstance().getProperties(null, folderId);

        // set object info of the the folder
        if (context.isObjectInfoRequired()) {
            compileObjectType(context, fld, null, false, false, objectInfos);
        }

        // get the tree
        List<ObjectInFolderContainer> result = new ArrayList<ObjectInFolderContainer>();
        gatherDescendants(context, fld, result, foldersOnly, d, filterCollection, iaa, ips, objectInfos);

        return result;
    } catch (PathNotFoundException e) {
        throw new CmisObjectNotFoundException(e.getMessage(), e);
    } catch (RepositoryException e) {
        throw new CmisStorageException(e.getMessage(), e);
    } catch (DatabaseException e) {
        throw new CmisStorageException(e.getMessage(), e);
    }
}

From source file:eu.europa.ec.markt.tlmanager.core.validation.Validation.java

/**
 * The field HistoricalPeriod must be equal to 65535
 *///from   w w  w.  j  a va 2s .c o  m
private void checkRuleHistoricalPeriod() {
    BigInteger historicalInformationPeriod = schemeInformation.getHistoricalInformationPeriod();
    String name = QNames._HistoricalInformationPeriod;
    BigInteger fixedValue = Configuration.getInstance().getHistoricalInformationPeriod();

    if (historicalInformationPeriod.intValue() != fixedValue.intValue()) {
        logger.error(name + uiKeys.getString("Validation.rule.historicalPeriod") + " " + fixedValue + "!", tsl);
    }
}

From source file:org.nuxeo.ecm.core.opencmis.impl.server.NuxeoCmisService.java

@Override
public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
        Boolean includePropertyDefinitions, ExtensionsData extension) {
    int d = depth == null ? DEFAULT_TYPE_LEVELS : depth.intValue();
    List<TypeDefinitionContainer> types = repository.getTypeDescendants(typeId, d, includePropertyDefinitions);
    // clone//  ww  w.j ava 2  s .  co  m
    // TODO copy only when local binding
    List<CmisTypeContainer> tmp = new ArrayList<CmisTypeContainer>(types.size());
    WSConverter.convertTypeContainerList(types, tmp);
    return WSConverter.convertTypeContainerList(tmp);
}

From source file:com.sun.honeycomb.adm.client.AdminClientImpl.java

public int delCell(byte cellId) throws MgmtException, ConnectException, PermissionException {
    if (!loggedIn())
        throw new PermissionException();
    HCCell cell = getCell(SiloInfo.getInstance().getMasterUrl());
    Object[] params = { Long.toString(this._sessionId), Byte.toString(cellId) };
    this.extLog(ExtLevel.EXT_INFO, AdminResourcesConstants.MSG_KEY_REMOVE_CELL, params, "delCell");
    BigInteger result = cell.delCell(new Byte(cellId));
    return result.intValue();
}

From source file:com.sun.honeycomb.adm.client.AdminClientImpl.java

public int verifyNtpServers(String ntpServers) throws MgmtException, ConnectException {

    HCCell cell = getCell(SiloInfo.getInstance().getMasterUrl());
    BigInteger retCode = cell.verifyNtpServers(ntpServers);
    return (retCode.intValue());

}

From source file:com.sun.honeycomb.adm.client.AdminClientImpl.java

/**
 * @see com.sun.honeycomb.adm.client.AdminClient#offlineDisk(HCDisk)
 *///from ww  w  .j a  v a  2  s .  c  om
public int offlineDisk(HCDisk disk) throws MgmtException, ConnectException, PermissionException {

    if (!loggedIn())
        throw new PermissionException();
    if (null == disk)
        throw new MgmtException("Attempted to offline nonexistent disk.");

    Object[] params = { Long.toString(this._sessionId), disk.getDiskId(), disk.getNodeId().toString() };
    this.extLog(ExtLevel.EXT_INFO, AdminResourcesConstants.MSG_KEY_OFFLINE_DISK, params, "offlineDisk");

    BigInteger result = disk.offline(BigInteger.valueOf(0));
    return result.intValue();
}

From source file:com.sun.honeycomb.adm.client.AdminClientImpl.java

public int addCell(String adminVIP, String dataVIP)
        throws MgmtException, ConnectException, PermissionException {
    if (!loggedIn())
        throw new PermissionException();

    HCCell cell = getCell(SiloInfo.getInstance().getMasterUrl());
    Object[] params = { Long.toString(this._sessionId), adminVIP, dataVIP };
    this.extLog(ExtLevel.EXT_INFO, AdminResourcesConstants.MSG_KEY_ADD_CELL, params, "addCell");
    BigInteger result = cell.addCell(new StatusCallback(), adminVIP, dataVIP);
    return result.intValue();
}

From source file:com.sun.honeycomb.adm.client.AdminClientImpl.java

/**
 * Wipe disk for the specified cell// ww w .jav  a2 s  .c o  m
 * @param cell the cell to wipe the disks on
 * @return int 0 on success, -1 on failure
 */
public int wipeDisks(HCCell cell) throws MgmtException, ConnectException, PermissionException {

    if (!loggedIn())
        throw new PermissionException();

    Object[] params = { Long.toString(this._sessionId), Byte.toString(cell.getCellId()) };
    this.extLog(ExtLevel.EXT_INFO, AdminResourcesConstants.MSG_KEY_WIPE_CELL_DISKS, params, "wipeDisks");

    BigInteger result = cell.wipe(new StatusCallback(), BigInteger.valueOf(0));
    return result.intValue();
}