Package eu.scape_project.planning.model

Examples of eu.scape_project.planning.model.ChangeLog


            clone.id = 0;

            clone.setParent(null);

            // created-timestamp is automatically set to now
            clone.setChangeLog(new ChangeLog(this.getChangeLog().getChangedBy()));

            if (this.getChildren() != null) {
                List<TreeNode> clonedChildren = new ArrayList<TreeNode>();
                for (TreeNode child : this.getChildren()) {
                    clonedChildren.add(child.clone());
View Full Code Here


        try {
            Value clone = (Value) super.clone();
            clone.id = 0;
            clone.scale = null;
            // created-timestamp is automatically set to now
            clone.setChangeLog(new ChangeLog(this.getChangeLog().getChangedBy()));
            return clone;
        } catch (CloneNotSupportedException e) {
            // never thrown
            return null;
        }
View Full Code Here

    public Scale clone() {
        try {
            Scale clone = (Scale) super.clone();
            clone.id = 0;
            // created-timestamp is automatically set to now
            clone.setChangeLog(new ChangeLog(this.getChangeLog().getChangedBy()));
            return clone;
        } catch (CloneNotSupportedException e) {
            // never thrown
            return null;
        }
View Full Code Here

        if (minCL <= createdAt) {
            minCL = Long.MAX_VALUE;
        }

        for (SampleObject sample : plan.getSampleRecordsDefinition().getRecords()) {
            ChangeLog sampleCL = sample.getChangeLog();
            if (sampleCL.getChanged() > maxCL) {
                maxCL = sampleCL.getChanged();
            }
            if (sampleCL.getCreated() < minCL) {
                minCL = sampleCL.getCreated();
            }
        }
        minChangeLogs[3] = minCL;
        maxChangeLogs[3] = maxCL;

        // 4. Identify requirements - TREE_DEFINED(4, "Tree Defined"),
        // - nodes/leaves (also created!)
        // - scales
        // - RequirementsDefinition
        minCL = plan.getRequirementsDefinition().getChangeLog().getChanged();
        maxCL = minCL;
        if (minCL <= createdAt) {
            minCL = Long.MAX_VALUE;
        }

        List<TreeNode> nodes = plan.getTree().getRoot().getAllChildren();
        for (TreeNode treeNode : nodes) {
            ChangeLog nodeCL = treeNode.getChangeLog();
            // we can only consider the creation time stamp, as changed is used
            // to confirm values
            if (minCL > nodeCL.getCreated()) {
                minCL = nodeCL.getCreated();
            }
            if (maxCL < nodeCL.getCreated()) {
                maxCL = nodeCL.getCreated();
            }
            // we can only use the scales of leaves, as
            // - nodes can be changed when weighting is changed
            // - leaves are "changed" when evaluated, aggregation mode is
            // changed
            if (treeNode instanceof Leaf) {
                Scale scale = ((Leaf) treeNode).getScale();
                if (scale != null) {
                    ChangeLog scaleCL = scale.getChangeLog();
                    if (maxCL < scaleCL.getChanged()) {
                        maxCL = scaleCL.getChanged();
                    }
                }
            }
        }
        minChangeLogs[4] = minCL;
        maxChangeLogs[4] = maxCL;

        // 5. Define alternatives - ALTERNATIVES_DEFINED(5,
        // "Alternatives Defined")
        // - AlternativesDefinition
        // - Alternative - only created, "changed" can be overwritten in
        // GoDecision)
        minCL = plan.getAlternativesDefinition().getChangeLog().getChanged();
        maxCL = minCL;
        if (minCL <= createdAt) {
            minCL = Long.MAX_VALUE;
        }
        for (Alternative alternative : plan.getAlternativesDefinition().getAlternatives()) {
            ChangeLog altCL = alternative.getChangeLog();
            if (minCL > altCL.getCreated()) {
                minCL = altCL.getCreated();
            }
            if (maxCL < altCL.getCreated()) {
                maxCL = altCL.getCreated();
            }
            // we cannot check for the changed(), as the alternative is also
            // changed in GoDecision
        }
        minChangeLogs[5] = minCL;
        maxChangeLogs[5] = maxCL;

        // 6. Take go decision - GO_CHOSEN(6, "Go Decision Taken")
        // - no: Alternative (! - if discarded)
        // - GoDecision
        minCL = plan.getDecision().getChangeLog().getChanged();
        maxCL = minCL;
        if (minCL <= createdAt) {
            minCL = Long.MAX_VALUE;
        }
        // for (Alternative alternative :
        // plan.getAlternativesDefinition().getAlternatives()) {
        // ChangeLog altCL = alternative.getChangeLog();
        // if (maxCL < altCL.getChanged()) {
        // maxCL = altCL.getChanged();
        // }
        // }
        minChangeLogs[6] = minCL;
        maxChangeLogs[6] = maxCL;
        // 7. Develop Experiments - EXPERIMENT_DEFINED(7, "Experiments Defined")
        // Alternative.Experiment
        minCL = Long.MAX_VALUE;
        maxCL = Long.MIN_VALUE;
        // as the experiment is created together with the alternative, this
        // might result in the same timestamps
        for (Alternative alternative : plan.getAlternativesDefinition().getAlternatives()) {
            ChangeLog expCL = alternative.getExperiment().getChangeLog();
            if (maxCL < expCL.getChanged()) {
                maxCL = expCL.getChanged();
            }
            if (minCL > expCL.getChanged()) {
                minCL = expCL.getChanged();
            }
        }
        minChangeLogs[7] = minCL;
        maxChangeLogs[7] = maxCL;
        // 8. Run Experiments - EXPERIMENT_PERFORMED(8, "Experiments Performed")
        // - detailedExperimentInfo
        // - result files (alternative.experiment.results)
        // - initValues on save
        minCL = Long.MAX_VALUE;
        maxCL = Long.MIN_VALUE;
        // as the experiment is created together with the alternative, this
        // might result in the same timestamps
        for (Alternative alternative : plan.getAlternativesDefinition().getAlternatives()) {
            Experiment experiment = alternative.getExperiment();
            // - detailedExperimentInfo
            // for (DetailedExperimentInfo detailedInfo :
            // experiment.getDetailedInfo().values()) {
            // ChangeLog diCL = detailedInfo.getChangeLog();
            // if (maxCL < diCL.getChanged()) {
            // maxCL = diCL.getChanged();
            // }
            // if (minCL > diCL.getChanged()) {
            // minCL = diCL.getChanged();
            // }
            // }
            // - result files (alternative.experiment.results)
            for (DigitalObject result : experiment.getResults().values()) {
                ChangeLog resultCL = result.getChangeLog();
                if (maxCL < resultCL.getChanged()) {
                    maxCL = resultCL.getChanged();
                }
                if (minCL > resultCL.getChanged()) {
                    minCL = resultCL.getChanged();
                }
            }
            // - initValues on save
            // cannot be used, as automatic evaluators replace the value objects
            // for (TreeNode treeNode : nodes) {
            // ChangeLog nodeCL = treeNode.getChangeLog();
            // if (treeNode instanceof Leaf) {
            // Leaf leaf = (Leaf)treeNode;
            // for (Values values : leaf.getValueMap().values()) {
            // for (Value value : values.getList()) {
            // ChangeLog valueCL = value.getChangeLog();
            // // only the creation time of the value is relevant!
            // if (maxCL.getChanged() < valueCL.getCreated()) {
            // maxCL = valueCL;
            // }
            // }
            // }
            // }
            // }
        }

        minChangeLogs[8] = minCL;
        maxChangeLogs[8] = maxCL;

        // 9. Evaluate Experiments - RESULTS_CAPTURED(9, "Results Captured")
        // - Evaluation
        // - ValueMap-Values
        minCL = plan.getEvaluation().getChangeLog().getChanged();
        maxCL = minCL;
        if (minCL <= createdAt) {
            minCL = Long.MAX_VALUE;
        }
        for (TreeNode treeNode : nodes) {
            if (treeNode instanceof Leaf) {
                Leaf leaf = (Leaf) treeNode;
                // ValueMap-Values
                for (Values values : leaf.getValueMap().values()) {
                    for (Value value : values.getList()) {
                        ChangeLog valueCL = value.getChangeLog();
                        if (maxCL < valueCL.getChanged()) {
                            maxCL = valueCL.getChanged();
                        }
                    }
                }
                // values are created in a previous step, therefore the min
                // values cannot be set regarding the created timestamp
            }
        }
        minChangeLogs[9] = minCL;
        maxChangeLogs[9] = maxCL;

        // 10. Transform measured values - TRANSFORMATION_DEFINED(10,
        // "Transformations Defined")
        // - leaf.transformer
        // - Transformation
        // - leaf (!! - leaf.aggregationMode )
        minCL = plan.getTransformation().getChangeLog().getChanged();
        maxCL = minCL;
        if (minCL <= createdAt) {
            minCL = Long.MAX_VALUE;
        }
        for (TreeNode treeNode : nodes) {
            if (treeNode instanceof Leaf) {
                Leaf leaf = (Leaf) treeNode;
                if (leaf.getTransformer() != null) {
                    ChangeLog tCL = leaf.getTransformer().getChangeLog();
                    if (maxCL < tCL.getChanged()) {
                        maxCL = tCL.getChanged();
                    }
                    if (minCL > tCL.getChanged()) {
                        minCL = tCL.getChanged();
                    }
                }
            }
        }
        minChangeLogs[10] = minCL;
View Full Code Here

*
*/public class ChangeLogFactory extends AbstractObjectCreationFactory<ChangeLog> {

    @Override
    public ChangeLog createObject(Attributes arg0) throws Exception {
        ChangeLog c = new ChangeLog();
        TimestampFormatter formatter = new TimestampFormatter();
        c.setChangedBy(arg0.getValue("changedBy"));
        c.setCreatedBy(arg0.getValue("createdBy"));
        String changed = arg0.getValue("changed");
        String created = arg0.getValue("created");
        c.setChanged(formatter.parseTimestamp(changed));
        c.setCreated(formatter.parseTimestamp(created));
        return c;
    }
View Full Code Here

     *            the element containing the change log
     * @throws ParseException
     *             if the date could not be parsed
     */
    private void createChangeLog(org.dom4j.Element changeLogElement) throws ParseException {
        changeLog = new ChangeLog();
        if (changeLogElement == null) {
            return;
        }
        TimestampFormatter formatter = new TimestampFormatter();
        changeLog.setChangedBy(changeLogElement.attributeValue("changedBy"));
View Full Code Here

     * and resets the modified flag. Resetting the modified flag is ok: If
     * persisting fails the user was already set.
     *
     */
    public void visit(ITouchable t) {
        ChangeLog log = t.getChangeLog();
        // maybe this object was just created
        String createdBy = log.getCreatedBy();
        if (createdBy == null || "".equals(createdBy)) {
            log.setCreatedBy(user);
        }
        // set user name and reset dirty flag
        if (log.isDirty()) {
            if (user != null) {
                log.setChangedBy(user);
            }
            log.setDirty(false);
        }
    }
View Full Code Here

        long planId = plan.getPlanProperties().getId();

        long createdAt = plan.getChangeLog().getCreated();
        // 0 CREATED
        // 1 INITIALISED
        ChangeLog changelog = plan.getChangeLog();
       
        stateChangeLogs.add(new StateChangeLog(planId, 1, createdAt, createdAt, changelog.getCreatedBy()));

        // 2 Define Basis - BASIS_DEFINED(2)
        // - ProjectBasis
        changelog = plan.getProjectBasis().getChangeLog();
        stateChangeLogs.add(new StateChangeLog(planId, 2, createdAt, changelog.getChanged(), changelog.getChangedBy()));

        // 3. Define Sample Objects - RECORDS_CHOSEN(3)
        // - SampleRecordsDefinition
        // - samples (also created here)
        changelog = plan.getSampleRecordsDefinition().getChangeLog();
        if (changelog.getChanged() > createdAt) {
            stateChangeLogs.add(new StateChangeLog(planId, 3, createdAt, changelog.getChanged(), changelog.getChangedBy()));
        }
        for (SampleObject sample : plan.getSampleRecordsDefinition().getRecords()) {
            ChangeLog sampleCL = sample.getChangeLog();
            stateChangeLogs.add(new StateChangeLog(planId, 3, createdAt, sampleCL.getCreated(), sampleCL.getCreatedBy()));
            if (sampleCL.getChanged() > sampleCL.getCreated()) {
                stateChangeLogs.add(new StateChangeLog(planId, 3, createdAt, sampleCL.getChanged(), sampleCL.getChangedBy()));
            }
        }

        // 4. Identify requirements - TREE_DEFINED(4, "Tree Defined"),
        // - nodes/leaves (also created!)
        // - scales
        // - RequirementsDefinition
        changelog = plan.getRequirementsDefinition().getChangeLog();
        if (changelog.getChanged() > createdAt) {
            stateChangeLogs.add(new StateChangeLog(planId, 4, createdAt, changelog.getChanged(), changelog.getChangedBy()));
        }

        List<TreeNode> nodes = plan.getTree().getRoot().getAllChildren();
        for (TreeNode treeNode : nodes) {
            ChangeLog nodeCL = treeNode.getChangeLog();

            stateChangeLogs.add(new StateChangeLog(planId, 4, createdAt, nodeCL.getCreated(), nodeCL.getCreatedBy()));

            // we can only use the scales of leaves, as
            // - nodes can be changed when weighting is changed
            // - leaves are "changed" when evaluated, aggregation mode is
            // changed
            if (treeNode instanceof Leaf) {
                Scale scale = ((Leaf) treeNode).getScale();
                if (scale != null) {
                    ChangeLog scaleCL = scale.getChangeLog();
                    stateChangeLogs.add(new StateChangeLog(planId, 4, createdAt, scaleCL.getChanged(), scaleCL.getChangedBy()));

                }
            }
        }

        // 5. Define alternatives - ALTERNATIVES_DEFINED(5,
        // "Alternatives Defined")
        // - AlternativesDefinition
        // - Alternative - only created, "changed" can be overwritten in
        // GoDecision)
        changelog = plan.getAlternativesDefinition().getChangeLog();
        if (changelog.getChanged() > createdAt) {
            stateChangeLogs.add(new StateChangeLog(planId, 5, createdAt, changelog.getChanged(), changelog.getChangedBy()));
        }

        for (Alternative alternative : plan.getAlternativesDefinition().getAlternatives()) {
            ChangeLog altCL = alternative.getChangeLog();
            stateChangeLogs.add(new StateChangeLog(planId, 5, createdAt, altCL.getCreated(), altCL.getCreatedBy()));
        }

        // 6. Take go decision - GO_CHOSEN(6, "Go Decision Taken")
        // - no: Alternative (! - if discarded)
        // - GoDecision
        changelog = plan.getDecision().getChangeLog();
        if (changelog.getChanged() > createdAt) {
            stateChangeLogs.add(new StateChangeLog(planId, 6, createdAt, changelog.getChanged(), changelog.getChangedBy()));
        }

        // 7. Develop Experiments - EXPERIMENT_DEFINED(7, "Experiments Defined")
        // Alternative.Experiment
        // as the experiment is created together with the alternative, this
        // might result in the same timestamps
        for (Alternative alternative : plan.getAlternativesDefinition().getAlternatives()) {
            ChangeLog expCL = alternative.getExperiment().getChangeLog();
            stateChangeLogs.add(new StateChangeLog(planId, 7, createdAt, expCL.getChanged(), expCL.getChangedBy()));
        }
        // 8. Run Experiments - EXPERIMENT_PERFORMED(8, "Experiments Performed")
        // - detailedExperimentInfo
        // - result files (alternative.experiment.results)
        // as the experiment is created together with the alternative, this
        // might result in the same timestamps
        for (Alternative alternative : plan.getAlternativesDefinition().getAlternatives()) {
            Experiment experiment = alternative.getExperiment();
            // - result files (alternative.experiment.results)
            for (DigitalObject result : experiment.getResults().values()) {
                ChangeLog resultCL = result.getChangeLog();
                stateChangeLogs.add(new StateChangeLog(planId, 8, createdAt, resultCL.getChanged(), resultCL.getChangedBy()));
            }
        }

        // 9. Evaluate Experiments - RESULTS_CAPTURED(9, "Results Captured")
        // - Evaluation
        // - ValueMap-Values
        changelog = plan.getEvaluation().getChangeLog();
        if (changelog.getChanged() > createdAt) {
            stateChangeLogs.add(new StateChangeLog(planId, 9, createdAt, changelog.getChanged(), changelog.getChangedBy()));
        }

        for (TreeNode treeNode : nodes) {
            if (treeNode instanceof Leaf) {
                Leaf leaf = (Leaf) treeNode;
                // ValueMap-Values
                for (Values values : leaf.getValueMap().values()) {
                    for (Value value : values.getList()) {
                        ChangeLog valueCL = value.getChangeLog();
                        stateChangeLogs
                            .add(new StateChangeLog(planId, 9, createdAt, valueCL.getChanged(), valueCL.getChangedBy()));
                    }
                }
            }
        }

        // 10. Transform measured values - TRANSFORMATION_DEFINED(10,
        // "Transformations Defined")
        // - leaf.transformer
        // - Transformation
        // - leaf (!! - leaf.aggregationMode )
        changelog = plan.getTransformation().getChangeLog();
        if (changelog.getChanged() > createdAt) {
            stateChangeLogs.add(new StateChangeLog(planId, 10, createdAt, changelog.getChanged(), changelog.getChangedBy()));
        }

        for (TreeNode treeNode : nodes) {
            if (treeNode instanceof Leaf) {
                Leaf leaf = (Leaf) treeNode;
                if (leaf.getTransformer() != null) {
                    ChangeLog tCL = leaf.getTransformer().getChangeLog();
                    stateChangeLogs.add(new StateChangeLog(planId, 10, createdAt, tCL.getChanged(), tCL.getChangedBy()));
                }
            }
        }

        // 11. Set importance factors - WEIGHTS_SET(11, "Weights Set")
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.model.ChangeLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.