com.versionone.om.Rank Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of VersionOne.SDK.Java.ObjectModel Show documentation
Show all versions of VersionOne.SDK.Java.ObjectModel Show documentation
A strongly-typed object model library on top of the VersionOne SDK.Java API Client library.
The newest version!
/*(c) Copyright 2008, VersionOne, Inc. All rights reserved. (c)*/
package com.versionone.om;
/**
* Class for ordering the Assets.
*
* @param The type of asset being ranked.
*/
public class Rank {
private final T asset;
private final String rankAttribute;
private final V1Instance instance;
Rank(V1Instance instance, T asset, String rankAttribute) {
this.instance = instance;
this.asset = asset;
this.rankAttribute = rankAttribute;
}
/**
* Set this Entity ahead of the passed in Entity in rank order.
*
* @param assetToRankAheadOf The Entity that will come next in order after
* this Entity.
*/
public void setAbove(T assetToRankAheadOf) {
instance.rankAbove(asset, assetToRankAheadOf, rankAttribute);
asset.save();
}
/**
* Set this Entity after the passed in Entity in rank order.
*
* @param assetToRankAfter The Entity that will come just before this Entity
* in rank order.
*/
public void setBelow(T assetToRankAfter) {
instance.rankBelow(asset, assetToRankAfter, rankAttribute);
asset.save();
}
/**
* Determines whether otherAsset is above this one.
*
* @param otherAsset The Entity that will come next in order after this
* Entity.
* @return true if this Entity ahead of the passed in Entity in rank order,
* false otherwise.
*/
public boolean isAbove(T otherAsset) {
return instance.isRankAbove(asset, otherAsset, rankAttribute);
}
/**
* Determines whether otherAsset is above this one.
*
* @param otherAsset The Entity that will come just before this Entity in
* rank order.
* @return true if this Entity after the passed in Entity in rank order,
* false otherwise.
*/
public boolean isBelow(T otherAsset) {
return instance.isRankBelow(asset, otherAsset, rankAttribute);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy