public String getLabel(final String _language,
                           final Company _company)
        throws EFapsException
    {
        String ret = "empty";
        final long companyID = _company == null ? 0 : _company.getId();
        final Cache<String, String> cache = InfinispanCache.get().<String, String>getCache(
                        MsgPhrase.LABELCACHE);
        final String key = _language + "_" + companyID + "_" + getUUID().toString();
        if (cache.containsKey(key)) {
            ret = cache.get(key);
        } else {
            long languageid = 0;
            final QueryBuilder queryBldr = new QueryBuilder(CIAdmin.Language);
            queryBldr.addWhereAttrEqValue(CIAdmin.Language.Language, _language);
            final InstanceQuery query = queryBldr.getQuery();
            query.executeWithoutAccessCheck();
            if (query.next()) {
                languageid = query.getCurrentValue().getId();
            }
            Label current = null;
            MsgPhrase phrase = this;
            while (phrase != null) {
                for (final Label label : phrase.labels) {
                    if (current == null) {
                        current = label;
                    } else {
                        if (label.getPriority(languageid, companyID) > current.getPriority(languageid, companyID)) {
                            current = label;
                        }
                    }
                }
                phrase = phrase.getParent();
            }
            if (current != null) {
                ret = current.getValue();
                cache.put(key, ret);
            }
        }
        return ret;
    }
public String getLabel ( final String _language , final Company _company ) throws EFapsException { String ret = "empty" ; final long companyID = _company == null ? 0 : _company . getId ( ) ; final Cache < String , String > cache = InfinispanCache . get ( ) . < String , String > getCache ( MsgPhrase . LABELCACHE ) ; final String key = _language + "_" + companyID + "_" + getUUID ( ) . toString ( ) ; if ( cache . containsKey ( key ) ) { ret = cache . get ( key ) ; } else { long languageid = 0 ; final QueryBuilder queryBldr = new QueryBuilder ( CIAdmin . Language ) ; queryBldr . addWhereAttrEqValue ( CIAdmin . Language . Language , _language ) ; final InstanceQuery query = queryBldr . getQuery ( ) ; query . executeWithoutAccessCheck ( ) ; if ( query . next ( ) ) { languageid = query . getCurrentValue ( ) . getId ( ) ; } Label current = null ; MsgPhrase phrase = this ; while ( phrase != null ) { for ( final Label label : phrase . labels ) { if ( current == null ) { current = label ; } else { if ( label . getPriority ( languageid , companyID ) > current . getPriority ( languageid , companyID ) ) { current = label ; } } } phrase = phrase . getParent ( ) ; } if ( current != null ) { ret = current . getValue ( ) ; cache . put ( key , ret ) ; } } return ret ; }
@param _language language
@param _company  Comany
@return the label
@throws EFapsException on error