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:com.flyhz.avengers.framework.AvengersAppMaster.java

private void fetch() {
    LOG.info("initFetch first ......");
    initCommon();//ww  w .  j a  va  2s.c om
    currentProcess = "fetch";
    HConnection hConnection = null;
    HBaseAdmin hbaseAdmin = null;
    // HTable hVersion = null;
    HTable hPage = null;
    try {
        hConnection = HConnectionManager.createConnection(hbaseConf);
        hbaseAdmin = new HBaseAdmin(hConnection);

        Configuration configuration = HBaseConfiguration.create(hbaseConf);

        configuration.setLong("hbase.rpc.timeout", 600000);
        // Scan
        configuration.setLong("hbase.client.scanner.caching", 1000);

        hPage = new HTable(hbaseConf, "av_page");

        Scan scan = new Scan();
        scan.addColumn(Bytes.toBytes("preference"), Bytes.toBytes("batchId"));
        ResultScanner rs = hPage.getScanner(scan);
        // 
        Set<String> urls = new HashSet<String>();
        for (Result result : rs) {
            for (Cell cell : result.rawCells()) {
                String url = Bytes.toString(cell.getRowArray());
                String family = Bytes.toString(cell.getFamilyArray());
                String column = Bytes.toString(cell.getQualifierArray());
                Long value = Bytes.toLong(cell.getValueArray());
                LOG.info("rowkey -> {},family -> {},column -> {},value ->{}", url, family, column, value);
                if ("preference".equals(family) && "batchId".equals(column) && value.equals(this.version)) {
                    urls.add(url);
                }
                if (urls.size() == 100) {
                    this.numTotalContainers = 100;
                    for (int i = 0; i < numTotalContainers; ++i) {
                        ContainerRequest containerAsk = setupContainerAskForRM();
                        amRMClient.addContainerRequest(containerAsk);
                    }
                    numRequestedContainers.set(numTotalContainers);
                    while (!done && (numCompletedContainers.get() != numTotalContainers)) {
                        try {
                            Thread.sleep(200);
                        } catch (InterruptedException ex) {
                        }
                    }
                }
            }
        }
    } catch (IOException e) {
        LOG.error("fetch", e);
    } catch (Throwable e) {
        LOG.error("fetch", e);
    } finally {
        if (hPage != null) {
            try {
                hPage.close();
            } catch (IOException e) {
                LOG.error("", e);
            }
        }
        if (hbaseAdmin != null) {
            try {
                hbaseAdmin.close();
            } catch (IOException e) {
                LOG.error("", e);
            }
        }
        if (hConnection != null) {
            try {
                hConnection.close();
            } catch (IOException e) {
                LOG.error("", e);
            }
        }
    }
}

From source file:com.youanmi.scrm.smp.facade.org.OrgInfoFacade.java

/**
 * // ww  w. java2 s.c  o  m
 * ?????
 * 
 * @param orgId
 * @param name
 */
private void checkOrgName(Long orgId, String name) {
    List<Long> listIds = orgInfoService.getShopByTopOrgAndName(UserTokenThreadLocal.get().getTopOrgId(), name);
    List<Long> resultListIds = new ArrayList<Long>();
    for (Long id : listIds) {
        if (!id.equals(orgId)) {
            resultListIds.add(id);
        }
    }

    // id???????
    if (AssertUtils.notNull(resultListIds)) {
        throw new ViewExternalDisplayException(ResultCode.Org.ORG_NAME_REPEAT);
    }

}

From source file:br.gov.jfrj.siga.vraptor.GrupoController.java

