Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ReviewSMArtifact.java40
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java145
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java24
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidRelationReorder.java118
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/IBasicRelationReorder.java25
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/RelationOrderModType.java35
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/jaxb/resMessages.xsd11
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/ObjectFactory.java111
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteAccessControlEvent1.java159
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidRelationReorder1.java122
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBranchEvent1.java148
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBroadcastEvent1.java202
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemotePersistEvent1.java270
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteTransactionEvent1.java159
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/RelationTypeSideSorterTest.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/order/RelationOrderDataTest.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java3678
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java65
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java539
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java61
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationEventType.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/ArtifactRelationOrderAccessor.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationOrderAccessor.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java27
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java46
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorerEventManager.java31
29 files changed, 3075 insertions, 2973 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ReviewSMArtifact.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ReviewSMArtifact.java
index 1d4be0d20c6..1caad8630c0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ReviewSMArtifact.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ReviewSMArtifact.java
@@ -49,7 +49,9 @@ public abstract class ReviewSMArtifact extends TaskableStateMachineArtifact {
private Collection<UserRole> preSaveReviewRoleComplete;
Boolean standAlone = null;
public static enum ReviewBlockType {
- None, Transition, Commit
+ None,
+ Transition,
+ Commit
};
public ReviewSMArtifact(ArtifactFactory parentFactory, String guid, String humanReadableId, Branch branch, ArtifactType artifactType) throws OseeDataStoreException {
@@ -65,7 +67,9 @@ public abstract class ReviewSMArtifact extends TaskableStateMachineArtifact {
@Override
public Set<User> getPrivilegedUsers() throws OseeCoreException {
Set<User> users = new HashSet<User>();
- if (getParentTeamWorkflow() != null) users.addAll(getParentTeamWorkflow().getPrivilegedUsers());
+ if (getParentTeamWorkflow() != null) {
+ users.addAll(getParentTeamWorkflow().getPrivilegedUsers());
+ }
for (ActionableItemArtifact aia : getActionableItemsDam().getActionableItems()) {
for (TeamDefinitionArtifact teamDef : aia.getImpactedTeamDefs()) {
addPriviledgedUsersUpTeamDefinitionTree(teamDef, users);
@@ -78,7 +82,7 @@ public abstract class ReviewSMArtifact extends TaskableStateMachineArtifact {
}
@Override
- public void onAttributePersist(SkynetTransaction transaction) throws OseeCoreException {
+ public void onAttributePersist(SkynetTransaction transaction) {
super.onAttributePersist(transaction);
// Since multiple ways exist to change the assignees, notification is performed on the persist
if (isDeleted()) {
@@ -197,16 +201,24 @@ public abstract class ReviewSMArtifact extends TaskableStateMachineArtifact {
@Override
public StateMachineArtifact getParentSMA() throws OseeCoreException {
- if (isStandAloneReview()) return null;
- if (parentSma != null) return parentSma;
+ if (isStandAloneReview()) {
+ return null;
+ }
+ if (parentSma != null) {
+ return parentSma;
+ }
parentSma = getParentTeamWorkflow();
return parentSma;
}
@Override
public ActionArtifact getParentActionArtifact() throws OseeCoreException {
- if (isStandAloneReview()) return null;
- if (parentAction != null) return parentAction;
+ if (isStandAloneReview()) {
+ return null;
+ }
+ if (parentAction != null) {
+ return parentAction;
+ }
parentTeamArt = getParentTeamWorkflow();
if (parentTeamArt != null) {
parentAction = parentTeamArt.getParentActionArtifact();
@@ -216,16 +228,20 @@ public abstract class ReviewSMArtifact extends TaskableStateMachineArtifact {
@Override
public TeamWorkFlowArtifact getParentTeamWorkflow() throws OseeCoreException {
- if (isStandAloneReview()) return null;
- if (parentTeamArt != null) return parentTeamArt;
+ if (isStandAloneReview()) {
+ return null;
+ }
+ if (parentTeamArt != null) {
+ return parentTeamArt;
+ }
List<TeamWorkFlowArtifact> teams =
- getRelatedArtifacts(AtsRelationTypes.TeamWorkflowToReview_Team, TeamWorkFlowArtifact.class);
+ getRelatedArtifacts(AtsRelationTypes.TeamWorkflowToReview_Team, TeamWorkFlowArtifact.class);
if (teams.size() > 1) {
OseeLog.log(AtsPlugin.class, Level.SEVERE,
- getArtifactTypeName() + " " + getHumanReadableId() + " has multiple parent workflows");
+ getArtifactTypeName() + " " + getHumanReadableId() + " has multiple parent workflows");
} else if (!isStandAloneReview() && teams.isEmpty()) {
OseeLog.log(AtsPlugin.class, Level.SEVERE,
- getArtifactTypeName() + " " + getHumanReadableId() + " has no parent workflow");
+ getArtifactTypeName() + " " + getHumanReadableId() + " has no parent workflow");
}
if (teams.size() > 0) {
parentTeamArt = teams.iterator().next();
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java
index a270e86bb6b..4b8b89340f2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java
@@ -102,7 +102,8 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
private static final AtsStateItems stateItems = new AtsStateItems();
private boolean inTransition = false;
public static enum TransitionOption {
- None, Persist,
+ None,
+ Persist,
// Override check whether workflow allows transition to state
OverrideTransitionValidityCheck,
// Allows transition to occur with UnAssigned, OseeSystem or Guest
@@ -226,7 +227,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
}
@Override
- public void onAttributePersist(SkynetTransaction transaction) throws OseeCoreException {
+ public void onAttributePersist(SkynetTransaction transaction) {
// Since multiple ways exist to change the assignees, notification is performed on the persist
if (isDeleted()) {
return;
@@ -360,6 +361,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return getWorldViewType() + ": " + getName();
}
+ @Override
public String getWorldViewActionableItems() throws OseeCoreException {
return "";
}
@@ -371,6 +373,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
atsWorldRelations.add(side);
}
+ @Override
public Image getAssigneeImage() throws OseeCoreException {
if (isDeleted()) {
return null;
@@ -389,6 +392,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return workFlowDefinition;
}
+ @Override
public void addSubscribed(User user, SkynetTransaction transaction) throws OseeCoreException {
if (!getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User).contains(user)) {
addRelation(AtsRelationTypes.SubscribedUser_User, user);
@@ -397,15 +401,18 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
}
+ @Override
public void removeSubscribed(User user, SkynetTransaction transaction) throws OseeCoreException {
deleteRelation(AtsRelationTypes.SubscribedUser_User, user);
persist(transaction);
}
+ @Override
public boolean isSubscribed(User user) throws OseeCoreException {
return getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User).contains(user);
}
+ @Override
public ArrayList<User> getSubscribed() throws OseeCoreException {
ArrayList<User> arts = new ArrayList<User>();
for (Artifact art : getRelatedArtifacts(AtsRelationTypes.SubscribedUser_User)) {
@@ -414,6 +421,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return arts;
}
+ @Override
public void addFavorite(User user, SkynetTransaction transaction) throws OseeCoreException {
if (!getRelatedArtifacts(AtsRelationTypes.FavoriteUser_User).contains(user)) {
addRelation(AtsRelationTypes.FavoriteUser_User, user);
@@ -421,15 +429,18 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
}
}
+ @Override
public void removeFavorite(User user, SkynetTransaction transaction) throws OseeCoreException {
deleteRelation(AtsRelationTypes.FavoriteUser_User, user);
persist(transaction);
}
+ @Override
public boolean isFavorite(User user) throws OseeCoreException {
return getRelatedArtifacts(AtsRelationTypes.FavoriteUser_User).contains(user);
}
+ @Override
public ArrayList<User> getFavorites() throws OseeCoreException {
ArrayList<User> arts = new ArrayList<User>();
for (Artifact art : getRelatedArtifacts(AtsRelationTypes.FavoriteUser_User)) {
@@ -438,6 +449,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return arts;
}
+ @Override
public boolean amISubscribed() {
try {
return isSubscribed(UserManager.getUser());
@@ -446,6 +458,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
}
}
+ @Override
public boolean amIFavorite() {
try {
return isFavorite(UserManager.getUser());
@@ -460,20 +473,24 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
super.atsDelete(deleteArts, allRelated);
}
+ @Override
public String getWorldViewType() throws OseeCoreException {
return getArtifactTypeName();
}
+ @Override
public String getWorldViewTitle() throws OseeCoreException {
return getName();
}
+ @Override
public String getWorldViewState() throws OseeCoreException {
return getStateMgr().getCurrentStateName();
}
public String implementersStr = null;
+ @Override
public String getWorldViewActivePoc() throws OseeCoreException {
if (isCancelledOrCompleted()) {
if (implementersStr == null) {
@@ -486,6 +503,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return Artifacts.toString("; ", getStateMgr().getAssignees());
}
+ @Override
public String getWorldViewCreatedDateStr() throws OseeCoreException {
if (getWorldViewCreatedDate() == null) {
return XViewerCells.getCellExceptionString("No creation date");
@@ -493,6 +511,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return new XDate(getWorldViewCreatedDate()).getMMDDYYHHMM();
}
+ @Override
public String getWorldViewCompletedDateStr() throws OseeCoreException {
if (isCompleted()) {
if (getWorldViewCompletedDate() == null) {
@@ -504,6 +523,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public String getWorldViewCancelledDateStr() throws OseeCoreException {
if (isCancelled()) {
if (getWorldViewCancelledDate() == null) {
@@ -515,18 +535,22 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public Date getWorldViewCreatedDate() throws OseeCoreException {
return getLog().getCreationDate();
}
+ @Override
public String getWorldViewOriginator() throws OseeCoreException {
return getOriginator().getName();
}
+ @Override
public String getWorldViewID() throws OseeCoreException {
return getHumanReadableId();
}
+ @Override
public String getWorldViewLegacyPCR() throws OseeCoreException {
if (isAttributeTypeValid(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName())) {
return getSoleAttributeValue(ATSAttributes.LEGACY_PCR_ID_ATTRIBUTE.getStoreName(), "");
@@ -534,6 +558,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public Date getWorldViewCompletedDate() throws OseeCoreException {
LogItem item = getLog().getCompletedLogItem();
if (item != null) {
@@ -542,6 +567,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return null;
}
+ @Override
public Date getWorldViewCancelledDate() throws OseeCoreException {
LogItem item = getLog().getCancelledLogItem();
if (item != null) {
@@ -550,12 +576,15 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return null;
}
+ @Override
public abstract VersionArtifact getWorldViewTargetedVersion() throws OseeCoreException;
+ @Override
public ChangeType getWorldViewChangeType() throws OseeCoreException {
return ChangeType.None;
}
+ @Override
public String getWorldViewChangeTypeStr() throws OseeCoreException {
if (getWorldViewChangeType() == null || getWorldViewChangeType() == ChangeType.None) {
return "";
@@ -607,18 +636,22 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return getEstimatedHoursFromArtifact() + getEstimatedHoursFromTasks() + getEstimatedHoursFromReviews();
}
+ @Override
public double getWorldViewEstimatedHours() throws OseeCoreException {
return getEstimatedHoursTotal();
}
+ @Override
public String getWorldViewUserCommunity() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewPriority() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewResolution() throws OseeCoreException {
return getAttributesToString(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
}
@@ -658,6 +691,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return getRemainHoursTotal();
}
+ @Override
public Result isWorldViewRemainHoursValid() throws OseeCoreException {
if (!isAttributeTypeValid(ATSAttributes.ESTIMATED_HOURS_ATTRIBUTE.getStoreName())) {
return Result.TrueResult;
@@ -673,10 +707,11 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return Result.TrueResult;
} catch (Exception ex) {
return new Result(
- ex.getClass().getName() + ": " + ex.getLocalizedMessage() + "\n\n" + Lib.exceptionToString(ex));
+ ex.getClass().getName() + ": " + ex.getLocalizedMessage() + "\n\n" + Lib.exceptionToString(ex));
}
}
+ @Override
public Result isWorldViewManDaysNeededValid() throws OseeCoreException {
Result result = isWorldViewRemainHoursValid();
if (result.isFalse()) {
@@ -689,6 +724,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return Result.TrueResult;
}
+ @Override
public double getWorldViewManDaysNeeded() throws OseeCoreException {
double hrsRemain = getWorldViewRemainHours();
double manDaysNeeded = 0;
@@ -702,10 +738,12 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return DEFAULT_HOURS_PER_WORK_DAY;
}
+ @Override
public double getWorldViewAnnualCostAvoidance() throws OseeCoreException {
return 0;
}
+ @Override
public Result isWorldViewAnnualCostAvoidanceValid() throws OseeCoreException {
if (isAttributeTypeValid(ATSAttributes.WEEKLY_BENEFIT_ATTRIBUTE.getStoreName())) {
return Result.TrueResult;
@@ -734,6 +772,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return Result.TrueResult;
}
+ @Override
public String getWorldViewNotes() throws OseeCoreException {
return getSoleAttributeValue(ATSAttributes.SMA_NOTE_ATTRIBUTE.getStoreName(), "");
}
@@ -743,32 +782,39 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return getSoleAttributeValue(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName(), "");
}
+ @Override
public String getWorldViewPoint() throws OseeCoreException {
return getSoleAttributeValue(ATSAttributes.POINTS_ATTRIBUTE.getStoreName(), "");
}
+ @Override
public String getWorldViewNumeric1() throws OseeCoreException {
return AtsUtil.doubleToI18nString(getSoleAttributeValue(ATSAttributes.NUMERIC1_ATTRIBUTE.getStoreName(), 0.0),
- true);
+ true);
}
+ @Override
public String getWorldViewNumeric2() throws OseeCoreException {
return AtsUtil.doubleToI18nString(getSoleAttributeValue(ATSAttributes.NUMERIC2_ATTRIBUTE.getStoreName(), 0.0),
- true);
+ true);
}
+ @Override
public String getWorldViewGoalOrderVote() throws OseeCoreException {
return getSoleAttributeValue(ATSAttributes.GOAL_ORDER_VOTE_ATTRIBUTE.getStoreName(), "");
}
+ @Override
public String getWorldViewCategory() throws OseeCoreException {
return getSoleAttributeValue(ATSAttributes.CATEGORY_ATTRIBUTE.getStoreName(), "");
}
+ @Override
public String getWorldViewCategory2() throws OseeCoreException {
return getSoleAttributeValue(ATSAttributes.CATEGORY2_ATTRIBUTE.getStoreName(), "");
}
+ @Override
public String getWorldViewCategory3() throws OseeCoreException {
return getSoleAttributeValue(ATSAttributes.CATEGORY3_ATTRIBUTE.getStoreName(), "");
}
@@ -777,6 +823,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return getPercentCompleteSMAStateTotal(getStateMgr().getCurrentStateName());
}
+ @Override
public String getWorldViewNumberOfTasks() throws OseeCoreException {
if (!(this instanceof TaskableStateMachineArtifact)) {
return "";
@@ -788,6 +835,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return String.valueOf(num);
}
+ @Override
public String getWorldViewRelatedToState() throws OseeCoreException {
return "";
}
@@ -812,7 +860,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
for (Artifact artifact : artifacts) {
if (artifact.isDirty()) {
return new Result(true, String.format("Artifact [%s][%s] is dirty", artifact.getHumanReadableId(),
- artifact));
+ artifact));
}
}
} catch (Exception ex) {
@@ -881,6 +929,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return null;
}
+ @Override
public String getWorldViewEstimatedReleaseDateStr() throws OseeCoreException {
if (getWorldViewEstimatedReleaseDate() == null) {
return "";
@@ -888,6 +937,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return new XDate(getWorldViewEstimatedReleaseDate()).getMMDDYYHHMM();
}
+ @Override
public String getWorldViewEstimatedCompletionDateStr() throws OseeCoreException {
if (getWorldViewEstimatedCompletionDate() == null) {
return "";
@@ -895,8 +945,10 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return new XDate(getWorldViewEstimatedCompletionDate()).getMMDDYYHHMM();
}
+ @Override
public abstract Date getWorldViewReleaseDate() throws OseeCoreException;
+ @Override
public String getWorldViewReleaseDateStr() throws OseeCoreException {
if (getWorldViewReleaseDate() == null) {
return "";
@@ -913,10 +965,12 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
public void transitioned(WorkPageDefinition fromPage, WorkPageDefinition toPage, Collection<User> toAssignees, boolean persist, SkynetTransaction transaction) throws OseeCoreException {
}
+ @Override
public String getHyperName() {
return getName();
}
+ @Override
public String getHyperType() {
try {
return getArtifactTypeName();
@@ -925,6 +979,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
}
}
+ @Override
public String getHyperState() {
try {
return getStateMgr().getCurrentStateName();
@@ -934,6 +989,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public String getHyperAssignee() {
try {
return Artifacts.toString("; ", getStateMgr().getAssignees());
@@ -943,22 +999,27 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public Image getHyperAssigneeImage() throws OseeCoreException {
return getAssigneeImage();
}
+ @Override
public Artifact getHyperArtifact() {
return this;
}
+ @Override
public String getWorldViewDecision() throws OseeCoreException {
return "";
}
+ @Override
public Artifact getParentAtsArtifact() throws OseeCoreException {
return getParentSMA();
}
+ @Override
public String getWorldViewValidationRequiredStr() throws OseeCoreException {
if (isAttributeTypeValid(ATSAttributes.VALIDATION_REQUIRED_ATTRIBUTE.getStoreName())) {
return String.valueOf(getSoleAttributeValue(ATSAttributes.VALIDATION_REQUIRED_ATTRIBUTE.getStoreName(), false));
@@ -966,14 +1027,17 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public Result isWorldViewDeadlineAlerting() throws OseeCoreException {
return Result.FalseResult;
}
+ @Override
public int getWorldViewPercentRework() throws OseeCoreException {
return 0;
}
+ @Override
public String getWorldViewPercentReworkStr() throws OseeCoreException {
int reWork = getWorldViewPercentRework();
if (reWork == 0) {
@@ -1002,29 +1066,34 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
List<TeamWorkFlowArtifact> result = new ArrayList<TeamWorkFlowArtifact>();
for (IArtifactType artType : TeamWorkflowExtensions.getInstance().getAllTeamWorkflowArtifactTypes()) {
List<TeamWorkFlowArtifact> teamArts =
- org.eclipse.osee.framework.jdk.core.util.Collections.castAll(ArtifactQuery.getArtifactListFromType(
- artType, AtsUtil.getAtsBranch()));
+ org.eclipse.osee.framework.jdk.core.util.Collections.castAll(ArtifactQuery.getArtifactListFromType(artType,
+ AtsUtil.getAtsBranch()));
result.addAll(teamArts);
}
return result;
}
+ @Override
public String getWorldViewBranchStatus() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewReviewAuthor() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewReviewDecider() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewReviewModerator() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewReviewReviewer() throws OseeCoreException {
return "";
}
@@ -1163,9 +1232,9 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
// Log error if multiple of same rule found, but keep going
if (workRuleDefs.size() > 1) {
OseeLog.log(
- AtsPlugin.class,
- Level.SEVERE,
- "Team Definition has multiple rules of type " + AtsStatePercentCompleteWeightRule.ID + ". Only 1 allowed. Defaulting to first found.");
+ AtsPlugin.class,
+ Level.SEVERE,
+ "Team Definition has multiple rules of type " + AtsStatePercentCompleteWeightRule.ID + ". Only 1 allowed. Defaulting to first found.");
}
if (workRuleDefs.size() == 1) {
stateToWeight = AtsStatePercentCompleteWeightRule.getStateWeightMap(workRuleDefs.iterator().next());
@@ -1267,6 +1336,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return XDate.getDateStr(getLastModified(), XDate.MMDDYYHHMM);
}
+ @Override
public String getWorldViewLastStatused() throws OseeCoreException {
return XDate.getDateStr(getLog().getLastStatusedDate(), XDate.MMDDYYHHMM);
}
@@ -1275,18 +1345,22 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public String getWorldViewNumberOfReviewIssueDefects() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewNumberOfReviewMajorDefects() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewNumberOfReviewMinorDefects() throws OseeCoreException {
return "";
}
+ @Override
public String getWorldViewActionsIntiatingWorkflow() throws OseeCoreException {
return getParentActionArtifact().getWorldViewActionsIntiatingWorkflow();
}
@@ -1308,6 +1382,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return "";
}
+ @Override
public String getGroupExplorerName() throws OseeCoreException {
return String.format("[%s] %s", getStateMgr().getCurrentStateName(), getName());
}
@@ -1322,6 +1397,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return getParentActionArtifact().getWorldViewOriginatingWorkflows();
}
+ @Override
public String getWorldViewNumberOfTasksRemaining() throws OseeCoreException {
return "";
}
@@ -1396,7 +1472,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
try {
return ((TeamWorkFlowArtifact) this).getTeamDefinition().isTeamUsesVersions();
} catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
return false;
}
}
@@ -1413,7 +1489,9 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
if (this instanceof ReviewSMArtifact) {
teamArt = ((ReviewSMArtifact) this).getParentTeamWorkflow();
}
- if (teamArt == null) return false;
+ if (teamArt == null) {
+ return false;
+ }
try {
return teamArt.getTeamDefinition().hasWorkRule(ruleId);
} catch (Exception ex) {
@@ -1533,29 +1611,29 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
public Result transitionToCancelled(String reason, SkynetTransaction transaction, TransitionOption... transitionOption) {
Result result =
- transition(DefaultTeamState.Cancelled.name(), Arrays.asList(new User[] {}), reason, transaction,
- transitionOption);
+ transition(DefaultTeamState.Cancelled.name(), Arrays.asList(new User[] {}), reason, transaction,
+ transitionOption);
return result;
}
public Result transitionToCompleted(String reason, SkynetTransaction transaction, TransitionOption... transitionOption) {
Result result =
- transition(DefaultTeamState.Completed.name(), Arrays.asList(new User[] {}), reason, transaction,
- transitionOption);
+ transition(DefaultTeamState.Completed.name(), Arrays.asList(new User[] {}), reason, transaction,
+ transitionOption);
return result;
}
public Result isTransitionValid(final String toStateName, final Collection<User> toAssignees, TransitionOption... transitionOption) throws OseeCoreException {
boolean overrideTransitionCheck =
- org.eclipse.osee.framework.jdk.core.util.Collections.getAggregate(transitionOption).contains(
- TransitionOption.OverrideTransitionValidityCheck);
+ org.eclipse.osee.framework.jdk.core.util.Collections.getAggregate(transitionOption).contains(
+ TransitionOption.OverrideTransitionValidityCheck);
boolean overrideAssigneeCheck =
- org.eclipse.osee.framework.jdk.core.util.Collections.getAggregate(transitionOption).contains(
- TransitionOption.OverrideAssigneeCheck);
+ org.eclipse.osee.framework.jdk.core.util.Collections.getAggregate(transitionOption).contains(
+ TransitionOption.OverrideAssigneeCheck);
// Validate assignees
if (!overrideAssigneeCheck && (getStateMgr().getAssignees().contains(UserManager.getUser(SystemUser.OseeSystem)) || getStateMgr().getAssignees().contains(
- UserManager.getUser(SystemUser.Guest)) || getStateMgr().getAssignees().contains(
- UserManager.getUser(SystemUser.UnAssigned)))) {
+ UserManager.getUser(SystemUser.Guest)) || getStateMgr().getAssignees().contains(
+ UserManager.getUser(SystemUser.UnAssigned)))) {
return new Result("Can not transition with \"Guest\", \"UnAssigned\" or \"OseeSystem\" user as assignee.");
}
@@ -1568,9 +1646,9 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
// Validate transition from fromPage to toPage
if (!overrideTransitionCheck && !getWorkFlowDefinition().getToPages(fromWorkPageDefinition).contains(
- toWorkPageDefinition)) {
+ toWorkPageDefinition)) {
String errStr =
- "Not configured to transition to \"" + toStateName + "\" from \"" + fromWorkPageDefinition.getPageName() + "\"";
+ "Not configured to transition to \"" + toStateName + "\" from \"" + fromWorkPageDefinition.getPageName() + "\"";
OseeLog.log(AtsPlugin.class, Level.SEVERE, errStr);
return new Result(errStr);
}
@@ -1623,8 +1701,8 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
private Result transition(final String toStateName, final Collection<User> toAssignees, final String completeOrCancelReason, SkynetTransaction transaction, TransitionOption... transitionOption) {
try {
final boolean persist =
- org.eclipse.osee.framework.jdk.core.util.Collections.getAggregate(transitionOption).contains(
- TransitionOption.Persist);
+ org.eclipse.osee.framework.jdk.core.util.Collections.getAggregate(transitionOption).contains(
+ TransitionOption.Persist);
Result result = isTransitionValid(toStateName, toAssignees, transitionOption);
if (result.isFalse()) {
@@ -1635,7 +1713,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
final WorkPageDefinition toWorkPageDefinition = getWorkPageDefinitionByName(toStateName);
transitionHelper(toAssignees, persist, fromWorkPageDefinition, toWorkPageDefinition, toStateName,
- completeOrCancelReason, transaction);
+ completeOrCancelReason, transaction);
if (persist) {
OseeNotificationManager.getInstance().sendNotifications();
}
@@ -1652,7 +1730,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
atsLog.addLog(LogType.StateCancelled, stateMgr.getCurrentStateName(), completeOrCancelReason);
} else {
atsLog.addLog(LogType.StateComplete, stateMgr.getCurrentStateName(),
- (completeOrCancelReason != null ? completeOrCancelReason : ""));
+ (completeOrCancelReason != null ? completeOrCancelReason : ""));
}
atsLog.addLog(LogType.StateEntered, toStateName, "");
@@ -1663,7 +1741,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
}
AtsNotifyUsers.getInstance().notify(this, AtsNotifyUsers.NotifyType.Subscribed,
- AtsNotifyUsers.NotifyType.Completed, AtsNotifyUsers.NotifyType.Completed);
+ AtsNotifyUsers.NotifyType.Completed, AtsNotifyUsers.NotifyType.Completed);
// Persist
if (persist) {
@@ -1717,6 +1795,7 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
return this instanceof TaskArtifact;
}
+ @Override
public String getWorldViewGoalOrder() throws OseeCoreException {
return GoalArtifact.getGoalOrder(this);
}
@@ -1735,11 +1814,11 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IGroup
for (WorkPageDefinition workPageDefinition : getWorkFlowDefinition().getPagesOrdered()) {
try {
AtsWorkPage atsWorkPage =
- new AtsWorkPage(getWorkFlowDefinition(), workPageDefinition, null,
- ATSXWidgetOptionResolver.getInstance());
+ new AtsWorkPage(getWorkFlowDefinition(), workPageDefinition, null,
+ ATSXWidgetOptionResolver.getInstance());
atsWorkPages.add(atsWorkPage);
} catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
}
}
return atsWorkPages;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java
index 83053005175..1313ab362c1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/AtsWorkflowConfigEditor.java
@@ -274,7 +274,7 @@ public class AtsWorkflowConfigEditor extends GraphicalEditorWithFlyoutPalette im
pageShape.setLocation(new Point(50, yLoc += 90));
}
pageShape.setStartPage(startPage.getId().equals(pageShape.getId()) || pageShape.getId().endsWith(
- startPage.getId()));
+ startPage.getId()));
diagram.addChild(pageShape);
}
@@ -282,7 +282,7 @@ public class AtsWorkflowConfigEditor extends GraphicalEditorWithFlyoutPalette im
for (WorkPageDefinition workPageDefinition : workflowDef.getPagesOrdered()) {
WorkPageShape pageShape = getWorkPageShape(workPageDefinition);
AtsWorkPage atsWorkPage =
- new AtsWorkPage(workflowDef, workPageDefinition, null, ATSXWidgetOptionResolver.getInstance());
+ new AtsWorkPage(workflowDef, workPageDefinition, null, ATSXWidgetOptionResolver.getInstance());
// Handle to pages
Set<WorkPageDefinition> toPages = new HashSet<WorkPageDefinition>();
toPages.addAll(atsWorkPage.getToPages());
@@ -322,7 +322,7 @@ public class AtsWorkflowConfigEditor extends GraphicalEditorWithFlyoutPalette im
for (Object object : getModel().getChildren()) {
if (object instanceof WorkPageShape) {
if (((WorkPageShape) object).getId().equals(page.getId()) || (page.getParentId() != null && ((WorkPageShape) object).getId().equals(
- page.getParentId()))) {
+ page.getParentId()))) {
return (WorkPageShape) object;
}
}
@@ -352,10 +352,10 @@ public class AtsWorkflowConfigEditor extends GraphicalEditorWithFlyoutPalette im
getViewer().setEditPartFactory(new ShapesTreeEditPartFactory());
// configure & add context menu to viewer
ContextMenuProvider cmProvider =
- new AtsWorkflowConfigEditorContextMenuProvider(getViewer(), getActionRegistry());
+ new AtsWorkflowConfigEditorContextMenuProvider(getViewer(), getActionRegistry());
getViewer().setContextMenu(cmProvider);
getSite().registerContextMenu("org.eclipse.osee.ats.config.editor.contextmenu", cmProvider,
- getSite().getSelectionProvider());
+ getSite().getSelectionProvider());
// hook outline viewer
getSelectionSynchronizer().addViewer(getViewer());
// initialize outline viewer with model
@@ -427,18 +427,14 @@ public class AtsWorkflowConfigEditor extends GraphicalEditorWithFlyoutPalette im
@Override
public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- try {
- for (Artifact delArt : artifactEvent.getCacheArtifacts(EventModType.Deleted)) {
- if (delArt.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
- if (delArt.getName().equals(getPartName())) {
- closeEditor();
- }
+ for (Artifact delArt : artifactEvent.getCacheArtifacts(EventModType.Deleted)) {
+ if (delArt.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
+ if (delArt.getName().equals(getPartName())) {
+ closeEditor();
}
}
- System.out.println("Add refresh of editor if workflow mod");
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE, ex);
}
+ System.out.println("Add refresh of editor if workflow mod");
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidRelationReorder.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidRelationReorder.java
new file mode 100644
index 00000000000..58aa6279c05
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidRelationReorder.java
@@ -0,0 +1,118 @@
+/*
+ * Created on Jul 21, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.core.model.event;
+
+import org.eclipse.osee.framework.core.data.IRelationType;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefaultBasicGuidRelationReorder implements IBasicRelationReorder {
+
+ private DefaultBasicGuidArtifact parentArt;
+ private String branchGuid;
+ private String relTypeGuid;
+ private RelationOrderModType modType;
+
+ public DefaultBasicGuidRelationReorder(RelationOrderModType modType, String branchGuid, String relTypeGuid, DefaultBasicGuidArtifact artA) {
+ this.modType = modType;
+ this.branchGuid = branchGuid;
+ this.relTypeGuid = relTypeGuid;
+ this.parentArt = artA;
+ }
+
+ @Override
+ public DefaultBasicGuidArtifact getParentArt() {
+ return parentArt;
+ }
+
+ @Override
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
+ @Override
+ public String getRelTypeGuid() {
+ return relTypeGuid;
+ }
+
+ public void setArtA(DefaultBasicGuidArtifact artA) {
+ this.parentArt = artA;
+ }
+
+ public void setBranchGuid(String branchGuid) {
+ this.branchGuid = branchGuid;
+ }
+
+ public void setRelTypeGuid(String relTypeGuid) {
+ this.relTypeGuid = relTypeGuid;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((parentArt == null) ? 0 : parentArt.hashCode());
+ result = prime * result + ((branchGuid == null) ? 0 : branchGuid.hashCode());
+ result = prime * result + ((relTypeGuid == null) ? 0 : relTypeGuid.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ IBasicRelationReorder other = (IBasicRelationReorder) obj;
+ if (parentArt == null) {
+ if (other.getParentArt() != null) {
+ return false;
+ }
+ } else if (!parentArt.equals(other.getParentArt())) {
+ return false;
+ }
+ if (branchGuid == null) {
+ if (other.getBranchGuid() != null) {
+ return false;
+ }
+ } else if (!branchGuid.equals(other.getBranchGuid())) {
+ return false;
+ }
+ if (relTypeGuid == null) {
+ if (other.getRelTypeGuid() != null) {
+ return false;
+ }
+ } else if (!relTypeGuid.equals(other.getRelTypeGuid())) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean is(IRelationType... relationTypes) {
+ for (IRelationType relType : relationTypes) {
+ if (relType.getGuid().equals(getRelTypeGuid())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public RelationOrderModType getModType() {
+ return modType;
+ }
+
+ public void setModType(RelationOrderModType modType) {
+ this.modType = modType;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/IBasicRelationReorder.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/IBasicRelationReorder.java
new file mode 100644
index 00000000000..da389cfa789
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/IBasicRelationReorder.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.model.event;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IBasicRelationReorder {
+
+ DefaultBasicGuidArtifact getParentArt();
+
+ String getRelTypeGuid();
+
+ String getBranchGuid();
+
+ RelationOrderModType getModType();
+}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/RelationOrderModType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/RelationOrderModType.java
new file mode 100644
index 00000000000..0802038cc34
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/RelationOrderModType.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.model.event;
+
+public enum RelationOrderModType {
+ Default("AFRkIhe6hTMJL8pL4IAA"), Absolute("AFRkIhftz3PrR0yVYqwA");
+
+ private final String guid;
+
+ private RelationOrderModType(String guid) {
+ this.guid = guid;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public static RelationOrderModType getType(String guid) {
+ for (RelationOrderModType type : values()) {
+ if (type.guid.equals(guid)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+};
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/jaxb/resMessages.xsd b/plugins/org.eclipse.osee.framework.messaging.event.res/jaxb/resMessages.xsd
index 0f8ebca8a34..c0ab2c027d3 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/jaxb/resMessages.xsd
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/jaxb/resMessages.xsd
@@ -27,6 +27,7 @@
<xsd:element name="transactionId" type="xsd:int"/>
<xsd:element name="artifacts" type="RemoteBasicGuidArtifact1" maxOccurs="unbounded" minOccurs="1"/>
<xsd:element name="relations" type="RemoteBasicGuidRelation1" maxOccurs="unbounded" minOccurs="1"/>
+ <xsd:element name="relationReorders" type="RemoteBasicGuidRelationReorder1" maxOccurs="unbounded" minOccurs="1"/>
<xsd:element name="networkSender" type="RemoteNetworkSender1" maxOccurs="1" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
@@ -92,6 +93,16 @@
</xsd:complexType>
+<xsd:complexType name="RemoteBasicGuidRelationReorder1">
+ <xsd:sequence>
+ <xsd:element name="modTypeGuid" type="xsd:string"/>
+ <xsd:element name="branchGuid" type="xsd:string"/>
+ <xsd:element name="relTypeGuid" type="xsd:string"/>
+ <xsd:element name="parentArt" type="RemoteBasicGuidArtifact1" maxOccurs="1" minOccurs="1"/>
+ </xsd:sequence>
+
+</xsd:complexType>
+
<xsd:complexType name="RemoteAttributeChange1">
<xsd:sequence>
<xsd:element name="attrTypeGuid" type="xsd:string"/>
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/ObjectFactory.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/ObjectFactory.java
deleted file mode 100644
index c3b83ce606f..00000000000
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/ObjectFactory.java
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.05.28 at 02:08:30 PM MST
-//
-
-
-package org.eclipse.osee.framework.messaging.event.res.msgs;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.eclipse.osee.framework.messaging.event.res.msgs package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.eclipse.osee.framework.messaging.event.res.msgs
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link RemoteBranchEvent1 }
- *
- */
- public RemoteBranchEvent1 createRemoteBranchEvent1() {
- return new RemoteBranchEvent1();
- }
-
- /**
- * Create an instance of {@link RemoteBasicGuidArtifact1 }
- *
- */
- public RemoteBasicGuidArtifact1 createRemoteBasicGuidArtifact1() {
- return new RemoteBasicGuidArtifact1();
- }
-
- /**
- * Create an instance of {@link RemoteNetworkSender1 }
- *
- */
- public RemoteNetworkSender1 createRemoteNetworkSender1() {
- return new RemoteNetworkSender1();
- }
-
- /**
- * Create an instance of {@link RemoteBroadcastEvent1 }
- *
- */
- public RemoteBroadcastEvent1 createRemoteBroadcastEvent1() {
- return new RemoteBroadcastEvent1();
- }
-
- /**
- * Create an instance of {@link RemoteTransactionEvent1 }
- *
- */
- public RemoteTransactionEvent1 createRemoteTransactionEvent1() {
- return new RemoteTransactionEvent1();
- }
-
- /**
- * Create an instance of {@link RemoteAttributeChange1 }
- *
- */
- public RemoteAttributeChange1 createRemoteAttributeChange1() {
- return new RemoteAttributeChange1();
- }
-
- /**
- * Create an instance of {@link RemoteTransactionChange1 }
- *
- */
- public RemoteTransactionChange1 createRemoteTransactionChange1() {
- return new RemoteTransactionChange1();
- }
-
- /**
- * Create an instance of {@link RemoteBasicGuidRelation1 }
- *
- */
- public RemoteBasicGuidRelation1 createRemoteBasicGuidRelation1() {
- return new RemoteBasicGuidRelation1();
- }
-
- /**
- * Create an instance of {@link RemotePersistEvent1 }
- *
- */
- public RemotePersistEvent1 createRemotePersistEvent1() {
- return new RemotePersistEvent1();
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteAccessControlEvent1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteAccessControlEvent1.java
index dfd8a5a1199..557802c6a87 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteAccessControlEvent1.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteAccessControlEvent1.java
@@ -5,7 +5,6 @@
// Generated on: 2010.06.04 at 10:11:33 AM MST
//
-
package org.eclipse.osee.framework.messaging.event.res.msgs;
import java.util.ArrayList;
@@ -16,11 +15,11 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
-
/**
- * <p>Java class for RemoteAccessControlEvent1 complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * Java class for RemoteAccessControlEvent1 complex type.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="RemoteAccessControlEvent1">
@@ -35,101 +34,75 @@ import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "RemoteAccessControlEvent1", propOrder = {
- "eventTypeGuid",
- "artifacts",
- "networkSender"
-})
-public class RemoteAccessControlEvent1
- extends RemoteEvent
-{
+@XmlType(name = "RemoteAccessControlEvent1", propOrder = {"eventTypeGuid", "artifacts", "networkSender"})
+public class RemoteAccessControlEvent1 extends RemoteEvent {
- @XmlElement(required = true)
- protected String eventTypeGuid;
- @XmlElement(required = true)
- protected List<RemoteBasicGuidArtifact1> artifacts;
- @XmlElement(required = true)
- protected RemoteNetworkSender1 networkSender;
+ @XmlElement(required = true)
+ protected String eventTypeGuid;
+ @XmlElement(required = true)
+ protected List<RemoteBasicGuidArtifact1> artifacts;
+ @XmlElement(required = true)
+ protected RemoteNetworkSender1 networkSender;
- /**
- * Gets the value of the eventTypeGuid property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getEventTypeGuid() {
- return eventTypeGuid;
- }
+ /**
+ * Gets the value of the eventTypeGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getEventTypeGuid() {
+ return eventTypeGuid;
+ }
- /**
- * Sets the value of the eventTypeGuid property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setEventTypeGuid(String value) {
- this.eventTypeGuid = value;
- }
+ /**
+ * Sets the value of the eventTypeGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setEventTypeGuid(String value) {
+ this.eventTypeGuid = value;
+ }
- /**
- * Gets the value of the artifacts property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the artifacts property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getArtifacts().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link RemoteBasicGuidArtifact1 }
- *
- *
- */
- public List<RemoteBasicGuidArtifact1> getArtifacts() {
- if (artifacts == null) {
- artifacts = new ArrayList<RemoteBasicGuidArtifact1>();
- }
- return this.artifacts;
- }
+ /**
+ * Gets the value of the artifacts property.
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
+ * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
+ * the artifacts property.
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getArtifacts().add(newItem);
+ * </pre>
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link RemoteBasicGuidArtifact1 }
+ */
+ public List<RemoteBasicGuidArtifact1> getArtifacts() {
+ if (artifacts == null) {
+ artifacts = new ArrayList<RemoteBasicGuidArtifact1>();
+ }
+ return this.artifacts;
+ }
- /**
- * Gets the value of the networkSender property.
- *
- * @return
- * possible object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public RemoteNetworkSender1 getNetworkSender() {
- return networkSender;
- }
+ /**
+ * Gets the value of the networkSender property.
+ *
+ * @return possible object is {@link RemoteNetworkSender1 }
+ */
+ @Override
+ public RemoteNetworkSender1 getNetworkSender() {
+ return networkSender;
+ }
- /**
- * Sets the value of the networkSender property.
- *
- * @param value
- * allowed object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public void setNetworkSender(RemoteNetworkSender1 value) {
- this.networkSender = value;
- }
+ /**
+ * Sets the value of the networkSender property.
+ *
+ * @param value allowed object is {@link RemoteNetworkSender1 }
+ */
+ public void setNetworkSender(RemoteNetworkSender1 value) {
+ this.networkSender = value;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidRelationReorder1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidRelationReorder1.java
new file mode 100644
index 00000000000..067cee3737a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidRelationReorder1.java
@@ -0,0 +1,122 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2010.07.23 at 07:00:27 AM MST
+//
+
+package org.eclipse.osee.framework.messaging.event.res.msgs;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
+
+/**
+ * <p>
+ * Java class for RemoteBasicGuidRelationReorder1 complex type.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="RemoteBasicGuidRelationReorder1">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="modTypeGuid" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="branchGuid" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="relTypeGuid" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="parentArt" type="{}RemoteBasicGuidArtifact1"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "RemoteBasicGuidRelationReorder1", propOrder = {"modTypeGuid", "branchGuid", "relTypeGuid", "parentArt"})
+public class RemoteBasicGuidRelationReorder1 extends RemoteEvent {
+
+ @XmlElement(required = true)
+ protected String modTypeGuid;
+ @XmlElement(required = true)
+ protected String branchGuid;
+ @XmlElement(required = true)
+ protected String relTypeGuid;
+ @XmlElement(required = true)
+ protected RemoteBasicGuidArtifact1 parentArt;
+
+ /**
+ * Gets the value of the modTypeGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getModTypeGuid() {
+ return modTypeGuid;
+ }
+
+ /**
+ * Sets the value of the modTypeGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setModTypeGuid(String value) {
+ this.modTypeGuid = value;
+ }
+
+ /**
+ * Gets the value of the branchGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
+ /**
+ * Sets the value of the branchGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setBranchGuid(String value) {
+ this.branchGuid = value;
+ }
+
+ /**
+ * Gets the value of the relTypeGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getRelTypeGuid() {
+ return relTypeGuid;
+ }
+
+ /**
+ * Sets the value of the relTypeGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setRelTypeGuid(String value) {
+ this.relTypeGuid = value;
+ }
+
+ /**
+ * Gets the value of the parentArt property.
+ *
+ * @return possible object is {@link RemoteBasicGuidArtifact1 }
+ */
+ public RemoteBasicGuidArtifact1 getParentArt() {
+ return parentArt;
+ }
+
+ /**
+ * Sets the value of the parentArt property.
+ *
+ * @param value allowed object is {@link RemoteBasicGuidArtifact1 }
+ */
+ public void setParentArt(RemoteBasicGuidArtifact1 value) {
+ this.parentArt = value;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBranchEvent1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBranchEvent1.java
index 55df3472453..eaa676215bc 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBranchEvent1.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBranchEvent1.java
@@ -5,7 +5,6 @@
// Generated on: 2010.05.28 at 09:30:30 AM MST
//
-
package org.eclipse.osee.framework.messaging.event.res.msgs;
import javax.xml.bind.annotation.XmlAccessType;
@@ -14,11 +13,11 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
-
/**
- * <p>Java class for RemoteBranchEvent1 complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * Java class for RemoteBranchEvent1 complex type.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="RemoteBranchEvent1">
@@ -33,96 +32,71 @@ import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "RemoteBranchEvent1", propOrder = {
- "eventTypeGuid",
- "branchGuid",
- "networkSender"
-})
-public class RemoteBranchEvent1
- extends RemoteEvent
-{
+@XmlType(name = "RemoteBranchEvent1", propOrder = {"eventTypeGuid", "branchGuid", "networkSender"})
+public class RemoteBranchEvent1 extends RemoteEvent {
- @XmlElement(required = true)
- protected String eventTypeGuid;
- @XmlElement(required = true)
- protected String branchGuid;
- @XmlElement(required = true)
- protected RemoteNetworkSender1 networkSender;
+ @XmlElement(required = true)
+ protected String eventTypeGuid;
+ @XmlElement(required = true)
+ protected String branchGuid;
+ @XmlElement(required = true)
+ protected RemoteNetworkSender1 networkSender;
- /**
- * Gets the value of the eventTypeGuid property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getEventTypeGuid() {
- return eventTypeGuid;
- }
+ /**
+ * Gets the value of the eventTypeGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getEventTypeGuid() {
+ return eventTypeGuid;
+ }
- /**
- * Sets the value of the eventTypeGuid property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setEventTypeGuid(String value) {
- this.eventTypeGuid = value;
- }
+ /**
+ * Sets the value of the eventTypeGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setEventTypeGuid(String value) {
+ this.eventTypeGuid = value;
+ }
- /**
- * Gets the value of the branchGuid property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getBranchGuid() {
- return branchGuid;
- }
+ /**
+ * Gets the value of the branchGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getBranchGuid() {
+ return branchGuid;
+ }
- /**
- * Sets the value of the branchGuid property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setBranchGuid(String value) {
- this.branchGuid = value;
- }
+ /**
+ * Sets the value of the branchGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setBranchGuid(String value) {
+ this.branchGuid = value;
+ }
- /**
- * Gets the value of the networkSender property.
- *
- * @return
- * possible object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public RemoteNetworkSender1 getNetworkSender() {
- return networkSender;
- }
+ /**
+ * Gets the value of the networkSender property.
+ *
+ * @return possible object is {@link RemoteNetworkSender1 }
+ */
+ @Override
+ public RemoteNetworkSender1 getNetworkSender() {
+ return networkSender;
+ }
- /**
- * Sets the value of the networkSender property.
- *
- * @param value
- * allowed object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public void setNetworkSender(RemoteNetworkSender1 value) {
- this.networkSender = value;
- }
+ /**
+ * Sets the value of the networkSender property.
+ *
+ * @param value allowed object is {@link RemoteNetworkSender1 }
+ */
+ public void setNetworkSender(RemoteNetworkSender1 value) {
+ this.networkSender = value;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBroadcastEvent1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBroadcastEvent1.java
index ae57d82a0c9..4e03bc594c0 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBroadcastEvent1.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBroadcastEvent1.java
@@ -5,7 +5,6 @@
// Generated on: 2010.05.13 at 02:00:51 PM MST
//
-
package org.eclipse.osee.framework.messaging.event.res.msgs;
import java.util.ArrayList;
@@ -16,11 +15,11 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
-
/**
- * <p>Java class for RemoteBroadcastEvent1 complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * Java class for RemoteBroadcastEvent1 complex type.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="RemoteBroadcastEvent1">
@@ -36,128 +35,95 @@ import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "RemoteBroadcastEvent1", propOrder = {
- "eventTypeGuid",
- "userIds",
- "message",
- "networkSender"
-})
-public class RemoteBroadcastEvent1
- extends RemoteEvent
-{
+@XmlType(name = "RemoteBroadcastEvent1", propOrder = {"eventTypeGuid", "userIds", "message", "networkSender"})
+public class RemoteBroadcastEvent1 extends RemoteEvent {
- @XmlElement(required = true)
- protected String eventTypeGuid;
- @XmlElement(required = true)
- protected List<String> userIds;
- @XmlElement(required = true)
- protected String message;
- @XmlElement(required = true)
- protected RemoteNetworkSender1 networkSender;
+ @XmlElement(required = true)
+ protected String eventTypeGuid;
+ @XmlElement(required = true)
+ protected List<String> userIds;
+ @XmlElement(required = true)
+ protected String message;
+ @XmlElement(required = true)
+ protected RemoteNetworkSender1 networkSender;
- /**
- * Gets the value of the eventTypeGuid property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getEventTypeGuid() {
- return eventTypeGuid;
- }
+ /**
+ * Gets the value of the eventTypeGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getEventTypeGuid() {
+ return eventTypeGuid;
+ }
- /**
- * Sets the value of the eventTypeGuid property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setEventTypeGuid(String value) {
- this.eventTypeGuid = value;
- }
+ /**
+ * Sets the value of the eventTypeGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setEventTypeGuid(String value) {
+ this.eventTypeGuid = value;
+ }
- /**
- * Gets the value of the userIds property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the userIds property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getUserIds().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
- *
- *
- */
- public List<String> getUserIds() {
- if (userIds == null) {
- userIds = new ArrayList<String>();
- }
- return this.userIds;
- }
+ /**
+ * Gets the value of the userIds property.
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
+ * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
+ * the userIds property.
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getUserIds().add(newItem);
+ * </pre>
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link String }
+ */
+ public List<String> getUserIds() {
+ if (userIds == null) {
+ userIds = new ArrayList<String>();
+ }
+ return this.userIds;
+ }
- /**
- * Gets the value of the message property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessage() {
- return message;
- }
+ /**
+ * Gets the value of the message property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getMessage() {
+ return message;
+ }
- /**
- * Sets the value of the message property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessage(String value) {
- this.message = value;
- }
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setMessage(String value) {
+ this.message = value;
+ }
- /**
- * Gets the value of the networkSender property.
- *
- * @return
- * possible object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public RemoteNetworkSender1 getNetworkSender() {
- return networkSender;
- }
+ /**
+ * Gets the value of the networkSender property.
+ *
+ * @return possible object is {@link RemoteNetworkSender1 }
+ */
+ @Override
+ public RemoteNetworkSender1 getNetworkSender() {
+ return networkSender;
+ }
- /**
- * Sets the value of the networkSender property.
- *
- * @param value
- * allowed object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public void setNetworkSender(RemoteNetworkSender1 value) {
- this.networkSender = value;
- }
+ /**
+ * Sets the value of the networkSender property.
+ *
+ * @param value allowed object is {@link RemoteNetworkSender1 }
+ */
+ public void setNetworkSender(RemoteNetworkSender1 value) {
+ this.networkSender = value;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemotePersistEvent1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemotePersistEvent1.java
index 49a69340cb4..ff703fcc07b 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemotePersistEvent1.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemotePersistEvent1.java
@@ -2,10 +2,9 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2010.05.28 at 02:08:30 PM MST
+// Generated on: 2010.07.23 at 07:00:27 AM MST
//
-
package org.eclipse.osee.framework.messaging.event.res.msgs;
import java.util.ArrayList;
@@ -16,11 +15,11 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
-
/**
- * <p>Java class for RemotePersistEvent1 complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * Java class for RemotePersistEvent1 complex type.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="RemotePersistEvent1">
@@ -31,157 +30,146 @@ import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
* &lt;element name="transactionId" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="artifacts" type="{}RemoteBasicGuidArtifact1" maxOccurs="unbounded"/>
* &lt;element name="relations" type="{}RemoteBasicGuidRelation1" maxOccurs="unbounded"/>
+ * &lt;element name="relationReorders" type="{}RemoteBasicGuidRelationReorder1" maxOccurs="unbounded"/>
* &lt;element name="networkSender" type="{}RemoteNetworkSender1"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "RemotePersistEvent1", propOrder = {
- "branchGuid",
- "transactionId",
- "artifacts",
- "relations",
- "networkSender"
-})
-public class RemotePersistEvent1
- extends RemoteEvent
-{
+@XmlType(name = "RemotePersistEvent1", propOrder = {"branchGuid", "transactionId", "artifacts", "relations",
+ "relationReorders", "networkSender"})
+public class RemotePersistEvent1 extends RemoteEvent {
+
+ @XmlElement(required = true)
+ protected String branchGuid;
+ protected int transactionId;
+ @XmlElement(required = true)
+ protected List<RemoteBasicGuidArtifact1> artifacts;
+ @XmlElement(required = true)
+ protected List<RemoteBasicGuidRelation1> relations;
+ @XmlElement(required = true)
+ protected List<RemoteBasicGuidRelationReorder1> relationReorders;
+ @XmlElement(required = true)
+ protected RemoteNetworkSender1 networkSender;
- @XmlElement(required = true)
- protected String branchGuid;
- protected int transactionId;
- @XmlElement(required = true)
- protected List<RemoteBasicGuidArtifact1> artifacts;
- @XmlElement(required = true)
- protected List<RemoteBasicGuidRelation1> relations;
- @XmlElement(required = true)
- protected RemoteNetworkSender1 networkSender;
+ /**
+ * Gets the value of the branchGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getBranchGuid() {
+ return branchGuid;
+ }
- /**
- * Gets the value of the branchGuid property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getBranchGuid() {
- return branchGuid;
- }
+ /**
+ * Sets the value of the branchGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setBranchGuid(String value) {
+ this.branchGuid = value;
+ }
- /**
- * Sets the value of the branchGuid property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setBranchGuid(String value) {
- this.branchGuid = value;
- }
+ /**
+ * Gets the value of the transactionId property.
+ */
+ public int getTransactionId() {
+ return transactionId;
+ }
- /**
- * Gets the value of the transactionId property.
- *
- */
- public int getTransactionId() {
- return transactionId;
- }
+ /**
+ * Sets the value of the transactionId property.
+ */
+ public void setTransactionId(int value) {
+ this.transactionId = value;
+ }
- /**
- * Sets the value of the transactionId property.
- *
- */
- public void setTransactionId(int value) {
- this.transactionId = value;
- }
+ /**
+ * Gets the value of the artifacts property.
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
+ * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
+ * the artifacts property.
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getArtifacts().add(newItem);
+ * </pre>
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link RemoteBasicGuidArtifact1 }
+ */
+ public List<RemoteBasicGuidArtifact1> getArtifacts() {
+ if (artifacts == null) {
+ artifacts = new ArrayList<RemoteBasicGuidArtifact1>();
+ }
+ return this.artifacts;
+ }
- /**
- * Gets the value of the artifacts property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the artifacts property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getArtifacts().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link RemoteBasicGuidArtifact1 }
- *
- *
- */
- public List<RemoteBasicGuidArtifact1> getArtifacts() {
- if (artifacts == null) {
- artifacts = new ArrayList<RemoteBasicGuidArtifact1>();
- }
- return this.artifacts;
- }
+ /**
+ * Gets the value of the relations property.
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
+ * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
+ * the relations property.
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getRelations().add(newItem);
+ * </pre>
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link RemoteBasicGuidRelation1 }
+ */
+ public List<RemoteBasicGuidRelation1> getRelations() {
+ if (relations == null) {
+ relations = new ArrayList<RemoteBasicGuidRelation1>();
+ }
+ return this.relations;
+ }
- /**
- * Gets the value of the relations property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the relations property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getRelations().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link RemoteBasicGuidRelation1 }
- *
- *
- */
- public List<RemoteBasicGuidRelation1> getRelations() {
- if (relations == null) {
- relations = new ArrayList<RemoteBasicGuidRelation1>();
- }
- return this.relations;
- }
+ /**
+ * Gets the value of the relationReorders property.
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
+ * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
+ * the relationReorders property.
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getRelationReorders().add(newItem);
+ * </pre>
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link RemoteBasicGuidRelationReorder1 }
+ */
+ public List<RemoteBasicGuidRelationReorder1> getRelationReorders() {
+ if (relationReorders == null) {
+ relationReorders = new ArrayList<RemoteBasicGuidRelationReorder1>();
+ }
+ return this.relationReorders;
+ }
- /**
- * Gets the value of the networkSender property.
- *
- * @return
- * possible object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public RemoteNetworkSender1 getNetworkSender() {
- return networkSender;
- }
+ /**
+ * Gets the value of the networkSender property.
+ *
+ * @return possible object is {@link RemoteNetworkSender1 }
+ */
+ @Override
+ public RemoteNetworkSender1 getNetworkSender() {
+ return networkSender;
+ }
- /**
- * Sets the value of the networkSender property.
- *
- * @param value
- * allowed object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public void setNetworkSender(RemoteNetworkSender1 value) {
- this.networkSender = value;
- }
+ /**
+ * Sets the value of the networkSender property.
+ *
+ * @param value allowed object is {@link RemoteNetworkSender1 }
+ */
+ public void setNetworkSender(RemoteNetworkSender1 value) {
+ this.networkSender = value;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteTransactionEvent1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteTransactionEvent1.java
index 9f0e969a61c..e21adcfb548 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteTransactionEvent1.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteTransactionEvent1.java
@@ -5,7 +5,6 @@
// Generated on: 2010.05.28 at 02:08:30 PM MST
//
-
package org.eclipse.osee.framework.messaging.event.res.msgs;
import java.util.ArrayList;
@@ -16,11 +15,11 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
-
/**
- * <p>Java class for RemoteTransactionEvent1 complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * Java class for RemoteTransactionEvent1 complex type.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="RemoteTransactionEvent1">
@@ -35,101 +34,75 @@ import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "RemoteTransactionEvent1", propOrder = {
- "eventTypeGuid",
- "transactions",
- "networkSender"
-})
-public class RemoteTransactionEvent1
- extends RemoteEvent
-{
+@XmlType(name = "RemoteTransactionEvent1", propOrder = {"eventTypeGuid", "transactions", "networkSender"})
+public class RemoteTransactionEvent1 extends RemoteEvent {
- @XmlElement(required = true)
- protected String eventTypeGuid;
- @XmlElement(required = true)
- protected List<RemoteTransactionChange1> transactions;
- @XmlElement(required = true)
- protected RemoteNetworkSender1 networkSender;
+ @XmlElement(required = true)
+ protected String eventTypeGuid;
+ @XmlElement(required = true)
+ protected List<RemoteTransactionChange1> transactions;
+ @XmlElement(required = true)
+ protected RemoteNetworkSender1 networkSender;
- /**
- * Gets the value of the eventTypeGuid property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getEventTypeGuid() {
- return eventTypeGuid;
- }
+ /**
+ * Gets the value of the eventTypeGuid property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getEventTypeGuid() {
+ return eventTypeGuid;
+ }
- /**
- * Sets the value of the eventTypeGuid property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setEventTypeGuid(String value) {
- this.eventTypeGuid = value;
- }
+ /**
+ * Sets the value of the eventTypeGuid property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setEventTypeGuid(String value) {
+ this.eventTypeGuid = value;
+ }
- /**
- * Gets the value of the transactions property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the transactions property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getTransactions().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link RemoteTransactionChange1 }
- *
- *
- */
- public List<RemoteTransactionChange1> getTransactions() {
- if (transactions == null) {
- transactions = new ArrayList<RemoteTransactionChange1>();
- }
- return this.transactions;
- }
+ /**
+ * Gets the value of the transactions property.
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
+ * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
+ * the transactions property.
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getTransactions().add(newItem);
+ * </pre>
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link RemoteTransactionChange1 }
+ */
+ public List<RemoteTransactionChange1> getTransactions() {
+ if (transactions == null) {
+ transactions = new ArrayList<RemoteTransactionChange1>();
+ }
+ return this.transactions;
+ }
- /**
- * Gets the value of the networkSender property.
- *
- * @return
- * possible object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public RemoteNetworkSender1 getNetworkSender() {
- return networkSender;
- }
+ /**
+ * Gets the value of the networkSender property.
+ *
+ * @return possible object is {@link RemoteNetworkSender1 }
+ */
+ @Override
+ public RemoteNetworkSender1 getNetworkSender() {
+ return networkSender;
+ }
- /**
- * Sets the value of the networkSender property.
- *
- * @param value
- * allowed object is
- * {@link RemoteNetworkSender1 }
- *
- */
- public void setNetworkSender(RemoteNetworkSender1 value) {
- this.networkSender = value;
- }
+ /**
+ * Sets the value of the networkSender property.
+ *
+ * @param value allowed object is {@link RemoteNetworkSender1 }
+ */
+ public void setNetworkSender(RemoteNetworkSender1 value) {
+ this.networkSender = value;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/RelationTypeSideSorterTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/RelationTypeSideSorterTest.java
index 165b01877eb..caaccacd8f0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/RelationTypeSideSorterTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/RelationTypeSideSorterTest.java
@@ -18,8 +18,8 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Random;
import java.util.Map.Entry;
+import java.util.Random;
import junit.framework.Assert;
import org.eclipse.osee.framework.core.data.IRelationSorterId;
import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
@@ -28,6 +28,7 @@ import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
import org.eclipse.osee.framework.core.model.test.mocks.MockOseeDataAccessor;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.model.type.RelationType;
@@ -315,8 +316,7 @@ public class RelationTypeSideSorterTest {
}
@Override
- public void store(IArtifact artifact, RelationOrderData orderData) throws OseeCoreException {
-
+ public void store(IArtifact artifact, RelationOrderData orderData, DefaultBasicGuidRelationReorder reorderRecord) throws OseeCoreException {
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/order/RelationOrderDataTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/order/RelationOrderDataTest.java
index 0621d2327b3..06790ca0a61 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/order/RelationOrderDataTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/order/RelationOrderDataTest.java
@@ -13,14 +13,15 @@ package org.eclipse.osee.framework.skynet.core.test.relation.order;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Random;
import java.util.Map.Entry;
+import java.util.Random;
import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
import org.eclipse.osee.framework.core.model.test.mocks.MockOseeDataAccessor;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.model.type.RelationType;
@@ -313,7 +314,7 @@ public class RelationOrderDataTest {
}
@Override
- public void store(IArtifact artifact, RelationOrderData orderData) throws OseeCoreException {
+ public void store(IArtifact artifact, RelationOrderData orderData, DefaultBasicGuidRelationReorder reorderRecord) throws OseeCoreException {
wasStoreCalled = true;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index e80e4fe16db..9206d520023 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -55,6 +55,7 @@ import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
import org.eclipse.osee.framework.core.model.event.IBasicGuidArtifact;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.model.type.AttributeType;
@@ -94,1924 +95,1775 @@ import org.eclipse.osee.framework.skynet.core.types.IArtifact;
import org.osgi.framework.Bundle;
public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, IBasicGuidArtifact {
- public static final String UNNAMED = "Unnamed";
- public static final String BEFORE_GUID_STRING = "/BeforeGUID/PrePend";
- public static final String AFTER_GUID_STRING = "/AfterGUID";
- public static final int TRANSACTION_SENTINEL = -1;
-
- private final HashCollection<String, Attribute<?>> attributes = new HashCollection<String, Attribute<?>>(false,
- LinkedList.class, 12);
- private final Branch branch;
- private final String guid;
- private String humanReadableId;
- private ArtifactType artifactType;
- private final ArtifactFactory parentFactory;
- private AttributeAnnotationManager annotationMgr;
- private int transactionId = TRANSACTION_SENTINEL;
- private int artId;
- private int gammaId;
- private boolean linksLoaded;
- private boolean historical;
- private ModificationType modType;
- private ModificationType lastValidModType;
- private EditState objectEditState;
-
- public Artifact(ArtifactFactory parentFactory, String guid, String humanReadableId, Branch branch, ArtifactType artifactType) throws OseeDataStoreException {
- objectEditState = EditState.NO_CHANGE;
- modType = ModificationType.NEW;
- if (guid == null) {
- this.guid = GUID.create();
- } else {
- this.guid = guid;
- }
-
- if (humanReadableId == null) {
- populateHumanReadableID();
- } else {
- this.humanReadableId = humanReadableId;
- }
-
- this.parentFactory = parentFactory;
- this.branch = branch;
- this.artifactType = artifactType;
- }
-
- public boolean isInDb() {
- return transactionId != TRANSACTION_SENTINEL;
- }
-
- /**
- * A historical artifact always corresponds to a fixed revision of an artifact
- *
- * @return whether this artifact represents a fixed revision
- */
- public boolean isHistorical() {
- return historical;
- }
-
- public Set<ArtifactAnnotation> getAnnotations() {
- Set<ArtifactAnnotation> annotations = new HashSet<ArtifactAnnotation>();
- for (IArtifactAnnotation annotation : getAnnotationExtensions()) {
- annotation.getAnnotations(this, annotations);
- }
- return annotations;
- }
-
- public boolean isAnnotationWarning() {
- for (ArtifactAnnotation notify : getAnnotations()) {
- if (notify.getType() == ArtifactAnnotation.Type.Warning || notify.getType() == ArtifactAnnotation.Type.Error) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * All the artifacts related to this artifact by relations of type relationTypeName are returned in a list order
- * based on the stored relation order
- *
- * @param relationTypeName
- * @return the artifacts related to this artifact by relations of type relationTypeName
+ public static final String UNNAMED = "Unnamed";
+ public static final String BEFORE_GUID_STRING = "/BeforeGUID/PrePend";
+ public static final String AFTER_GUID_STRING = "/AfterGUID";
+ public static final int TRANSACTION_SENTINEL = -1;
+
+ private final HashCollection<String, Attribute<?>> attributes = new HashCollection<String, Attribute<?>>(false,
+ LinkedList.class, 12);
+ private final Set<DefaultBasicGuidRelationReorder> relationOrderRecords = new HashSet<DefaultBasicGuidRelationReorder>();
+ private final Branch branch;
+ private final String guid;
+ private String humanReadableId;
+ private ArtifactType artifactType;
+ private final ArtifactFactory parentFactory;
+ private AttributeAnnotationManager annotationMgr;
+ private int transactionId = TRANSACTION_SENTINEL;
+ private int artId;
+ private int gammaId;
+ private boolean linksLoaded;
+ private boolean historical;
+ private ModificationType modType;
+ private ModificationType lastValidModType;
+ private EditState objectEditState;
+
+ public Artifact(ArtifactFactory parentFactory, String guid, String humanReadableId, Branch branch, ArtifactType artifactType) throws OseeDataStoreException {
+ objectEditState = EditState.NO_CHANGE;
+ modType = ModificationType.NEW;
+ if (guid == null) {
+ this.guid = GUID.create();
+ } else {
+ this.guid = guid;
+ }
+
+ if (humanReadableId == null) {
+ populateHumanReadableID();
+ } else {
+ this.humanReadableId = humanReadableId;
+ }
+
+ this.parentFactory = parentFactory;
+ this.branch = branch;
+ this.artifactType = artifactType;
+ }
+
+ public boolean isInDb() {
+ return transactionId != TRANSACTION_SENTINEL;
+ }
+
+ /**
+ * A historical artifact always corresponds to a fixed revision of an artifact
+ *
+ * @return whether this artifact represents a fixed revision
+ */
+ public boolean isHistorical() {
+ return historical;
+ }
+
+ public Set<ArtifactAnnotation> getAnnotations() {
+ Set<ArtifactAnnotation> annotations = new HashSet<ArtifactAnnotation>();
+ for (IArtifactAnnotation annotation : getAnnotationExtensions()) {
+ annotation.getAnnotations(this, annotations);
+ }
+ return annotations;
+ }
+
+ public boolean isAnnotationWarning() {
+ for (ArtifactAnnotation notify : getAnnotations()) {
+ if (notify.getType() == ArtifactAnnotation.Type.Warning || notify.getType() == ArtifactAnnotation.Type.Error) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * All the artifacts related to this artifact by relations of type relationTypeName are returned in a list order
+ * based on the stored relation order
+ *
+ * @param relationTypeName
+ * @return the artifacts related to this artifact by relations of type relationTypeName
* @throws OseeCoreException
- */
- public List<Artifact> getRelatedArtifacts(String relationTypeName) throws OseeCoreException {
- RelationType relationType = RelationTypeManager.getType(relationTypeName);
- return RelationManager.getRelatedArtifacts(this, new RelationTypeSide(relationType, RelationSide.SIDE_B));
- }
-
- public List<? extends IArtifact> getRelatedArtifacts(RelationType relationType) throws OseeCoreException {
- return RelationManager.getRelatedArtifacts(this, new RelationTypeSide(relationType, RelationSide.SIDE_B));
- }
-
- @Override
- public List<? extends IArtifact> getRelatedArtifacts(RelationTypeSide relationTypeSide) throws OseeCoreException {
- return RelationManager.getRelatedArtifacts(this, relationTypeSide);
- }
-
- public List<Artifact> getRelatedArtifactsUnSorted(IRelationEnumeration relationEnum) throws OseeCoreException {
- return RelationManager.getRelatedArtifactsUnSorted(this, relationEnum);
- }
-
- public List<Artifact> getRelatedArtifacts(IRelationEnumeration relationEnum) throws OseeCoreException {
- return RelationManager.getRelatedArtifacts(this, relationEnum);
- }
-
- public List<Artifact> getRelatedArtifacts(IRelationEnumeration relationEnum, boolean includeDeleted) throws OseeCoreException {
- return RelationManager.getRelatedArtifacts(this, relationEnum, includeDeleted);
- }
-
- public String getRelationRationale(Artifact artifact, IRelationEnumeration relationTypeSide) throws OseeCoreException {
- Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
- return RelationManager.getRelationRationale(sides.getFirst(), sides.getSecond(),
- RelationTypeManager.getType(relationTypeSide));
- }
-
- public void setRelationRationale(Artifact artifact, IRelationEnumeration relationTypeSide, String rationale) throws OseeCoreException {
- Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
- RelationManager.setRelationRationale(sides.getFirst(), sides.getSecond(),
- RelationTypeManager.getType(relationTypeSide), rationale);
- }
-
- private Pair<Artifact, Artifact> determineArtifactSides(Artifact artifact, IRelationEnumeration relationSide) {
- boolean sideA = relationSide.getSide().isSideA();
- Artifact artifactA = sideA ? artifact : this;
- Artifact artifactB = sideA ? this : artifact;
- return new Pair<Artifact, Artifact>(artifactA, artifactB);
- }
-
- /**
- * Check if artifacts are related to each other by relation type
- *
- * @param relationEnum
- * @param other artifact to check
- * @return whether they are related
- * @throws OseeCoreException
- */
- public boolean isRelated(IRelationEnumeration relationEnum, Artifact other) throws OseeCoreException {
- List<Artifact> relatedArtifacts = getRelatedArtifacts(relationEnum);
- return relatedArtifacts.contains(other);
- }
-
- /**
- * Get the exactly one artifact related to this artifact by relations of type relationType are returned in a list
- * order based on
- *
- * @param relationType
- * @return the related artifact
- * @throws ArtifactDoesNotExist
- * @throws OseeDataStoreException
- * @throws MultipleArtifactsExist
- */
- public Artifact getRelatedArtifact(IRelationEnumeration relationEnum) throws OseeCoreException {
- return RelationManager.getRelatedArtifact(this, relationEnum);
- }
-
- public int getRelatedArtifactsCount(IRelationEnumeration relationEnum) throws OseeCoreException {
- return RelationManager.getRelatedArtifactsCount(this, RelationTypeManager.getType(relationEnum),
- relationEnum.getSide());
- }
-
- public int getRelatedArtifactsCount(RelationTypeSideSorter relationSorter) throws OseeCoreException {
- return RelationManager.getRelatedArtifactsCount(relationSorter.getArtifact(), relationSorter.getRelationType(),
- relationSorter.getSide());
- }
-
- public <A extends Artifact> List<A> getRelatedArtifactsUnSorted(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException {
- return Collections.castAll(getRelatedArtifactsUnSorted(side));
- }
-
- public <A extends Artifact> List<A> getRelatedArtifacts(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException {
- return Collections.castAll(getRelatedArtifacts(side));
- }
-
- @SuppressWarnings("unchecked")
- public <A extends Artifact> List<A> getRelatedArtifactsOfType(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException {
- List<A> objs = new ArrayList<A>();
- for (Artifact art : getRelatedArtifacts(side)) {
- if (clazz.isInstance(art)) {
- objs.add((A) art);
- }
- }
- return objs;
- }
-
- /**
- * Called upon completion of the initialization of an artifact when it is initially created. This allows sub-class
- * artifacts to set default attributes or do default processing.
- */
- public void onBirth() throws OseeCoreException {
- };
-
- /**
- * Called upon completion of the initialization of an artifact when loaded from the persistence layer, and when
- * initially created. When called upon initial creation, it is called after <code>onBirth()</code>. This allows
- * sub-class artifacts to set default attributes or do default processing.
- */
- public void onInitializationComplete() {
- }
-
- @Deprecated
- public void onAttributePersist(SkynetTransaction transaction) throws OseeCoreException {
- }
-
- /**
- * @return Returns the art_id.
- */
- @Override
- public int getArtId() {
- return artId;
- }
-
- /**
- * @return Returns the artTypeId.
- */
- public int getArtTypeId() {
- return artifactType.getId();
- }
-
- /**
- * @return Returns the branch.
- */
- @Override
- public Branch getBranch() {
- return branch;
- }
-
- @Override
- public String getGuid() {
- return guid;
- }
-
- public String getArtifactTypeName() {
- return artifactType.getName();
- }
-
- /**
- * Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
- * <code>otherType</code> parameter.
- *
- * @param artifactTypeName
- * @return whether this artifact's type or any of its super-types (any ancestor type) are the specified type
- * @throws OseeDataStoreException
- * @throws OseeTypeDoesNotExist
- */
- public boolean isOfType(String artifactTypeName) throws OseeCoreException {
- return artifactType.inheritsFrom(ArtifactTypeManager.getType(artifactTypeName));
- }
-
- /**
- * Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
- * <code>otherType</code> parameter.
- *
- * @param oseeType
- * @return
- * @throws OseeCoreException
- */
- public boolean isOfType(IArtifactType oseeType) throws OseeCoreException {
- return artifactType.inheritsFrom(oseeType);
- }
-
- @Override
- public String toString() {
- return getName();
- }
-
- // TODO should not return null but currently application code expects it to
- /**
- * The method should be used when the caller expects this artifact to have exactly one parent. Otherwise use
- * hasParent() to safely determine whether
- */
- public Artifact getParent() throws OseeCoreException {
- if (hasParent()) {
- return RelationManager.getRelatedArtifact(this, CoreRelationTypes.Default_Hierarchical__Parent);
- }
- return null;
- }
-
- public Attribute<?> getAttributeById(int attrId, boolean includeDeleted) throws OseeCoreException {
- for (Attribute<?> attribute : getAttributes(includeDeleted)) {
- if (attribute.getId() == attrId) {
- return attribute;
- }
- }
- return null;
- }
-
- /**
- * @return whether this artifact has exactly one parent artifact related by a relation of type default hierarchical
- * @throws OseeCoreException
- * @throws MultipleArtifactsExist if this artifact has more than one parent
- */
- public boolean hasParent() throws OseeCoreException {
- int parentCount = getRelatedArtifactsUnSorted(CoreRelationTypes.Default_Hierarchical__Parent).size();
- if (parentCount > 1) {
- throw new MultipleArtifactsExist(humanReadableId + " has " + parentCount + " parents");
- }
-
- return parentCount == 1;
- }
-
- public boolean isOrphan() throws OseeCoreException {
- Artifact root = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(getBranch());
-
- if (root.equals(getArtifactRoot())) {
- return false;
- } else {
- return true;
- }
- }
-
- public Artifact getArtifactRoot() throws OseeCoreException {
- Artifact artifactRoot = null;
-
- for (Artifact parent = getParent(); parent != null; parent = parent.getParent()) {
- artifactRoot = parent;
- }
- return artifactRoot;
- }
-
- public Artifact getChild(String descriptiveName) throws OseeCoreException {
- for (Artifact artifact : getChildren()) {
- if (artifact.getName().equals(descriptiveName)) {
- return artifact;
- }
- }
- throw new ArtifactDoesNotExist("\"" + getName() + "\" has no child with the name \"" + descriptiveName + "\"");
- }
-
- public boolean hasChild(String descriptiveName) throws OseeCoreException {
- for (Artifact artifact : getChildren()) {
- if (artifact.getName().equals(descriptiveName)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return set of the direct children of this artifact
- * @throws OseeCoreException
- */
- public List<Artifact> getChildren() throws OseeCoreException {
- return getRelatedArtifacts(Default_Hierarchical__Child);
- }
-
- /**
- * @return set of the direct children of this artifact
- * @throws OseeCoreException
- */
- public List<Artifact> getChildren(boolean includeDeleted) throws OseeCoreException {
- return getRelatedArtifacts(Default_Hierarchical__Child, includeDeleted);
- }
-
- /**
- * @return a list of artifacts ordered by a depth first traversal of this artifact's descendants
- * @throws OseeCoreException
- */
- public List<Artifact> getDescendants() throws OseeCoreException {
- List<Artifact> descendants = new LinkedList<Artifact>();
- getDescendants(descendants);
- return descendants;
- }
-
- private void getDescendants(Collection<Artifact> descendants) throws OseeCoreException {
- for (Artifact child : getChildren()) {
- descendants.add(child);
- child.getDescendants(descendants);
- }
- }
-
- public void addChild(Artifact artifact) throws OseeCoreException {
- addChild(null, artifact);
- }
-
- public void addChild(IRelationSorterId sorterId, Artifact artifact) throws OseeCoreException {
- addRelation(sorterId, Default_Hierarchical__Child, artifact);
- }
-
- public Artifact addNewChild(IRelationSorterId sorterId, ArtifactType artifactType, String name) throws OseeCoreException {
- Artifact child = ArtifactTypeManager.makeNewArtifact(artifactType, branch);
- child.setName(name);
- addChild(sorterId, child);
- return child;
- }
-
- /**
- * Creates an instance of <code>Attribute</code> of the given attribute type. This method should not be called by
- * applications. Use addAttribute() instead
- *
- * @param <T>
- * @param attributeType
- * @return new Attribute
- * @throws OseeCoreException
- */
- @SuppressWarnings("unchecked")
- private <T> Attribute<T> createAttribute(IAttributeType attributeType) throws OseeCoreException {
- Class<? extends Attribute<T>> attributeClass =
- (Class<? extends Attribute<T>>) AttributeTypeManager.getAttributeBaseClass(attributeType);
- Attribute<T> attribute = null;
- try {
- attribute = attributeClass.newInstance();
- attributes.put(attributeType.getName(), attribute);
- } catch (InstantiationException ex) {
- OseeExceptions.wrapAndThrow(ex);
- } catch (IllegalAccessException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return attribute;
- }
-
- private <T> Attribute<T> initializeAttribute(IAttributeType attributeType, ModificationType modificationType, boolean markDirty, boolean setDefaultValue) throws OseeCoreException {
- Attribute<T> attribute = createAttribute(attributeType);
- attribute.internalInitialize(attributeType, this, modificationType, markDirty, setDefaultValue);
- return attribute;
- }
-
- public <T> Attribute<T> internalInitializeAttribute(IAttributeType attributeType, int attributeId, int gammaId, ModificationType modificationType, boolean markDirty, Object... data) throws OseeCoreException {
- Attribute<T> attribute = createAttribute(attributeType);
- attribute.internalInitialize(attributeType, this, modificationType, attributeId, gammaId, markDirty, false);
- attribute.getAttributeDataProvider().loadData(data);
- return attribute;
- }
-
- public boolean isAttributeTypeValid(String attributeName) throws OseeCoreException {
- return isAttributeTypeValid(AttributeTypeManager.getType(attributeName));
- }
-
- public boolean isAttributeTypeValid(IAttributeType attributeType) throws OseeCoreException {
- return getArtifactType().isValidAttributeType(attributeType, branch);
- }
-
- /**
- * The use of this method is discouraged since it directly returns Attributes.
- *
- * @param <T>
- * @param attributeTypeName
- * @param value
- * @throws OseeCoreException
- */
- public <T> List<Attribute<T>> getAttributes(String attributeTypeName, Object value) throws OseeCoreException {
- List<Attribute<?>> filteredList = new ArrayList<Attribute<?>>();
- for (Attribute<?> attribute : getAttributes(attributeTypeName)) {
- if (attribute.getValue().equals(value)) {
- filteredList.add(attribute);
- }
- }
- return Collections.castAll(filteredList);
- }
-
- /**
- * The use of this method is discouraged since it directly returns Attributes.
- *
- * @param <T>
- * @param attributeTypeName
- * @param value
- * @throws OseeCoreException
- */
- public <T> List<Attribute<T>> getAttributes(IAttributeType attributeType, Object value) throws OseeCoreException {
- return getAttributes(attributeType.getName(), value);
- }
-
- /**
- * The use of this method is discouraged since it directly returns Attributes.
- *
- * @return attributes All attributes including deleted and artifact deleted
- * @throws OseeCoreException
- */
- public List<Attribute<?>> getAllAttributesIncludingHardDeleted() throws OseeCoreException {
- return getAttributesByModificationType(ModificationType.getAllStates());
- }
-
- /**
- * The use of this method is discouraged since it directly returns Attributes.
- *
- * @return attributes All attributes of the specified type name including deleted and artifact deleted
- * @throws OseeCoreException
- */
- public List<Attribute<?>> getAllAttributesIncludingHardDeleted(String artifactTypeName) throws OseeCoreException {
- return getAttributesByModificationType(artifactTypeName, ModificationType.getAllStates());
- }
-
- /**
- * The use of this method is discouraged since it directly returns Attributes.
- *
- * @return attributes
- * @throws OseeCoreException
- */
- public List<Attribute<?>> getAttributes() throws OseeCoreException {
- return getAttributes(false);
- }
-
- public List<Attribute<?>> getAttributes(boolean includeDeleted) throws OseeCoreException {
- List<Attribute<?>> attributes;
- if (includeDeleted) {
- attributes = getAttributesByModificationType(ModificationType.getAllCurrentModTypes());
- } else {
- attributes = getAttributesByModificationType(ModificationType.getCurrentModTypes());
- }
- return attributes;
- }
-
- /**
- * The use of this method is discouraged since it directly returns Attributes.
- *
- * @param <T>
- * @param attributeTypeName
- * @throws OseeCoreException
- */
- public <T> List<Attribute<T>> getAttributes(String attributeTypeName) throws OseeCoreException {
- return Collections.castAll(getAttributesByModificationType(attributeTypeName,
- ModificationType.getCurrentModTypes()));
- }
-
- public <T> List<Attribute<T>> getAttributes(IAttributeType attributeType) throws OseeCoreException {
- return Collections.castAll(getAttributesByModificationType(attributeType.getName(),
- ModificationType.getCurrentModTypes()));
- }
-
- private List<Attribute<?>> getAttributesByModificationType(Set<ModificationType> allowedModTypes) throws OseeCoreException {
- ensureAttributesLoaded();
- return filterByModificationType(attributes.getValues(), allowedModTypes);
- }
-
- private List<Attribute<?>> getAttributesByModificationType(String attributeTypeName, Set<ModificationType> allowedModTypes) throws OseeCoreException {
- ensureAttributesLoaded();
- return filterByModificationType(attributes.getValues(attributeTypeName), allowedModTypes);
- }
-
- private List<Attribute<?>> filterByModificationType(Collection<Attribute<?>> attributes, Set<ModificationType> allowedModTypes) throws OseeCoreException {
- List<Attribute<?>> filteredList = new ArrayList<Attribute<?>>();
- if (allowedModTypes != null && !allowedModTypes.isEmpty() && attributes != null && !attributes.isEmpty()) {
- for (Attribute<?> attribute : attributes) {
- if (allowedModTypes.contains(attribute.getModificationType())) {
- filteredList.add(attribute);
- }
- }
- }
- return filteredList;
- }
-
- /**
- * @return all attributes including deleted ones
- */
- public List<Attribute<?>> internalGetAttributes() {
- return attributes.getValues();
- }
-
- /**
- * Deletes all attributes of the given type, if any
- *
- * @param attributeTypeName
- * @throws OseeCoreException
- */
- public void deleteAttributes(String attributeTypeName) throws OseeCoreException {
- for (Attribute<?> attribute : getAttributes(attributeTypeName)) {
- attribute.delete();
- }
- }
-
- /**
- * Deletes all attributes of the given type, if any
- *
- * @param attributeTypeName
- * @throws OseeCoreException
- */
- public void deleteAttributes(IAttributeType attributeType) throws OseeCoreException {
- for (Attribute<?> attribute : getAttributes(attributeType)) {
- attribute.delete();
- }
- }
-
- private void ensureAttributesLoaded() throws OseeCoreException {
- if (!isAttributesLoaded() && isInDb()) {
- ArtifactLoader.loadArtifactData(this, LoadLevel.ATTRIBUTE);
- }
- }
-
- public boolean isAttributesLoaded() {
- return !attributes.isEmpty();
- }
-
- public Collection<AttributeType> getAttributeTypes() throws OseeCoreException {
- return getArtifactType().getAttributeTypes(branch);
- }
-
- public <T> Attribute<T> getSoleAttribute(IAttributeType attributeType) throws OseeCoreException {
- return getSoleAttribute(attributeType.getName());
- }
-
- public <T> Attribute<T> getSoleAttribute(String attributeTypeName) throws OseeCoreException {
- ensureAttributesLoaded();
- List<Attribute<T>> soleAttributes = getAttributes(attributeTypeName);
- if (soleAttributes.isEmpty()) {
- return null;
- } else if (soleAttributes.size() > 1) {
- throw new MultipleAttributesExist(String.format(
- "The attribute \'%s\' can have no more than one instance for sole attribute operations; guid \'%s\'",
- attributeTypeName, getGuid()));
- }
- return soleAttributes.iterator().next();
- }
-
- private <T> Attribute<T> getOrCreateSoleAttribute(String attributeTypeName) throws OseeCoreException {
- Attribute<T> attribute = getSoleAttribute(attributeTypeName);
- if (attribute == null) {
- attribute =
- initializeAttribute(AttributeTypeManager.getType(attributeTypeName), ModificationType.NEW, true, true);
- }
- return attribute;
- }
-
- /**
- * @param <T>
- * @param attributeTypeName
- * @return the existing attribute value or the default value from a newly initialized attribute if none previously
- * existed
- * @throws OseeCoreException
- */
- public <T> T getOrInitializeSoleAttributeValue(String attributeTypeName) throws OseeCoreException {
- Attribute<T> attribute = getOrCreateSoleAttribute(attributeTypeName);
- return attribute.getValue();
- }
-
- public <T> T getOrInitializeSoleAttributeValue(IAttributeType attributeType) throws OseeCoreException {
- return getOrInitializeSoleAttributeValue(attributeType.getName());
- }
-
- /**
- * Return sole attribute value for given attribute type name. Will throw exceptions if "Sole" nature of attribute is
- * invalid.<br>
- * <br>
- * Used for quick access to attribute value that should only have 0 or 1 instances of the attribute.
- *
- * @param <T>
- * @param attributeTypeName
- * @return sole attribute value
- * @throws OseeCoreException
- */
- public <T> T getSoleAttributeValue(String attributeTypeName) throws OseeCoreException {
- List<Attribute<T>> soleAttributes = getAttributes(attributeTypeName);
- if (soleAttributes.isEmpty()) {
- if (!isAttributeTypeValid(attributeTypeName)) {
- throw new OseeArgumentException(String.format(
- "The attribute type %s is not valid for artifacts of type [%s]", attributeTypeName,
- getArtifactTypeName()));
- }
- throw new AttributeDoesNotExist(
- "Attribute \"" + attributeTypeName + "\" does not exist for artifact " + getGuid());
- } else if (soleAttributes.size() > 1) {
- throw new MultipleAttributesExist(
- "Attribute \"" + attributeTypeName + "\" must have exactly one instance. It currently has " + soleAttributes.size() + " for artifact " + getGuid());
- }
- return soleAttributes.iterator().next().getValue();
- }
-
- public <T> T getSoleAttributeValue(IAttributeType attributeType) throws OseeCoreException {
- return getSoleAttributeValue(attributeType.getName());
- }
-
- public String getSoleAttributeValueAsString(IAttributeType attributeType, String defaultReturnValue) throws OseeCoreException, MultipleAttributesExist {
- return getSoleAttributeValueAsString(attributeType.getName(), defaultReturnValue);
- }
-
- /**
- * Return sole attribute string value for given attribute type name. Handles AttributeDoesNotExist case by returning
- * defaultReturnValue.<br>
- * <br>
- * Used for display purposes where toString() of attribute is to be displayed.
- *
- * @param attributeTypeName
- * @param defaultReturnValue return value if attribute instance does not exist
- * @return attribute value
- * @throws MultipleAttributesExist if multiple attribute instances exist
- */
- public String getSoleAttributeValueAsString(String attributeTypeName, String defaultReturnValue) throws OseeCoreException, MultipleAttributesExist {
- String toReturn = null;
- Object value = getSoleAttributeValue(attributeTypeName, defaultReturnValue);
- if (value instanceof InputStream) {
- InputStream inputStream = (InputStream) value;
- try {
- toReturn = Lib.inputStreamToString(inputStream);
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- try {
- inputStream.close();
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
- } else {
- if (value != null) {
- toReturn = value.toString();
- }
- }
- return toReturn;
- }
-
- /**
- * Return sole attribute value for given attribute type name Handles AttributeDoesNotExist case by returning
- * defaultReturnValue.<br>
- * <br>
- * Used for purposes where attribute value of specified type is desired.
- *
- * @param <T>
- * @param attributeTypeName
- * @param defaultReturnValue
- * @return attribute value
- * @throws MultipleAttributesExist if multiple attribute instances exist
- * @throws OseeCoreException
- */
- public <T> T getSoleAttributeValue(String attributeTypeName, T defaultReturnValue) throws OseeCoreException {
- List<Attribute<T>> soleAttributes = getAttributes(attributeTypeName);
- if (soleAttributes.size() == 1) {
- T value = soleAttributes.iterator().next().getValue();
- if (value == null) {
- OseeLog.log(
- Activator.class,
- Level.SEVERE,
- "Attribute \"" + attributeTypeName + "\" has null value for Artifact " + getGuid() + " \"" + getName() + "\"");
- return defaultReturnValue;
- }
- return value;
- } else if (soleAttributes.size() > 1) {
- throw new MultipleAttributesExist(
- "Attribute \"" + attributeTypeName + "\" must have exactly one instance. It currently has " + soleAttributes.size() + " for artifact " + getGuid());
- } else {
- return defaultReturnValue;
- }
- }
-
- public <T> T getSoleAttributeValue(IAttributeType attributeTypeEnum, T defaultReturnValue) throws OseeCoreException {
- return getSoleAttributeValue(attributeTypeEnum.getName(), defaultReturnValue);
- }
-
- /**
- * Return sole attribute value for given attribute type name or defaultReturnValue if no attribute instance exists
- * for this artifact.<br>
- * <br>
- * Used for purposes where attribute value of specified type is desired.<br>
- * <br>
- * NOTE: Use only for inline calls. This method returns identical data as
- * getSoleTAttributeValue(attributeTypeName,defaultReturnValue) but provides an extra parameter that allows it to be
- * called within another method call because it specifically defines the return type as clazz
- *
- * @param <T>
- * @param attributeTypeName
- * @param defaultReturnValue
- * @param clazz class to be returned
- * @return attribute value
- * @throws MultipleAttributesExist if multiple attribute instances exist
- * @throws OseeCoreException
- */
- public <T> T getSoleAttributeValue(String attributeTypeName, T defaultReturnValue, Class<T> clazz) throws OseeCoreException {
- return getSoleAttributeValue(attributeTypeName, defaultReturnValue);
- }
-
- /**
- * Delete attribute if exactly one exists. Does nothing if attribute does not exist and throw MultipleAttributesExist
- * is more than one instance of the attribute type exsits for this artifact
- *
- * @param attributeTypeName
- * @throws OseeCoreException
- */
- public void deleteSoleAttribute(String attributeTypeName) throws OseeCoreException {
- Attribute<?> attribute = getSoleAttribute(attributeTypeName);
- if (attribute != null) {
- attribute.delete();
- }
- }
-
- public void deleteSoleAttribute(IAttributeType attributeType) throws OseeCoreException {
- deleteSoleAttribute(attributeType.getName());
- }
-
- public void deleteAttribute(String attributeTypeName, Object value) throws OseeCoreException {
- for (Attribute<Object> attribute : getAttributes(attributeTypeName)) {
- if (attribute.getValue().equals(value)) {
- attribute.delete();
- }
- }
- }
-
- public void deleteAttribute(IAttributeType attributeType, Object value) throws OseeCoreException {
- for (Attribute<Object> attribute : getAttributes(attributeType.getName())) {
- if (attribute.getValue().equals(value)) {
- attribute.delete();
- }
- }
- }
-
- /**
- * Used on attribute types with no more than one instance. If the attribute exists, it's value is changed, otherwise
- * a new attribute is added and its value set.
- *
- * @param <T>
- * @param attributeTypeName
- * @param value
- * @throws OseeCoreException
- * @throws MultipleAttributesExist
- */
- public <T> void setSoleAttributeValue(String attributeTypeName, T value) throws OseeCoreException {
- getOrCreateSoleAttribute(attributeTypeName).setValue(value);
- }
-
- public <T> void setSoleAttributeValue(IAttributeType attributeTypeEnum, T value) throws OseeCoreException {
- getOrCreateSoleAttribute(attributeTypeEnum.getName()).setValue(value);
- }
-
- public <T> void setSoleAttributeFromString(IAttributeType attributeType, String value) throws OseeCoreException {
- getOrCreateSoleAttribute(attributeType.getName()).setFromString(value);
- }
-
- public <T> void setSoleAttributeFromString(String attributeTypeName, String value) throws OseeCoreException {
- getOrCreateSoleAttribute(attributeTypeName).setFromString(value);
- }
-
- public void setSoleAttributeFromStream(String attributeTypeName, InputStream stream) throws OseeCoreException {
- getOrCreateSoleAttribute(attributeTypeName).setValueFromInputStream(stream);
- }
-
- public void setSoleAttributeFromStream(IAttributeType attributeType, InputStream stream) throws OseeCoreException {
- setSoleAttributeFromStream(attributeType.getName(), stream);
- }
-
- /**
- * @param attributeTypeName
- * @return comma delimited representation of all the attributes of the type attributeName
- * @throws OseeCoreException
- */
- public String getAttributesToString(String attributeTypeName) throws OseeCoreException {
- StringBuffer sb = new StringBuffer();
- for (Attribute<?> attr : getAttributes(attributeTypeName)) {
- sb.append(attr);
- sb.append(", ");
- }
- return sb.toString().replaceFirst(", $", "");
- }
-
- public String getAttributesToString(IAttributeType attributeType) throws OseeCoreException {
- return getAttributesToString(attributeType.getName());
- }
-
- /**
- * All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
- * attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
- * excess attributes will be deleted.
- *
- * @param attributeType
- * @param newValues
- * @throws OseeCoreException
- */
- public void setAttributeValues(IAttributeType attributeType, Collection<String> newValues) throws OseeCoreException {
- setAttributeValues(attributeType.getName(), newValues);
- }
-
- /**
- * All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
- * attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
- * excess attributes will be deleted.
- *
- * @param attributeTypeName
- * @param newValues
- * @throws OseeCoreException
- */
- public void setAttributeValues(String attributeTypeName, Collection<String> newValues) throws OseeCoreException {
- ensureAttributesLoaded();
- // ensure new values are unique
- HashSet<String> uniqueNewValues = new HashSet<String>(newValues);
-
- List<Attribute<Object>> remainingAttributes = getAttributes(attributeTypeName);
- List<String> remainingNewValues = new ArrayList<String>(uniqueNewValues.size());
-
- // all existing attributes matching a new value will be left untouched
- for (String newValue : uniqueNewValues) {
- boolean found = false;
- for (Attribute<Object> attribute : remainingAttributes) {
- if (attribute.getValue().toString().equals(newValue)) {
- remainingAttributes.remove(attribute);
- found = true;
- break;
- }
- }
- if (!found) {
- remainingNewValues.add(newValue);
- }
- }
-
- for (String newValue : remainingNewValues) {
- if (remainingAttributes.isEmpty()) {
- setOrAddAttribute(attributeTypeName, newValue);
- } else {
- int index = remainingAttributes.size() - 1;
- remainingAttributes.get(index).setValue(newValue);
- remainingAttributes.remove(index);
- }
- }
-
- for (Attribute<Object> attribute : remainingAttributes) {
- attribute.delete();
- }
- }
-
- /**
- * adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
- * @param <T>
- * @param attributeTypeName
- * @param value
- * @throws OseeCoreException
- */
- public <T> void addAttribute(String attributeTypeName, T value) throws OseeCoreException {
- addAttribute(AttributeTypeManager.getType(attributeTypeName), value);
- }
-
- /**
- * adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
- * @param <T>
- * @param attributeType
- * @param value
- * @throws OseeCoreException
- */
- public <T> void addAttribute(IAttributeType attributeType, T value) throws OseeCoreException {
- initializeAttribute(attributeType, ModificationType.NEW, true, false).setValue(value);
- }
-
- /**
- * adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
- * if any.
- *
- * @param attributeType
- * @throws OseeCoreException
- */
- public void addAttribute(IAttributeType attributeType) throws OseeCoreException {
- initializeAttribute(attributeType, ModificationType.NEW, true, true);
- }
-
- /**
- * adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
- * if any.
- *
- * @param attributeType
- * @throws OseeCoreException
- */
- public void addAttribute(AttributeType attributeType) throws OseeCoreException {
- initializeAttribute(attributeType, ModificationType.NEW, true, true);
- }
-
- /**
- * adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
- * @param attributeTypeName
- * @param value
- * @throws OseeCoreException
- */
- public void addAttributeFromString(String attributeTypeName, String value) throws OseeCoreException {
- initializeAttribute(AttributeTypeManager.getType(attributeTypeName), ModificationType.NEW, true, false).setFromString(
- value);
- }
-
- /**
- * we do not what duplicated enumerated values so this method silently returns if the specified attribute type is
- * enumerated and value is already present
- *
- * @param <T>
- * @param attributeTypeName
- * @param value
- * @throws OseeCoreException
- */
- public <T> void setOrAddAttribute(String attributeTypeName, T value) throws OseeCoreException {
- List<Attribute<String>> attributes = getAttributes(attributeTypeName);
- for (Attribute<String> canidateAttribute : attributes) {
- if (canidateAttribute.getValue().equals(value)) {
- return;
- }
- }
- addAttribute(attributeTypeName, value);
- }
-
- /**
- * @param attributeTypeName
- * @return string collection containing of all the attribute values of the type attributeName
- * @throws OseeCoreException
- */
- public List<String> getAttributesToStringList(String attributeTypeName) throws OseeCoreException {
- ensureAttributesLoaded();
-
- List<String> items = new ArrayList<String>();
- for (Attribute<?> attribute : getAttributes(attributeTypeName)) {
- items.add(attribute.getDisplayableString());
- }
- return items;
- }
-
- /**
- * @param attributeType
- * @return string collection containing of all the attribute values of the type attributeName
- * @throws OseeCoreException
- */
- public List<String> getAttributesToStringList(IAttributeType attributeType) throws OseeCoreException {
- return getAttributesToStringList(attributeType.getName());
- }
-
- @Override
- public String getName() {
- String name = null;
- try {
- ensureAttributesLoaded();
- // use the first name attribute whether deleted or not.
- for (Attribute<?> attribute : internalGetAttributes()) {
- if (attribute.isOfType(CoreAttributeTypes.NAME)) {
- name = (String) attribute.getValue();
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- if (!Strings.isValid(name)) {
- return UNNAMED;
- }
- return name;
- }
-
- public void setName(String name) throws OseeCoreException {
- setSoleAttributeValue("Name", name);
- }
-
- public ArtifactFactory getFactory() {
- return parentFactory;
- }
-
- /**
- * This is used to mark that the artifact deleted.
- *
- * @throws OseeCoreException
- */
- public void internalSetDeleted() throws OseeCoreException {
- this.modType = ModificationType.DELETED;
-
- for (Attribute<?> attribute : getAttributes()) {
- attribute.setArtifactDeleted();
- }
- }
-
- public void internalSetDeletedFromRemoteEvent() throws OseeCoreException {
- if (!isHistorical()) {
- this.modType = ModificationType.DELETED;
- ArtifactCache.deCache(this);
-
- for (Attribute<?> attribute : getAttributes()) {
- attribute.internalSetDeletedFromRemoteEvent();
- }
- }
- }
-
- /**
- * This is used to mark that the artifact not deleted. This should only be called by the RemoteEventManager.
- */
- public void resetToPreviousModType() {
- this.modType = lastValidModType;
-
- for (Attribute<?> attribute : attributes.getValues()) {
- if (attribute.getModificationType() == ModificationType.ARTIFACT_DELETED) {
- attribute.resetModType();
- }
- }
- }
-
- /**
- * @return whether this artifact has unsaved attribute changes
- */
- public boolean hasDirtyAttributes() {
- for (Attribute<?> attribute : internalGetAttributes()) {
- if (attribute.isDirty()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return whether this artifact has unsaved relation changes
- */
- public boolean hasDirtyRelations() {
- return RelationManager.hasDirtyLinks(this);
- }
-
- public EditState getEditState() {
- return objectEditState;
- }
-
- public boolean hasDirtyArtifactType() {
- return objectEditState.isArtifactTypeChange();
- }
-
- /**
- * @return whether this artifact has unsaved relation changes
- */
- public boolean isDirty() {
- return hasDirtyAttributes() || hasDirtyRelations() || hasDirtyArtifactType();
- }
-
- private IAccessControlService getAccessControlService() throws OseeCoreException {
- return Activator.getInstance().getAccessControlService();
- }
-
- public boolean isReadOnly() {
- try {
- return isDeleted() || isHistorical() || !getBranch().isEditable() || !getAccessControlService().hasPermission(
- this, PermissionEnum.WRITE);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- return true;
- }
- }
-
- public void revert() throws OseeCoreException {
- DbTransaction dbTransaction = new DbTransaction() {
- @Override
- protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
- ArtifactPersistenceManager.revertArtifact(connection, Artifact.this);
- }
- };
- dbTransaction.execute();
- }
-
- /**
- * Reloads this artifact's attributes and relations back to the last state saved. This will have no effect if the
- * artifact has never been saved.
- *
- * @throws OseeCoreException
- */
- public void reloadAttributesAndRelations() throws OseeCoreException {
- if (!isInDb()) {
- return;
- }
-
- ArtifactQuery.reloadArtifactFromId(getArtId(), getBranch());
- }
-
- void prepareForReload() throws OseeCoreException {
- attributes.clear();
- linksLoaded = false;
-
- RelationManager.prepareRelationsForReload(this);
- }
-
- private final void persistAttributes(SkynetTransaction transaction) throws OseeCoreException {
- if (!UserManager.duringMainUserCreation() && !getAccessControlService().hasPermission(getBranch(),
- PermissionEnum.WRITE)) {
- throw new OseeArgumentException(
- "No write permissions for the branch that this artifact belongs to:" + getBranch());
- }
- if (isHistorical()) {
- throw new OseeArgumentException(
- "The artifact " + getGuid() + " must be at the head of the branch to be edited.");
- }
-
- if (hasDirtyAttributes() || hasDirtyArtifactType()) {
- transaction.addArtifactAndAttributes(this);
- onAttributePersist(transaction);
- }
- }
-
- private final void persistRelations(SkynetTransaction transaction) throws OseeCoreException {
- RelationManager.persistRelationsFor(transaction, this, null);
- }
-
- public final void persist() throws OseeCoreException {
- persist("artifact.persist() default transaction");
- }
-
- public final void persist(String comment) throws OseeCoreException {
- SkynetTransaction transaction = new SkynetTransaction(branch, comment);
- persist(transaction);
- transaction.execute();
- }
-
- public final void persist(SkynetTransaction transaction) throws OseeCoreException {
- if (transaction == null) {
- persist();
- } else {
- persistAttributes(transaction);
- persistRelations(transaction);
- }
- }
-
- /**
- * Returns all of the descendants through the primary decomposition tree that have a particular human readable id.
- * This will not return the called upon node if the name matches since it can not be a descendant of itself.
- *
- * @param humanReadableId The human readable id text to match against.
- * @param caseSensitive Whether to use case sensitive matching.
- * @return <code>Collection</code> of <code>Artifact</code>'s that match.
- * @throws OseeCoreException
- */
- public Collection<Artifact> getDescendants(String humanReadableId, boolean caseSensitive) throws OseeCoreException {
- Collection<Artifact> descendants = new LinkedList<Artifact>();
-
- for (Artifact child : getChildren()) {
- if (caseSensitive && child.getName().equals(humanReadableId) || !caseSensitive && child.getName().equalsIgnoreCase(
- humanReadableId)) {
- descendants.add(child);
- }
- descendants.addAll(child.getDescendants(humanReadableId, caseSensitive));
- }
-
- return descendants;
- }
-
- /**
- * Starting from this artifact, walks down the child hierarchy based on the list of child names provided and returns
- * the child of the last name provided. ArtifactDoesNotExist exception is thrown ff any child along the path does not
- * exist.
- *
- * @param names
- * @return child at the leaf (bottom) of the specified hierarchy.
- * @throws OseeCoreException
- */
- public Artifact getDescendant(String... names) throws OseeCoreException {
- if (names.length == 0) {
- throw new OseeArgumentException("Must suply at least one name to getDescendant()");
- }
- Artifact descendant = this;
- for (String name : names) {
- descendant = descendant.getChild(name);
- }
- return descendant;
- }
-
- /**
- * Removes artifact from a specific branch
- */
- public void deleteAndPersist() throws OseeCoreException {
- SkynetTransaction transaction = new SkynetTransaction(branch, "Delete artifact from a specific branch");
- deleteAndPersist(transaction);
- transaction.execute();
- }
-
- public void deleteAndPersist(SkynetTransaction transaction, boolean overrideChecks) throws OseeCoreException {
- ArtifactPersistenceManager.deleteArtifact(transaction, overrideChecks, this);
- }
-
- /**
- * Removes artifact from a specific branch
- */
- public void deleteAndPersist(SkynetTransaction transaction) throws OseeCoreException {
- ArtifactPersistenceManager.deleteArtifact(transaction, false, this);
- }
-
- public void delete() throws OseeCoreException {
- ArtifactPersistenceManager.deleteArtifact(null, false, this);
- }
-
- /**
- * Remove artifact from a specific branch in the database
- *
- * @throws OseeCoreException
- */
- public void purgeFromBranch() throws OseeCoreException {
- new PurgeArtifacts(Arrays.asList(this)).execute();
- }
-
- public boolean isDeleted() {
- return modType == ModificationType.DELETED;
- }
-
- public void setLinksLoaded(boolean loaded) {
- linksLoaded = loaded;
- }
-
- public void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationTypeSide, Artifact artifact, String rationale) throws OseeCoreException {
- Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
- RelationManager.addRelation(sorterId, RelationTypeManager.getType(relationTypeSide), sides.getFirst(),
- sides.getSecond(), rationale);
- }
-
- public void addRelation(IRelationEnumeration relationSide, Artifact artifact) throws OseeCoreException {
- addRelation(null, relationSide, artifact, null);
- }
-
- public void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationSide, Artifact artifact) throws OseeCoreException {
- addRelation(sorterId, relationSide, artifact, null);
- }
-
- public void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd, String rationale) throws OseeCoreException {
- boolean sideA = relationEnumeration.getSide().isSideA();
- Artifact artifactA = sideA ? itemToAdd : this;
- Artifact artifactB = sideA ? this : itemToAdd;
-
- RelationManager.addRelation(sorterId, RelationTypeManager.getType(relationEnumeration), artifactA, artifactB,
- rationale);
- setRelationOrder(relationEnumeration, targetArtifact, insertAfterTarget, itemToAdd);
- }
-
- public void setRelationOrder(IRelationEnumeration relationSide, List<Artifact> artifactsInNewOrder) throws OseeCoreException {
- RelationManager.setRelationOrder(this, RelationTypeManager.getType(relationSide), relationSide.getSide(),
- RelationOrderBaseTypes.USER_DEFINED, artifactsInNewOrder);
- }
-
- public void setRelationOrder(IRelationEnumeration relationEnumeration, IRelationSorterId orderId) throws OseeCoreException {
- if (RelationOrderBaseTypes.USER_DEFINED == orderId) {
- setRelationOrder(relationEnumeration, getRelatedArtifacts(relationEnumeration));
- } else {
- List<Artifact> empty = java.util.Collections.emptyList();
- RelationManager.setRelationOrder(this, RelationTypeManager.getType(relationEnumeration),
- relationEnumeration.getSide(), orderId, empty);
- }
- }
-
- public void setRelationOrder(IRelationEnumeration relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd) throws OseeCoreException {
- List<Artifact> currentOrder = getRelatedArtifacts(relationEnumeration, Artifact.class);
- // target artifact doesn't exist
- if (!currentOrder.contains(targetArtifact)) {
- // add to end of list if not already in list
- if (!currentOrder.contains(itemToAdd)) {
- currentOrder.add(itemToAdd);
- }
- }
- boolean result = Collections.moveItem(currentOrder, itemToAdd, targetArtifact, insertAfterTarget);
- if (!result) {
- throw new OseeStateException("Could not set Relation Order");
- }
-
- RelationManager.setRelationOrder(this, RelationTypeManager.getType(relationEnumeration),
- relationEnumeration.getSide(), RelationOrderBaseTypes.USER_DEFINED, currentOrder);
- }
-
- public void deleteRelation(IRelationEnumeration relationTypeSide, Artifact artifact) throws OseeCoreException {
- Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
- RelationManager.deleteRelation(RelationTypeManager.getType(relationTypeSide), sides.getFirst(), sides.getSecond());
- }
-
- public void deleteRelations(IRelationEnumeration relationSide) throws OseeCoreException {
- for (Artifact art : getRelatedArtifacts(relationSide)) {
- deleteRelation(relationSide, art);
- }
- }
-
- /**
- * Creates new relations that don't already exist and removes relations to artifacts that are not in collection
- *
- * @param relationSide
- * @param artifacts
- * @throws OseeCoreException
- */
- public void setRelations(IRelationSorterId sorterId, IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException {
- Collection<Artifact> currentlyRelated = getRelatedArtifacts(relationSide, Artifact.class);
- // Remove relations that have been removed
- for (Artifact artifact : currentlyRelated) {
- if (!artifacts.contains(artifact)) {
- deleteRelation(relationSide, artifact);
- }
- }
- // Add new relations if don't exist
- for (Artifact artifact : artifacts) {
- if (!currentlyRelated.contains(artifact)) {
- addRelation(sorterId, relationSide, artifact);
- }
- }
- }
-
- /**
- * Creates new relations that don't already exist and removes relations to artifacts that are not in collection
- */
- public void setRelations(IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException {
- setRelations(null, relationSide, artifacts);
- }
-
- /**
- * Creates new relations that don't already exist and removes relations to artifacts that are not in collection
- */
- public void setRelationsOfTypeUseCurrentOrder(IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts, Class<?> clazz) throws OseeCoreException {
- RelationTypeSideSorter sorter =
+ */
+ public List<Artifact> getRelatedArtifacts(String relationTypeName) throws OseeCoreException {
+ RelationType relationType = RelationTypeManager.getType(relationTypeName);
+ return RelationManager.getRelatedArtifacts(this, new RelationTypeSide(relationType, RelationSide.SIDE_B));
+ }
+
+ public List<? extends IArtifact> getRelatedArtifacts(RelationType relationType) throws OseeCoreException {
+ return RelationManager.getRelatedArtifacts(this, new RelationTypeSide(relationType, RelationSide.SIDE_B));
+ }
+
+ @Override
+ public List<? extends IArtifact> getRelatedArtifacts(RelationTypeSide relationTypeSide) throws OseeCoreException {
+ return RelationManager.getRelatedArtifacts(this, relationTypeSide);
+ }
+
+ public List<Artifact> getRelatedArtifactsUnSorted(IRelationEnumeration relationEnum) throws OseeCoreException {
+ return RelationManager.getRelatedArtifactsUnSorted(this, relationEnum);
+ }
+
+ public List<Artifact> getRelatedArtifacts(IRelationEnumeration relationEnum) throws OseeCoreException {
+ return RelationManager.getRelatedArtifacts(this, relationEnum);
+ }
+
+ public List<Artifact> getRelatedArtifacts(IRelationEnumeration relationEnum, boolean includeDeleted) throws OseeCoreException {
+ return RelationManager.getRelatedArtifacts(this, relationEnum, includeDeleted);
+ }
+
+ public String getRelationRationale(Artifact artifact, IRelationEnumeration relationTypeSide) throws OseeCoreException {
+ Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
+ return RelationManager.getRelationRationale(sides.getFirst(), sides.getSecond(),
+ RelationTypeManager.getType(relationTypeSide));
+ }
+
+ public void setRelationRationale(Artifact artifact, IRelationEnumeration relationTypeSide, String rationale) throws OseeCoreException {
+ Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
+ RelationManager.setRelationRationale(sides.getFirst(), sides.getSecond(),
+ RelationTypeManager.getType(relationTypeSide), rationale);
+ }
+
+ private Pair<Artifact, Artifact> determineArtifactSides(Artifact artifact, IRelationEnumeration relationSide) {
+ boolean sideA = relationSide.getSide().isSideA();
+ Artifact artifactA = sideA ? artifact : this;
+ Artifact artifactB = sideA ? this : artifact;
+ return new Pair<Artifact, Artifact>(artifactA, artifactB);
+ }
+
+ /**
+ * Check if artifacts are related to each other by relation type
+ */
+ public boolean isRelated(IRelationEnumeration relationEnum, Artifact other) throws OseeCoreException {
+ List<Artifact> relatedArtifacts = getRelatedArtifacts(relationEnum);
+ return relatedArtifacts.contains(other);
+ }
+
+ /**
+ * Get the exactly one artifact related to this artifact by relations of type relationType are returned in a list
+ * order based on
+ */
+ public Artifact getRelatedArtifact(IRelationEnumeration relationEnum) throws OseeCoreException {
+ return RelationManager.getRelatedArtifact(this, relationEnum);
+ }
+
+ public int getRelatedArtifactsCount(IRelationEnumeration relationEnum) throws OseeCoreException {
+ return RelationManager.getRelatedArtifactsCount(this, RelationTypeManager.getType(relationEnum),
+ relationEnum.getSide());
+ }
+
+ public int getRelatedArtifactsCount(RelationTypeSideSorter relationSorter) throws OseeCoreException {
+ return RelationManager.getRelatedArtifactsCount(relationSorter.getArtifact(), relationSorter.getRelationType(),
+ relationSorter.getSide());
+ }
+
+ public <A extends Artifact> List<A> getRelatedArtifactsUnSorted(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException {
+ return Collections.castAll(getRelatedArtifactsUnSorted(side));
+ }
+
+ public <A extends Artifact> List<A> getRelatedArtifacts(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException {
+ return Collections.castAll(getRelatedArtifacts(side));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <A extends Artifact> List<A> getRelatedArtifactsOfType(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException {
+ List<A> objs = new ArrayList<A>();
+ for (Artifact art : getRelatedArtifacts(side)) {
+ if (clazz.isInstance(art)) {
+ objs.add((A) art);
+ }
+ }
+ return objs;
+ }
+
+ /**
+ * Called upon completion of the initialization of an artifact when it is initially created. This allows sub-class
+ * artifacts to set default attributes or do default processing.
+ */
+ @SuppressWarnings("unused")
+ public void onBirth() throws OseeCoreException {
+ // provided for subclass implementation
+ };
+
+ /**
+ * Called upon completion of the initialization of an artifact when loaded from the persistence layer, and when
+ * initially created. When called upon initial creation, it is called after <code>onBirth()</code>. This allows
+ * sub-class artifacts to set default attributes or do default processing.
+ */
+ public void onInitializationComplete() {
+ // provided for subclass implementation
+ }
+
+ @Deprecated
+ public void onAttributePersist(SkynetTransaction transaction) {
+ // provided for subclass implementation
+ }
+
+ @Override
+ public int getArtId() {
+ return artId;
+ }
+
+ public int getArtTypeId() {
+ return artifactType.getId();
+ }
+
+ @Override
+ public Branch getBranch() {
+ return branch;
+ }
+
+ @Override
+ public String getGuid() {
+ return guid;
+ }
+
+ public String getArtifactTypeName() {
+ return artifactType.getName();
+ }
+
+ /**
+ * Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
+ * <code>otherType</code> parameter.
+ *
+ * @return whether this artifact's type or any of its super-types (any ancestor type) are the specified type
+ */
+ public boolean isOfType(String artifactTypeName) throws OseeCoreException {
+ return artifactType.inheritsFrom(ArtifactTypeManager.getType(artifactTypeName));
+ }
+
+ /**
+ * Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
+ * <code>otherType</code> parameter.
+ */
+ public boolean isOfType(IArtifactType oseeType) {
+ return artifactType.inheritsFrom(oseeType);
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ // TODO should not return null but currently application code expects it to
+ /**
+ * The method should be used when the caller expects this artifact to have exactly one parent. Otherwise use
+ * hasParent() to safely determine whether
+ */
+ public Artifact getParent() throws OseeCoreException {
+ if (hasParent()) {
+ return RelationManager.getRelatedArtifact(this, CoreRelationTypes.Default_Hierarchical__Parent);
+ }
+ return null;
+ }
+
+ public Attribute<?> getAttributeById(int attrId, boolean includeDeleted) throws OseeCoreException {
+ for (Attribute<?> attribute : getAttributes(includeDeleted)) {
+ if (attribute.getId() == attrId) {
+ return attribute;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return whether this artifact has exactly one parent artifact related by a relation of type default hierarchical
+ * @throws MultipleArtifactsExist if this artifact has more than one parent
+ */
+ public boolean hasParent() throws OseeCoreException {
+ int parentCount = getRelatedArtifactsUnSorted(CoreRelationTypes.Default_Hierarchical__Parent).size();
+ if (parentCount > 1) {
+ throw new MultipleArtifactsExist(humanReadableId + " has " + parentCount + " parents");
+ }
+
+ return parentCount == 1;
+ }
+
+ public boolean isOrphan() throws OseeCoreException {
+ Artifact root = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(getBranch());
+
+ if (root.equals(getArtifactRoot())) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public Artifact getArtifactRoot() throws OseeCoreException {
+ Artifact artifactRoot = null;
+
+ for (Artifact parent = getParent(); parent != null; parent = parent.getParent()) {
+ artifactRoot = parent;
+ }
+ return artifactRoot;
+ }
+
+ public Artifact getChild(String descriptiveName) throws OseeCoreException {
+ for (Artifact artifact : getChildren()) {
+ if (artifact.getName().equals(descriptiveName)) {
+ return artifact;
+ }
+ }
+ throw new ArtifactDoesNotExist("\"" + getName() + "\" has no child with the name \"" + descriptiveName + "\"");
+ }
+
+ public boolean hasChild(String descriptiveName) throws OseeCoreException {
+ for (Artifact artifact : getChildren()) {
+ if (artifact.getName().equals(descriptiveName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @return set of the direct children of this artifact
+ */
+ public List<Artifact> getChildren() throws OseeCoreException {
+ return getRelatedArtifacts(Default_Hierarchical__Child);
+ }
+
+ /**
+ * @return set of the direct children of this artifact
+ */
+ public List<Artifact> getChildren(boolean includeDeleted) throws OseeCoreException {
+ return getRelatedArtifacts(Default_Hierarchical__Child, includeDeleted);
+ }
+
+ /**
+ * @return a list of artifacts ordered by a depth first traversal of this artifact's descendants
+ */
+ public List<Artifact> getDescendants() throws OseeCoreException {
+ List<Artifact> descendants = new LinkedList<Artifact>();
+ getDescendants(descendants);
+ return descendants;
+ }
+
+ private void getDescendants(Collection<Artifact> descendants) throws OseeCoreException {
+ for (Artifact child : getChildren()) {
+ descendants.add(child);
+ child.getDescendants(descendants);
+ }
+ }
+
+ public void addChild(Artifact artifact) throws OseeCoreException {
+ addChild(null, artifact);
+ }
+
+ public void addChild(IRelationSorterId sorterId, Artifact artifact) throws OseeCoreException {
+ addRelation(sorterId, Default_Hierarchical__Child, artifact);
+ }
+
+ public Artifact addNewChild(IRelationSorterId sorterId, ArtifactType artifactType, String name) throws OseeCoreException {
+ Artifact child = ArtifactTypeManager.makeNewArtifact(artifactType, branch);
+ child.setName(name);
+ addChild(sorterId, child);
+ return child;
+ }
+
+ /**
+ * Creates an instance of <code>Attribute</code> of the given attribute type. This method should not be called by
+ * applications. Use addAttribute() instead
+ */
+ @SuppressWarnings("unchecked")
+ private <T> Attribute<T> createAttribute(IAttributeType attributeType) throws OseeCoreException {
+ Class<? extends Attribute<T>> attributeClass =
+ (Class<? extends Attribute<T>>) AttributeTypeManager.getAttributeBaseClass(attributeType);
+ Attribute<T> attribute = null;
+ try {
+ attribute = attributeClass.newInstance();
+ attributes.put(attributeType.getName(), attribute);
+ } catch (InstantiationException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ } catch (IllegalAccessException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return attribute;
+ }
+
+ private <T> Attribute<T> initializeAttribute(IAttributeType attributeType, ModificationType modificationType, boolean markDirty, boolean setDefaultValue) throws OseeCoreException {
+ Attribute<T> attribute = createAttribute(attributeType);
+ attribute.internalInitialize(attributeType, this, modificationType, markDirty, setDefaultValue);
+ return attribute;
+ }
+
+ public <T> Attribute<T> internalInitializeAttribute(IAttributeType attributeType, int attributeId, int gammaId, ModificationType modificationType, boolean markDirty, Object... data) throws OseeCoreException {
+ Attribute<T> attribute = createAttribute(attributeType);
+ attribute.internalInitialize(attributeType, this, modificationType, attributeId, gammaId, markDirty, false);
+ attribute.getAttributeDataProvider().loadData(data);
+ return attribute;
+ }
+
+ public boolean isAttributeTypeValid(String attributeName) throws OseeCoreException {
+ return isAttributeTypeValid(AttributeTypeManager.getType(attributeName));
+ }
+
+ public boolean isAttributeTypeValid(IAttributeType attributeType) throws OseeCoreException {
+ return getArtifactType().isValidAttributeType(attributeType, branch);
+ }
+
+ /**
+ * The use of this method is discouraged since it directly returns Attributes.
+ */
+ public <T> List<Attribute<T>> getAttributes(String attributeTypeName, Object value) throws OseeCoreException {
+ List<Attribute<?>> filteredList = new ArrayList<Attribute<?>>();
+ for (Attribute<?> attribute : getAttributes(attributeTypeName)) {
+ if (attribute.getValue().equals(value)) {
+ filteredList.add(attribute);
+ }
+ }
+ return Collections.castAll(filteredList);
+ }
+
+ /**
+ * The use of this method is discouraged since it directly returns Attributes.
+ */
+ public <T> List<Attribute<T>> getAttributes(IAttributeType attributeType, Object value) throws OseeCoreException {
+ return getAttributes(attributeType.getName(), value);
+ }
+
+ /**
+ * The use of this method is discouraged since it directly returns Attributes.
+ *
+ * @return attributes All attributes including deleted and artifact deleted
+ */
+ public List<Attribute<?>> getAllAttributesIncludingHardDeleted() throws OseeCoreException {
+ return getAttributesByModificationType(ModificationType.getAllStates());
+ }
+
+ /**
+ * The use of this method is discouraged since it directly returns Attributes.
+ *
+ * @return attributes All attributes of the specified type name including deleted and artifact deleted
+ */
+ public List<Attribute<?>> getAllAttributesIncludingHardDeleted(String artifactTypeName) throws OseeCoreException {
+ return getAttributesByModificationType(artifactTypeName, ModificationType.getAllStates());
+ }
+
+ /**
+ * The use of this method is discouraged since it directly returns Attributes.
+ *
+ * @return attributes
+ */
+ public List<Attribute<?>> getAttributes() throws OseeCoreException {
+ return getAttributes(false);
+ }
+
+ public List<Attribute<?>> getAttributes(boolean includeDeleted) throws OseeCoreException {
+ List<Attribute<?>> attributes;
+ if (includeDeleted) {
+ attributes = getAttributesByModificationType(ModificationType.getAllCurrentModTypes());
+ } else {
+ attributes = getAttributesByModificationType(ModificationType.getCurrentModTypes());
+ }
+ return attributes;
+ }
+
+ /**
+ * The use of this method is discouraged since it directly returns Attributes.
+ */
+ public <T> List<Attribute<T>> getAttributes(String attributeTypeName) throws OseeCoreException {
+ return Collections.castAll(getAttributesByModificationType(attributeTypeName,
+ ModificationType.getCurrentModTypes()));
+ }
+
+ public <T> List<Attribute<T>> getAttributes(IAttributeType attributeType) throws OseeCoreException {
+ return Collections.castAll(getAttributesByModificationType(attributeType.getName(),
+ ModificationType.getCurrentModTypes()));
+ }
+
+ private List<Attribute<?>> getAttributesByModificationType(Set<ModificationType> allowedModTypes) throws OseeCoreException {
+ ensureAttributesLoaded();
+ return filterByModificationType(attributes.getValues(), allowedModTypes);
+ }
+
+ private List<Attribute<?>> getAttributesByModificationType(String attributeTypeName, Set<ModificationType> allowedModTypes) throws OseeCoreException {
+ ensureAttributesLoaded();
+ return filterByModificationType(attributes.getValues(attributeTypeName), allowedModTypes);
+ }
+
+ private List<Attribute<?>> filterByModificationType(Collection<Attribute<?>> attributes, Set<ModificationType> allowedModTypes) {
+ List<Attribute<?>> filteredList = new ArrayList<Attribute<?>>();
+ if (allowedModTypes != null && !allowedModTypes.isEmpty() && attributes != null && !attributes.isEmpty()) {
+ for (Attribute<?> attribute : attributes) {
+ if (allowedModTypes.contains(attribute.getModificationType())) {
+ filteredList.add(attribute);
+ }
+ }
+ }
+ return filteredList;
+ }
+
+ /**
+ * @return all attributes including deleted ones
+ */
+ public List<Attribute<?>> internalGetAttributes() {
+ return attributes.getValues();
+ }
+
+ /**
+ * Deletes all attributes of the given type, if any
+ */
+ public void deleteAttributes(String attributeTypeName) throws OseeCoreException {
+ for (Attribute<?> attribute : getAttributes(attributeTypeName)) {
+ attribute.delete();
+ }
+ }
+
+ /**
+ * Deletes all attributes of the given type, if any
+ */
+ public void deleteAttributes(IAttributeType attributeType) throws OseeCoreException {
+ for (Attribute<?> attribute : getAttributes(attributeType)) {
+ attribute.delete();
+ }
+ }
+
+ private void ensureAttributesLoaded() throws OseeCoreException {
+ if (!isAttributesLoaded() && isInDb()) {
+ ArtifactLoader.loadArtifactData(this, LoadLevel.ATTRIBUTE);
+ }
+ }
+
+ public boolean isAttributesLoaded() {
+ return !attributes.isEmpty();
+ }
+
+ public Collection<AttributeType> getAttributeTypes() throws OseeCoreException {
+ return getArtifactType().getAttributeTypes(branch);
+ }
+
+ public <T> Attribute<T> getSoleAttribute(IAttributeType attributeType) throws OseeCoreException {
+ return getSoleAttribute(attributeType.getName());
+ }
+
+ public <T> Attribute<T> getSoleAttribute(String attributeTypeName) throws OseeCoreException {
+ ensureAttributesLoaded();
+ List<Attribute<T>> soleAttributes = getAttributes(attributeTypeName);
+ if (soleAttributes.isEmpty()) {
+ return null;
+ } else if (soleAttributes.size() > 1) {
+ throw new MultipleAttributesExist(String.format(
+ "The attribute \'%s\' can have no more than one instance for sole attribute operations; guid \'%s\'",
+ attributeTypeName, getGuid()));
+ }
+ return soleAttributes.iterator().next();
+ }
+
+ private <T> Attribute<T> getOrCreateSoleAttribute(String attributeTypeName) throws OseeCoreException {
+ Attribute<T> attribute = getSoleAttribute(attributeTypeName);
+ if (attribute == null) {
+ attribute =
+ initializeAttribute(AttributeTypeManager.getType(attributeTypeName), ModificationType.NEW, true, true);
+ }
+ return attribute;
+ }
+
+ /**
+ * Return he existing attribute value or the default value from a newly initialized attribute if none previously
+ * existed
+ */
+ public <T> T getOrInitializeSoleAttributeValue(String attributeTypeName) throws OseeCoreException {
+ Attribute<T> attribute = getOrCreateSoleAttribute(attributeTypeName);
+ return attribute.getValue();
+ }
+
+ public <T> T getOrInitializeSoleAttributeValue(IAttributeType attributeType) throws OseeCoreException {
+ return getOrInitializeSoleAttributeValue(attributeType.getName());
+ }
+
+ /**
+ * Return sole attribute value for given attribute type name. Will throw exceptions if "Sole" nature of attribute is
+ * invalid.<br>
+ * <br>
+ * Used for quick access to attribute value that should only have 0 or 1 instances of the attribute.
+ */
+ public <T> T getSoleAttributeValue(String attributeTypeName) throws OseeCoreException {
+ List<Attribute<T>> soleAttributes = getAttributes(attributeTypeName);
+ if (soleAttributes.isEmpty()) {
+ if (!isAttributeTypeValid(attributeTypeName)) {
+ throw new OseeArgumentException(String.format(
+ "The attribute type %s is not valid for artifacts of type [%s]", attributeTypeName,
+ getArtifactTypeName()));
+ }
+ throw new AttributeDoesNotExist(
+ "Attribute \"" + attributeTypeName + "\" does not exist for artifact " + getGuid());
+ } else if (soleAttributes.size() > 1) {
+ throw new MultipleAttributesExist(
+ "Attribute \"" + attributeTypeName + "\" must have exactly one instance. It currently has " + soleAttributes.size() + " for artifact " + getGuid());
+ }
+ return soleAttributes.iterator().next().getValue();
+ }
+
+ public <T> T getSoleAttributeValue(IAttributeType attributeType) throws OseeCoreException {
+ return getSoleAttributeValue(attributeType.getName());
+ }
+
+ public String getSoleAttributeValueAsString(IAttributeType attributeType, String defaultReturnValue) throws OseeCoreException, MultipleAttributesExist {
+ return getSoleAttributeValueAsString(attributeType.getName(), defaultReturnValue);
+ }
+
+ /**
+ * Return sole attribute string value for given attribute type name. Handles AttributeDoesNotExist case by returning
+ * defaultReturnValue.<br>
+ * <br>
+ * Used for display purposes where toString() of attribute is to be displayed.
+ *
+ * @param defaultReturnValue return value if attribute instance does not exist
+ * @throws MultipleAttributesExist if multiple attribute instances exist
+ */
+ public String getSoleAttributeValueAsString(String attributeTypeName, String defaultReturnValue) throws OseeCoreException, MultipleAttributesExist {
+ String toReturn = null;
+ Object value = getSoleAttributeValue(attributeTypeName, defaultReturnValue);
+ if (value instanceof InputStream) {
+ InputStream inputStream = (InputStream) value;
+ try {
+ toReturn = Lib.inputStreamToString(inputStream);
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ } finally {
+ try {
+ inputStream.close();
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+ } else {
+ if (value != null) {
+ toReturn = value.toString();
+ }
+ }
+ return toReturn;
+ }
+
+ /**
+ * Return sole attribute value for given attribute type name Handles AttributeDoesNotExist case by returning
+ * defaultReturnValue.<br>
+ * <br>
+ * Used for purposes where attribute value of specified type is desired.
+ *
+ * @throws MultipleAttributesExist if multiple attribute instances exist
+ */
+ public <T> T getSoleAttributeValue(String attributeTypeName, T defaultReturnValue) throws OseeCoreException {
+ List<Attribute<T>> soleAttributes = getAttributes(attributeTypeName);
+ if (soleAttributes.size() == 1) {
+ T value = soleAttributes.iterator().next().getValue();
+ if (value == null) {
+ OseeLog.log(
+ Activator.class,
+ Level.SEVERE,
+ "Attribute \"" + attributeTypeName + "\" has null value for Artifact " + getGuid() + " \"" + getName() + "\"");
+ return defaultReturnValue;
+ }
+ return value;
+ } else if (soleAttributes.size() > 1) {
+ throw new MultipleAttributesExist(
+ "Attribute \"" + attributeTypeName + "\" must have exactly one instance. It currently has " + soleAttributes.size() + " for artifact " + getGuid());
+ } else {
+ return defaultReturnValue;
+ }
+ }
+
+ public <T> T getSoleAttributeValue(IAttributeType attributeTypeEnum, T defaultReturnValue) throws OseeCoreException {
+ return getSoleAttributeValue(attributeTypeEnum.getName(), defaultReturnValue);
+ }
+
+ /**
+ * Return sole attribute value for given attribute type name or defaultReturnValue if no attribute instance exists
+ * for this artifact.<br>
+ * <br>
+ * Used for purposes where attribute value of specified type is desired.<br>
+ * <br>
+ * NOTE: Use only for inline calls. This method returns identical data as
+ * getSoleTAttributeValue(attributeTypeName,defaultReturnValue) but provides an extra parameter that allows it to be
+ * called within another method call because it specifically defines the return type as clazz
+ *
+ * @throws MultipleAttributesExist if multiple attribute instances exist
+ */
+ public <T> T getSoleAttributeValue(String attributeTypeName, T defaultReturnValue, Class<T> clazz) throws OseeCoreException {
+ return getSoleAttributeValue(attributeTypeName, defaultReturnValue);
+ }
+
+ /**
+ * Delete attribute if exactly one exists. Does nothing if attribute does not exist and throw MultipleAttributesExist
+ * is more than one instance of the attribute type exsits for this artifact
+ */
+ public void deleteSoleAttribute(String attributeTypeName) throws OseeCoreException {
+ Attribute<?> attribute = getSoleAttribute(attributeTypeName);
+ if (attribute != null) {
+ attribute.delete();
+ }
+ }
+
+ public void deleteSoleAttribute(IAttributeType attributeType) throws OseeCoreException {
+ deleteSoleAttribute(attributeType.getName());
+ }
+
+ public void deleteAttribute(String attributeTypeName, Object value) throws OseeCoreException {
+ for (Attribute<Object> attribute : getAttributes(attributeTypeName)) {
+ if (attribute.getValue().equals(value)) {
+ attribute.delete();
+ }
+ }
+ }
+
+ public void deleteAttribute(IAttributeType attributeType, Object value) throws OseeCoreException {
+ for (Attribute<Object> attribute : getAttributes(attributeType.getName())) {
+ if (attribute.getValue().equals(value)) {
+ attribute.delete();
+ }
+ }
+ }
+
+ /**
+ * Used on attribute types with no more than one instance. If the attribute exists, it's value is changed, otherwise
+ * a new attribute is added and its value set.
+ */
+ public <T> void setSoleAttributeValue(String attributeTypeName, T value) throws OseeCoreException {
+ getOrCreateSoleAttribute(attributeTypeName).setValue(value);
+ }
+
+ public <T> void setSoleAttributeValue(IAttributeType attributeTypeEnum, T value) throws OseeCoreException {
+ getOrCreateSoleAttribute(attributeTypeEnum.getName()).setValue(value);
+ }
+
+ public <T> void setSoleAttributeFromString(IAttributeType attributeType, String value) throws OseeCoreException {
+ getOrCreateSoleAttribute(attributeType.getName()).setFromString(value);
+ }
+
+ public <T> void setSoleAttributeFromString(String attributeTypeName, String value) throws OseeCoreException {
+ getOrCreateSoleAttribute(attributeTypeName).setFromString(value);
+ }
+
+ public void setSoleAttributeFromStream(String attributeTypeName, InputStream stream) throws OseeCoreException {
+ getOrCreateSoleAttribute(attributeTypeName).setValueFromInputStream(stream);
+ }
+
+ public void setSoleAttributeFromStream(IAttributeType attributeType, InputStream stream) throws OseeCoreException {
+ setSoleAttributeFromStream(attributeType.getName(), stream);
+ }
+
+ /**
+ * @return comma delimited representation of all the attributes of the type attributeName
+ */
+ public String getAttributesToString(String attributeTypeName) throws OseeCoreException {
+ StringBuffer sb = new StringBuffer();
+ for (Attribute<?> attr : getAttributes(attributeTypeName)) {
+ sb.append(attr);
+ sb.append(", ");
+ }
+ return sb.toString().replaceFirst(", $", "");
+ }
+
+ public String getAttributesToString(IAttributeType attributeType) throws OseeCoreException {
+ return getAttributesToString(attributeType.getName());
+ }
+
+ /**
+ * All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
+ * attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
+ * excess attributes will be deleted.
+ */
+ public void setAttributeValues(IAttributeType attributeType, Collection<String> newValues) throws OseeCoreException {
+ setAttributeValues(attributeType.getName(), newValues);
+ }
+
+ /**
+ * All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
+ * attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
+ * excess attributes will be deleted.
+ */
+ public void setAttributeValues(String attributeTypeName, Collection<String> newValues) throws OseeCoreException {
+ ensureAttributesLoaded();
+ // ensure new values are unique
+ HashSet<String> uniqueNewValues = new HashSet<String>(newValues);
+
+ List<Attribute<Object>> remainingAttributes = getAttributes(attributeTypeName);
+ List<String> remainingNewValues = new ArrayList<String>(uniqueNewValues.size());
+
+ // all existing attributes matching a new value will be left untouched
+ for (String newValue : uniqueNewValues) {
+ boolean found = false;
+ for (Attribute<Object> attribute : remainingAttributes) {
+ if (attribute.getValue().toString().equals(newValue)) {
+ remainingAttributes.remove(attribute);
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ remainingNewValues.add(newValue);
+ }
+ }
+
+ for (String newValue : remainingNewValues) {
+ if (remainingAttributes.isEmpty()) {
+ setOrAddAttribute(attributeTypeName, newValue);
+ } else {
+ int index = remainingAttributes.size() - 1;
+ remainingAttributes.get(index).setValue(newValue);
+ remainingAttributes.remove(index);
+ }
+ }
+
+ for (Attribute<Object> attribute : remainingAttributes) {
+ attribute.delete();
+ }
+ }
+
+ /**
+ * adds a new attribute of the type named attributeTypeName and assigns it the given value
+ */
+ public <T> void addAttribute(String attributeTypeName, T value) throws OseeCoreException {
+ addAttribute(AttributeTypeManager.getType(attributeTypeName), value);
+ }
+
+ /**
+ * adds a new attribute of the type named attributeTypeName and assigns it the given value
+ */
+ public <T> void addAttribute(IAttributeType attributeType, T value) throws OseeCoreException {
+ initializeAttribute(attributeType, ModificationType.NEW, true, false).setValue(value);
+ }
+
+ /**
+ * adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
+ * if any.
+ */
+ public void addAttribute(IAttributeType attributeType) throws OseeCoreException {
+ initializeAttribute(attributeType, ModificationType.NEW, true, true);
+ }
+
+ /**
+ * adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
+ * if any.
+ */
+ public void addAttribute(AttributeType attributeType) throws OseeCoreException {
+ initializeAttribute(attributeType, ModificationType.NEW, true, true);
+ }
+
+ /**
+ * adds a new attribute of the type named attributeTypeName and assigns it the given value
+ */
+ public void addAttributeFromString(String attributeTypeName, String value) throws OseeCoreException {
+ initializeAttribute(AttributeTypeManager.getType(attributeTypeName), ModificationType.NEW, true, false).setFromString(
+ value);
+ }
+
+ /**
+ * we do not what duplicated enumerated values so this method silently returns if the specified attribute type is
+ * enumerated and value is already present
+ */
+ public <T> void setOrAddAttribute(String attributeTypeName, T value) throws OseeCoreException {
+ List<Attribute<String>> attributes = getAttributes(attributeTypeName);
+ for (Attribute<String> canidateAttribute : attributes) {
+ if (canidateAttribute.getValue().equals(value)) {
+ return;
+ }
+ }
+ addAttribute(attributeTypeName, value);
+ }
+
+ /**
+ * @return string collection containing of all the attribute values of the type attributeName
+ */
+ public List<String> getAttributesToStringList(String attributeTypeName) throws OseeCoreException {
+ ensureAttributesLoaded();
+
+ List<String> items = new ArrayList<String>();
+ for (Attribute<?> attribute : getAttributes(attributeTypeName)) {
+ items.add(attribute.getDisplayableString());
+ }
+ return items;
+ }
+
+ /**
+ * @return string collection containing of all the attribute values of the type attributeName
+ */
+ public List<String> getAttributesToStringList(IAttributeType attributeType) throws OseeCoreException {
+ return getAttributesToStringList(attributeType.getName());
+ }
+
+ @Override
+ public String getName() {
+ String name = null;
+ try {
+ ensureAttributesLoaded();
+ // use the first name attribute whether deleted or not.
+ for (Attribute<?> attribute : internalGetAttributes()) {
+ if (attribute.isOfType(CoreAttributeTypes.NAME)) {
+ name = (String) attribute.getValue();
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ if (!Strings.isValid(name)) {
+ return UNNAMED;
+ }
+ return name;
+ }
+
+ public void setName(String name) throws OseeCoreException {
+ setSoleAttributeValue("Name", name);
+ }
+
+ public ArtifactFactory getFactory() {
+ return parentFactory;
+ }
+
+ /**
+ * This is used to mark that the artifact deleted.
+ */
+ public void internalSetDeleted() throws OseeCoreException {
+ this.modType = ModificationType.DELETED;
+
+ for (Attribute<?> attribute : getAttributes()) {
+ attribute.setArtifactDeleted();
+ }
+ }
+
+ public void internalSetDeletedFromRemoteEvent() throws OseeCoreException {
+ if (!isHistorical()) {
+ this.modType = ModificationType.DELETED;
+ ArtifactCache.deCache(this);
+
+ for (Attribute<?> attribute : getAttributes()) {
+ attribute.internalSetDeletedFromRemoteEvent();
+ }
+ }
+ }
+
+ /**
+ * This is used to mark that the artifact not deleted. This should only be called by the RemoteEventManager.
+ */
+ public void resetToPreviousModType() {
+ this.modType = lastValidModType;
+
+ for (Attribute<?> attribute : attributes.getValues()) {
+ if (attribute.getModificationType() == ModificationType.ARTIFACT_DELETED) {
+ attribute.resetModType();
+ }
+ }
+ }
+
+ /**
+ * @return whether this artifact has unsaved attribute changes
+ */
+ public boolean hasDirtyAttributes() {
+ for (Attribute<?> attribute : internalGetAttributes()) {
+ if (attribute.isDirty()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @return whether this artifact has unsaved relation changes
+ */
+ public boolean hasDirtyRelations() {
+ return RelationManager.hasDirtyLinks(this);
+ }
+
+ public EditState getEditState() {
+ return objectEditState;
+ }
+
+ public boolean hasDirtyArtifactType() {
+ return objectEditState.isArtifactTypeChange();
+ }
+
+ /**
+ * @return whether this artifact has unsaved relation changes
+ */
+ public boolean isDirty() {
+ return hasDirtyAttributes() || hasDirtyRelations() || hasDirtyArtifactType();
+ }
+
+ private IAccessControlService getAccessControlService() throws OseeCoreException {
+ return Activator.getInstance().getAccessControlService();
+ }
+
+ public boolean isReadOnly() {
+ try {
+ return isDeleted() || isHistorical() || !getBranch().isEditable() || !getAccessControlService().hasPermission(
+ this, PermissionEnum.WRITE);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ return true;
+ }
+ }
+
+ public void revert() throws OseeCoreException {
+ DbTransaction dbTransaction = new DbTransaction() {
+ @Override
+ protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ ArtifactPersistenceManager.revertArtifact(connection, Artifact.this);
+ }
+ };
+ dbTransaction.execute();
+ }
+
+ /**
+ * Reloads this artifact's attributes and relations back to the last state saved. This will have no effect if the
+ * artifact has never been saved.
+ */
+ public void reloadAttributesAndRelations() throws OseeCoreException {
+ if (!isInDb()) {
+ return;
+ }
+
+ ArtifactQuery.reloadArtifactFromId(getArtId(), getBranch());
+ }
+
+ void prepareForReload() {
+ attributes.clear();
+ linksLoaded = false;
+
+ RelationManager.prepareRelationsForReload(this);
+ }
+
+ private final void persistAttributes(SkynetTransaction transaction) throws OseeCoreException {
+ if (!UserManager.duringMainUserCreation() && !getAccessControlService().hasPermission(getBranch(),
+ PermissionEnum.WRITE)) {
+ throw new OseeArgumentException(
+ "No write permissions for the branch that this artifact belongs to:" + getBranch());
+ }
+ if (isHistorical()) {
+ throw new OseeArgumentException(
+ "The artifact " + getGuid() + " must be at the head of the branch to be edited.");
+ }
+
+ if (hasDirtyAttributes() || hasDirtyArtifactType()) {
+ transaction.addArtifactAndAttributes(this);
+ onAttributePersist(transaction);
+ }
+ }
+
+ private final void persistRelations(SkynetTransaction transaction) throws OseeCoreException {
+ RelationManager.persistRelationsFor(transaction, this, null);
+ }
+
+ public final void persist() throws OseeCoreException {
+ persist("artifact.persist() default transaction");
+ }
+
+ public final void persist(String comment) throws OseeCoreException {
+ SkynetTransaction transaction = new SkynetTransaction(branch, comment);
+ persist(transaction);
+ transaction.execute();
+ }
+
+ public final void persist(SkynetTransaction transaction) throws OseeCoreException {
+ if (transaction == null) {
+ persist();
+ } else {
+ persistAttributes(transaction);
+ persistRelations(transaction);
+ }
+ }
+
+ /**
+ * Returns all of the descendants through the primary decomposition tree that have a particular human readable id.
+ * This will not return the called upon node if the name matches since it can not be a descendant of itself.
+ *
+ * @param humanReadableId The human readable id text to match against.
+ * @param caseSensitive Whether to use case sensitive matching.
+ * @return <code>Collection</code> of <code>Artifact</code>'s that match.
+ */
+ public Collection<Artifact> getDescendants(String humanReadableId, boolean caseSensitive) throws OseeCoreException {
+ Collection<Artifact> descendants = new LinkedList<Artifact>();
+
+ for (Artifact child : getChildren()) {
+ if (caseSensitive && child.getName().equals(humanReadableId) || !caseSensitive && child.getName().equalsIgnoreCase(
+ humanReadableId)) {
+ descendants.add(child);
+ }
+ descendants.addAll(child.getDescendants(humanReadableId, caseSensitive));
+ }
+
+ return descendants;
+ }
+
+ /**
+ * Starting from this artifact, walks down the child hierarchy based on the list of child names provided and returns
+ * the child of the last name provided. ArtifactDoesNotExist exception is thrown ff any child along the path does not
+ * exist.
+ *
+ * @return child at the leaf (bottom) of the specified hierarchy.
+ * @throws OseeCoreException
+ */
+ public Artifact getDescendant(String... names) throws OseeCoreException {
+ if (names.length == 0) {
+ throw new OseeArgumentException("Must suply at least one name to getDescendant()");
+ }
+ Artifact descendant = this;
+ for (String name : names) {
+ descendant = descendant.getChild(name);
+ }
+ return descendant;
+ }
+
+ /**
+ * Removes artifact from a specific branch
+ */
+ public void deleteAndPersist() throws OseeCoreException {
+ SkynetTransaction transaction = new SkynetTransaction(branch, "Delete artifact from a specific branch");
+ deleteAndPersist(transaction);
+ transaction.execute();
+ }
+
+ public void deleteAndPersist(SkynetTransaction transaction, boolean overrideChecks) throws OseeCoreException {
+ ArtifactPersistenceManager.deleteArtifact(transaction, overrideChecks, this);
+ }
+
+ /**
+ * Removes artifact from a specific branch
+ */
+ public void deleteAndPersist(SkynetTransaction transaction) throws OseeCoreException {
+ ArtifactPersistenceManager.deleteArtifact(transaction, false, this);
+ }
+
+ public void delete() throws OseeCoreException {
+ ArtifactPersistenceManager.deleteArtifact(null, false, this);
+ }
+
+ /**
+ * Remove artifact from a specific branch in the database
+ */
+ public void purgeFromBranch() throws OseeCoreException {
+ new PurgeArtifacts(Arrays.asList(this)).execute();
+ }
+
+ public boolean isDeleted() {
+ return modType == ModificationType.DELETED;
+ }
+
+ public void setLinksLoaded(boolean loaded) {
+ linksLoaded = loaded;
+ }
+
+ public void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationTypeSide, Artifact artifact, String rationale) throws OseeCoreException {
+ Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
+ RelationManager.addRelation(sorterId, RelationTypeManager.getType(relationTypeSide), sides.getFirst(),
+ sides.getSecond(), rationale);
+ }
+
+ public void addRelation(IRelationEnumeration relationSide, Artifact artifact) throws OseeCoreException {
+ addRelation(null, relationSide, artifact, null);
+ }
+
+ public void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationSide, Artifact artifact) throws OseeCoreException {
+ addRelation(sorterId, relationSide, artifact, null);
+ }
+
+ public void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd, String rationale) throws OseeCoreException {
+ boolean sideA = relationEnumeration.getSide().isSideA();
+ Artifact artifactA = sideA ? itemToAdd : this;
+ Artifact artifactB = sideA ? this : itemToAdd;
+
+ RelationManager.addRelation(sorterId, RelationTypeManager.getType(relationEnumeration), artifactA, artifactB,
+ rationale);
+ setRelationOrder(relationEnumeration, targetArtifact, insertAfterTarget, itemToAdd);
+ }
+
+ public void setRelationOrder(IRelationEnumeration relationSide, List<Artifact> artifactsInNewOrder) throws OseeCoreException {
+ RelationManager.setRelationOrder(this, RelationTypeManager.getType(relationSide), relationSide.getSide(),
+ RelationOrderBaseTypes.USER_DEFINED, artifactsInNewOrder);
+ }
+
+ public void setRelationOrder(IRelationEnumeration relationEnumeration, IRelationSorterId orderId) throws OseeCoreException {
+ if (RelationOrderBaseTypes.USER_DEFINED == orderId) {
+ setRelationOrder(relationEnumeration, getRelatedArtifacts(relationEnumeration));
+ } else {
+ List<Artifact> empty = java.util.Collections.emptyList();
+ RelationManager.setRelationOrder(this, RelationTypeManager.getType(relationEnumeration),
+ relationEnumeration.getSide(), orderId, empty);
+ }
+ }
+
+ public void setRelationOrder(IRelationEnumeration relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd) throws OseeCoreException {
+ List<Artifact> currentOrder = getRelatedArtifacts(relationEnumeration, Artifact.class);
+ // target artifact doesn't exist
+ if (!currentOrder.contains(targetArtifact)) {
+ // add to end of list if not already in list
+ if (!currentOrder.contains(itemToAdd)) {
+ currentOrder.add(itemToAdd);
+ }
+ }
+ boolean result = Collections.moveItem(currentOrder, itemToAdd, targetArtifact, insertAfterTarget);
+ if (!result) {
+ throw new OseeStateException("Could not set Relation Order");
+ }
+
+ RelationManager.setRelationOrder(this, RelationTypeManager.getType(relationEnumeration),
+ relationEnumeration.getSide(), RelationOrderBaseTypes.USER_DEFINED, currentOrder);
+ }
+
+ public void deleteRelation(IRelationEnumeration relationTypeSide, Artifact artifact) throws OseeCoreException {
+ Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide);
+ RelationManager.deleteRelation(RelationTypeManager.getType(relationTypeSide), sides.getFirst(), sides.getSecond());
+ }
+
+ public void deleteRelations(IRelationEnumeration relationSide) throws OseeCoreException {
+ for (Artifact art : getRelatedArtifacts(relationSide)) {
+ deleteRelation(relationSide, art);
+ }
+ }
+
+ /**
+ * Creates new relations that don't already exist and removes relations to artifacts that are not in collection
+ */
+ public void setRelations(IRelationSorterId sorterId, IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException {
+ Collection<Artifact> currentlyRelated = getRelatedArtifacts(relationSide, Artifact.class);
+ // Remove relations that have been removed
+ for (Artifact artifact : currentlyRelated) {
+ if (!artifacts.contains(artifact)) {
+ deleteRelation(relationSide, artifact);
+ }
+ }
+ // Add new relations if don't exist
+ for (Artifact artifact : artifacts) {
+ if (!currentlyRelated.contains(artifact)) {
+ addRelation(sorterId, relationSide, artifact);
+ }
+ }
+ }
+
+ /**
+ * Creates new relations that don't already exist and removes relations to artifacts that are not in collection
+ */
+ public void setRelations(IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException {
+ setRelations(null, relationSide, artifacts);
+ }
+
+ /**
+ * Creates new relations that don't already exist and removes relations to artifacts that are not in collection
+ */
+ public void setRelationsOfTypeUseCurrentOrder(IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts, Class<?> clazz) throws OseeCoreException {
+ RelationTypeSideSorter sorter =
RelationManager.createTypeSideSorter(this, RelationTypeManager.getType(relationSide),
relationSide.getSide());
- Collection<Artifact> currentlyRelated = getRelatedArtifacts(relationSide, Artifact.class);
- // Add new relations if don't exist
- for (Artifact artifact : artifacts) {
- if (clazz.isInstance(artifact) && !currentlyRelated.contains(artifact)) {
- addRelation(sorter.getSorterId(), relationSide, artifact);
- }
- }
- // Remove relations that have been removed
- for (Artifact artifact : currentlyRelated) {
- if (clazz.isInstance(artifact) && !artifacts.contains(artifact)) {
- deleteRelation(relationSide, artifact);
- }
- }
- }
-
- public final boolean isLinksLoaded() {
- return linksLoaded;
- }
-
- public String getHumanReadableId() {
- return humanReadableId;
- }
-
- private void populateHumanReadableID() throws OseeDataStoreException {
- String hrid = HumanReadableId.generate();
- humanReadableId = isUniqueHRID(hrid) ? hrid : HumanReadableId.generate();
- }
-
- public static boolean isUniqueHRID(String id) throws OseeDataStoreException {
- String DUPLICATE_HRID_SEARCH =
- "select count(1) from (select DISTINCT(art_id) from osee_artifact where human_readable_id = ?) t1";
- return ConnectionHandler.runPreparedQueryFetchLong(0L, DUPLICATE_HRID_SEARCH, id) <= 0;
- }
-
- /**
- * @return Returns the descriptor.
- */
- @Override
- public ArtifactType getArtifactType() {
- return artifactType;
- }
-
- public String getVersionedName() {
- String name = getName();
-
- if (isHistorical()) {
- name += " [Rev:" + transactionId + "]";
- }
-
- return name;
- }
-
- /**
- * Return true if this artifact any of it's links specified or any of the artifacts on the other side of the links
- * are dirty
- *
- * @param links
- */
- public String isRelationsAndArtifactsDirty(Set<IRelationEnumeration> links) {
- try {
- if (hasDirtyAttributes()) {
-
- for (Attribute<?> attribute : internalGetAttributes()) {
- if (attribute.isDirty()) {
- return "===> Dirty Attribute - " + attribute.getAttributeType().getName() + "\n";
- }
- }
- return "Artifact isDirty == true??";
- }
- // Loop through all relations
- for (IRelationEnumeration side : links) {
- for (Artifact art : getRelatedArtifacts(side)) {
- // Check artifact dirty
- if (art.hasDirtyAttributes()) {
- return art.getArtifactTypeName() + " \"" + art + "\" => dirty\n";
- }
- // Check the links to this artifact
- for (RelationLink link : getRelations(side, art)) {
- if (link.isDirty()) {
- return "Link \"" + link + "\" => dirty\n";
- }
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return null;
- }
-
- /**
- * Creates a new artifact and duplicates all of its attribute data.
- *
- * @throws OseeCoreException
- */
- public Artifact duplicate(Branch branch) throws OseeCoreException {
- Artifact newArtifact = ArtifactTypeManager.makeNewArtifact(artifactType, branch);
- // we do this because attributes were added on creation to meet the
- // minimum attribute requirements
- newArtifact.attributes.clear();
- copyAttributes(newArtifact);
- return newArtifact;
- }
-
- private void copyAttributes(Artifact artifact) throws OseeCoreException {
- for (Attribute<?> attribute : getAttributes()) {
- if (isCopyAllowed(attribute)) {
- artifact.addAttribute(attribute.getAttributeType(), attribute.getValue());
- }
- }
- }
-
- private boolean isCopyAllowed(Attribute<?> attribute) {
- return attribute != null && !attribute.isOfType(CoreAttributeTypes.RELATION_ORDER);
- }
-
- /**
- * An artifact reflected about its own branch returns itself. Otherwise a new artifact is introduced on the
- * destinationBranch
- *
- * @param destinationBranch
- * @return the newly created artifact or this artifact if the destinationBranch is this artifact's branch
- * @throws OseeCoreException
- */
- public Artifact reflect(IOseeBranch destinationBranch) throws OseeCoreException {
- if (branch.equals(destinationBranch)) {
- return this;
- }
- return reflectHelper(destinationBranch);
- }
-
- private Artifact reflectHelper(IOseeBranch branch) throws OseeCoreException {
- Artifact reflectedArtifact =
- ArtifactTypeManager.getFactory(artifactType).reflectExisitingArtifact(artId, guid, humanReadableId,
- artifactType, gammaId, branch, ModificationType.INTRODUCED);
-
- for (Attribute<?> sourceAttribute : attributes.getValues()) {
- // In order to reflect attributes they must exist in the data store
- // and be valid for the destination branch as well
- if (sourceAttribute.isInDb() && reflectedArtifact.isAttributeTypeValid(sourceAttribute.getAttributeType())) {
- reflectedArtifact.internalInitializeAttribute(sourceAttribute.getAttributeType(), sourceAttribute.getId(),
- sourceAttribute.getGammaId(), ModificationType.INTRODUCED, true,
- sourceAttribute.getAttributeDataProvider().getData());
- }
- }
- return reflectedArtifact;
- }
-
- public void updateArtifactFromBranch(IOseeBranch updateSourceBranch) throws OseeCoreException {
- // Do not update the artifact with itself.
- if (branch.equals(updateSourceBranch)) {
- return;
- }
- updateAttributesFromBranch(updateSourceBranch);
- }
-
- @SuppressWarnings("unchecked")
- private void updateAttributesFromBranch(IOseeBranch updateSourceBranch) throws OseeCoreException {
- Artifact updateSourceArtifact = ArtifactQuery.getArtifactFromId(this.getArtId(), updateSourceBranch);
- for (Attribute updateSourceAttr : updateSourceArtifact.getAttributes()) {
- Attribute thisAttr = getAttributeById(updateSourceAttr.getId(), true);
- if (isCopyAllowed(updateSourceAttr)) {
- if (thisAttr != null && thisAttr.getGammaId() != updateSourceAttr.getGammaId()) {
- thisAttr.setValue(updateSourceAttr.getValue());
- }
- }
- }
- }
-
- /**
- * @return the transaction number that was set when this artifact was loaded
- */
- public int getTransactionNumber() {
- return transactionId;
- }
-
- public TransactionRecord getTransactionRecord() throws OseeCoreException {
- if (transactionId == TRANSACTION_SENTINEL) {
- return null;
- }
- return TransactionManager.getTransactionId(transactionId);
- }
-
- /**
- * @return Returns the gammaId.
- */
- public int getGammaId() {
- return gammaId;
- }
-
- /**
- * @return Returns dirty attributes.
- * @throws Exception
- */
- public Collection<SkynetAttributeChange> getDirtySkynetAttributeChanges() throws OseeDataStoreException {
- List<SkynetAttributeChange> dirtyAttributes = new LinkedList<SkynetAttributeChange>();
-
- for (Attribute<?> attribute : internalGetAttributes()) {
- if (attribute.isDirty()) {
- dirtyAttributes.add(new SkynetAttributeChange(attribute.getAttributeType().getId(),
+ Collection<Artifact> currentlyRelated = getRelatedArtifacts(relationSide, Artifact.class);
+ // Add new relations if don't exist
+ for (Artifact artifact : artifacts) {
+ if (clazz.isInstance(artifact) && !currentlyRelated.contains(artifact)) {
+ addRelation(sorter.getSorterId(), relationSide, artifact);
+ }
+ }
+ // Remove relations that have been removed
+ for (Artifact artifact : currentlyRelated) {
+ if (clazz.isInstance(artifact) && !artifacts.contains(artifact)) {
+ deleteRelation(relationSide, artifact);
+ }
+ }
+ }
+
+ public final boolean isLinksLoaded() {
+ return linksLoaded;
+ }
+
+ public String getHumanReadableId() {
+ return humanReadableId;
+ }
+
+ private void populateHumanReadableID() throws OseeDataStoreException {
+ String hrid = HumanReadableId.generate();
+ humanReadableId = isUniqueHRID(hrid) ? hrid : HumanReadableId.generate();
+ }
+
+ public static boolean isUniqueHRID(String id) throws OseeDataStoreException {
+ String DUPLICATE_HRID_SEARCH =
+ "select count(1) from (select DISTINCT(art_id) from osee_artifact where human_readable_id = ?) t1";
+ return ConnectionHandler.runPreparedQueryFetchLong(0L, DUPLICATE_HRID_SEARCH, id) <= 0;
+ }
+
+ /**
+ * @return Returns the descriptor.
+ */
+ @Override
+ public ArtifactType getArtifactType() {
+ return artifactType;
+ }
+
+ public String getVersionedName() {
+ String name = getName();
+
+ if (isHistorical()) {
+ name += " [Rev:" + transactionId + "]";
+ }
+
+ return name;
+ }
+
+ /**
+ * Return true if this artifact any of it's links specified or any of the artifacts on the other side of the links
+ * are dirty
+ */
+ public String isRelationsAndArtifactsDirty(Set<IRelationEnumeration> links) {
+ try {
+ if (hasDirtyAttributes()) {
+
+ for (Attribute<?> attribute : internalGetAttributes()) {
+ if (attribute.isDirty()) {
+ return "===> Dirty Attribute - " + attribute.getAttributeType().getName() + "\n";
+ }
+ }
+ return "Artifact isDirty == true??";
+ }
+ // Loop through all relations
+ for (IRelationEnumeration side : links) {
+ for (Artifact art : getRelatedArtifacts(side)) {
+ // Check artifact dirty
+ if (art.hasDirtyAttributes()) {
+ return art.getArtifactTypeName() + " \"" + art + "\" => dirty\n";
+ }
+ // Check the links to this artifact
+ for (RelationLink link : getRelations(side, art)) {
+ if (link.isDirty()) {
+ return "Link \"" + link + "\" => dirty\n";
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return null;
+ }
+
+ /**
+ * Creates a new artifact and duplicates all of its attribute data.
+ */
+ public Artifact duplicate(Branch branch) throws OseeCoreException {
+ Artifact newArtifact = ArtifactTypeManager.makeNewArtifact(artifactType, branch);
+ // we do this because attributes were added on creation to meet the
+ // minimum attribute requirements
+ newArtifact.attributes.clear();
+ copyAttributes(newArtifact);
+ return newArtifact;
+ }
+
+ private void copyAttributes(Artifact artifact) throws OseeCoreException {
+ for (Attribute<?> attribute : getAttributes()) {
+ if (isCopyAllowed(attribute)) {
+ artifact.addAttribute(attribute.getAttributeType(), attribute.getValue());
+ }
+ }
+ }
+
+ private boolean isCopyAllowed(Attribute<?> attribute) {
+ return attribute != null && !attribute.isOfType(CoreAttributeTypes.RELATION_ORDER);
+ }
+
+ /**
+ * An artifact reflected about its own branch returns itself. Otherwise a new artifact is introduced on the
+ * destinationBranch
+ *
+ * @return the newly created artifact or this artifact if the destinationBranch is this artifact's branch
+ */
+ public Artifact reflect(IOseeBranch destinationBranch) throws OseeCoreException {
+ if (branch.equals(destinationBranch)) {
+ return this;
+ }
+ return reflectHelper(destinationBranch);
+ }
+
+ private Artifact reflectHelper(IOseeBranch branch) throws OseeCoreException {
+ Artifact reflectedArtifact =
+ ArtifactTypeManager.getFactory(artifactType).reflectExisitingArtifact(artId, guid, humanReadableId,
+ artifactType, gammaId, branch, ModificationType.INTRODUCED);
+
+ for (Attribute<?> sourceAttribute : attributes.getValues()) {
+ // In order to reflect attributes they must exist in the data store
+ // and be valid for the destination branch as well
+ if (sourceAttribute.isInDb() && reflectedArtifact.isAttributeTypeValid(sourceAttribute.getAttributeType())) {
+ reflectedArtifact.internalInitializeAttribute(sourceAttribute.getAttributeType(), sourceAttribute.getId(),
+ sourceAttribute.getGammaId(), ModificationType.INTRODUCED, true,
+ sourceAttribute.getAttributeDataProvider().getData());
+ }
+ }
+ return reflectedArtifact;
+ }
+
+ public void updateArtifactFromBranch(IOseeBranch updateSourceBranch) throws OseeCoreException {
+ // Do not update the artifact with itself.
+ if (branch.equals(updateSourceBranch)) {
+ return;
+ }
+ updateAttributesFromBranch(updateSourceBranch);
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ private void updateAttributesFromBranch(IOseeBranch updateSourceBranch) throws OseeCoreException {
+ Artifact updateSourceArtifact = ArtifactQuery.getArtifactFromId(this.getArtId(), updateSourceBranch);
+ for (Attribute<?> updateSourceAttr : updateSourceArtifact.getAttributes()) {
+ Attribute thisAttr = getAttributeById(updateSourceAttr.getId(), true);
+ if (isCopyAllowed(updateSourceAttr)) {
+ if (thisAttr != null && thisAttr.getGammaId() != updateSourceAttr.getGammaId()) {
+ thisAttr.setValue(updateSourceAttr.getValue());
+ }
+ }
+ }
+ }
+
+ /**
+ * @return the transaction number that was set when this artifact was loaded
+ */
+ public int getTransactionNumber() {
+ return transactionId;
+ }
+
+ public TransactionRecord getTransactionRecord() throws OseeCoreException {
+ if (transactionId == TRANSACTION_SENTINEL) {
+ return null;
+ }
+ return TransactionManager.getTransactionId(transactionId);
+ }
+
+ /**
+ * @return Returns the gammaId.
+ */
+ public int getGammaId() {
+ return gammaId;
+ }
+
+ /**
+ * @return Returns dirty attributes.
+ */
+ public Collection<SkynetAttributeChange> getDirtySkynetAttributeChanges() throws OseeDataStoreException {
+ List<SkynetAttributeChange> dirtyAttributes = new LinkedList<SkynetAttributeChange>();
+
+ for (Attribute<?> attribute : internalGetAttributes()) {
+ if (attribute.isDirty()) {
+ dirtyAttributes.add(new SkynetAttributeChange(attribute.getAttributeType().getId(),
attribute.getAttributeDataProvider().getData(), attribute.getModificationType(),
attribute.getId(), attribute.getGammaId()));
- }
- }
- return dirtyAttributes;
- }
-
- public Collection<AttributeChange> getDirtyFrameworkAttributeChanges() throws OseeDataStoreException {
- List<AttributeChange> dirtyAttributes = new LinkedList<AttributeChange>();
-
- for (Attribute<?> attribute : internalGetAttributes()) {
- if (attribute.isDirty()) {
- AttributeChange change = new AttributeChange();
- change.setAttrTypeGuid(attribute.getAttributeType().getGuid());
- change.setGammaId(attribute.getGammaId());
- change.setAttributeId(attribute.getId());
- change.setModTypeGuid(AttributeEventModificationType.getType(attribute.getModificationType()).getGuid());
- for (Object obj : attribute.getAttributeDataProvider().getData()) {
- if (obj == null) {
- change.getData().add("");
- } else if (obj instanceof String) {
- change.getData().add((String) obj);
- } else {
- OseeLog.log(Activator.class, Level.SEVERE, "Unhandled data type " + obj.getClass().getSimpleName());
- }
- }
- dirtyAttributes.add(change);
- }
- }
- return dirtyAttributes;
- }
-
- /**
- * Changes the artifact type.
- *
- * @param artifactType
- * @throws OseeDataStoreException
- */
- public void setArtifactType(ArtifactType artifactType) {
- if (!this.artifactType.equals(artifactType)) {
- this.artifactType = artifactType;
- objectEditState = EditState.ARTIFACT_TYPE_MODIFIED;
- if (isInDb()) {
- lastValidModType = modType;
- modType = ModificationType.MODIFIED;
- }
- }
- }
-
- public void clearEditState() {
- objectEditState = EditState.NO_CHANGE;
- resetToPreviousModType();
- }
-
- private static final Pattern safeNamePattern = Pattern.compile("[^A-Za-z0-9 ]");
- private static final String[] NUMBER = new String[] {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven",
- "Eight", "Nine"};
-
- /**
- * Since artifact names are free text it is important to reformat the name to ensure it is suitable as an element
- * name
- *
- * @return artifact name in a form that is valid as an XML element
- */
- public String getSafeName() {
- String elementName = safeNamePattern.matcher(getName()).replaceAll("_");
-
- // Fix the first character if it is a number by replacing it with its name
- char firstChar = elementName.charAt(0);
- if (firstChar >= '0' && firstChar <= '9') {
- elementName = NUMBER[firstChar - '0'] + elementName.substring(1);
- }
-
- if (elementName.length() > 75) {
- elementName = elementName.substring(0, 75);
- }
-
- return elementName;
- }
-
- private Set<IArtifactAnnotation> artifactAnnotationExtensions;
-
- private Set<IArtifactAnnotation> getAnnotationExtensions() {
- if (artifactAnnotationExtensions != null) {
- return artifactAnnotationExtensions;
- }
- artifactAnnotationExtensions = new HashSet<IArtifactAnnotation>();
- IExtensionPoint point =
+ }
+ }
+ return dirtyAttributes;
+ }
+
+ public Collection<AttributeChange> getDirtyFrameworkAttributeChanges() throws OseeDataStoreException {
+ List<AttributeChange> dirtyAttributes = new LinkedList<AttributeChange>();
+
+ for (Attribute<?> attribute : internalGetAttributes()) {
+ if (attribute.isDirty()) {
+ AttributeChange change = new AttributeChange();
+ change.setAttrTypeGuid(attribute.getAttributeType().getGuid());
+ change.setGammaId(attribute.getGammaId());
+ change.setAttributeId(attribute.getId());
+ change.setModTypeGuid(AttributeEventModificationType.getType(attribute.getModificationType()).getGuid());
+ for (Object obj : attribute.getAttributeDataProvider().getData()) {
+ if (obj == null) {
+ change.getData().add("");
+ } else if (obj instanceof String) {
+ change.getData().add((String) obj);
+ } else {
+ OseeLog.log(Activator.class, Level.SEVERE, "Unhandled data type " + obj.getClass().getSimpleName());
+ }
+ }
+ dirtyAttributes.add(change);
+ }
+ }
+ return dirtyAttributes;
+ }
+
+ /**
+ * Changes the artifact type.
+ */
+ public void setArtifactType(ArtifactType artifactType) {
+ if (!this.artifactType.equals(artifactType)) {
+ this.artifactType = artifactType;
+ objectEditState = EditState.ARTIFACT_TYPE_MODIFIED;
+ if (isInDb()) {
+ lastValidModType = modType;
+ modType = ModificationType.MODIFIED;
+ }
+ }
+ }
+
+ public void clearEditState() {
+ objectEditState = EditState.NO_CHANGE;
+ resetToPreviousModType();
+ }
+
+ private static final Pattern safeNamePattern = Pattern.compile("[^A-Za-z0-9 ]");
+ private static final String[] NUMBER = new String[] {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven",
+ "Eight", "Nine"};
+
+ /**
+ * Since artifact names are free text it is important to reformat the name to ensure it is suitable as an element
+ * name
+ *
+ * @return artifact name in a form that is valid as an XML element
+ */
+ public String getSafeName() {
+ String elementName = safeNamePattern.matcher(getName()).replaceAll("_");
+
+ // Fix the first character if it is a number by replacing it with its name
+ char firstChar = elementName.charAt(0);
+ if (firstChar >= '0' && firstChar <= '9') {
+ elementName = NUMBER[firstChar - '0'] + elementName.substring(1);
+ }
+
+ if (elementName.length() > 75) {
+ elementName = elementName.substring(0, 75);
+ }
+
+ return elementName;
+ }
+
+ private Set<IArtifactAnnotation> artifactAnnotationExtensions;
+
+ private Set<IArtifactAnnotation> getAnnotationExtensions() {
+ if (artifactAnnotationExtensions != null) {
+ return artifactAnnotationExtensions;
+ }
+ artifactAnnotationExtensions = new HashSet<IArtifactAnnotation>();
+ IExtensionPoint point =
Platform.getExtensionRegistry().getExtensionPoint(
"org.eclipse.osee.framework.skynet.core.ArtifactAnnotation");
- if (point == null) {
- System.err.println("Can't access ArtifactAnnotation extension point");
- return artifactAnnotationExtensions;
- }
- IExtension[] extensions = point.getExtensions();
- for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- String classname = null;
- String bundleName = null;
- for (IConfigurationElement el : elements) {
- if (el.getName().equals("ArtifactAnnotation")) {
- classname = el.getAttribute("classname");
- bundleName = el.getContributor().getName();
- if (classname != null && bundleName != null) {
- Bundle bundle = Platform.getBundle(bundleName);
- try {
- Class<?> taskClass = bundle.loadClass(classname);
- Object obj = taskClass.newInstance();
- artifactAnnotationExtensions.add((IArtifactAnnotation) obj);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- }
- }
- }
- return artifactAnnotationExtensions;
- }
-
- /**
- * @return the annotationMgr
- */
- public AttributeAnnotationManager getAnnotationMgr() {
- if (annotationMgr == null) {
- annotationMgr = new AttributeAnnotationManager(this);
- }
- return annotationMgr;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- if (adapter == null) {
- throw new IllegalArgumentException("adapter can not be null");
- }
-
- if (adapter.isInstance(this)) {
- return this;
- }
- return null;
- }
-
- @Override
- public final int compareTo(Artifact otherArtifact) {
- if (otherArtifact == null || otherArtifact.isDeleted()) {
- return -1;
- } else if (this.isDeleted()) {
- return 1;
- }
-
- int diff;
- if (otherArtifact.equals(this)) {
- diff = 0;
- } else {
- try {
- diff = getName().compareTo(otherArtifact.getName());
- } catch (Exception ex) {
- diff = 0;
- }
- }
-
- return diff;
- }
-
- @Override
- public final int hashCode() {
- int hashCode = 11;
- hashCode = hashCode * 37 + getGuid().hashCode();
- hashCode = hashCode * 37 + getBranch().hashCode();
- return hashCode;
- }
-
- /**
- * @param obj the reference object with which to compare.
- * @return <code>true</code> if this artifact has the same GUID and branch <code>false</code> otherwise.
- */
- @Override
- public final boolean equals(Object obj) {
- if (obj instanceof IBasicGuidArtifact) {
- IBasicGuidArtifact other = (IBasicGuidArtifact) obj;
- boolean result = getGuid().equals(other.getGuid());
- if (result) {
- if (getBranchGuid() != null && other.getBranchGuid() != null) {
- result = getBranchGuid().equals(other.getBranchGuid());
- }
- }
- return result;
- }
- if (obj instanceof IArtifact) {
- IArtifact other = (IArtifact) obj;
- boolean result = getArtId() == other.getArtId();
- if (result) {
- if (getBranch() != null && other.getBranch() != null) {
- result = getBranch().equals(other.getBranch());
- } else {
- result = getBranch() == null && other.getBranch() == null;
- }
- }
- return result;
- }
- return false;
- }
-
- public int getRemainingAttributeCount(AttributeType attributeType) throws OseeCoreException {
- return attributeType.getMaxOccurrences() - getAttributeCount(attributeType);
- }
-
- public int getAttributeCount(String attributeTypeName) throws OseeCoreException {
- ensureAttributesLoaded();
- return getAttributes(attributeTypeName).size();
- }
-
- public int getAttributeCount(IAttributeType attributeType) throws OseeCoreException {
- ensureAttributesLoaded();
- return getAttributes(attributeType).size();
- }
-
- void setArtId(int artifactId) {
- this.artId = artifactId;
- }
-
- /**
- * Return relations that exist between artifacts
- *
- * @throws ArtifactDoesNotExist
- */
- public ArrayList<RelationLink> internalGetRelations(Artifact artifact) throws OseeCoreException {
- ArrayList<RelationLink> relations = new ArrayList<RelationLink>();
- for (RelationLink relation : getRelationsAll(false)) {
- try {
- if (relation.getArtifactOnOtherSide(this).equals(artifact)) {
- relations.add(relation);
- }
- } catch (ArtifactDoesNotExist ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- return relations;
- }
-
- public List<RelationLink> getRelations(IRelationEnumeration relationEnum) throws OseeCoreException {
- return RelationManager.getRelations(this, RelationTypeManager.getType(relationEnum), relationEnum.getSide());
- }
-
- /**
- * Return relations that exist between artifacts of type side
- *
- * @throws OseeCoreException
- */
- @Deprecated
- public ArrayList<RelationLink> getRelations(IRelationEnumeration side, Artifact artifact) throws OseeCoreException {
- ArrayList<RelationLink> relations = new ArrayList<RelationLink>();
- for (RelationLink relation : getRelations(side)) {
- try {
- if (relation.getArtifactOnOtherSide(this).equals(artifact)) {
- relations.add(relation);
- }
- } catch (ArtifactDoesNotExist ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- return relations;
- }
-
- /**
- * @param relationType
- * @return a list of relations from a specific relation type
- */
- @Deprecated
- public List<RelationLink> getRelations(RelationType relationType) {
- return RelationManager.getRelations(this, relationType, null);
- }
-
- public List<RelationLink> getRelationsAll(boolean includeDeleted) {
- return RelationManager.getRelationsAll(getArtId(), getBranch().getId(), includeDeleted);
- }
-
- /**
- * This method should never be called from outside the OSEE Application Framework
- */
- void internalSetPersistenceData(int gammaId, int transactionId, ModificationType modType, boolean historical) {
- this.gammaId = gammaId;
- this.transactionId = transactionId;
- this.historical = historical;
- this.modType = modType;
- this.lastValidModType = modType;
- this.objectEditState = EditState.NO_CHANGE;
- }
-
- /**
- * This method should never be called from outside the OSEE Application Framework
- */
- public void setTransactionId(int transactionId) {
- this.transactionId = transactionId;
- }
-
- public Date getLastModified() throws OseeCoreException {
- if (transactionId == TRANSACTION_SENTINEL) {
- return new Date();
- }
- return getTransactionRecord().getTimeStamp();
- }
-
- public User getLastModifiedBy() throws OseeCoreException {
- TransactionRecord transactionRecord = getTransactionRecord();
- if (transactionRecord == null) {
- return UserManager.getUser(SystemUser.OseeSystem);
- }
- return UserManager.getUserByArtId(transactionRecord.getAuthor());
- }
-
- void meetMinimumAttributeCounts(boolean isNewArtifact) throws OseeCoreException {
- if (modType == ModificationType.DELETED) {
- return;
- }
- for (AttributeType attributeType : getAttributeTypes()) {
- int missingCount = attributeType.getMinOccurrences() - getAttributeCount(attributeType);
- for (int i = 0; i < missingCount; i++) {
- initializeAttribute(attributeType, ModificationType.NEW, isNewArtifact, true);
- }
- }
- }
-
- public ModificationType getModType() {
- return modType;
- }
-
- @Override
- public Artifact getFullArtifact() throws OseeCoreException {
- return this;
- }
-
- public DefaultBasicGuidArtifact getBasicGuidArtifact() {
- return new DefaultBasicGuidArtifact(getBranch().getGuid(), getArtifactType().getGuid(), getGuid());
- }
-
- @Override
- public String getArtTypeGuid() {
- return getArtifactType().getGuid();
- }
-
- @Override
- public String getBranchGuid() {
- return getBranch().getGuid();
- }
+ if (point == null) {
+ System.err.println("Can't access ArtifactAnnotation extension point");
+ return artifactAnnotationExtensions;
+ }
+ IExtension[] extensions = point.getExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ String classname = null;
+ String bundleName = null;
+ for (IConfigurationElement el : elements) {
+ if (el.getName().equals("ArtifactAnnotation")) {
+ classname = el.getAttribute("classname");
+ bundleName = el.getContributor().getName();
+ if (classname != null && bundleName != null) {
+ Bundle bundle = Platform.getBundle(bundleName);
+ try {
+ Class<?> taskClass = bundle.loadClass(classname);
+ Object obj = taskClass.newInstance();
+ artifactAnnotationExtensions.add((IArtifactAnnotation) obj);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ }
+ }
+ }
+ return artifactAnnotationExtensions;
+ }
+
+ public AttributeAnnotationManager getAnnotationMgr() {
+ if (annotationMgr == null) {
+ annotationMgr = new AttributeAnnotationManager(this);
+ }
+ return annotationMgr;
+ }
+
+ @Override
+ @SuppressWarnings({"rawtypes"})
+ public Object getAdapter(Class adapter) {
+ if (adapter == null) {
+ throw new IllegalArgumentException("adapter can not be null");
+ }
+
+ if (adapter.isInstance(this)) {
+ return this;
+ }
+ return null;
+ }
+
+ @Override
+ public final int compareTo(Artifact otherArtifact) {
+ if (otherArtifact == null || otherArtifact.isDeleted()) {
+ return -1;
+ } else if (this.isDeleted()) {
+ return 1;
+ }
+
+ int diff;
+ if (otherArtifact.equals(this)) {
+ diff = 0;
+ } else {
+ try {
+ diff = getName().compareTo(otherArtifact.getName());
+ } catch (Exception ex) {
+ diff = 0;
+ }
+ }
+
+ return diff;
+ }
+
+ @Override
+ public final int hashCode() {
+ int hashCode = 11;
+ hashCode = hashCode * 37 + getGuid().hashCode();
+ hashCode = hashCode * 37 + getBranch().hashCode();
+ return hashCode;
+ }
+
+ /**
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this artifact has the same GUID and branch <code>false</code> otherwise.
+ */
+ @Override
+ public final boolean equals(Object obj) {
+ if (obj instanceof IBasicGuidArtifact) {
+ IBasicGuidArtifact other = (IBasicGuidArtifact) obj;
+ boolean result = getGuid().equals(other.getGuid());
+ if (result) {
+ if (getBranchGuid() != null && other.getBranchGuid() != null) {
+ result = getBranchGuid().equals(other.getBranchGuid());
+ }
+ }
+ return result;
+ }
+ if (obj instanceof IArtifact) {
+ IArtifact other = (IArtifact) obj;
+ boolean result = getArtId() == other.getArtId();
+ if (result) {
+ if (getBranch() != null && other.getBranch() != null) {
+ result = getBranch().equals(other.getBranch());
+ } else {
+ result = getBranch() == null && other.getBranch() == null;
+ }
+ }
+ return result;
+ }
+ return false;
+ }
+
+ public int getRemainingAttributeCount(AttributeType attributeType) throws OseeCoreException {
+ return attributeType.getMaxOccurrences() - getAttributeCount(attributeType);
+ }
+
+ public int getAttributeCount(String attributeTypeName) throws OseeCoreException {
+ ensureAttributesLoaded();
+ return getAttributes(attributeTypeName).size();
+ }
+
+ public int getAttributeCount(IAttributeType attributeType) throws OseeCoreException {
+ ensureAttributesLoaded();
+ return getAttributes(attributeType).size();
+ }
+
+ void setArtId(int artifactId) {
+ this.artId = artifactId;
+ }
+
+ /**
+ * Return relations that exist between artifacts
+ */
+ public ArrayList<RelationLink> internalGetRelations(Artifact artifact) throws OseeCoreException {
+ ArrayList<RelationLink> relations = new ArrayList<RelationLink>();
+ for (RelationLink relation : getRelationsAll(false)) {
+ try {
+ if (relation.getArtifactOnOtherSide(this).equals(artifact)) {
+ relations.add(relation);
+ }
+ } catch (ArtifactDoesNotExist ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ return relations;
+ }
+
+ public List<RelationLink> getRelations(IRelationEnumeration relationEnum) throws OseeCoreException {
+ return RelationManager.getRelations(this, RelationTypeManager.getType(relationEnum), relationEnum.getSide());
+ }
+
+ /**
+ * Return relations that exist between artifacts of type side
+ */
+ @Deprecated
+ public ArrayList<RelationLink> getRelations(IRelationEnumeration side, Artifact artifact) throws OseeCoreException {
+ ArrayList<RelationLink> relations = new ArrayList<RelationLink>();
+ for (RelationLink relation : getRelations(side)) {
+ try {
+ if (relation.getArtifactOnOtherSide(this).equals(artifact)) {
+ relations.add(relation);
+ }
+ } catch (ArtifactDoesNotExist ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ return relations;
+ }
+
+ /**
+ * @return a list of relations from a specific relation type
+ */
+ @Deprecated
+ public List<RelationLink> getRelations(RelationType relationType) {
+ return RelationManager.getRelations(this, relationType, null);
+ }
+
+ public List<RelationLink> getRelationsAll(boolean includeDeleted) {
+ return RelationManager.getRelationsAll(getArtId(), getBranch().getId(), includeDeleted);
+ }
+
+ /**
+ * This method should never be called from outside the OSEE Application Framework
+ */
+ void internalSetPersistenceData(int gammaId, int transactionId, ModificationType modType, boolean historical) {
+ this.gammaId = gammaId;
+ this.transactionId = transactionId;
+ this.historical = historical;
+ this.modType = modType;
+ this.lastValidModType = modType;
+ this.objectEditState = EditState.NO_CHANGE;
+ }
+
+ /**
+ * This method should never be called from outside the OSEE Application Framework
+ */
+ public void setTransactionId(int transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public Date getLastModified() throws OseeCoreException {
+ if (transactionId == TRANSACTION_SENTINEL) {
+ return new Date();
+ }
+ return getTransactionRecord().getTimeStamp();
+ }
+
+ public User getLastModifiedBy() throws OseeCoreException {
+ TransactionRecord transactionRecord = getTransactionRecord();
+ if (transactionRecord == null) {
+ return UserManager.getUser(SystemUser.OseeSystem);
+ }
+ return UserManager.getUserByArtId(transactionRecord.getAuthor());
+ }
+
+ void meetMinimumAttributeCounts(boolean isNewArtifact) throws OseeCoreException {
+ if (modType == ModificationType.DELETED) {
+ return;
+ }
+ for (AttributeType attributeType : getAttributeTypes()) {
+ int missingCount = attributeType.getMinOccurrences() - getAttributeCount(attributeType);
+ for (int i = 0; i < missingCount; i++) {
+ initializeAttribute(attributeType, ModificationType.NEW, isNewArtifact, true);
+ }
+ }
+ }
+
+ public ModificationType getModType() {
+ return modType;
+ }
+
+ @Override
+ public Artifact getFullArtifact() {
+ return this;
+ }
+
+ public DefaultBasicGuidArtifact getBasicGuidArtifact() {
+ return new DefaultBasicGuidArtifact(getBranch().getGuid(), getArtifactType().getGuid(), getGuid());
+ }
+
+ @Override
+ public String getArtTypeGuid() {
+ return getArtifactType().getGuid();
+ }
+
+ @Override
+ public String getBranchGuid() {
+ return getBranch().getGuid();
+ }
+
+ public Set<DefaultBasicGuidRelationReorder> getRelationOrderRecords() {
+ return relationOrderRecords;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
index 40c29f0b20b..6b73676a3cd 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
@@ -32,7 +32,7 @@ import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
*/
public class AttributeTransactionData extends BaseTransactionData {
private static final String INSERT_ATTRIBUTE =
- "INSERT INTO osee_attribute (art_id, attr_id, attr_type_id, value, gamma_id, uri) VALUES (?, ?, ?, ?, ?, ?)";
+ "INSERT INTO osee_attribute (art_id, attr_id, attr_type_id, value, gamma_id, uri) VALUES (?, ?, ?, ?, ?, ?)";
private final Attribute<?> attribute;
private final DAOToSQL daoToSql;
@@ -55,7 +55,7 @@ public class AttributeTransactionData extends BaseTransactionData {
attribute.getAttributeDataProvider().persist(getGammaId());
daoToSql.setData(attribute.getAttributeDataProvider().getData());
internalAddInsertToBatch(transaction, 3, INSERT_ATTRIBUTE, attribute.getArtifact().getArtId(), getItemId(),
- attribute.getAttributeType().getId(), daoToSql.getValue(), getGammaId(), daoToSql.getUri());
+ attribute.getAttributeType().getId(), daoToSql.getValue(), getGammaId(), daoToSql.getUri());
}
}
@@ -136,6 +136,7 @@ public class AttributeTransactionData extends BaseTransactionData {
}
@Override
- protected void internalAddToEvents(ArtifactEvent artifactEvent) throws OseeCoreException {
+ protected void internalAddToEvents(ArtifactEvent artifactEvent) {
+ return;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
index 3653c031838..ac939d6d90d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
@@ -21,7 +21,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.event2.AccessControlEvent;
import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent;
@@ -49,7 +48,7 @@ public class InternalEventManager2 {
private static boolean disableEvents = false;
private static final ThreadFactory threadFactory = new OseeEventThreadFactory("Osee Events2");
private static final ExecutorService executorService = Executors.newFixedThreadPool(
- Runtime.getRuntime().availableProcessors(), threadFactory);
+ Runtime.getRuntime().availableProcessors(), threadFactory);
private static final List<IEventListener> priorityListeners = new CopyOnWriteArrayList<IEventListener>();
private static final List<IEventListener> listeners = new CopyOnWriteArrayList<IEventListener>();
@@ -121,7 +120,7 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(
- String.format("IEM2: processBranchEvent [%s] error processing priorityListeners", branchEvent), ex);
+ String.format("IEM2: processBranchEvent [%s] error processing priorityListeners", branchEvent), ex);
}
}
for (IEventListener listener : listeners) {
@@ -131,14 +130,14 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(
- String.format("IEM2: processBranchEvent [%s] error processing listeners", branchEvent), ex);
+ String.format("IEM2: processBranchEvent [%s] error processing listeners", branchEvent), ex);
}
}
}
private static void processBranchEventListener(IBranchEventListener listener, Sender sender, BranchEvent branchEvent) {
// If any filter doesn't match, don't call listener
- if (listener instanceof IEventFilteredListener && ((IEventFilteredListener) listener).getEventFilters() != null) {
+ if (((IEventFilteredListener) listener).getEventFilters() != null) {
for (IEventFilter eventFilter : ((IEventFilteredListener) listener).getEventFilters()) {
// If this branch doesn't match, don't pass events through
if (!eventFilter.isMatch(branchEvent.getBranchGuid())) {
@@ -147,7 +146,7 @@ public class InternalEventManager2 {
}
}
// Call listener if we matched all of the filters
- ((IBranchEventListener) listener).handleBranchEvent(sender, branchEvent);
+ listener.handleBranchEvent(sender, branchEvent);
}
/**
@@ -161,7 +160,7 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(
- String.format("IEM2: processArtsAndRels [%s] error processing priorityListeners", artifactEvent), ex);
+ String.format("IEM2: processArtsAndRels [%s] error processing priorityListeners", artifactEvent), ex);
}
}
for (IEventListener listener : listeners) {
@@ -171,7 +170,7 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(
- String.format("IEM2: processArtsAndRels [%s] error processing listeners", artifactEvent), ex);
+ String.format("IEM2: processArtsAndRels [%s] error processing listeners", artifactEvent), ex);
}
}
}
@@ -179,7 +178,7 @@ public class InternalEventManager2 {
private static void processEventArtifactsAndRelationsListener(IArtifactEventListener listener, ArtifactEvent artifactEvent, Sender sender) {
OseeEventManager.eventLog(String.format("IEM2: processArtsAndRels [%s]", artifactEvent));
// If any filter doesn't match, don't call listener
- if (listener instanceof IEventFilteredListener && ((IEventFilteredListener) listener).getEventFilters() != null) {
+ if (((IEventFilteredListener) listener).getEventFilters() != null) {
for (IEventFilter eventFilter : ((IEventFilteredListener) listener).getEventFilters()) {
// If this branch doesn't match, don't pass events through
if (!eventFilter.isMatch(artifactEvent.getBranchGuid())) {
@@ -198,7 +197,7 @@ public class InternalEventManager2 {
}
}
// Call listener if we matched all of the filters
- ((IArtifactEventListener) listener).handleArtifactEvent(artifactEvent, sender);
+ listener.handleArtifactEvent(artifactEvent, sender);
}
public static void processAccessControlEvent(Sender sender, AccessControlEvent accessControlEvent) {
@@ -210,7 +209,7 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(String.format(
- "IEM2: processAccessControlEvent [%s] error processing priorityListeners", accessControlEvent), ex);
+ "IEM2: processAccessControlEvent [%s] error processing priorityListeners", accessControlEvent), ex);
}
}
for (IEventListener listener : listeners) {
@@ -220,23 +219,25 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(
- String.format("IEM2: processAccessControlEvent [%s] error processing listeners", accessControlEvent),
- ex);
+ String.format("IEM2: processAccessControlEvent [%s] error processing listeners", accessControlEvent), ex);
}
}
}
public static void processEventBroadcastEvent(Sender sender, BroadcastEvent broadcastEvent) {
OseeEventManager.eventLog(String.format("IEM2: processEventBroadcastEvent [%s]", broadcastEvent));
- if (broadcastEvent.getUsers().size() == 0) return;
+ if (broadcastEvent.getUsers().size() == 0) {
+ return;
+ }
for (IEventListener listener : priorityListeners) {
try {
if (listener instanceof IBroadcastEventListener) {
((IBroadcastEventListener) listener).handleBroadcastEvent(sender, broadcastEvent);
}
} catch (Exception ex) {
- OseeEventManager.eventLog(String.format(
- "IEM2: processEventBroadcastEvent [%s] error processing priorityListeners", broadcastEvent), ex);
+ OseeEventManager.eventLog(
+ String.format("IEM2: processEventBroadcastEvent [%s] error processing priorityListeners", broadcastEvent),
+ ex);
}
}
for (IEventListener listener : listeners) {
@@ -246,7 +247,7 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(
- String.format("IEM2: processEventBroadcastEvent [%s] error processing listeners", broadcastEvent), ex);
+ String.format("IEM2: processEventBroadcastEvent [%s] error processing listeners", broadcastEvent), ex);
}
}
}
@@ -257,11 +258,11 @@ public class InternalEventManager2 {
try {
if (listener instanceof IRemoteEventManagerEventListener) {
((IRemoteEventManagerEventListener) listener).handleRemoteEventManagerEvent(sender,
- remoteEventServiceEvent);
+ remoteEventServiceEvent);
}
} catch (Exception ex) {
- OseeEventManager.eventLog(String.format(
- "IEM2: processRemoteEventManagerEvent [%s] error processing priorityListeners",
+ OseeEventManager.eventLog(
+ String.format("IEM2: processRemoteEventManagerEvent [%s] error processing priorityListeners",
remoteEventServiceEvent), ex);
}
}
@@ -269,11 +270,11 @@ public class InternalEventManager2 {
try {
if (listener instanceof IRemoteEventManagerEventListener) {
((IRemoteEventManagerEventListener) listener).handleRemoteEventManagerEvent(sender,
- remoteEventServiceEvent);
+ remoteEventServiceEvent);
}
} catch (Exception ex) {
OseeEventManager.eventLog(String.format(
- "IEM2: processRemoteEventManagerEvent [%s] error processing listeners", remoteEventServiceEvent), ex);
+ "IEM2: processRemoteEventManagerEvent [%s] error processing listeners", remoteEventServiceEvent), ex);
}
}
}
@@ -286,8 +287,9 @@ public class InternalEventManager2 {
((ITransactionEventListener) listener).handleTransactionEvent(sender, transactionEvent);
}
} catch (Exception ex) {
- OseeEventManager.eventLog(String.format(
- "IEM2: processTransactionEvent [%s] error processing priorityListeners", transactionEvent), ex);
+ OseeEventManager.eventLog(
+ String.format("IEM2: processTransactionEvent [%s] error processing priorityListeners", transactionEvent),
+ ex);
}
}
for (IEventListener listener : listeners) {
@@ -297,7 +299,7 @@ public class InternalEventManager2 {
}
} catch (Exception ex) {
OseeEventManager.eventLog(
- String.format("IEM2: processTransactionEvent [%s] error processing listeners", transactionEvent), ex);
+ String.format("IEM2: processTransactionEvent [%s] error processing listeners", transactionEvent), ex);
}
}
}
@@ -338,6 +340,7 @@ public class InternalEventManager2 {
}
OseeEventManager.eventLog("IEM2: kickAccessControlEvent - type: " + accessControlEvent + sender + " artifacts: " + accessControlEvent.getArtifacts());
Runnable runnable = new Runnable() {
+ @Override
public void run() {
try {
// Kick LOCAL
@@ -349,7 +352,7 @@ public class InternalEventManager2 {
// Kick REMOTE
if (sender.isLocal() && accessControlEvent.getEventType().isRemoteEventType()) {
RemoteEventManager2.getInstance().kick(
- FrameworkEventUtil.getRemoteAccessControlEvent(accessControlEvent));
+ FrameworkEventUtil.getRemoteAccessControlEvent(accessControlEvent));
}
} catch (Exception ex) {
OseeEventManager.eventLog("IEM2 kickAccessControlEvent", ex);
@@ -360,12 +363,13 @@ public class InternalEventManager2 {
}
// Kick LOCAL "remote event manager" event
- static void kickLocalRemEvent(final Sender sender, final RemoteEventServiceEventType remoteEventServiceEventType) throws OseeCoreException {
+ static void kickLocalRemEvent(final Sender sender, final RemoteEventServiceEventType remoteEventServiceEventType) {
if (isDisableEvents()) {
return;
}
OseeEventManager.eventLog("IEM2: kickLocalRemEvent: type: " + remoteEventServiceEventType + " - " + sender);
Runnable runnable = new Runnable() {
+ @Override
public void run() {
// Kick LOCAL
try {
@@ -387,6 +391,7 @@ public class InternalEventManager2 {
}
OseeEventManager.eventLog("IEM2: kickArtifactReloadEvent [" + artifactEvent + "] - " + sender);
Runnable runnable = new Runnable() {
+ @Override
public void run() {
try {
// Kick LOCAL
@@ -418,6 +423,7 @@ public class InternalEventManager2 {
}
OseeEventManager.eventLog("IEM2: kickBranchEvent: type: " + branchEvent.getEventType() + " guid: " + branchEvent.getBranchGuid() + " - " + sender);
Runnable runnable = new Runnable() {
+ @Override
public void run() {
try {
// Log if this is a loopback and what is happening
@@ -456,6 +462,7 @@ public class InternalEventManager2 {
}
OseeEventManager.eventLog("IEM2: kickPersistEvent [" + artifactEvent + "] - " + sender);
Runnable runnable = new Runnable() {
+ @Override
public void run() {
// Roll-up change information
try {
@@ -494,6 +501,7 @@ public class InternalEventManager2 {
}
OseeEventManager.eventLog("IEM2: kickTransactionEvent [" + transEvent + "] - " + sender);
Runnable runnable = new Runnable() {
+ @Override
public void run() {
// Roll-up change information
try {
@@ -525,7 +533,7 @@ public class InternalEventManager2 {
/*
* Kick LOCAL and REMOTE broadcast event
*/
- static void kickBroadcastEvent(final Sender sender, final BroadcastEvent broadcastEvent) throws OseeCoreException {
+ static void kickBroadcastEvent(final Sender sender, final BroadcastEvent broadcastEvent) {
if (isDisableEvents()) {
return;
}
@@ -534,6 +542,7 @@ public class InternalEventManager2 {
OseeEventManager.eventLog("IEM2: kickBroadcastEvent: type: " + broadcastEvent.getBroadcastEventType().name() + " message: " + broadcastEvent.getMessage() + " - " + sender);
}
Runnable runnable = new Runnable() {
+ @Override
public void run() {
try {
// Kick from REMOTE
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
index 71953fbd826..a23ae603947 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
@@ -307,7 +307,7 @@ public class OseeEventManager {
if (ex != null) {
OseeLog.log(Activator.class, Level.SEVERE, output, ex);
} else {
- OseeLog.log(Activator.class, Level.INFO, output);
+ OseeLog.log(Activator.class, Level.FINE, output);
}
}
} catch (Exception ex1) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java
index 76e8a8d6482..3fe9aa97b1a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager2.java
@@ -244,8 +244,6 @@ public class RemoteEventManager2 implements IFrameworkEventListener {
relation.undelete();
relation.setNotDirty();
}
- } else if (eventType == RelationEventType.ReOrdered) {
- // TODO Handle this
} else {
OseeEventManager.eventLog(String.format("REM2: updateRelations - Unhandled mod type [%s]", eventType));
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java
index 4f674ce7e74..a84e39b2d40 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.event2;
-
+package org.eclipse.osee.framework.skynet.core.event2;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -19,6 +19,8 @@ import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
import org.eclipse.osee.framework.core.model.event.IBasicGuidArtifact;
import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -34,261 +36,278 @@ import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
import org.eclipse.osee.framework.skynet.core.event2.filter.BranchGuidEventFilter;
import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
import org.eclipse.osee.framework.skynet.core.relation.RelationEventType;
-
-public class ArtifactEvent extends FrameworkEvent {
-
- private String branchGuid;
- private int transactionId;
- private List<EventBasicGuidArtifact> artifacts;
- private List<EventBasicGuidRelation> relations;
- private NetworkSender networkSender;
- private Collection<ArtifactTransactionModifiedEvent> skynetTransactionDetails =
- new ArrayList<ArtifactTransactionModifiedEvent>();
-
- public String getBranchGuid() {
- return branchGuid;
- }
-
- public void setBranchGuid(String value) {
- this.branchGuid = value;
- }
-
- public boolean isForBranch(Branch branch) {
- return getBranchGuid().equals(branch.getGuid());
- }
-
- public int getTransactionId() {
- return transactionId;
- }
-
- public void setTransactionId(int value) {
- this.transactionId = value;
- }
-
- public List<EventBasicGuidArtifact> getArtifacts() {
- if (artifacts == null) {
- artifacts = new ArrayList<EventBasicGuidArtifact>();
- }
- return this.artifacts;
- }
-
- public List<EventBasicGuidRelation> getRelations() {
- if (relations == null) {
- relations = new ArrayList<EventBasicGuidRelation>();
- }
- return this.relations;
- }
-
- public NetworkSender getNetworkSender() {
- return networkSender;
- }
-
- public void setNetworkSender(NetworkSender value) {
- this.networkSender = value;
- }
-
- public boolean isRelAddedChangedDeleted(Artifact artifact) {
- return isRelAddedChangedDeleted(artifact.getBasicGuidArtifact());
- }
-
- public boolean isRelAddedChangedDeleted(IBasicGuidArtifact guidArt) {
- return isRelChange(guidArt) || isRelAdded(guidArt) || isRelDeletedPurged(guidArt);
- }
-
- public boolean isHasEvent(Artifact artifact) {
- return isHasEvent(artifact.getBasicGuidArtifact());
- }
-
- public boolean isHasEvent(IBasicGuidArtifact guidArt) {
- return isModified(guidArt) || isDeletedPurged(guidArt) || isRelChange(guidArt) || isRelDeletedPurged(guidArt) || isRelAdded(guidArt);
- }
-
- public boolean isDeletedPurged(Artifact artifact) {
- return isDeletedPurged(artifact.getBasicGuidArtifact());
- }
-
- public boolean isDeletedPurged(IBasicGuidArtifact guidArt) {
- for (EventBasicGuidArtifact gArt : artifacts) {
- if (gArt.is(EventModType.Deleted, EventModType.Purged) && gArt.equals(guidArt)) {
- return true;
- }
- }
- return false;
- }
-
- public Collection<Artifact> getRelModifiedCacheArtifacts() {
- try {
- return ArtifactCache.getActive(getRelationsArts(RelationEventType.ModifiedRationale,
- RelationEventType.ReOrdered));
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return java.util.Collections.emptyList();
- }
-
- public Collection<Artifact> getRelCacheArtifacts() {
- try {
- return ArtifactCache.getActive(getRelationsArts(RelationEventType.ModifiedRationale,
- RelationEventType.ReOrdered, RelationEventType.Added, RelationEventType.Deleted,
- RelationEventType.Purged, RelationEventType.Undeleted));
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return java.util.Collections.emptyList();
- }
-
- public Collection<Artifact> getCacheArtifacts(EventModType... eventModTypes) {
- try {
- return ArtifactCache.getActive(get(eventModTypes));
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return java.util.Collections.emptyList();
- }
-
- public Collection<EventBasicGuidArtifact> get(EventModType... eventModTypes) {
- Set<EventBasicGuidArtifact> guidArts = new HashSet<EventBasicGuidArtifact>();
- for (EventBasicGuidArtifact guidArt : artifacts) {
- for (EventModType modType : eventModTypes) {
- if (guidArt.getModType() == modType) {
- guidArts.add(guidArt);
- }
- }
- }
- return guidArts;
- }
-
- public Collection<IBasicGuidArtifact> getRelationsArts(RelationEventType... eventModTypes) {
- Set<IBasicGuidArtifact> guidArts = new HashSet<IBasicGuidArtifact>();
- for (EventBasicGuidRelation guidRel : getRelations(eventModTypes)) {
- guidArts.add(guidRel.getArtA());
- guidArts.add(guidRel.getArtB());
- }
- return guidArts;
- }
-
- public Collection<EventBasicGuidRelation> getRelations(RelationEventType... eventModTypes) {
- Set<EventBasicGuidRelation> guidRels = new HashSet<EventBasicGuidRelation>();
- for (EventBasicGuidRelation guidRel : relations) {
- for (RelationEventType modType : eventModTypes) {
- if (guidRel.getModType() == modType) {
- guidRels.add(guidRel);
- }
- }
- }
- return guidRels;
- }
-
- public boolean isReloaded(Artifact artifact) {
- return isReloaded(artifact.getBasicGuidArtifact());
- }
-
- public boolean isReloaded(IBasicGuidArtifact guidArt) {
- return get(EventModType.Reloaded).contains(guidArt);
- }
-
- public boolean isModified(Artifact artifact) {
- return isModified(artifact.getBasicGuidArtifact());
- }
-
- public boolean isModified(IBasicGuidArtifact guidArt) {
- return get(EventModType.Modified).contains(guidArt);
- }
-
- public boolean isModifiedReloaded(Artifact artifact) {
- return isModifiedReloaded(artifact.getBasicGuidArtifact());
- }
-
- public boolean isModifiedReloaded(IBasicGuidArtifact guidArt) {
- return get(EventModType.Modified, EventModType.Reloaded).contains(guidArt);
- }
-
- /**
- * Relation rationale or order changed
- */
- public boolean isRelChange(Artifact artifact) {
- return isRelChange(artifact.getBasicGuidArtifact());
- }
-
- /**
- * Relation rationale or order changed
- */
- public boolean isRelChange(IBasicGuidArtifact guidArt) {
- for (EventBasicGuidRelation guidRel : getRelations(RelationEventType.ModifiedRationale,
- RelationEventType.ReOrdered)) {
- if (guidRel.getArtA().equals(guidArt) || guidRel.getArtB().equals(guidArt)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isRelDeletedPurged(Artifact artifact) {
- return isRelDeletedPurged(artifact.getBasicGuidArtifact());
- }
-
- public boolean isRelDeletedPurged(IBasicGuidArtifact guidArt) {
- for (EventBasicGuidRelation guidRel : getRelations(RelationEventType.Deleted, RelationEventType.Purged)) {
- if (guidRel.getArtA().equals(guidArt) || guidRel.getArtB().equals(guidArt)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isRelAdded(Artifact artifact) {
- return isRelAdded(artifact.getBasicGuidArtifact());
- }
-
- public boolean isRelAdded(IBasicGuidArtifact guidArt) {
- for (EventBasicGuidRelation guidRel : getRelations(RelationEventType.Added, RelationEventType.Undeleted)) {
- if (guidRel.getArtA().equals(guidArt) || guidRel.getArtB().equals(guidArt)) {
- return true;
- }
- }
- return false;
- }
-
- public String toString() {
- try {
- return String.format("ArtifactEvent: BG[%s] TrId[%d] ARTS[%s] RELS[%s] Sender[%s]", branchGuid, transactionId,
- artifacts, relations, networkSender);
- } catch (Exception ex) {
- return String.format("ArtifactEvent exception: " + ex.getLocalizedMessage());
- }
- }
-
- /**
- * Returns cached artifacts given type
- */
- public Collection<Artifact> getArtifactsInRelations(IRelationType relationType, RelationEventType... relationEventTypes) throws OseeCoreException {
- Set<Artifact> artifacts = new HashSet<Artifact>();
- Collection<RelationEventType> modTypes = Collections.getAggregate(relationEventTypes);
- for (EventBasicGuidRelation guidRel : relations) {
- if (modTypes.contains(ChangeType.All) || modTypes.contains(guidRel.getModType())) {
- artifacts.addAll(ArtifactCache.getActive(guidRel));
- }
- }
- return artifacts;
- }
-
- public boolean isMatch(Collection<IEventFilter> eventFilters) {
- for (IEventFilter eventFilter : eventFilters) {
- for (EventBasicGuidArtifact guidArt : artifacts) {
- if (!((BranchGuidEventFilter) eventFilter).isMatch(guidArt.getBranchGuid())) {
- break;
- }
- }
- }
- return false;
- }
-
- /**
- * Return details of artifact and relation changes for artifact and relation events that occurred as part of a
- * SkynetTransaction
- */
- public Collection<ArtifactTransactionModifiedEvent> getSkynetTransactionDetails() {
- return skynetTransactionDetails;
- }
-
-}
+
+public class ArtifactEvent extends FrameworkEvent {
+
+ private String branchGuid;
+ private int transactionId;
+ private NetworkSender networkSender;
+ private final List<EventBasicGuidArtifact> artifacts = new ArrayList<EventBasicGuidArtifact>();
+ private final List<EventBasicGuidRelation> relations = new ArrayList<EventBasicGuidRelation>();
+ private final Set<DefaultBasicGuidRelationReorder> relationReorderRecords = new HashSet<DefaultBasicGuidRelationReorder>();
+ private final Collection<ArtifactTransactionModifiedEvent> skynetTransactionDetails =
+ new ArrayList<ArtifactTransactionModifiedEvent>();
+
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
+ public Set<DefaultBasicGuidRelationReorder> getRelationOrderRecords() {
+ return relationReorderRecords;
+ }
+
+ public void setBranchGuid(String value) {
+ this.branchGuid = value;
+ }
+
+ public boolean isForBranch(Branch branch) {
+ return getBranchGuid().equals(branch.getGuid());
+ }
+
+ public int getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(int value) {
+ this.transactionId = value;
+ }
+
+ public List<EventBasicGuidArtifact> getArtifacts() {
+ return this.artifacts;
+ }
+
+ public List<EventBasicGuidRelation> getRelations() {
+ return this.relations;
+ }
+
+ public NetworkSender getNetworkSender() {
+ return networkSender;
+ }
+
+ public void setNetworkSender(NetworkSender value) {
+ this.networkSender = value;
+ }
+
+ public boolean isRelAddedChangedDeleted(Artifact artifact) {
+ return isRelAddedChangedDeleted(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isRelAddedChangedDeleted(IBasicGuidArtifact guidArt) {
+ return isRelChange(guidArt) || isRelAdded(guidArt) || isRelDeletedPurged(guidArt);
+ }
+
+ public boolean isHasEvent(Artifact artifact) {
+ return isHasEvent(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isHasEvent(IBasicGuidArtifact guidArt) {
+ return isModified(guidArt) || isDeletedPurged(guidArt) || isRelChange(guidArt) || isRelDeletedPurged(guidArt) || isRelAdded(guidArt);
+ }
+
+ public boolean isDeletedPurged(Artifact artifact) {
+ return isDeletedPurged(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isDeletedPurged(IBasicGuidArtifact guidArt) {
+ for (EventBasicGuidArtifact gArt : artifacts) {
+ if (gArt.is(EventModType.Deleted, EventModType.Purged) && gArt.equals(guidArt)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Collection<Artifact> getRelModifiedCacheArtifacts() {
+ try {
+ return ArtifactCache.getActive(getRelationsArts(RelationEventType.ModifiedRationale));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return java.util.Collections.emptyList();
+ }
+
+ public Collection<Artifact> getRelCacheArtifacts() {
+ try {
+ return ArtifactCache.getActive(getRelationsArts(RelationEventType.ModifiedRationale, RelationEventType.Added,
+ RelationEventType.Deleted, RelationEventType.Purged, RelationEventType.Undeleted));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return java.util.Collections.emptyList();
+ }
+
+ public Collection<Artifact> getCacheArtifacts(EventModType... eventModTypes) {
+ try {
+ return ArtifactCache.getActive(get(eventModTypes));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return java.util.Collections.emptyList();
+ }
+
+ public Collection<DefaultBasicGuidArtifact> getRelOrderChangedArtifacts() {
+ return getRelOrderChangedArtifacts((IRelationType[]) null);
+ }
+
+ public Collection<DefaultBasicGuidArtifact> getRelOrderChangedArtifacts(IRelationType... relationTypes) {
+ Set<DefaultBasicGuidArtifact> guidArts = new HashSet<DefaultBasicGuidArtifact>();
+ for (DefaultBasicGuidRelationReorder record : relationReorderRecords) {
+ if (relationTypes == null) {
+ guidArts.add(record.getParentArt());
+ } else {
+ for (IRelationType type : relationTypes) {
+ if (record.getRelTypeGuid().equals(type.getGuid())) {
+ guidArts.add(record.getParentArt());
+ }
+ }
+ }
+ }
+ return guidArts;
+ }
+
+ public Collection<EventBasicGuidArtifact> get(EventModType... eventModTypes) {
+ Set<EventBasicGuidArtifact> guidArts = new HashSet<EventBasicGuidArtifact>();
+ for (EventBasicGuidArtifact guidArt : artifacts) {
+ for (EventModType modType : eventModTypes) {
+ if (guidArt.getModType() == modType) {
+ guidArts.add(guidArt);
+ }
+ }
+ }
+ return guidArts;
+ }
+
+ public Collection<IBasicGuidArtifact> getRelationsArts(RelationEventType... eventModTypes) {
+ Set<IBasicGuidArtifact> guidArts = new HashSet<IBasicGuidArtifact>();
+ for (EventBasicGuidRelation guidRel : getRelations(eventModTypes)) {
+ guidArts.add(guidRel.getArtA());
+ guidArts.add(guidRel.getArtB());
+ }
+ return guidArts;
+ }
+
+ public Collection<EventBasicGuidRelation> getRelations(RelationEventType... eventModTypes) {
+ Set<EventBasicGuidRelation> guidRels = new HashSet<EventBasicGuidRelation>();
+ for (EventBasicGuidRelation guidRel : relations) {
+ for (RelationEventType modType : eventModTypes) {
+ if (guidRel.getModType() == modType) {
+ guidRels.add(guidRel);
+ }
+ }
+ }
+ return guidRels;
+ }
+
+ public boolean isReloaded(Artifact artifact) {
+ return isReloaded(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isReloaded(IBasicGuidArtifact guidArt) {
+ return get(EventModType.Reloaded).contains(guidArt);
+ }
+
+ public boolean isModified(Artifact artifact) {
+ return isModified(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isModified(IBasicGuidArtifact guidArt) {
+ return get(EventModType.Modified).contains(guidArt);
+ }
+
+ public boolean isModifiedReloaded(Artifact artifact) {
+ return isModifiedReloaded(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isModifiedReloaded(IBasicGuidArtifact guidArt) {
+ return get(EventModType.Modified, EventModType.Reloaded).contains(guidArt);
+ }
+
+ /**
+ * Relation rationale changed
+ */
+ public boolean isRelChange(Artifact artifact) {
+ return isRelChange(artifact.getBasicGuidArtifact());
+ }
+
+ /**
+ * Relation rationale changed
+ */
+ public boolean isRelChange(IBasicGuidArtifact guidArt) {
+ for (EventBasicGuidRelation guidRel : getRelations(RelationEventType.ModifiedRationale)) {
+ if (guidRel.getArtA().equals(guidArt) || guidRel.getArtB().equals(guidArt)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isRelDeletedPurged(Artifact artifact) {
+ return isRelDeletedPurged(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isRelDeletedPurged(IBasicGuidArtifact guidArt) {
+ for (EventBasicGuidRelation guidRel : getRelations(RelationEventType.Deleted, RelationEventType.Purged)) {
+ if (guidRel.getArtA().equals(guidArt) || guidRel.getArtB().equals(guidArt)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isRelAdded(Artifact artifact) {
+ return isRelAdded(artifact.getBasicGuidArtifact());
+ }
+
+ public boolean isRelAdded(IBasicGuidArtifact guidArt) {
+ for (EventBasicGuidRelation guidRel : getRelations(RelationEventType.Added, RelationEventType.Undeleted)) {
+ if (guidRel.getArtA().equals(guidArt) || guidRel.getArtB().equals(guidArt)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ return String.format("ArtifactEvent: BG[%s] TrId[%d] ARTS[%s] RELS[%s] Sender[%s]", branchGuid, transactionId,
+ artifacts, relations, networkSender);
+ } catch (Exception ex) {
+ return String.format("ArtifactEvent exception: " + ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Returns cached artifacts given type
+ */
+ public Collection<Artifact> getArtifactsInRelations(IRelationType relationType, RelationEventType... relationEventTypes) throws OseeCoreException {
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+ Collection<RelationEventType> modTypes = Collections.getAggregate(relationEventTypes);
+ for (EventBasicGuidRelation guidRel : relations) {
+ if (modTypes.contains(ChangeType.All) || modTypes.contains(guidRel.getModType())) {
+ artifacts.addAll(ArtifactCache.getActive(guidRel));
+ }
+ }
+ return artifacts;
+ }
+
+ public boolean isMatch(Collection<IEventFilter> eventFilters) {
+ for (IEventFilter eventFilter : eventFilters) {
+ for (EventBasicGuidArtifact guidArt : artifacts) {
+ if (!((BranchGuidEventFilter) eventFilter).isMatch(guidArt.getBranchGuid())) {
+ break;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return details of artifact and relation changes for artifact and relation events that occurred as part of a
+ * SkynetTransaction
+ */
+ public Collection<ArtifactTransactionModifiedEvent> getSkynetTransactionDetails() {
+ return skynetTransactionDetails;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java
index b92bb86057d..8f426489ab7 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventUtil.java
@@ -17,13 +17,15 @@ import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.UserNotInDatabase;
import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
+import org.eclipse.osee.framework.core.model.event.RelationOrderModType;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteAccessControlEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteAttributeChange1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicGuidArtifact1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicGuidRelation1;
+import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicGuidRelationReorder1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBranchEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBroadcastEvent1;
import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteNetworkSender1;
@@ -71,7 +73,7 @@ public class FrameworkEventUtil {
return accessControlEvent;
} else {
OseeLog.log(Activator.class, Level.WARNING,
- "Unhandled AccessControl event type guid " + remEvent.getEventTypeGuid());
+ "Unhandled AccessControl event type guid " + remEvent.getEventTypeGuid());
}
return null;
}
@@ -87,7 +89,7 @@ public class FrameworkEventUtil {
event.getUserIds().add(user.getUserId());
}
} catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
}
}
return event;
@@ -106,14 +108,14 @@ public class FrameworkEventUtil {
} catch (UserNotInDatabase ex) {
// do nothing
} catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
}
}
broadcastEvent.setNetworkSender(getNetworkSender(remEvent.getNetworkSender()));
return broadcastEvent;
} else {
OseeLog.log(Activator.class, Level.WARNING,
- "Unhandled broadcast event type guid " + remEvent.getEventTypeGuid());
+ "Unhandled broadcast event type guid " + remEvent.getEventTypeGuid());
}
return null;
}
@@ -178,23 +180,26 @@ public class FrameworkEventUtil {
for (EventBasicGuidArtifact guidArt : transEvent.getArtifacts()) {
if (guidArt.getModType() == EventModType.Modified) {
event.getArtifacts().add(
- getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(),
- ((EventModifiedBasicGuidArtifact) guidArt).getAttributeChanges()));
+ getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(),
+ ((EventModifiedBasicGuidArtifact) guidArt).getAttributeChanges()));
} else if (guidArt.getModType() == EventModType.ChangeType) {
EventChangeTypeBasicGuidArtifact changeGuidArt = (EventChangeTypeBasicGuidArtifact) guidArt;
RemoteBasicGuidArtifact1 remGuidArt =
- getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(), null);
+ getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(), null);
remGuidArt.setArtTypeGuid(changeGuidArt.getFromArtTypeGuid());
remGuidArt.setToArtTypeGuid(changeGuidArt.getArtTypeGuid());
event.getArtifacts().add(remGuidArt);
} else {
event.getArtifacts().add(
- getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(), null));
+ getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(), null));
}
}
for (EventBasicGuidRelation guidRel : transEvent.getRelations()) {
event.getRelations().add(getRemoteBasicGuidRelation1(guidRel));
}
+ for (DefaultBasicGuidRelationReorder guidOrderRel : transEvent.getRelationOrderRecords()) {
+ event.getRelationReorders().add(getRemoteBasicGuidRelationReorder1(guidOrderRel));
+ }
return event;
}
@@ -227,9 +232,20 @@ public class FrameworkEventUtil {
event.getRelations().add(relEvent);
}
}
+ for (RemoteBasicGuidRelationReorder1 guidReorder : remEvent.getRelationReorders()) {
+ event.getRelationOrderRecords().add(getDefaultBasicGuidRelationReorder(guidReorder));
+ }
return event;
}
+ public static DefaultBasicGuidRelationReorder getDefaultBasicGuidRelationReorder(RemoteBasicGuidRelationReorder1 guidRelOrder) {
+ DefaultBasicGuidRelationReorder guidArt =
+ new DefaultBasicGuidRelationReorder(RelationOrderModType.getType(guidRelOrder.getModTypeGuid()),
+ guidRelOrder.getBranchGuid(), guidRelOrder.getRelTypeGuid(),
+ getBasicGuidArtifact(guidRelOrder.getParentArt()));
+ return guidArt;
+ }
+
public static RemoteBasicGuidRelation1 getRemoteBasicGuidRelation1(EventBasicGuidRelation guidRel) {
RemoteBasicGuidRelation1 remEvent = new RemoteBasicGuidRelation1();
remEvent.setGammaId(guidRel.getGammaId());
@@ -253,16 +269,25 @@ public class FrameworkEventUtil {
return event;
}
+ public static RemoteBasicGuidRelationReorder1 getRemoteBasicGuidRelationReorder1(DefaultBasicGuidRelationReorder guidOrderRel) {
+ RemoteBasicGuidRelationReorder1 event = new RemoteBasicGuidRelationReorder1();
+ event.setBranchGuid(guidOrderRel.getBranchGuid());
+ event.setRelTypeGuid(guidOrderRel.getRelTypeGuid());
+ event.setModTypeGuid(guidOrderRel.getModType().getGuid());
+ event.setParentArt(getRemoteBasicGuidArtifact(guidOrderRel.getParentArt()));
+ return event;
+ }
+
public static EventBasicGuidRelation getEventBasicGuidRelation(RemoteBasicGuidRelation1 guidRel) {
RelationEventType eventType = RelationEventType.getType(guidRel.getModTypeGuid());
if (eventType == null) {
OseeLog.log(Activator.class, Level.WARNING,
- "Can't determine RelationEventType from guid " + guidRel.getModTypeGuid());
+ "Can't determine RelationEventType from guid " + guidRel.getModTypeGuid());
}
EventBasicGuidRelation event =
- new EventBasicGuidRelation(eventType, guidRel.getBranchGuid(), guidRel.getRelTypeGuid(),
- guidRel.getRelationId(), guidRel.getGammaId(), guidRel.getArtAId(),
- getBasicGuidArtifact(guidRel.getArtA()), guidRel.getArtBId(), getBasicGuidArtifact(guidRel.getArtB()));
+ new EventBasicGuidRelation(eventType, guidRel.getBranchGuid(), guidRel.getRelTypeGuid(),
+ guidRel.getRelationId(), guidRel.getGammaId(), guidRel.getArtAId(),
+ getBasicGuidArtifact(guidRel.getArtA()), guidRel.getArtBId(), getBasicGuidArtifact(guidRel.getArtB()));
if (eventType == RelationEventType.ModifiedRationale || eventType == RelationEventType.Added) {
event.setRationale(guidRel.getRationale());
}
@@ -271,12 +296,12 @@ public class FrameworkEventUtil {
public static EventBasicGuidArtifact getEventBasicGuidArtifact(EventModType modType, RemoteBasicGuidArtifact1 remGuidArt) {
return new EventBasicGuidArtifact(modType, remGuidArt.getBranchGuid(), remGuidArt.getArtTypeGuid(),
- remGuidArt.getArtGuid());
+ remGuidArt.getArtGuid());
}
public static EventChangeTypeBasicGuidArtifact getEventChangeTypeBasicGuidArtifact(EventModType modType, RemoteBasicGuidArtifact1 remGuidArt) {
return new EventChangeTypeBasicGuidArtifact(remGuidArt.getBranchGuid(), remGuidArt.getArtTypeGuid(),
- remGuidArt.getToArtTypeGuid(), remGuidArt.getArtGuid());
+ remGuidArt.getToArtTypeGuid(), remGuidArt.getArtGuid());
}
public static EventModifiedBasicGuidArtifact getEventModifiedBasicGuidArtifact(EventModType modType, RemoteBasicGuidArtifact1 remGuidArt) {
@@ -285,7 +310,7 @@ public class FrameworkEventUtil {
attributeChanges.add(getAttributeChange(remAttrChg));
}
return new EventModifiedBasicGuidArtifact(remGuidArt.getBranchGuid(), remGuidArt.getArtTypeGuid(),
- remGuidArt.getArtGuid(), attributeChanges);
+ remGuidArt.getArtGuid(), attributeChanges);
}
public static DefaultBasicGuidArtifact getBasicGuidArtifact(RemoteBasicGuidArtifact1 remGuidArt) {
@@ -336,8 +361,8 @@ public class FrameworkEventUtil {
public static NetworkSender getNetworkSender(RemoteNetworkSender1 remSender) {
NetworkSender networkSender =
- new NetworkSender(remSender.getSourceObject(), remSender.getSessionId(), remSender.getMachineName(),
- remSender.getUserId(), remSender.getMachineIp(), remSender.getPort(), remSender.getClientVersion());
+ new NetworkSender(remSender.getSourceObject(), remSender.getSessionId(), remSender.getMachineName(),
+ remSender.getUserId(), remSender.getMachineIp(), remSender.getPort(), remSender.getClientVersion());
return networkSender;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationEventType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationEventType.java
index 170c9737979..cf4d1c1e4c2 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationEventType.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationEventType.java
@@ -19,7 +19,6 @@ public enum RelationEventType {
Purged("AAn_P4kbcxaUKL4bosgA"),
Added("AISIbR69A2yjMFpbsSgA"),
ModifiedRationale("AISIbR9Tm0dwqN1KdoAA"), // this handles modifiedRationale and UnDeleted for now
- ReOrdered("AISIbRohWReUi5aitFgA"),
Undeleted("AISIbRqzlF3s4TeMvzgA");
private final String guid;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/ArtifactRelationOrderAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/ArtifactRelationOrderAccessor.java
index dae112ae732..0e0d4dfbd16 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/ArtifactRelationOrderAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/ArtifactRelationOrderAccessor.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.skynet.core.relation.order;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
@@ -31,14 +32,15 @@ public class ArtifactRelationOrderAccessor implements IRelationOrderAccessor {
public void load(IArtifact artifact, RelationOrderData orderData) throws OseeCoreException {
Artifact fullArtifact = artifact.getFullArtifact();
String value =
- fullArtifact.getSoleAttributeValueAsString(CoreAttributeTypes.RELATION_ORDER, Strings.emptyString());
+ fullArtifact.getSoleAttributeValueAsString(CoreAttributeTypes.RELATION_ORDER, Strings.emptyString());
parser.loadFromXml(orderData, value);
}
@Override
- public void store(IArtifact artifact, RelationOrderData orderData) throws OseeCoreException {
+ public void store(IArtifact artifact, RelationOrderData orderData, DefaultBasicGuidRelationReorder relationOrderRecord) throws OseeCoreException {
Artifact fullArtifact = artifact.getFullArtifact();
+ fullArtifact.getRelationOrderRecords().add(relationOrderRecord);
if (orderData.hasEntries() && !fullArtifact.isDeleted()) {
fullArtifact.setSoleAttributeFromString(CoreAttributeTypes.RELATION_ORDER, parser.toXml(orderData));
} else {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationOrderAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationOrderAccessor.java
index 4e3b136ce59..72a9451d749 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationOrderAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationOrderAccessor.java
@@ -12,6 +12,7 @@
package org.eclipse.osee.framework.skynet.core.relation.order;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
/**
@@ -19,7 +20,7 @@ import org.eclipse.osee.framework.skynet.core.types.IArtifact;
*/
public interface IRelationOrderAccessor {
- public void store(IArtifact artifact, RelationOrderData orderData) throws OseeCoreException;
+ public void store(IArtifact artifact, RelationOrderData orderData, DefaultBasicGuidRelationReorder reorderRecord) throws OseeCoreException;
public void load(IArtifact artifact, RelationOrderData orderData) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java
index a02163bc69c..6ea93aac619 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java
@@ -22,6 +22,9 @@ import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidRelationReorder;
+import org.eclipse.osee.framework.core.model.event.RelationOrderModType;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
import org.eclipse.osee.framework.jdk.core.type.Pair;
@@ -114,19 +117,27 @@ public class RelationOrderData {
}
public void store(RelationType type, RelationSide side, IRelationSorterId requestedSorterId, List<? extends IArtifact> relativeSequence) throws OseeCoreException {
- storeFromGuids(type, side, requestedSorterId, Artifacts.toGuids(relativeSequence));
- }
-
- public void storeFromGuids(RelationType type, RelationSide side, IRelationSorterId requestedSorterId, List<String> relativeSequence) throws OseeCoreException {
+ storeFromGuids(type, side, requestedSorterId, Artifacts.toGuids(relativeSequence));
+ }
+
+ public void storeFromGuids(RelationType type, RelationSide side, IRelationSorterId requestedSorterId, List<String> relativeSequence) throws OseeCoreException {
boolean isDifferentSorterId = isDifferentSorterId(type, side, requestedSorterId);
boolean changingRelatives = isRelativeOrderChange(type, side, requestedSorterId, relativeSequence);
if (isDifferentSorterId || changingRelatives) {
+ RelationOrderModType relationOrderModType = null;
if (isRevertingToDefaultTypeOrder(type, side, requestedSorterId)) {
removeOrderList(type, side);
+ relationOrderModType = RelationOrderModType.Default;
} else {
- addOrderList(type, side, requestedSorterId, relativeSequence);
+ addOrderList(type, side, requestedSorterId, relativeSequence);
+ relationOrderModType = RelationOrderModType.Absolute;
}
- accessor.store(getIArtifact(), this);
+ DefaultBasicGuidRelationReorder reorder =
+ new DefaultBasicGuidRelationReorder(relationOrderModType, getIArtifact().getBranch().getGuid(),
+ type.getGuid(), new DefaultBasicGuidArtifact(getIArtifact().getBranch().getGuid(),
+ getIArtifact().getArtifactType().getGuid(), getIArtifact().getGuid()));
+
+ accessor.store(getIArtifact(), this, reorder);
}
}
@@ -135,8 +146,8 @@ public class RelationOrderData {
return sorterId.getGuid().equals(defaultOrderGuid) && isDifferentSorterId(type, side, sorterId);
}
- protected boolean isRelativeOrderChange(RelationType type, RelationSide side, IRelationSorterId sorterId, List<String> relativeSequence) throws OseeCoreException {
- return sorterId.equals(RelationOrderBaseTypes.USER_DEFINED) && !relativeSequence.equals(getOrderList(type, side));
+ protected boolean isRelativeOrderChange(RelationType type, RelationSide side, IRelationSorterId sorterId, List<String> relativeSequence) throws OseeCoreException {
+ return sorterId.equals(RelationOrderBaseTypes.USER_DEFINED) && !relativeSequence.equals(getOrderList(type, side));
}
protected boolean isDifferentSorterId(RelationType type, RelationSide side, IRelationSorterId sorterId) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
index 375a43b6910..612ab6c6052 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
@@ -73,14 +73,14 @@ import org.eclipse.osee.framework.skynet.core.relation.RelationTransactionData;
public class SkynetTransaction extends AbstractOperation {
private static final String UPDATE_TXS_NOT_CURRENT =
- "UPDATE osee_txs txs1 SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " WHERE txs1.transaction_id = ? AND txs1.gamma_id = ?";
+ "UPDATE osee_txs txs1 SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " WHERE txs1.transaction_id = ? AND txs1.gamma_id = ?";
private static final String GET_EXISTING_ATTRIBUTE_IDS =
- "SELECT att1.attr_id FROM osee_attribute att1, osee_artifact art1, osee_txs txs1 WHERE att1.attr_type_id = ? AND att1.art_id = ? AND att1.art_id = art1.art_id AND art1.gamma_id = txs1.gamma_id AND txs1.branch_id <> ?";
+ "SELECT att1.attr_id FROM osee_attribute att1, osee_artifact art1, osee_txs txs1 WHERE att1.attr_type_id = ? AND att1.art_id = ? AND att1.art_id = art1.art_id AND art1.gamma_id = txs1.gamma_id AND txs1.branch_id <> ?";
private TransactionRecord transactionId, lastTransactionId;
private final CompositeKeyHashMap<Class<? extends BaseTransactionData>, Integer, BaseTransactionData> transactionDataItems =
- new CompositeKeyHashMap<Class<? extends BaseTransactionData>, Integer, BaseTransactionData>();
+ new CompositeKeyHashMap<Class<? extends BaseTransactionData>, Integer, BaseTransactionData>();
private final HashCollection<String, Object[]> dataItemInserts = new HashCollection<String, Object[]>();
private final Map<Integer, String> dataInsertOrder = new HashMap<Integer, String>();
@@ -143,8 +143,8 @@ public class SkynetTransaction extends AbstractOperation {
private void ensureCorrectBranch(RelationLink link) throws OseeStateException {
if (!link.getBranch().equals(branch)) {
String msg =
- String.format("The relation link [%s] is on branch [%s] but this transaction is for branch [%s]",
- link.getId(), link.getBranch(), branch);
+ String.format("The relation link [%s] is on branch [%s] but this transaction is for branch [%s]",
+ link.getId(), link.getBranch(), branch);
throw new OseeStateException(msg);
}
}
@@ -152,8 +152,8 @@ public class SkynetTransaction extends AbstractOperation {
private void ensureCorrectBranch(Artifact artifact) throws OseeStateException {
if (!artifact.getBranch().equals(branch)) {
String msg =
- String.format("The artifact [%s] is on branch [%s] but this transaction is for branch [%s]",
- artifact.getGuid(), artifact.getBranch(), branch);
+ String.format("The artifact [%s] is on branch [%s] but this transaction is for branch [%s]",
+ artifact.getGuid(), artifact.getBranch(), branch);
throw new OseeStateException(msg);
}
}
@@ -161,7 +161,7 @@ public class SkynetTransaction extends AbstractOperation {
private void ensureBranchIsEditable(RelationLink link) throws OseeStateException {
if (!link.getBranch().isEditable()) {
String msg =
- String.format("The relation link [%s] is on a non-editable branch [%s]", link.getId(), link.getBranch());
+ String.format("The relation link [%s] is on a non-editable branch [%s]", link.getId(), link.getBranch());
throw new OseeStateException(msg);
}
}
@@ -169,8 +169,8 @@ public class SkynetTransaction extends AbstractOperation {
private void ensureBranchIsEditable(Artifact artifact) throws OseeStateException {
if (!artifact.getBranch().isEditable()) {
String msg =
- String.format("The artifact [%s] is on a non-editable branch [%s]", artifact.getGuid(),
- artifact.getBranch());
+ String.format("The artifact [%s] is on a non-editable branch [%s]", artifact.getGuid(),
+ artifact.getBranch());
throw new OseeStateException(msg);
}
}
@@ -186,7 +186,6 @@ public class SkynetTransaction extends AbstractOperation {
* IF transaction has not been executed, this is the transactionId that will be used.<br>
* ELSE this is next transaction to be used upon execute
*
- * @return
* @throws OseeCoreException
*/
public int getTransactionNumber() throws OseeCoreException {
@@ -257,7 +256,7 @@ public class SkynetTransaction extends AbstractOperation {
if (attributeType.getMaxOccurrences() == 1) {
try {
chStmt.runPreparedQuery(GET_EXISTING_ATTRIBUTE_IDS, attributeType.getId(), artifact.getArtId(),
- artifact.getBranch().getId());
+ artifact.getBranch().getId());
if (chStmt.next()) {
attrId = chStmt.getInt("attr_id");
@@ -322,8 +321,6 @@ public class SkynetTransaction extends AbstractOperation {
/**
* Always want to persist artifacts on other side of dirty relation. This is necessary for ordering attribute to be
* persisted and desired for other cases.
- *
- * @throws OseeCoreException
*/
private void persitRelatedArtifact(Artifact artifact) throws OseeCoreException {
if (artifact != null) {
@@ -472,26 +469,37 @@ public class SkynetTransaction extends AbstractOperation {
transactionData.internalAddToEvents(artifactEvent);
}
+ // Collect attribute events
for (Artifact artifact : artifactReferences) {
if (artifact.hasDirtyAttributes()) {
artifactEvent.getSkynetTransactionDetails().add(
- new ArtifactModifiedEvent(new Sender(this.getClass().getName()), ArtifactModType.Changed, artifact,
- artifact.getTransactionNumber(), artifact.getDirtySkynetAttributeChanges()));
+ new ArtifactModifiedEvent(new Sender(this.getClass().getName()), ArtifactModType.Changed, artifact,
+ artifact.getTransactionNumber(), artifact.getDirtySkynetAttributeChanges()));
EventModifiedBasicGuidArtifact guidArt =
- new EventModifiedBasicGuidArtifact(artifact.getBranch().getGuid(),
- artifact.getArtifactType().getGuid(), artifact.getGuid(),
- artifact.getDirtyFrameworkAttributeChanges());
+ new EventModifiedBasicGuidArtifact(artifact.getBranch().getGuid(), artifact.getArtifactType().getGuid(),
+ artifact.getGuid(), artifact.getDirtyFrameworkAttributeChanges());
artifactEvent.getArtifacts().add(guidArt);
if (artifactEvent.getBranchGuid() == null) {
artifactEvent.setBranchGuid(artifact.getBranchGuid());
}
+
+ // Collection relation reorder records for events
+ if (!artifact.getRelationOrderRecords().isEmpty()) {
+ artifactEvent.getRelationOrderRecords().addAll(artifact.getRelationOrderRecords());
+ }
}
}
+
// Clear all dirty flags
for (BaseTransactionData transactionData : transactionDataItems.values()) {
transactionData.internalClearDirtyState();
}
+ // Clear all relation order records
+ for (Artifact artifact : artifactReferences) {
+ artifact.getRelationOrderRecords().clear();
+ }
+
if (artifactEvent.getSkynetTransactionDetails().size() > 0) {
OseeEventManager.kickPersistEvent(this, artifactEvent);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorerEventManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorerEventManager.java
index 63c7fef9d7b..591eb5851ed 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorerEventManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactExplorerEventManager.java
@@ -10,8 +10,10 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.Sender;
import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent;
@@ -59,12 +61,13 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
handlers.remove(handler);
}
}
- System.out.println("ArtifacExplorer: handleArtifactEvent called [" + artifactEvent + "] - sender " + sender + "");
+ OseeEventManager.eventLog("ArtifacExplorer: handleArtifactEvent called [" + artifactEvent + "] - sender " + sender + "");
final Collection<Artifact> modifiedArts =
- artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
+ artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
final Collection<Artifact> relModifiedArts = artifactEvent.getRelCacheArtifacts();
final Collection<EventBasicGuidArtifact> deletedPurgedArts =
- artifactEvent.get(EventModType.Deleted, EventModType.Purged);
+ artifactEvent.get(EventModType.Deleted, EventModType.Purged);
+ final Collection<DefaultBasicGuidArtifact> relOrderChangedArtifacts = artifactEvent.getRelOrderChangedArtifacts();
Displays.ensureInDisplayThread(new Runnable() {
@Override
@@ -73,7 +76,7 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
for (IArtifactExplorerEventHandler handler : handlers) {
if (!handler.isDisposed()) {
handler.getArtifactExplorer().getTreeViewer().remove(
- deletedPurgedArts.toArray(new Object[deletedPurgedArts.size()]));
+ deletedPurgedArts.toArray(new Object[deletedPurgedArts.size()]));
}
}
}
@@ -93,11 +96,20 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
if (art.isDeleted()) {
continue;
}
- if (!art.isDeleted()) {
- handler.getArtifactExplorer().getTreeViewer().refresh(art);
- if (art.getParent() != null) {
- handler.getArtifactExplorer().getTreeViewer().refresh(art.getParent());
- }
+ handler.getArtifactExplorer().getTreeViewer().refresh(art);
+ if (art.getParent() != null) {
+ handler.getArtifactExplorer().getTreeViewer().refresh(art.getParent());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ for (DefaultBasicGuidArtifact guidArt : relOrderChangedArtifacts) {
+ try {
+ Artifact artifact = ArtifactCache.getActive(guidArt);
+ if (artifact != null) {
+ handler.getArtifactExplorer().getTreeViewer().refresh(artifact);
}
} catch (Exception ex) {
OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
@@ -108,5 +120,4 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
}
});
}
-
}

Back to the top