Package no.ugland.utransprod.model

Examples of no.ugland.utransprod.model.Cutting


        { LazyLoadEnum.ORDER_COSTS, LazyLoadEnum.NONE },
        { LazyLoadEnum.ORDER_COMMENTS, LazyLoadEnum.NONE },
        { LazyLoadEnum.ORDER_LINES, LazyLoadEnum.NONE },
        { LazyLoadEnum.COLLIES, LazyLoadEnum.NONE },
        { LazyLoadEnum.PROCENT_DONES, LazyLoadEnum.NONE } });
    Cutting cutting = order.getCutting();
    CuttingManager cuttingManager = (CuttingManager) ModelUtil
        .getBean(CuttingManager.MANAGER_NAME);
    cuttingManager.lazyLoad(cutting, new LazyLoadEnum[][] { {
        LazyLoadEnum.CUTTING_LINES, LazyLoadEnum.NONE } });
    FileViewHandler fileViewHandler = new FileViewHandler(cutting
        .toFileContent());
    FileView fileView = new FileView(fileViewHandler);
    JDialog dialog = Util.getDialog(aWindow, "Kappfil", true);
    WindowInterface dialogWindow = new JDialogAdapter(dialog);
    dialog.add(fileView.buildPanel(dialogWindow));
View Full Code Here


  }

  private String importAndSaveCutting(Order order,
      final boolean overwriteExistingCutting) throws ProTransException {

    Cutting cutting = getAndImportCuttingFile(window, order);
    if (cutting != Cutting.UNKNOWN) {
      saveImportedCutting(cutting, overwriteExistingCutting);
      overviewManager.saveObject(order);
    }
    return cutting.getProId();
  }
View Full Code Here

  }

  private Cutting importCuttingFile(String cuttingFileName, Order order)
      throws ProTransException {
    CuttingImport cuttingImport = new CuttingImport();
    Cutting cutting = cuttingImport.importCuttingFile(cuttingFileName);
    cutting.setOrder(order);

    return cutting;
  }
View Full Code Here

    protected Serializable getObjectId(Cutting object) {
        return object.getCuttingId();
    }

    public Cutting findByProId(String aProId) {
        Cutting cutting = new Cutting();
        cutting.setProId(aProId);
        List<Cutting> cuttings = dao.findByExample(cutting);
        return cuttings.size() == 1 ? cuttings.get(0) : null;
    }
View Full Code Here

        dao.removeObject(cutting.getCuttingId());

    }

    public void saveCutting(Cutting cutting, final Boolean overwriteExistingCutting) throws ProTransException {
        Cutting existingCutting = findByProId(cutting.getProId());
        if (existingCutting != null && !existingCutting.getOrder().equals(cutting.getOrder())) {
            throw new ProTransException("Kappfil med proid " + cutting.getProId() + " er allerede importert!");
        }
        if (overwriteExistingCutting) {
            checkAndDeleteExisting(cutting);
        }
View Full Code Here

        dao.saveObject(cutting);

    }

    private void checkAndDeleteExisting(Cutting cutting) {
        Cutting oldCutting = ((CuttingDAO)dao).findByOrder(cutting.getOrder());
        if (oldCutting != null) {
            removeCutting(oldCutting);
        }

    }
View Full Code Here

  public void testImportCuttingFile() throws Exception {
    CuttingImport cuttingImport = new CuttingImport();
   
    URL url=this.getClass().getClassLoader().getResource("test_cutting.boq");
   
    Cutting cutting = cuttingImport.importCuttingFile(url.getFile());
    assertNotNull(cutting);
    assertEquals("110", cutting.getVersion());
    assertEquals("JW", cutting.getProSign());
    assertEquals("0950435", cutting.getProId());
    Set<CuttingLine> cuttingLines = cutting.getCuttingLines();
    assertNotNull(cuttingLines);
    assertEquals(18, cuttingLines.size());
    validateCuttingLines(cuttingLines);

  }
View Full Code Here

        return new File(tmpFileName);
    }

    @SuppressWarnings("unchecked")
    private Cutting readAndImportCuttingFile(File cuttingFile) throws ProTransException {
        Cutting cutting = new Cutting();
        try {
            List<String> lines = FileUtils.readLines(cuttingFile);
            int lineCount = 0;

            for (String line : lines) {
View Full Code Here

public class CuttingManagerTest {

    @After
    public void tearDown() throws Exception {
        CuttingManager cuttingManager = (CuttingManager)ModelUtil.getBean(CuttingManager.MANAGER_NAME);
        Cutting cutting = cuttingManager.findByProId("0950435");
        if(cutting!=null){
            cuttingManager.removeCutting(cutting);
        }
        cutting = cuttingManager.findByProId("0950436");
        if(cutting!=null){
View Full Code Here

        checkInsertedCutting(cuttingManager,"0950435");
        insertCutting("0950436",true);
        checkInsertedCutting(cuttingManager,"0950436");
    }
    private void checkInsertedCutting(CuttingManager cuttingManager,final String proId) {
        Cutting savedCutting = cuttingManager.findByProId(proId);
        assertNotNull(savedCutting);
        cuttingManager.lazyLoad(savedCutting, new LazyLoadEnum[][]{{LazyLoadEnum.CUTTING_LINES,LazyLoadEnum.NONE}});
        assertEquals(proId, savedCutting.getProId());
        assertEquals("110", savedCutting.getVersion());
        assertEquals("JW", savedCutting.getProSign());
        assertEquals("49838", savedCutting.getOrder().getOrderNr());
       
        Set<CuttingLine> lines = savedCutting.getCuttingLines();
        assertNotNull(lines);
        assertEquals(1, lines.size());
       
        CuttingLine aLine=lines.iterator().next();
        assertEquals("KAP", aLine.getName());
View Full Code Here

TOP

Related Classes of no.ugland.utransprod.model.Cutting

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.