/** * * @return An iterator over the nodes history. */ public AssetHistoryIterator getHistory() { if(isHistoricalVersion()) { Node frozenNode = getNode(); try { Node headNode = frozenNode.getSession().getNodeByIdentifier( frozenNode.getProperty("jcr:frozenUuid") .getString()); return new AssetHistoryIterator( this.rulesRepository, headNode ); } catch (RepositoryException e) { throw new RulesRepositoryException(e); } } return new AssetHistoryIterator( this.rulesRepository, this.node ); }
/** * * @return An iterator over the nodes history. */ public AssetHistoryIterator getHistory() { if(isHistoricalVersion()) { Node frozenNode = getNode(); try { Node headNode = frozenNode.getSession().getNodeByIdentifier( frozenNode.getProperty("jcr:frozenUuid") .getString()); return new AssetHistoryIterator( this.rulesRepository, headNode ); } catch (RepositoryException e) { throw new RulesRepositoryException(e); } } return new AssetHistoryIterator( this.rulesRepository, this.node ); }
/** * Constructs a AssetItem object, setting its node attribute to the specified * node. * * @param rulesRepository * the rulesRepository that instantiated this object * @param node * the node in the repository that this AssetItem corresponds to * @throws RulesRepositoryException */ public AssetItem(RulesRepository rulesRepository, Node node) throws RulesRepositoryException { super( rulesRepository, node ); try { // make sure this node is an asset node if ( !(this.node.getPrimaryNodeType().getName().equals( ASSET_NODE_TYPE_NAME ) || isHistoricalVersion()) ) { String message = this.node.getName() + " is not a node of type " + ASSET_NODE_TYPE_NAME + " nor nt:version. It is a node of type: " + this.node.getPrimaryNodeType().getName(); log.error( message ); throw new RulesRepositoryException( message ); } } catch ( Exception e ) { log.error( "Caught exception", e ); throw new RulesRepositoryException( e ); } }
/** * Constructs a AssetItem object, setting its node attribute to the specified * node. * * @param rulesRepository * the rulesRepository that instantiated this object * @param node * the node in the repository that this AssetItem corresponds to * @throws RulesRepositoryException */ public AssetItem(RulesRepository rulesRepository, Node node) throws RulesRepositoryException { super( rulesRepository, node ); try { // make sure this node is an asset node if ( !(this.node.getPrimaryNodeType().getName().equals( ASSET_NODE_TYPE_NAME ) || isHistoricalVersion()) ) { String message = this.node.getName() + " is not a node of type " + ASSET_NODE_TYPE_NAME + " nor nt:version. It is a node of type: " + this.node.getPrimaryNodeType().getName(); log.error( message ); throw new RulesRepositoryException( message ); } } catch ( Exception e ) { log.error( "Caught exception", e ); throw new RulesRepositoryException( e ); } }
/** * This will get the module an asset item belongs to. */ public ModuleItem getModule() { try { if ( this.isHistoricalVersion() ) { return this.rulesRepository.loadModule( this.getModuleName() ); } return new ModuleItem( this.rulesRepository, this.node.getParent().getParent() ); } catch ( RepositoryException e ) { throw new RulesRepositoryException( e ); } }
/** * This will get the module an asset item belongs to. */ public ModuleItem getModule() { try { if ( this.isHistoricalVersion() ) { return this.rulesRepository.loadModule( this.getModuleName() ); } return new ModuleItem( this.rulesRepository, this.node.getParent().getParent() ); } catch ( RepositoryException e ) { throw new RulesRepositoryException( e ); } }
protected AssetItem loadAssetWithVersion(final AssetItem assetItem, String version) { long requiredVersion = Long.parseLong(version); if (assetItem.isHistoricalVersion()) { long currentVersion = assetItem.getVersionNumber(); if(requiredVersion == currentVersion) {
protected AssetItem loadAssetWithVersion(final AssetItem assetItem, String version) { long requiredVersion = Long.parseLong(version); if (assetItem.isHistoricalVersion()) { long currentVersion = assetItem.getVersionNumber(); if(requiredVersion == currentVersion) {
assertTrue(loadedHistorical.isHistoricalVersion()); assertFalse(ruleItem1.getVersionNumber() == loadedHistorical.getVersionNumber());
assertTrue(loadedHistorical.isHistoricalVersion()); assertFalse(asset.getVersionNumber() == loadedHistorical.getVersionNumber());