Search in sources :

Example 1 with MergeConflictNotification

use of teamdash.merge.ui.MergeConflictNotification in project processdash by dtuma.

the class WBSModelMergeConflictNotificationFactory method createAll.

public static List<MergeConflictNotification> createAll(AbstractWBSModelMerger<? extends WBSModel> merger) {
    List<MergeConflictNotification> result = new ArrayList();
    ModelType modelType = merger.getModelType();
    Map<Integer, WBSNode> baseNodeMap = merger.base.getNodeMap();
    Map<Integer, WBSNode> mainNodeMap = merger.main.getNodeMap();
    Map<Integer, WBSNode> incomingNodeMap = merger.incoming.getNodeMap();
    for (MergeWarning<Integer> warning : merger.getMergeWarnings()) {
        MergeConflictNotification notification = create(merger, modelType, baseNodeMap, mainNodeMap, incomingNodeMap, warning);
        if (notification != null)
            result.add(notification);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) MergeConflictNotification(teamdash.merge.ui.MergeConflictNotification) ModelType(teamdash.merge.ModelType)

Example 2 with MergeConflictNotification

use of teamdash.merge.ui.MergeConflictNotification in project processdash by dtuma.

the class WBSModelMergeConflictNotificationFactory method create.

private static MergeConflictNotification create(AbstractWBSModelMerger merger, ModelType modelType, Map<Integer, WBSNode> baseNodeMap, Map<Integer, WBSNode> mainNodeMap, Map<Integer, WBSNode> incomingNodeMap, MergeWarning<Integer> mw) {
    MergeConflictNotification result = new MergeConflictNotification(modelType, mw);
    // look up the main and incoming nodes, and store them as attributes
    WBSNode mainNode = mainNodeMap.get(mw.getMainNodeID());
    WBSNode incomingNode = incomingNodeMap.get(mw.getIncomingNodeID());
    result.putNodeAttributes(mainNode, incomingNode);
    if (mw instanceof AttributeMergeWarning) {
        if (mw.matches(AbstractWBSModelMerger.NODE_NAME)) {
            NODE_NAME_HANDLER.install(result);
        } else if (mw.matches(AbstractWBSModelMerger.NODE_TYPE)) {
            NODE_TYPE_HANDLER.install(result);
        } else {
            WBSNode baseNode = baseNodeMap.get(mw.getIncomingNodeID());
            result.putAttribute(MergeConflictNotification.BASE_NODE, baseNode, false);
        }
    } else {
        // for structural changes, record the parent nodes in case the
        // conflict message needs them
        WBSNode mainParent = merger.main.getParent(mainNode);
        result.putAttribute("mainParent", mainParent);
        WBSNode incomingParent = merger.incoming.getParent(incomingNode);
        result.putAttribute("incomingParent", incomingParent);
        // structural conflict messages are generic and shared by all of
        // the various WBS model types.  Thus, we switch to a plain
        // resource message key that is not prefixed by the model type.
        result.setMessageKey(mw.getKey());
        // structural conflicts can only be acknowledged and dismissed;
        // resolution options are not available at this time.
        result.addUserOption(MergeConflictNotification.DISMISS, null);
    }
    return result;
}
Also used : MergeConflictNotification(teamdash.merge.ui.MergeConflictNotification) AttributeMergeWarning(teamdash.merge.AttributeMergeWarning)

Example 3 with MergeConflictNotification

use of teamdash.merge.ui.MergeConflictNotification in project processdash by dtuma.

the class TeamMemberListMergeConflictNotificationFactory method create.

public static MergeConflictNotification create(TeamMemberListMerger merger, MergeWarning<Integer> mw) {
    MergeConflictNotification result = new MergeConflictNotification(ModelType.TeamList, mw);
    result.putNodeAttributes(merger.main.findTeamMemberByID(mw.getMainNodeID()), merger.incoming.findTeamMemberByID(mw.getIncomingNodeID()));
    result.addUserOption(MergeConflictNotification.DISMISS, null);
    try {
        result.formatDescription();
        return result;
    } catch (MissingResourceException mre) {
        System.err.println("Unexpected merge conflict key for " + "team member list: " + mre.getKey());
        return null;
    }
}
Also used : MissingResourceException(java.util.MissingResourceException) MergeConflictNotification(teamdash.merge.ui.MergeConflictNotification)

Example 4 with MergeConflictNotification

use of teamdash.merge.ui.MergeConflictNotification in project processdash by dtuma.

the class CustomColumnsMerger method create.

private MergeConflictNotification create(MergeWarning<String> mw) {
    MergeConflictNotification result = new MergeConflictNotification(ModelType.Columns, mw);
    String columnID = mw.getMainNodeID();
    result.putNodeAttributes(getColumnName(main.get(columnID)), getColumnName(incoming.get(columnID)));
    result.putAttribute("columnID", getColumnDisplayID(columnID));
    result.addUserOption(MergeConflictNotification.DISMISS, null);
    try {
        result.formatDescription();
        return result;
    } catch (MissingResourceException mre) {
        System.err.println("Unexpected merge conflict key for " + "custom column specs: " + mre.getKey());
        return null;
    }
}
Also used : MissingResourceException(java.util.MissingResourceException) MergeConflictNotification(teamdash.merge.ui.MergeConflictNotification)

Aggregations

MergeConflictNotification (teamdash.merge.ui.MergeConflictNotification)4 MissingResourceException (java.util.MissingResourceException)2 ArrayList (java.util.ArrayList)1 AttributeMergeWarning (teamdash.merge.AttributeMergeWarning)1 ModelType (teamdash.merge.ModelType)1