Search in sources :

Example 6 with IStepSourceContainer

use of com.twinsoft.convertigo.beans.core.IStepSourceContainer in project convertigo by convertigo.

the class CanCreateSource method canCreateSource.

public static boolean canCreateSource(Object obj, StepSourceWrap ssw) {
    // if (target instanceof TreeObject) {
    // TreeObject targetTreeObject = (TreeObject) target;
    // Check for drop to a step which contains a stepSource definition
    // if (targetTreeObject.getObject() instanceof IStepSourceContainer) {
    DatabaseObject targetDbo = (DatabaseObject) obj;
    if (targetDbo instanceof Step && ((Step) targetDbo).canWorkOnSource() || targetDbo instanceof IStepSourceContainer) {
        // StepSourceTransfer.getInstance().getStepSource();
        StepSourceWrap stepSource = ssw;
        if (stepSource != null) {
            Step targetStep = (Step) ((targetDbo instanceof StepVariable) ? ((StepVariable) targetDbo).getParent() : targetDbo);
            // Check for drop to a step in the same sequence
            Long key = Long.valueOf(stepSource.getPriority());
            Step sourceStep = targetStep.getSequence().loadedSteps.get(key);
            if ((sourceStep != null) && (!targetStep.equals(sourceStep))) {
                // Check for drop on a 'following' step
                try {
                    List<DatabaseObject> siblings = new ArrayList<>();
                    getNextSiblings(siblings, targetDbo.getProject(), sourceStep);
                    // System.out.println("siblings: "+siblings.toString());
                    return siblings.contains(targetDbo);
                } catch (Exception e) {
                    e.printStackTrace(System.out);
                }
                ;
            }
        }
    }
    // }
    return false;
}
Also used : ArrayList(java.util.ArrayList) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) Step(com.twinsoft.convertigo.beans.core.Step) StepVariable(com.twinsoft.convertigo.beans.variables.StepVariable) IStepSourceContainer(com.twinsoft.convertigo.beans.core.IStepSourceContainer) StepSourceWrap(com.twinsoft.convertigo.engine.studio.dnd.StepSourceWrap)

Aggregations

IStepSourceContainer (com.twinsoft.convertigo.beans.core.IStepSourceContainer)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)4 Step (com.twinsoft.convertigo.beans.core.Step)4 XMLVector (com.twinsoft.convertigo.beans.common.XMLVector)3 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)3 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)2 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)2 StepVariable (com.twinsoft.convertigo.beans.variables.StepVariable)2 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)2 EngineException (com.twinsoft.convertigo.engine.EngineException)2 StepSourceWrap (com.twinsoft.convertigo.engine.studio.dnd.StepSourceWrap)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 XmlQName (com.twinsoft.convertigo.beans.common.XmlQName)1 ISimpleTypeAffectation (com.twinsoft.convertigo.beans.core.ISimpleTypeAffectation)1 IVariableContainer (com.twinsoft.convertigo.beans.core.IVariableContainer)1 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)1 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)1 Variable (com.twinsoft.convertigo.beans.core.Variable)1 XMLActionStep (com.twinsoft.convertigo.beans.steps.XMLActionStep)1