find the company according company id (prioritary) or company name
        :param cmp_id: the company id
        :param cmp_name: the company name
        :return: found company or None if not found
772535
def find_company(cmp_id=None, cmp_name=None):
        
        LOGGER.debug("CompanyService.find_company")
        if (cmp_id is None or not cmp_id) and (cmp_name is None or not cmp_name):
            raise exceptions.ArianeCallParametersError('id and name')

        if (cmp_id is not None and cmp_id) and (cmp_name is not None and cmp_name):
            LOGGER.warn('CompanyService.find_company - Both id and name are defined. Will give you search on id.')
            cmp_name = None

        params = None
        if cmp_id is not None and cmp_id:
            params = {'id': cmp_id}
        elif cmp_name is not None and cmp_name:
            params = {'name': cmp_name}

        ret = None
        if params is not None:
            args = {'http_operation': 'GET', 'operation_path': 'get', 'parameters': params}
            response = CompanyService.requester.call(args)
            if response.rc == 0:
                ret = Company.json_2_company(response.response_content)
            elif response.rc != 404:
                err_msg = 'CompanyService.find_company - Problem while finding company (id:' + str(cmp_id) + \
                          ', name:' + str(cmp_name) + '). ' + \
                          'Reason: ' + str(response.response_content) + '-' + str(response.error_message) + \
                          " (" + str(response.rc) + ")"
                LOGGER.warning(
                    err_msg
                )

        return ret
1150595
def _get_id(vpc_name=None, cidr=None, tags=None, region=None, key=None,
            keyid=None, profile=None):
    '''
    
    '''

    if vpc_name and not any((cidr, tags)):
        vpc_id = _cache_id(vpc_name, region=region,
                           key=key, keyid=keyid,
                           profile=profile)
        if vpc_id:
            return vpc_id

    vpc_ids = _find_vpcs(vpc_name=vpc_name, cidr=cidr, tags=tags, region=region,
                         key=key, keyid=keyid, profile=profile)
    if vpc_ids:
        log.debug("Matching VPC: %s", " ".join(vpc_ids))
        if len(vpc_ids) == 1:
            vpc_id = vpc_ids[0]
            if vpc_name:
                _cache_id(vpc_name, vpc_id,
                          region=region, key=key,
                          keyid=keyid, profile=profile)
            return vpc_id
        else:
            raise CommandExecutionError('Found more than one VPC matching the criteria.')
    else:
        log.info('No VPC found.')
        return None
1269594
private function _setActiveCompany($ccmp_id){

         if(Yii::app()->getModule('user')->user()->profile->ccmp_id != $ccmp_id){
            //update 
            $sSql = "
                UPDATE profiles 
                SET ".$this->profiles_ccmp_field." = ".$ccmp_id." 
                WHERE 
                    user_id = ".Yii::app()->getModule('user')->user()->id
                ;
            Yii::app()->db->createCommand($sSql)->query();             
         }

         $this->_activeCompany = $ccmp_id;
         
         //set comapny name
         foreach($this->getClientCompanies() as $company){
             if($ccmp_id == $company['ccmp_id']){
                 //$this->_company_attributes =  array_merge( $company->ccucCcmp->attributes,$company->ccucCcmp->cccdCustomData->attributes);                 
                 $sql = "
                    SELECT 
                        * 
                    FROM
                        ccmp_company inner 
                        JOIN cccd_custom_data 
                          ON ccmp_id = cccd_ccmp_id 
                    WHERE ccmp_id = ".$ccmp_id."
                    ";
                 $this->_company_attributes = Yii::app()->db->createCommand($sql)->queryRow();
                 $this->_activeCompanyName = $this->_company_attributes['ccmp_name'];
                 return TRUE;
             }
         }
         throw new CHttpException(404, "For ccmp_id=".$ccmp_id. "neatrada nosaukumu");
     }
184100
@Override
	public List<CommerceOrder> getCommerceOrdersByUuidAndCompanyId(
		String uuid, long companyId) {
		return commerceOrderPersistence.findByUuid_C(uuid, companyId);
	}
1098292
@Override
	public List<CommercePriceEntry> findByCompanyId(long companyId) {
		return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			null);
	}
3529
@Override
	public List<CPInstance> findByC_LtD_S(long CPDefinitionId,
		Date displayDate, int status) {
		return findByC_LtD_S(CPDefinitionId, displayDate, status,
			QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
1046812
def find(self, name):
        
        collectors = self.get_collectors()

        for collector in collectors:
            if name.lower() == collector['name'].lower():
                self.collector_id = collector['id']
                return collector

        return {'status': 'No results found.'}
465058
def cmp(self, other_service):
        
        if not isinstance(other_service, HttpService):
            return None
        for att in dir(self):
            if att == 'cmp' or att.startswith('_'):
                continue
            if not hasattr(other_service, att):
                return None
            if getattr(self, att) != getattr(other_service, att):
                return False
        return True
156845
@Override
	public List<CPDisplayLayout> getCPDisplayLayoutsByUuidAndCompanyId(
		String uuid, long companyId) {
		return cpDisplayLayoutPersistence.findByUuid_C(uuid, companyId);
	}
971627
public static List<CPSpecificationOption> findByUuid_C(String uuid,
		long companyId) {
		return getPersistence().findByUuid_C(uuid, companyId);
	}
1276107
public static List<CPDisplayLayout> findByUuid_C(String uuid, long companyId) {
		return getPersistence().findByUuid_C(uuid, companyId);
	}
306888
public static Company get(final long _id)
        throws CacheReloadException
    {
        final Cache<Long, Company> cache = InfinispanCache.get().<Long, Company>getCache(Company.IDCACHE);
        if (!cache.containsKey(_id) && !Company.getCompanyFromDB(Company.SQL_ID, _id)) {
            cache.put(_id, Company.NULL, 100, TimeUnit.SECONDS);
        }
        final Company ret = cache.get(_id);
        return ret.equals(Company.NULL) ? null : ret;
    }
161191
public static List<CommerceOrder> findByUuid_C(String uuid, long companyId) {
		return getPersistence().findByUuid_C(uuid, companyId);
	}
17803
public static List<CPOption> findByUuid_C(String uuid, long companyId) {
		return getPersistence().findByUuid_C(uuid, companyId);
	}
5690
@Override
	public List<CommercePriceList> findByCompanyId(long companyId) {
		return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			null);
	}
1347958
public static java.util.List<com.liferay.commerce.product.model.CPDefinitionLink> getCPDefinitionLinksByUuidAndCompanyId(
		String uuid, long companyId) {
		return getService()
				   .getCPDefinitionLinksByUuidAndCompanyId(uuid, companyId);
	}
755923
@Override
	public List<CommerceDiscount> getCommerceDiscountsByUuidAndCompanyId(
		String uuid, long companyId) {
		return commerceDiscountPersistence.findByUuid_C(uuid, companyId);
	}