public String aEditar(Long idCpGrupo) throws Exception {
    List<String> idConfiguracao = new ArrayList<String>();
    List<String> codigoTipoConfiguracao = new ArrayList<String>();
    List<String> conteudoConfiguracao = new ArrayList<String>();

    Cp.getInstance().getConf().limparCacheSeNecessario();

    Integer t_idTpGrupo = getIdTipoGrupo();
    setCpTipoGrupo(dao().consultar(t_idTpGrupo, CpTipoGrupo.class, false));

    // idCpGrupo vazio indica incluso
    if (idCpGrupo == null || idCpGrupo.equals("")) {
        dscGrupo = "";
        siglaGrupo = "";
        tiposConfiguracaoGrupoParaTipoDeGrupo = obterTiposConfiguracaoGrupoParaTipoDeGrupo(getCpTipoGrupo());
        configuracoesGrupo = new ArrayList<ConfiguracaoGrupo>();
        return "edita";
    } else {/*from  www.  ja  v a2 s  . com*/
        setIdCpGrupo(idCpGrupo);
        CpGrupo grp;
        grp = daoGrupo(idCpGrupo);
        if (grp == null) {
            throw new AplicacaoException("Grupo no encontrado para Id do grupo: " + idCpGrupo + ".");
        }
        if (!grp.isAtivo()) {
            throw new AplicacaoException(
                    "Grupo antigo no pode ser editado. Favor atualizar a pgina da lista de grupos antes de selecionar um grupo para edio.");
        }
        dscGrupo = grp.getDscGrupo();
        siglaGrupo = grp.getSiglaGrupo();
        getGrupoPaiSel().buscarPorObjeto(grp.getCpGrupoPai());

        CpTipoGrupo tpGrp = grp.getCpTipoGrupo();

        tiposConfiguracaoGrupoParaTipoDeGrupo = obterTiposConfiguracaoGrupoParaTipoDeGrupo(tpGrp);
        dscCpTipoGrupo = tpGrp.getDscTpGrupo();
        try {
            configuracoesGrupo = Cp.getInstance().getConf().obterCfgGrupo(grp);
            for (ConfiguracaoGrupo t_cfgConfiguracaoGrupo : configuracoesGrupo) {
                CpConfiguracao t_cpcConfiguracaoCorrente = t_cfgConfiguracaoGrupo.getCpConfiguracao();
                Long t_lngIdConfiguracao = t_cpcConfiguracaoCorrente.getIdConfiguracao();
                idConfiguracao.add(t_lngIdConfiguracao.toString());
                TipoConfiguracaoGrupoEnum t_tpcTipo = t_cfgConfiguracaoGrupo.getTipo();
                codigoTipoConfiguracao.add(String.valueOf(t_tpcTipo.getCodigo()));
                String t_strConteudoConfiguracaoCorrente = t_cfgConfiguracaoGrupo.getConteudoConfiguracao();
                conteudoConfiguracao.add(t_strConteudoConfiguracaoCorrente);
            }
        } catch (Exception e) {
            throw new AplicacaoException(
                    MessageFormat.format("Id do grupo: {0} erro ao obter configuraes do grupo.", idCpGrupo),
                    0, e);
        }
    }

    result.include("idConfiguracao", idConfiguracao);
    result.include("codigoTipoConfiguracao", codigoTipoConfiguracao);
    result.include("conteudoConfiguracao", conteudoConfiguracao);

    return "edita";
}

From source file:org.alfresco.repo.discussion.DiscussionServiceImpl.java

