Package mks.ci.server.engine
Class CopyTree
- java.lang.Object
-
- mks.ci.server.engine.CopyTree
-
- All Implemented Interfaces:
mks.ci.server.engine.ICopyTree
public class CopyTree extends java.lang.Object implements mks.ci.server.engine.ICopyTree
Copytree and Branch support- Since:
- Chrome/IS2007
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CopyTree.CopyTreeInterceptor
Used on the server for dynamic manipulation of the copied issues.static class
CopyTree.ScriptArgsBaseBean
The base bean methods for both copytree and branch triggers.static class
CopyTree.ScriptBranchArgsBean
The Branch Arguments Bean (imBranchArgsBean).static class
CopyTree.ScriptBranchResultBean
The Branch Result Bean (imBranchResultBean).static class
CopyTree.ScriptCopyTreeArgsBean
The Copy Tree Arguments Bean (imCopyTreeArgsBean).static class
CopyTree.ScriptCopyTreeResultBean
The Copy Tree Result Bean (imCopyTreeResultBean).
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_SEQ_HINT
-
Constructor Summary
Constructors Constructor Description CopyTree(mks.ci.common.CopyTreeArgs args, java.sql.Connection c, mks.ci.server.engine.EngineSQL e, int user)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addContains(java.util.Set<mks.ci.server.engine.Relation> relations, mks.ci.server.engine.Issue node)
mks.ci.server.engine.RelationshipSet
calculateRelationshipSet(mks.ci.server.engine.datamappers.IssueFieldKey key)
This method is used to check the relationship cache for the original relationship set for the provided IssueFieldKey parameter.long
createDelta(int issueID)
Create a delta for an issue.void
createRelationships(boolean forward, java.util.Collection<mks.ci.server.engine.Relation> links, mks.ci.server.engine.creators.VersionTracesCreator tracesCreator)
Create the relationships; both the active ones, and the history delta record.static java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>>
execute(mks.ci.common.CopyTreeArgs args, mks.ci.server.engine.EngineSQL e, int user, int permissionsUser, java.util.Set<java.lang.Integer> topLevel, java.sql.Connection c, LocalTriggerManager.ScriptServerBean ssb, mks.frame.app.ui.AsynchronousStatusReport report, CopyTree.CopyTreeInterceptor cti)
Internal entry point.static java.util.Map<java.lang.Integer,java.lang.Integer>
execute(mks.ci.common.CopyTreeArgs args, mks.ci.server.engine.EngineSQL e, int user, java.util.Set<java.lang.Integer> topLevel)
Entry point from the RMI. - Used for Backwards Compatibility Going forward, we use executeV2 Setup all the boilerplate, and get us started.static java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>>
executeV2(mks.ci.common.CopyTreeArgs args, mks.ci.server.engine.EngineSQL e, int user, java.util.Set<java.lang.Integer> topLevel)
Entry point from the RMI.void
findForwardLinks(java.util.Collection<java.lang.Integer> ids, java.util.Collection<java.lang.Integer> linkFields, java.util.Collection<mks.ci.server.engine.Relation> forward, java.util.Collection<java.lang.Integer> rightIDs)
java.util.List<mks.ci.server.engine.Relation>[]
findLinks(java.util.List<java.lang.Integer> ids, java.util.Set<java.lang.Integer> linkFields)
Retrieve all the links thru the link fields for the specified issues.java.util.Map<java.lang.Integer,java.lang.Long>
getDeltas()
java.util.Map<java.lang.Integer,mks.ci.server.engine.Issue>
getItemsForTraversalList(java.util.List<mks.ci.server.engine.Relation> traversalList)
Load the referenced item type for the given set of relations so that it can be used when copying/branching an item.java.util.Map<java.lang.Integer,java.lang.Integer>
getOldNew()
mks.ci.server.engine.Type
getReferencedItemType(mks.ci.server.engine.Issue node)
java.util.List<mks.ci.server.engine.Relation>
getTraversalList()
void
handleVersionDescriptions(java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> byTypeIncVersion, java.lang.Integer type, java.util.List<java.lang.Integer> ids)
void
setRefModeForLiveItemBranchedFromVersion(mks.ci.server.engine.Issue issue, long deltaID)
void
updateFieldInHistory(mks.ci.server.engine.Field f, java.lang.Object value, java.lang.Integer issue)
-
-
-
Field Detail
-
MAX_SEQ_HINT
public static final int MAX_SEQ_HINT
- See Also:
- Constant Field Values
-
-
Method Detail
-
execute
public static java.util.Map<java.lang.Integer,java.lang.Integer> execute(mks.ci.common.CopyTreeArgs args, mks.ci.server.engine.EngineSQL e, int user, java.util.Set<java.lang.Integer> topLevel) throws java.sql.SQLException, mks.ci.exception.CIException
Entry point from the RMI. - Used for Backwards Compatibility Going forward, we use executeV2 Setup all the boilerplate, and get us started. This method fires the triggers! Since we guarantee that the commit will have completed when the post trigger fires, if a caller uses this class thru any other entry point, it is their responsibility to fire the triggers after their commit!- Throws:
java.sql.SQLException
mks.ci.exception.CIException
-
executeV2
public static java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> executeV2(mks.ci.common.CopyTreeArgs args, mks.ci.server.engine.EngineSQL e, int user, java.util.Set<java.lang.Integer> topLevel) throws java.sql.SQLException, mks.ci.exception.CIException
Entry point from the RMI. Setup all the boilerplate, and get us started. This method fires the triggers! Since we guarantee that the commit will have completed when the post trigger fires, if a caller uses this class thru any other entry point, it is their responsibility to fire the triggers after their commit!- Throws:
java.sql.SQLException
mks.ci.exception.CIException
-
execute
public static java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> execute(mks.ci.common.CopyTreeArgs args, mks.ci.server.engine.EngineSQL e, int user, int permissionsUser, java.util.Set<java.lang.Integer> topLevel, java.sql.Connection c, LocalTriggerManager.ScriptServerBean ssb, mks.frame.app.ui.AsynchronousStatusReport report, CopyTree.CopyTreeInterceptor cti) throws java.sql.SQLException, mks.ci.exception.CIException, mks.frame.app.ui.CancelledException
Internal entry point.- Parameters:
user
- The current user; this will be the creator of the new issues.permissionsUser
- Either the current user, or the internal user; depending on whether the gesture came from the client or the trigger.- Throws:
java.sql.SQLException
mks.ci.exception.CIException
mks.frame.app.ui.CancelledException
-
getItemsForTraversalList
public java.util.Map<java.lang.Integer,mks.ci.server.engine.Issue> getItemsForTraversalList(java.util.List<mks.ci.server.engine.Relation> traversalList) throws mks.ci.exception.CIException, java.sql.SQLException
Load the referenced item type for the given set of relations so that it can be used when copying/branching an item.- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
addContains
public void addContains(java.util.Set<mks.ci.server.engine.Relation> relations, mks.ci.server.engine.Issue node)
-
getReferencedItemType
public mks.ci.server.engine.Type getReferencedItemType(mks.ci.server.engine.Issue node)
-
handleVersionDescriptions
public void handleVersionDescriptions(java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> byTypeIncVersion, java.lang.Integer type, java.util.List<java.lang.Integer> ids) throws mks.ci.exception.FieldNotFoundException, java.sql.SQLException, mks.ci.exception.CIException, mks.ci.exception.LoggingTextfieldModificationException, mks.ci.exception.UserNotFoundException, mks.ci.exception.NoConnectionException
- Throws:
mks.ci.exception.FieldNotFoundException
java.sql.SQLException
mks.ci.exception.CIException
mks.ci.exception.LoggingTextfieldModificationException
mks.ci.exception.UserNotFoundException
mks.ci.exception.NoConnectionException
-
setRefModeForLiveItemBranchedFromVersion
public void setRefModeForLiveItemBranchedFromVersion(mks.ci.server.engine.Issue issue, long deltaID) throws mks.ci.exception.TypeNotFoundException, java.sql.SQLException, mks.ci.exception.FieldNotFoundException
- Throws:
mks.ci.exception.TypeNotFoundException
java.sql.SQLException
mks.ci.exception.FieldNotFoundException
-
updateFieldInHistory
public void updateFieldInHistory(mks.ci.server.engine.Field f, java.lang.Object value, java.lang.Integer issue) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
createDelta
public long createDelta(int issueID) throws java.sql.SQLException
Create a delta for an issue. Make a record of that delta in the deltas map.- Specified by:
createDelta
in interfacemks.ci.server.engine.ICopyTree
- Throws:
java.sql.SQLException
-
findLinks
public java.util.List<mks.ci.server.engine.Relation>[] findLinks(java.util.List<java.lang.Integer> ids, java.util.Set<java.lang.Integer> linkFields) throws java.sql.SQLException, mks.ci.exception.CIException
Retrieve all the links thru the link fields for the specified issues.- Specified by:
findLinks
in interfacemks.ci.server.engine.ICopyTree
- Throws:
java.sql.SQLException
mks.ci.exception.CIException
-
findForwardLinks
public void findForwardLinks(java.util.Collection<java.lang.Integer> ids, java.util.Collection<java.lang.Integer> linkFields, java.util.Collection<mks.ci.server.engine.Relation> forward, java.util.Collection<java.lang.Integer> rightIDs) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
calculateRelationshipSet
public mks.ci.server.engine.RelationshipSet calculateRelationshipSet(mks.ci.server.engine.datamappers.IssueFieldKey key) throws java.sql.SQLException
This method is used to check the relationship cache for the original relationship set for the provided IssueFieldKey parameter.- Parameters:
key
- IssueFieldKey containing the itemID and fieldID- Returns:
- RelationshipSet object
- Throws:
java.sql.SQLException
-
createRelationships
public void createRelationships(boolean forward, java.util.Collection<mks.ci.server.engine.Relation> links, mks.ci.server.engine.creators.VersionTracesCreator tracesCreator) throws java.sql.SQLException, mks.ci.exception.CIException
Create the relationships; both the active ones, and the history delta record. Create either forward or reverse relationships.- Specified by:
createRelationships
in interfacemks.ci.server.engine.ICopyTree
- Throws:
java.sql.SQLException
mks.ci.exception.CIException
-
getOldNew
public java.util.Map<java.lang.Integer,java.lang.Integer> getOldNew()
- Specified by:
getOldNew
in interfacemks.ci.server.engine.ICopyTree
-
getDeltas
public java.util.Map<java.lang.Integer,java.lang.Long> getDeltas()
- Specified by:
getDeltas
in interfacemks.ci.server.engine.ICopyTree
-
getTraversalList
public java.util.List<mks.ci.server.engine.Relation> getTraversalList()
- Specified by:
getTraversalList
in interfacemks.ci.server.engine.ICopyTree
-
-