@Nuwna the code is the same expect I removed the registry.get method call.
Since it would break the functionality of the store I created a new method
call getById.
          // asset module

Manager.prototype.getById = function(id){
log.info(id);
        return this.manager.get(id);
}

// This also need a calling method in store module
assetID = function(type, aid){
var asset = assetManager(type).getById(aid);
asset.rating = rating(aid);
return asset;

}

@Sameera I was referring to a limitation of the code. But it's a good thing
to learn about the usage of the RxtManager object. @Ruchira also said we
need to transfer the path based way to asset id based way inside the store.

Thanks.


On Tue, Aug 13, 2013 at 10:39 AM, Sameera Medagammaddegedara <
[email protected]> wrote:

> Hello Chan,
>
> Do you need the asset instances or the rxt templates for the assets?
>
> *To get the asset instances;*
>
> The ArtifactManager in the carbon module has a method called get(id) which
> will allow you to retrieve assets by id.
>
>                type='gadget'; //Asset type
>                id='xxxxxxxxxxxxxx';
>
>
> GovernanceUtils.loadGovernanceArtifacts(this.registry.registry);
>
>                var artifactMnger=new
> carbon.registry.ArtifactManager(this.registry,type);
>
>                var asset=artifactManager.get(id); *(Source: rxt.manager :
> line: 106)*
>
> There are some utility methods which are available in ;
>                /publisher/modules/rxt.manager.js
>
> *To  get the templates;
>
> *
> You can use ;
>
> *Requires*: /publisher/modules/rxt.manager.js
>
> var rxtManager=new RxtManager();
> rxtManager.loadAssets(); //Only need to call this once.
>
> var assetTemplate=rxtManager.findAssetTemplate(function(template){
>              return (template.shortName=='The type of gadget')?true:false;
> });
>
>
> The returned object will be of the form described in the
> /publisher/modules/rxt.domain.js file.
>
> Please let me know if I have answered your query correctly.
>
>
>
> *P.S:* Sorry for the delay
>
> Thank You,
> Sameera
>
>
>
> On Mon, Aug 12, 2013 at 9:47 PM, Nuwan Bandara <[email protected]> wrote:
>
>> Sameera,
>>
>> I think you wrote some code to do this. Can you share
>>
>> Regards,
>> /Nuwan
>>
>>
>> On Mon, Aug 12, 2013 at 4:25 PM, Chan <[email protected]> wrote:
>>
>>> $subject.
>>>
>>> I looked into the store module's asset method but it requires the path
>>> of the asset.
>>>
>>> Thanks.
>>>
>>> --
>>> Chan (Dulitha Wijewantha)
>>> Software Engineer - Mobile Development
>>> WSO2Mobile
>>> Lean.Enterprise.Mobileware
>>>  * ~Email       [email protected]*
>>> *  ~Mobile     +94712112165*
>>> *  ~Website   dulithawijewantha.com
>>> *
>>> *  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>>> *
>>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>>
>>
>>
>>
>> --
>> *Thanks & Regards,
>>
>> Nuwan Bandara
>> Technical Lead; **WSO2 Inc. *
>> *lean . enterprise . middleware |  http://wso2.com *
>> *blog : http://nuwanbando.com; email: [email protected]; phone: +94 11 763
>> 9629
>> *
>> <http://www.nuwanbando.com/>
>>
>
>


-- 
Chan (Dulitha Wijewantha)
Software Engineer - Mobile Development
WSO2Mobile
Lean.Enterprise.Mobileware
 * ~Email       [email protected]*
*  ~Mobile     +94712112165*
*  ~Website   dulithawijewantha.com
*
*  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
*
*  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to