@Override
public PostWithReplies listPostReplies(PostInfo primaryPost, int levels) {
    // Grab the factory
    GetChildrenWithTargetAssocsAuditableCannedQueryFactory cqFactory = (GetChildrenWithTargetAssocsAuditableCannedQueryFactory) cannedQueryRegistry
            .getNamedObject(CANNED_QUERY_GET_CHILDREN_TARGETS);

    // Sort by date
    CannedQuerySortDetails sorting = cqFactory.createDateAscendingCQSortDetails();

    // Run the canned query
    GetChildrenWithTargetAssocsAuditableCannedQuery cq = (GetChildrenWithTargetAssocsAuditableCannedQuery) cqFactory
            .getCannedQuery(primaryPost.getTopic().getNodeRef(), ForumModel.TYPE_POST,
                    ContentModel.ASSOC_REFERENCES, sorting, new PagingRequest(MAX_REPLIES_FETCH_SIZE));

    // Execute the canned query
    CannedQueryResults<NodeWithTargetsEntity> results = cq.execute();

    // Prepare to invert
    Map<Long, NodeRef> idToNodeRef = new HashMap<Long, NodeRef>();
    for (NodeWithTargetsEntity e : results.getPage()) {
        idToNodeRef.put(e.getId(), tenantService.getBaseName(e.getNodeRef()));
    }//from   w w  w . ja  v  a2 s  . co  m

    Map<NodeRef, List<NodeWithTargetsEntity>> idToReplies = new HashMap<NodeRef, List<NodeWithTargetsEntity>>();
    for (NodeWithTargetsEntity e : results.getPage()) {
        for (TargetAndTypeId idP : e.getTargetIds()) {
            Long id = idP.getTargetId();
            NodeRef nodeRef = idToNodeRef.get(id);
            if (nodeRef == null) {
                // References a node outside of this topic
                continue;
            }
            nodeRef = tenantService.getBaseName(nodeRef);
            if (id.equals(e.getId())) {
                // Self reference
                continue;
            }
            if (!idToReplies.containsKey(nodeRef)) {
                idToReplies.put(nodeRef, new ArrayList<NodeWithTargetsEntity>());
            }
            idToReplies.get(nodeRef).add(e);
        }
    }

    // Grab the list of NodeRefs to pre-load, and pre-load them
    List<NodeRef> preLoad = new ArrayList<NodeRef>();
    calculateRepliesPreLoad(primaryPost.getNodeRef(), preLoad, idToReplies, levels);
    nodeDAO.cacheNodes(preLoad);

    // Wrap
    return wrap(primaryPost, idToReplies, levels);
}

From source file:org.alfresco.solr.tracker.MetadataTracker.java

private void reindexTransactions() throws IOException, AuthenticationException, JSONException {
    long startElapsed = System.nanoTime();
    int docCount = 0;
    boolean requiresCommit = false;
    while (transactionsToReindex.peek() != null) {
        Long transactionId = transactionsToReindex.poll();
        if (transactionId != null) {
            // make sure it is cleaned out so we do not miss deletes
            this.infoSrv.deleteByTransactionId(transactionId);

            Transactions transactions = client.getTransactions(null, transactionId, null, transactionId + 1, 1);
            if ((transactions.getTransactions().size() > 0)
                    && (transactionId.equals(transactions.getTransactions().get(0).getId()))) {
                Transaction info = transactions.getTransactions().get(0);

                GetNodesParameters gnp = new GetNodesParameters();
                ArrayList<Long> txs = new ArrayList<Long>();
                txs.add(info.getId());//from w  ww .j  av  a 2  s. co m
                gnp.setTransactionIds(txs);
                gnp.setStoreProtocol(storeRef.getProtocol());
                gnp.setStoreIdentifier(storeRef.getIdentifier());
                List<Node> nodes = client.getNodes(gnp, (int) info.getUpdates());
                for (Node node : nodes) {
                    docCount++;
                    if (log.isDebugEnabled()) {
                        log.debug(node.toString());
                    }
                    this.infoSrv.indexNode(node, true);
                    checkShutdown();
                }

                // Index the transaction doc after the node - if this is not found then a reindex will be done.
                this.infoSrv.indexTransaction(info, true);
                requiresCommit = true;
            }
        }

        if (docCount > batchCount) {
            if (this.infoSrv.getRegisteredSearcherCount() < getMaxLiveSearchers()) {
                checkShutdown();
                this.infoSrv.commit();
                long endElapsed = System.nanoTime();
                trackerStats.addElapsedNodeTime(docCount, endElapsed - startElapsed);
                startElapsed = endElapsed;
                docCount = 0;
                requiresCommit = false;
            }
        }
    }
    if (requiresCommit || (docCount > 0)) {
        checkShutdown();
        this.infoSrv.commit();
        long endElapsed = System.nanoTime();
        trackerStats.addElapsedNodeTime(docCount, endElapsed - startElapsed);
    }
}

From source file:controllers.core.ActorController.java

/**
 * Form to create/edit an allocation with an activity.
 * /*ww w  . j a  v a 2 s. co m*/
 * @param id
 *            the actor id
 * @param allocatedActivityId
 *            the allocated activity id (0 for create)
 */
