It's all about the answers!

Ask a question

Is there any way to get the creation time of the asset in RAM (v 7.2.0.1)


Samanwita Majumdar (5033940) | asked Nov 28 '12, 6:43 a.m.
I am querying a RAM Asset and when I execute the same and get the asset using the following code:
RAMAsset ramAsset =(RAMAsset)assets[i].getAsset();
                ramAsset.getCreationTime();

But the value of ramAsset.getCreationTime() is null. Is there anyway by which we can get the creation time?

One answer



permanent link
Gili Mendel (1.8k56) | answered Nov 28 '12, 11:16 a.m.
JAZZ DEVELOPER
The getCreationTime returns a PersonTime object ... it is for owners to set/get the time it took to create that asset.  In any case this API was deprecated, as it was not really used.

What you are looking is for the activities of that Asset... specifically when was it submited (activity 675) or when it was created from an older version (new version, activity 685).


public static void main(String[] args) {
        RAMSession session = new RAMSession("http://localhost:8080/ram.ws",  "admin",  "admin");
        session.setWebServiceTimeout(10000);
       
        RAMAsset asset = session.getAsset(new AssetIdentification("{0C972087-F35B-2907-8505-8A8EA00EF600}", "1.0"));
       
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        long now = cal.getTimeInMillis();
       
        try {
            RAMAssetActivity[] activities = asset.getActivites(new int[] {675,685}, 0, now );
            for (RAMAssetActivity ramAssetActivity : activities) {
                cal.setTimeInMillis(ramAssetActivity.getTimestamp());
                System.out.println(cal.getTime());
            }
        } catch (EntitlementException e) {
            e.printStackTrace();
        } catch (AssetNotFoundException e) {
            e.printStackTrace();
        } catch (RAMException e) {
            e.printStackTrace();
        }
   
       
        // upload/create the new version to the repository
        // Make sure to create the asset with its artifacts, before removing things off
        session.put(asset, new NullProgressMonitor());
        session.release();   
    }
 

Other asset activities:


    public static final int METRIC_TYPE_CREATE_ASSET_TAG = 601;
   
    public static final int METRIC_TYPE_DELETE_ASSET_TAG = 603;
   
    public static final int METRIC_TYPE_ASSET_BROWSE = 608;
   
    public static final int METRIC_TYPE_ASSET_DOWNLOAD = 610;
   
    public static final int METRIC_TYPE_ASSET_USAGE = 615;
  
    public static final int METRIC_TYPE_ASSET_SUBSCRIPTION_CREATE = 630;
   
    public static final int METRIC_TYPE_ASSET_SUBSCRIPTION_DELETE = 633;

    public static final int METRIC_TYPE_ARTIFACT_BROWSE = 650;
   
    public static final int METRIC_TYPE_SUBMIT_ASSET = 675;

    public static final int METRIC_TYPE_UPDATE = 680;
   
    public static final int METRIC_TYPE_ASSET_NEW_VERSION = 685;

    public static final int METRIC_TYPE_DELETE_ASSET = 690;

    public static final int METRIC_TYPE_PUBLISH_ASSET = 700;




Comments
Rich Kulp commented Nov 28 '12, 12:14 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

FYI:

For
   RAMAssetActivity[] activities = asset.getActivites(new int[] {675,685}, 0, now )

Use instead
   RAMAssetActivity[] activities = asset.getActivites(new int[] {675,685}, -1, -1)

No need to try to compute now to go from 0 to now. -1, -1 is equivalent to this.




For:

cal.setTimeInMillis(ramAssetActivity.getTimestamp());
System.out.println(cal.getTime());

Just use:
System.out.println(ramAssetActivity.getTimestamp());

They are equivalent.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.