Example usage for java.lang CloneNotSupportedException printStackTrace

List of usage examples for java.lang CloneNotSupportedException printStackTrace

Introduction

In this page you can find the example usage for java.lang CloneNotSupportedException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.jfree.chart.demo.SuperDemo.java

private void exportToPDF() {
    java.awt.Component component = chartContainer.getComponent(0);
    if (component instanceof ChartPanel) {
        JFileChooser jfilechooser = new JFileChooser();
        jfilechooser.setName("untitled.pdf");
        jfilechooser.setFileFilter(new FileFilter() {

            public boolean accept(File file) {
                return file.isDirectory() || file.getName().endsWith(".pdf");
            }//from   w  ww.  j a v  a 2s. c  om

            public String getDescription() {
                return "Portable Document Format (PDF)";
            }

        });
        int i = jfilechooser.showSaveDialog(this);
        if (i == 0) {
            ChartPanel chartpanel = (ChartPanel) component;
            try {
                JFreeChart jfreechart = (JFreeChart) chartpanel.getChart().clone();
                PDFExportTask pdfexporttask = new PDFExportTask(jfreechart, chartpanel.getWidth(),
                        chartpanel.getHeight(), jfilechooser.getSelectedFile());
                Thread thread = new Thread(pdfexporttask);
                thread.start();
            } catch (CloneNotSupportedException clonenotsupportedexception) {
                clonenotsupportedexception.printStackTrace();
            }
        }
    } else {
        String s = "Unable to export the selected item.  There is ";
        s = s + "either no chart selected,\nor else the chart is not ";
        s = s + "at the expected location in the component hierarchy\n";
        s = s + "(future versions of the demo may include code to ";
        s = s + "handle these special cases).";
        JOptionPane.showMessageDialog(this, s, "PDF Export", 1);
    }
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * Method to parse a CheckList//from   ww w. jav a  2s . c  om
 * 
 * @param _checkList
 */
private void parseCheckList(CheckList _checkList) {

    CheckList clone = null;

    try {
        clone = _checkList.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    List<Section> sections = new ArrayList<Section>();
    sections.addAll(_checkList.getSections());

    _checkList.getSections().clear();

    this.checkListService.saveCheckList(_checkList);
    System.out.println("###CheckList vide sauvee");

    for (Section section : sections) {
        this.parseSection(section);
    }

    _checkList.setSections(this.checkListService.getSections(_checkList));

    _checkList.addAllSection(clone.getSections());

    this.checkListService.saveCheckList(_checkList);
    System.out.println("###CheckList sauvee");
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * //from www.j  ava2s  . co  m
 * Method to parse a RoleDefinition
 * 
 * @param _rdef
 */
private List<Guidance> parseRoleDefinition(RoleDefinition _rdef, List<Guidance> guid) {

    RoleDefinition clone = null;

    List<Guidance> tmp = new ArrayList<Guidance>();
    tmp.addAll(guid);

    try {
        clone = _rdef.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    Set<Guidance> guidances = new HashSet<Guidance>();
    guidances.addAll(_rdef.getGuidances());

    _rdef.getRoleDescriptors().clear();
    _rdef.getGuidances().clear();

    this.roleDefinitionService.getRoleDefinitionDao().saveOrUpdateRoleDefinition(_rdef);
    System.out.println("###RoleDefinition vide sauve");

    for (Guidance g : guidances) {
        if (!tmp.contains(g)) {
            tmp.add(g);
        }
    }

    // _rdef.setRoleDescriptors(this.roleDefinitionService.getRoleDescriptors(_rdef));
    _rdef.setGuidances(this.roleDefinitionService.getGuidances(_rdef));

    // _rdef.addAllRoleDescriptors(clone.getRoleDescriptors());
    _rdef.addAllGuidances(clone.getGuidances());

    this.roleDefinitionService.getRoleDefinitionDao().saveOrUpdateRoleDefinition(_rdef);
    System.out.println("###RoleDefinition sauve");

    return tmp;
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * //w  ww  . j av  a  2s  .  c o m
 * Method to parse a RoleDescriptor
 * 
 * @param _rd
 */
private List<Guidance> parseRoleDescriptor(RoleDescriptor _rd, List<Guidance> guid) {

    RoleDescriptor clone = null;

    List<Guidance> tmp = new ArrayList<Guidance>();
    tmp.addAll(guid);

    try {
        clone = _rd.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    RoleDefinition rdef = _rd.getRoleDefinition();

    _rd.getAdditionalTasks().clear();
    _rd.getPrimaryTasks().clear();
    _rd.getSuperActivities().clear();
    _rd.setRoleDefinition(null);

    this.roleDescriptorService.getRoleDescriptorDao().saveOrUpdateRoleDescriptor(_rd);
    System.out.println("###RoleDescriptor vide sauve");

    if (rdef != null) {
        tmp = this.parseRoleDefinition(rdef, tmp);
    }

    // _rd.setAdditionalTasks(this.roleDescriptorService.getAdditionalTasks(_rd));
    _rd.setPrimaryTasks(this.roleDescriptorService.getPrimaryTasks(_rd));
    _rd.setSuperActivities(this.breakdownElementService.getSuperActivities(_rd));

    // _rd.addAllAdditionalTasks(clone.getAdditionalTasks());
    _rd.addAllPrimaryTasks(clone.getPrimaryTasks());
    _rd.addAllSuperActivities(clone.getSuperActivities());
    _rd.setRoleDefinition(clone.getRoleDefinition());

    this.roleDescriptorService.getRoleDescriptorDao().saveOrUpdateRoleDescriptor(_rd);
    System.out.println("###RoleDescriptor sauve");

    return tmp;
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * /*from   w  w w .  ja va2s  .  c  o m*/
 * Method to parse a TaskDescriptor
 * 
 * @param _td
 */
private List<Guidance> parseTaskDescriptor(TaskDescriptor _td, List<Guidance> guid) {

    TaskDescriptor clone = null;

    List<Guidance> tmp = new ArrayList<Guidance>();
    tmp.addAll(guid);

    try {
        clone = _td.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    TaskDefinition tdef = _td.getTaskDefinition();

    _td.getAdditionalRoles().clear();
    _td.getPredecessors().clear();
    _td.getSuccessors().clear();
    _td.getSuperActivities().clear();
    _td.setMainRole(null);
    _td.setTaskDefinition(null);

    this.taskDescriptorService.getTaskDescriptorDao().saveOrUpdateTaskDescriptor(_td);
    System.out.println("###TaskDescriptor vide sauve");

    if (tdef != null) {
        tmp = this.parseTaskDefinition(tdef, tmp);
    }

    // To decomment when you want to manage additionalRoles
    _td.setAdditionalRoles(this.taskDescriptorService.getAdditionalRoles(_td));
    _td.setPredecessors(this.workBreakdownElementService.getPredecessors(_td));
    _td.setSuccessors(this.workBreakdownElementService.getSuccessors(_td));
    _td.setSuperActivities(this.breakdownElementService.getSuperActivities(_td));

    // clone dependencies getting
    _td.addAllAdditionalRoles(clone.getAdditionalRoles());
    _td.addAllPredecessors(clone.getPredecessors());
    _td.addAllSuccessors(clone.getSuccessors());
    _td.addAllSuperActivities(clone.getSuperActivities());
    _td.setMainRole(clone.getMainRole());
    _td.setTaskDefinition(clone.getTaskDefinition());

    this.taskDescriptorService.getTaskDescriptorDao().saveOrUpdateTaskDescriptor(_td);
    System.out.println("###TaskDescriptor sauve");

    return tmp;
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * /*from ww w  . j  a  v  a 2  s .  c o m*/
 * @param _tdef
 */
private List<Guidance> parseTaskDefinition(TaskDefinition _tdef, List<Guidance> guid) {

    TaskDefinition clone = null;

    List<Guidance> tmp = new ArrayList<Guidance>();
    tmp.addAll(guid);

    try {
        clone = _tdef.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    Set<Guidance> guidances = new HashSet<Guidance>();
    guidances.addAll(_tdef.getGuidances());

    List<Step> steps = new ArrayList<Step>();
    // recuperation des breakdownelements du processus
    steps.addAll(_tdef.getSteps());

    _tdef.getSteps().clear();
    _tdef.getTaskDescriptors().clear();
    _tdef.getGuidances().clear();

    this.taskDefinitionService.getTaskDefinitionDao().saveOrUpdateTaskDefinition(_tdef);
    System.out.println("###TaskDefinition vide sauve");

    for (Guidance g : guidances) {
        if (!tmp.contains(g)) {
            tmp.add(g);
        }
    }

    for (Step step : steps) {
        this.parseStep(step);
    }

    _tdef.setSteps(this.taskDefinitionService.getSteps(_tdef));
    // _tdef.setTaskDescriptors(this.roleDefinitionService.getRoleDescriptors(_rdef));
    _tdef.setGuidances(this.taskDefinitionService.getGuidances(_tdef));

    _tdef.addAllSteps(clone.getSteps());
    // _tdef.addAllTaskDesciptors(clone.getTaskDescriptors());
    _tdef.addAllGuidances(clone.getGuidances());

    this.taskDefinitionService.getTaskDefinitionDao().saveOrUpdateTaskDefinition(_tdef);
    System.out.println("###TaskDefinition sauve");

    return tmp;
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * /*from w  w w .  j  av a 2 s  .  com*/
 * Method to parse an Iteration
 * 
 * @param _it
 */
private List<Guidance> parseIteration(Iteration _it, List<Guidance> guid) {

    Iteration clone = null;

    List<Guidance> tmp = new ArrayList<Guidance>();
    tmp.addAll(guid);

    try {
        clone = _it.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    List<BreakdownElement> bdes = new ArrayList<BreakdownElement>();
    bdes.addAll(_it.getBreakdownElements());

    Set<Guidance> guidances = new HashSet<Guidance>();
    guidances.addAll(_it.getGuidances());

    _it.getBreakdownElements().clear();
    _it.getPredecessors().clear();
    _it.getSuccessors().clear();
    _it.getSuperActivities().clear();
    _it.getGuidances().clear();
    this.iterationService.getIterationDao().saveOrUpdateIteration(_it);
    System.out.println("###Iteration vide sauve");

    for (Guidance g : guidances) {
        if (!tmp.contains(g)) {
            tmp.add(g);
        }
    }

    for (BreakdownElement bde : bdes) {
        if (bde instanceof Activity) {
            Activity act = (Activity) bde;
            tmp = this.parseActivity(act, tmp);
        } else {
            if (bde instanceof RoleDescriptor) {
                RoleDescriptor rd = (RoleDescriptor) bde;
                tmp = this.parseRoleDescriptor(rd, tmp);
            } else {
                TaskDescriptor td = (TaskDescriptor) bde;
                tmp = this.parseTaskDescriptor(td, tmp);
            }
        }
    }

    _it.setBreakdownElements(this.activityService.getBreakdownElements(_it));
    _it.setPredecessors(this.workBreakdownElementService.getPredecessors(_it));
    _it.setSuccessors(this.workBreakdownElementService.getSuccessors(_it));
    _it.setSuperActivities(this.breakdownElementService.getSuperActivities(_it));
    _it.setGuidances(this.activityService.getGuidances(_it));

    // clone dependencies getting
    _it.addAllBreakdownElements(clone.getBreakdownElements());
    _it.addAllPredecessors(clone.getPredecessors());
    _it.addAllSuccessors(clone.getSuccessors());
    _it.addAllSuperActivities(clone.getSuperActivities());
    _it.setGuidances(clone.getGuidances());

    this.iterationService.getIterationDao().saveOrUpdateIteration(_it);
    System.out.println("###Iteration sauve");

    return tmp;
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * //w  w w  .java2 s  . c om
 * Method to parse an Activity
 * 
 * @param _act
 */
private List<Guidance> parseActivity(Activity _act, List<Guidance> guid) {

    Activity clone = null;

    List<Guidance> tmp = new ArrayList<Guidance>();
    tmp.addAll(guid);

    try {
        clone = _act.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    List<BreakdownElement> bdes = new ArrayList<BreakdownElement>();
    bdes.addAll(_act.getBreakdownElements());

    Set<Guidance> guidances = new HashSet<Guidance>();
    guidances.addAll(_act.getGuidances());

    _act.getBreakdownElements().clear();
    _act.getPredecessors().clear();
    _act.getSuccessors().clear();
    _act.getSuperActivities().clear();
    _act.getGuidances().clear();
    this.activityService.saveActivity(_act);
    System.out.println("###Activity vide sauve");

    for (Guidance g : guidances) {
        if (!tmp.contains(g)) {
            tmp.add(g);
        }
    }

    for (BreakdownElement bde : bdes) {
        if (bde instanceof Activity) {
            Activity act = (Activity) bde;
            tmp = this.parseActivity(act, tmp);
        } else {
            if (bde instanceof RoleDescriptor) {
                RoleDescriptor rd = (RoleDescriptor) bde;
                tmp = this.parseRoleDescriptor(rd, tmp);
            } else {
                TaskDescriptor td = (TaskDescriptor) bde;
                tmp = this.parseTaskDescriptor(td, tmp);
            }
        }
    }

    _act.setBreakdownElements(this.activityService.getBreakdownElements(_act));
    _act.setPredecessors(this.workBreakdownElementService.getPredecessors(_act));
    _act.setSuccessors(this.workBreakdownElementService.getSuccessors(_act));
    _act.setSuperActivities(this.breakdownElementService.getSuperActivities(_act));
    _act.setGuidances(this.activityService.getGuidances(_act));

    // clone dependencies getting
    _act.addAllBreakdownElements(clone.getBreakdownElements());
    _act.addAllPredecessors(clone.getPredecessors());
    _act.addAllSuccessors(clone.getSuccessors());
    _act.addAllSuperActivities(clone.getSuperActivities());
    _act.setGuidances(clone.getGuidances());

    this.activityService.saveActivity(_act);
    System.out.println("###Activity sauve");

    return tmp;
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * //from w ww  . j a  v  a 2  s.  c om
 * Method to parse a Phase
 * 
 * @param _ph
 */
private List<Guidance> parsePhase(Phase _ph, List<Guidance> guid) {

    Phase clone = null;

    List<Guidance> tmp = new ArrayList<Guidance>();
    tmp.addAll(guid);

    try {
        clone = _ph.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    List<BreakdownElement> bdes = new ArrayList<BreakdownElement>();
    bdes.addAll(_ph.getBreakdownElements());

    // Guides
    Set<Guidance> guidances = new HashSet<Guidance>();
    guidances.addAll(_ph.getGuidances());

    // clean of dependancies of _ph
    _ph.getBreakdownElements().clear();
    _ph.getPredecessors().clear();
    _ph.getSuccessors().clear();
    _ph.getSuperActivities().clear();
    _ph.getGuidances().clear();
    this.phaseService.getPhaseDao().saveOrUpdatePhase(_ph);
    System.out.println("###Phase vide sauve");

    for (Guidance g : guidances) {
        if (!tmp.contains(g)) {
            tmp.add(g);
        }
    }

    for (BreakdownElement bde : bdes) {
        if (bde instanceof Iteration) {
            Iteration it = (Iteration) bde;
            tmp = this.parseIteration(it, tmp);
        } else {
            if (bde instanceof Activity) {
                Activity act = (Activity) bde;
                tmp = this.parseActivity(act, tmp);
            } else {
                if (bde instanceof RoleDescriptor) {
                    RoleDescriptor rd = (RoleDescriptor) bde;
                    tmp = this.parseRoleDescriptor(rd, tmp);
                } else {
                    TaskDescriptor td = (TaskDescriptor) bde;
                    tmp = this.parseTaskDescriptor(td, tmp);
                }
            }
        }
    }

    _ph.setBreakdownElements(this.activityService.getBreakdownElements(_ph));
    _ph.setPredecessors(this.workBreakdownElementService.getPredecessors(_ph));
    _ph.setSuccessors(this.workBreakdownElementService.getSuccessors(_ph));
    _ph.setSuperActivities(this.breakdownElementService.getSuperActivities(_ph));
    _ph.setGuidances(this.activityService.getGuidances(_ph));

    // clone dependencies getting
    _ph.addAllBreakdownElements(clone.getBreakdownElements());
    _ph.addAllPredecessors(clone.getPredecessors());
    _ph.addAllSuccessors(clone.getSuccessors());
    _ph.addAllSuperActivities(clone.getSuperActivities());
    _ph.setGuidances(clone.getGuidances());

    // Parse for guidances
    this.phaseService.getPhaseDao().saveOrUpdatePhase(_ph);
    System.out.println("###Phase sauve");

    return tmp;
}

From source file:wilos.business.services.spem2.process.ProcessService.java

/**
 * //  ww  w  .  j a va  2  s.c om
 * Method for saving a Process
 * 
 * @param _process
 */
public void saveProcess(Process _process, String _processManagerId) {

    Process clone = null;

    // clone creation for the save of the dependencies
    try {
        clone = _process.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }

    // elements of collection getting
    List<BreakdownElement> bdes = new ArrayList<BreakdownElement>();
    bdes.addAll(_process.getBreakdownElements());

    // elements of collection getting
    List<Guidance> guid = new ArrayList<Guidance>();

    // dependencies erasing
    _process.getBreakdownElements().clear();
    _process.getPredecessors().clear();
    _process.getProjects().clear();
    _process.getSuccessors().clear();
    _process.getSuperActivities().clear();

    // save of the project
    this.processDao.saveOrUpdateProcess(_process);
    System.out.println("###Process vide sauve");

    // in function of element type
    for (BreakdownElement bde : bdes) {
        if (bde instanceof Phase) {
            Phase ph = (Phase) bde;
            guid = this.parsePhase(ph, guid);
        } else {
            if (bde instanceof Iteration) {
                Iteration it = (Iteration) bde;
                guid = this.parseIteration(it, guid);
            } else {
                if (bde instanceof Activity) {
                    Activity act = (Activity) bde;
                    guid = this.parseActivity(act, guid);
                } else {
                    if (bde instanceof RoleDescriptor) {
                        RoleDescriptor rd = (RoleDescriptor) bde;
                        guid = this.parseRoleDescriptor(rd, guid);
                    } else {
                        TaskDescriptor td = (TaskDescriptor) bde;
                        guid = this.parseTaskDescriptor(td, guid);
                    }
                }
            }
        }
    }

    // saving of the attached guidances to the process
    for (Guidance g : guid) {
        this.parseGuidance(g);
    }

    // destroy the persistance of the collections
    _process.setBreakdownElements(this.activityService.getBreakdownElements(_process));
    _process.setPredecessors(this.workBreakdownElementService.getPredecessors(_process));
    _process.setSuccessors(this.workBreakdownElementService.getSuccessors(_process));
    _process.setSuperActivities(this.breakdownElementService.getSuperActivities(_process));

    // clone dependencies getting
    _process.addAllBreakdownElements(clone.getBreakdownElements());
    _process.addAllPredecessors(clone.getPredecessors());
    _process.addAllSuccessors(clone.getSuccessors());
    _process.addAllSuperActivities(clone.getSuperActivities());

    _process.addProcessManager(this.processManagerService.getProcessManager(_processManagerId));

    // update of the project
    this.processDao.saveOrUpdateProcess(_process);
    System.out.println("###Process sauve");
}