@With(CheckActorExists.class)
@Dynamic(IMafConstants.ACTOR_EDIT_DYNAMIC_PERMISSION)
public Result manageAllocatedActivity(Long id, Long allocatedActivityId) {

    // get the actor
    Actor actor = ActorDao.getActorById(id);

    // initiate the form with the template
    Form<TimesheetActivityAllocatedActorFormData> allocatedActivityForm = allocatedActivityFormTemplate;

    // edit case: inject values
    if (!allocatedActivityId.equals(Long.valueOf(0))) {

        TimesheetActivityAllocatedActor allocatedActivity = TimesheetDao
                .getTimesheetActivityAllocatedActorById(allocatedActivityId);

        // security: the actor must be related to the object
        if (!allocatedActivity.actor.id.equals(id)) {
            return forbidden(views.html.error.access_forbidden.render(""));
        }

        allocatedActivityForm = allocatedActivityFormTemplate
                .fill(new TimesheetActivityAllocatedActorFormData(id, allocatedActivity));

        // add the custom attributes values
        this.getCustomAttributeManagerService().fillWithValues(allocatedActivityForm,
                TimesheetActivityAllocatedActor.class, allocatedActivityId);
    } else {
        // add the custom attributes default values
        this.getCustomAttributeManagerService().fillWithValues(allocatedActivityForm,
                TimesheetActivityAllocatedActor.class, null);
    }

    return ok(views.html.core.actor.allocated_activity_manage.render(actor, allocatedActivityForm));

}

From source file:nl.strohalm.cyclos.services.customization.CustomFieldServiceImpl.java

public <F extends CustomField> F save(F customField) {
    if (customField.getNature() == CustomField.Nature.OPERATOR) {
        throw new UnexpectedEntityException();
    }// w w w .  ja  v a2s .  c  o m

    // Special handling for fields with a parent field
    CustomField parent = null;
    if (customField.getParent() != null) {
        // When the field has a parent, several settings are copied from it
        parent = fetchService.fetch(customField.getParent());
        copyParentProperties(parent, customField);
    }
    validate(customField);
    if (customField.isTransient()) {
        if (parent == null) {
            // Top level fields: set the order after other fields
            final int order = listByNature(customField.getNature()).size() + 1;
            customField.setOrder(order);
        }

        // Save the field
        customField = customFieldDao.insert(customField);

        if (parent != null) {
            // Nested fields: position the field just after his parent
            final List<? extends CustomField> allFields = listByNature(customField.getNature());
            final List<Long> order = new ArrayList<Long>();
            for (int i = 0; i < allFields.size(); i++) {
                final Long current = allFields.get(i).getId();
                if (current.equals(parent.getId())) {
                    // Insert the custom field just after the parent
                    order.add(parent.getId());
                    order.add(customField.getId());
                } else if (current.equals(customField.getId())) {
                    // The custom field has already been inserted
                    continue;
                } else {
                    // Another unrelated field
                    order.add(current);
                }
            }
            setOrder(customField.getNature(), order.toArray(new Long[order.size()]));
        }
    } else {
        // Keep the order
        final CustomField current = customFieldDao.load(customField.getId());
        customField.setOrder(current.getOrder());

        customField = customFieldDao.update(customField);

        // Update the dependent properties for child fields
        if (customField.getType() == CustomField.Type.ENUMERATED) {
            customField = fetchService.reload(customField, CustomField.Relationships.CHILDREN);
            for (final CustomField child : customField.getChildren()) {
                copyParentProperties(customField, child);
            }
        }
    }
    cachedCustomFieldsByNature.remove(customField.getNature());
    return customField;
}

From source file:org.apache.ambari.server.controller.metrics.timeline.cache.TimelineMetricCacheEntryFactory.java

/**
 * Called on a get call for existing values in the cache,
 * the necessary locking code is present in the get call and this call
 * should update the value of the cache entry before returning.
 *
 * @param key @org.apache.ambari.server.controller.metrics.timeline.cache.TimelineAppMetricCacheKey
 * @param value @org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics
 * @throws Exception// ww  w.  jav a 2 s.c om
 */
@Override
public void updateEntryValue(Object key, Object value) throws Exception {
    TimelineAppMetricCacheKey metricCacheKey = (TimelineAppMetricCacheKey) key;
    TimelineMetricsCacheValue existingMetrics = (TimelineMetricsCacheValue) value;

    LOG.debug("Updating cache entry, key: " + key + ", with value = " + value);

    Long existingSeriesStartTime = existingMetrics.getStartTime();
    Long existingSeriesEndTime = existingMetrics.getEndTime();

    TemporalInfo newTemporalInfo = metricCacheKey.getTemporalInfo();
    Long requestedStartTime = newTemporalInfo.getStartTimeMillis();
    Long requestedEndTime = newTemporalInfo.getEndTimeMillis();

    // Calculate new start and end times
    URIBuilder uriBuilder = new URIBuilder(metricCacheKey.getSpec());

    Precision requestedPrecision = Precision.getPrecision(requestedStartTime, requestedEndTime);
    Precision currentPrecision = existingMetrics.getPrecision();

    Long newStartTime = null;
    Long newEndTime = null;
    if (!requestedPrecision.equals(currentPrecision)) {
        // Ignore cache entry. Get the entire data from the AMS and update the cache.
        LOG.debug("Precision changed from " + currentPrecision + " to " + requestedPrecision);
        newStartTime = requestedStartTime;
        newEndTime = requestedEndTime;
    } else {
        //Get only the metric values for the delta period from the cache.
        LOG.debug("No change in precision " + currentPrecision);
        newStartTime = getRefreshRequestStartTime(existingSeriesStartTime, existingSeriesEndTime,
                requestedStartTime);
        newEndTime = getRefreshRequestEndTime(existingSeriesStartTime, existingSeriesEndTime, requestedEndTime);
    }

    // Cover complete overlap scenario
    // time axis: |-------- exSt ----- reqSt ------ reqEnd ----- exEnd ---------|
    if (newEndTime > newStartTime
            && !((newStartTime.equals(existingSeriesStartTime) && newEndTime.equals(existingSeriesEndTime))
                    && requestedPrecision.equals(currentPrecision))) {

        LOG.debug("Existing cached timeseries startTime = "
                + new Date(getMillisecondsTime(existingSeriesStartTime)) + ", endTime = "
                + new Date(getMillisecondsTime(existingSeriesEndTime)));

        LOG.debug("Requested timeseries startTime = " + new Date(getMillisecondsTime(newStartTime))
                + ", endTime = " + new Date(getMillisecondsTime(newEndTime)));

        // Update spec with new start and end time
        uriBuilder.setParameter("startTime", String.valueOf(newStartTime));
        uriBuilder.setParameter("endTime", String.valueOf(newEndTime));
        uriBuilder.setParameter("precision", requestedPrecision.toString());

        try {
            TimelineMetrics newTimeSeries = requestHelperForUpdates.fetchTimelineMetrics(uriBuilder,
                    newStartTime, newEndTime);

            // Update existing time series with new values
            updateTimelineMetricsInCache(newTimeSeries, existingMetrics,
                    getMillisecondsTime(requestedStartTime), getMillisecondsTime(requestedEndTime),
                    !currentPrecision.equals(requestedPrecision));

            // Replace old boundary values
            existingMetrics.setStartTime(requestedStartTime);
            existingMetrics.setEndTime(requestedEndTime);
            existingMetrics.setPrecision(requestedPrecision);

        } catch (IOException io) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Exception retrieving metrics.", io);
            }
        }
    } else {
        LOG.debug("Skip updating cache with new startTime = " + new Date(getMillisecondsTime(newStartTime))
                + ", new endTime = " + new Date(getMillisecondsTime(newEndTime)));
    }
}

From source file:com.ssbusy.controller.checkout.CheckoutController.java

@SuppressWarnings("deprecation")
private MyAddress processShippingForm(MyShippingInfoForm shippingForm, BindingResult result) {
    shippingInfoFormValidator.validate(shippingForm, result);
    if (result.hasErrors())
        return null;
    // TODO ID?/*from w ww. jav  a2  s  . co  m*/
    // addressAddressLine3?dormitoryid??iddormitory??
    MyAddress myAddress = shippingForm.getMyAddress();
    Long dormitoryId;
    try {
        dormitoryId = Long.parseLong(myAddress.getAddressLine3());
    } catch (NumberFormatException e) {
        ValidationUtils.rejectIfEmpty(result, "myAddress.addressLine3", "addressLine3.required");
        return null;
    }
    if (myAddress.getDormitory() == null || !dormitoryId.equals(myAddress.getDormitory().getDormitoryId())) {
        Dormitory dormitory = dormitoryService.loadDormitotyById(dormitoryId);
        if (dormitory == null) {
            ValidationUtils.rejectIfEmpty(result, "myAddress.addressLine3", "addressLine3.required");
            return null;
        }
        // dormitory.id-1
        myAddress.setDormitory(dormitory);
    }

    myAddress.setAddressLine1("addressLine1");
    myAddress.setCity("city");
    myAddress.setPostalCode("310018");
    if (myAddress.getLastName() != null && myAddress.getLastName().length() > 30) {
        myAddress.setLastName(myAddress.getLastName().substring(0, 30));
    }
    myAddress.setState(shippingForm.getAddress().getState());
    if (myAddress.getCountry() == null)
        myAddress.setCountry(shippingForm.getAddress().getCountry());
    return myAddress;
}

From source file:jp.primecloud.auto.ui.ServerTable.java

ServerTable(String caption, Container container, final MyCloudTabs sender) {
    super(caption, container);

    this.sender = sender;
    setVisibleColumns(new Object[] {});

    setWidth("100%");
    if (this.isEnabled()) {
        setHeight("100%");
    }//  www .j  a v  a 2s .co  m

    setPageLength(0);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setImmediate(true);
    setStyleName("server-table");
    setNullSelectionAllowed(false);
    setCacheRate(0.1);

    addGeneratedColumn("no", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Label nlbl = new Label(String.valueOf(p.getInstance().getInstanceNo()));
            return nlbl;
        }
    });

    addGeneratedColumn("name", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;

            PlatformDto platformDto = p.getPlatform();
            //????
            Icons icon = CommonUtils.getPlatformIcon(platformDto);

            Label nlbl = new Label("<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, icon) + "\"><div>"
                    + p.getInstance().getInstanceName() + "</div>", Label.CONTENT_XHTML);
            nlbl.setHeight(COLUMN_HEIGHT);
            return nlbl;
        }
    });

    addGeneratedColumn("fqdn", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Label nlbl = new Label(p.getInstance().getFqdn());
            return nlbl;
        }
    });

    addGeneratedColumn("publicIp", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Boolean showPublicIp = BooleanUtils.toBooleanObject(Config.getProperty("ui.showPublicIp"));
            Label ipaddr;
            if (BooleanUtils.isTrue(showPublicIp)) {
                //ui.showPublicIp = true???PublicIp
                ipaddr = new Label(p.getInstance().getPublicIp());
            } else {
                //ui.showPublicIp = false???PrivateIp
                ipaddr = new Label(p.getInstance().getPrivateIp());
            }
            return ipaddr;
        }
    });

    addGeneratedColumn("status", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            String a = p.getInstance().getStatus().substring(0, 1).toUpperCase()
                    + p.getInstance().getStatus().substring(1).toLowerCase();
            Icons icon = Icons.fromName(a);
            Label slbl = new Label(
                    "<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, icon) + "\"><div>" + a + "</div>",
                    Label.CONTENT_XHTML);
            slbl.setHeight(COLUMN_HEIGHT);
            return slbl;
        }
    });

    addGeneratedColumn("services", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {

            InstanceDto p = (InstanceDto) itemId;

            String context = "<div>";
            for (ComponentDto dto : sender.getComponents(p.getComponentInstances())) {
                ComponentType componentType = dto.getComponentType();
                String name = componentType.getComponentTypeNameDisp();
                Icons nameIcon = Icons.fromName(componentType.getComponentTypeName());
                // Master
                if (MySQLConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
                    Long masterInstanceNo = null;
                    for (InstanceConfig config : dto.getInstanceConfigs()) {
                        if (MySQLConstants.CONFIG_NAME_MASTER_INSTANCE_NO.equals(config.getConfigName())) {
                            if (StringUtils.isEmpty(config.getConfigValue())) {
                                masterInstanceNo = config.getInstanceNo();
                                break;
                            }
                        }
                    }
                    if (masterInstanceNo != null) {
                        if (masterInstanceNo.equals(p.getInstance().getInstanceNo())) {
                            name = name + "_master";
                            nameIcon = Icons.MYSQL_MASTER;
                        } else {
                            name = name + "_slave";
                            nameIcon = Icons.MYSQL_SLAVE;
                        }
                    } else {
                        name = name + "_slave";
                        nameIcon = Icons.MYSQL_SLAVE;
                    }
                }

                context = context + "<img style=\"width: 5px;\" src=\" "
                        + VaadinUtils.getIconPath(ServerTable.this, Icons.fromName("SPACER")) + "\" >"
                        + "<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, nameIcon) + "\" + "
                        + " title=\"" + name + "\">";
            }
            context = context + "</div>";

            Label slayout = new Label(context, Label.CONTENT_XHTML);
            slayout.setHeight(COLUMN_HEIGHT);
            return slayout;
        }

    });

    //        addGeneratedColumn("operation", new ColumnGenerator() {
    //            public Component generateCell(Table source, Object itemId, Object columnId) {
    //
    //                List<Button> list = new ArrayList<Button>();
    //
    //                CssLayout blayout = new CssLayout();
    //
    //                blayout.setWidth("100%");
    //                blayout.setHeight(COLUMN_HEIGHT);
    //                blayout.setMargin(false);
    //
    //                InstanceDto p = (InstanceDto) itemId;
    //
    //                Button playButton = new Button(ViewProperties.getCaption("button.startServer"));
    //                playButton.setDescription(ViewProperties.getCaption("description.startServer"));
    //                playButton.addStyleName("borderless");
    //                playButton.setIcon(Icons.PLAY.resource());
    //                playButton.setEnabled(false);
    //                playButton.addListener(Button.ClickEvent.class, ServerTable.this, "playButtonClick");
    //                blayout.addComponent(playButton);
    //                list.add(playButton);
    //
    //                Button stopButton = new Button(ViewProperties.getCaption("button.stopServer"));
    //                stopButton.setDescription(ViewProperties.getCaption("description.stopServer"));
    //                stopButton.addStyleName("borderless");
    //                stopButton.setIcon(Icons.STOP.resource());
    //                stopButton.setEnabled(false);
    //                stopButton.addListener(Button.ClickEvent.class, ServerTable.this, "stopButtonClick");
    //                blayout.addComponent(stopButton);
    //                list.add(stopButton);
    //
    //                Button editButton = new Button(ViewProperties.getCaption("button.editServer"));
    //                editButton.setDescription(ViewProperties.getCaption("description.editServer"));
    //                editButton.addStyleName("borderless");
    //                editButton.setIcon(Icons.EDIT.resource());
    //                editButton.setEnabled(false);
    //                editButton.addListener(Button.ClickEvent.class, ServerTable.this, "editButtonClick");
    //                blayout.addComponent(editButton);
    //                list.add(editButton);
    //
    //                Button delButton = new Button(ViewProperties.getCaption("button.deleteServer"));
    //                delButton.setDescription(ViewProperties.getCaption("description.deleteServer"));
    //                delButton.addStyleName("borderless");
    //                delButton.setIcon(Icons.DELETE.resource());
    //                delButton.setEnabled(false);
    //                delButton.addListener(Button.ClickEvent.class, ServerTable.this, "delButtonClick");
    //                blayout.addComponent(delButton);
    //                list.add(delButton);
    //
    //                map.put(p.getInstance().getInstanceNo(), list);
    //
    //                return blayout;
    //            }
    //
    //        });

    //???
    setColumnHeaders(CAPNAME);

    //????StyleName
    setCellStyleGenerator(new Table.CellStyleGenerator() {
        public String getStyle(Object itemId, Object propertyId) {

            if (propertyId == null) {
                return "";
            } else {
                return propertyId.toString().toLowerCase();
            }
        }
    });

    //        setColumnExpandRatio("name", 100);
    setColumnExpandRatio("fqdn", 100);
    addListener(Table.ValueChangeEvent.class, sender, "tableRowSelected");

    //        alwaysRecalculateColumnWidths = true;
}