Examples of Matter


Examples of beans.directory.vidal.entities.matter.Matter

    private void loadMatter() {
        //загрузка в мап уже находящихся в базе объектов
        mapMatter = new HashMap<String, Integer>();
        List matterEntityList = findEntityList(Matter.class);
        for (int i = 0; i < matterEntityList.size(); i++) {
            Matter matter = (Matter) matterEntityList.get(i);
            mapMatter.put(matter.getTitle().toUpperCase().trim(), matter.getId());
        }
        //сохранение в базу новых объектов
        Collection<String> newMatterTitles = cc.matterMap.values();
        for (Iterator<String> it = newMatterTitles.iterator(); it.hasNext();) {
            String matterTitle = it.next().toUpperCase().trim();
            //if (mapMatter.get(matterTitle) == null) {
            if (!mapMatter.containsKey(matterTitle)) {
                //Сохранение в базу и запоминание в мап
                Matter matter = new Matter();
                matter.setTitle(matterTitle);
                manager.persist(matter);
                manager.flush();
                manager.refresh(matter);
                mapMatter.put(matterTitle, matter.getId());
                //System.out.println(matter.getId() + " - " + matterTitle);
            }
        }
       
    }
View Full Code Here

Examples of org.martinlaw.bo.Matter

   * @throws IllegalAccessException
   */
  @Test
  public void testLocalReference_validation()
  throws InstantiationException, IllegalAccessException {
    Matter kase = new CourtCase();
    kase.setLocalReference("my/firm/ cases/2013");
    final String attributeName = "localReference";
    getTestUtils().validate(kase, 1, attributeName);
   
    kase.setLocalReference("MY/FIRM/cases/2013");
    getTestUtils().validate(kase, 1, attributeName);
   
    kase.setLocalReference("MY/FIRM/CASES/2013");
    getTestUtils().validate(kase, 0, attributeName);
   
    kase.setLocalReference("MY/FIRM/CASES(5)/2013");
    getTestUtils().validate(kase, 0, attributeName);
  }
View Full Code Here

Examples of org.martinlaw.bo.Matter

  @Before
  public void setUp() throws Exception {
    keyValues = new ScopedKeyValuesUif();
    boSvc = mock(BusinessObjectService.class);
    keyValues.setBusinessObjectService(boSvc);
    matter = new Matter();
    concreteClass = "org.mlaw.bo.files.Prosecution";
    matter.setConcreteClass(concreteClass);
    matterId = 54l;
   
  }
View Full Code Here

Examples of org.martinlaw.bo.Matter

   *
   * @throws Exception
   */
  @Test
  public void testMatterRetrieve() throws Exception {
      Matter matter = getBoSvc().findBySinglePrimaryKey(getDataObjectClass(), getDataObjectPrimaryKey());
      assertNotNull("matter should not be null", matter);
      testRetrievedMatterFields(matter);
  }
View Full Code Here

Examples of org.martinlaw.bo.Matter

            "Jakton Nyonje (Returning Officer Oriri Constituency)\n" +
            "Noah Bowen (Rongo Constituency)\n" +
            "Alex Uyuga (Returning officer Suna East Constituency)\n" +
            "Jairus Obago (Returning Officer Migori County)\n" +
            "Adam Mohamed (Returning officer Kuria West Constituency)\n";
    Matter matter = getTestMatter(localReference, statusText, name);
    // C
    getBoSvc().save(matter);
    // R
    matter = getBoSvc().findBySinglePrimaryKey(getDataObjectClass(), matter.getId());
    matter.refreshNonUpdateableReferences(); //without this, case status (object) is null
    assertEquals("case name differs", name, matter.getName());
    assertEquals("local reference differs", localReference, matter.getLocalReference());
    assertNotNull("clients should not be null", matter.getClients());
    assertEquals("number of clients expected differs", 2, matter.getClients().size());
   
    assertNotNull("status id should not be null", matter.getStatusId());
    assertNotNull("status should not be null", matter.getStatus());
    assertNotNull("type should not be null", matter.getType());
   
    assertEquals("status differs", statusText, matter.getStatus().getName());
    assertNotNull("considerations should not be null", matter.getConsiderations());
    assertEquals("default number of considerations differs", 2, matter.getConsiderations().size());
    log.debug("Created case with id " + matter.getId());
    assertNotNull("case id should not be null", matter.getId());
   
    assertEquals("ojb concrete class differs", getDataObjectClass().getCanonicalName(), matter.getConcreteClass());
    assertEquals("tags differ", matterTags, matter.getTags());
    additionalTestsForCreatedMatter(matter);
    // U
    matter.getConsiderations().add((MatterConsideration) getTestUtils().getTestConsideration());
   
    getBoSvc().save(matter);
   
    matter = getBoSvc().findBySinglePrimaryKey(matter.getClass(), matter.getId());
   
    getTestUtils().testConsiderationFields(matter.getConsiderations().get(0));
    getTestUtils().testMatterClient(matter, getTestUtils().getTestClientFirstName());
   
    // D
    getBoSvc().delete(matter);
    assertNull("matter should have been deleted", getBoSvc().findBySinglePrimaryKey(getDataObjectClass(), matter.getId()));
    for (MatterClient client: matter.getClients()) {
      assertNull("client should have been deleted", getBoSvc().findBySinglePrimaryKey(MatterClient.class, client.getId()));
    }
    assertNull("consideration should have been deleted", getBoSvc().findBySinglePrimaryKey(MatterConsideration.class,
        matter.getConsiderations().get(0).getId()));
    additionalTestsForDeletedMatter(matter);
  }
View Full Code Here

Examples of org.martinlaw.bo.Matter

   * @throws IllegalAccessException
   * @throws InstantiationException
   */
  protected Matter getTestMatter(String localReference, String statusText, String matterName) throws InstantiationException,
      IllegalAccessException {
    Matter matter = getDataObjectClass().newInstance();
    matter.setLocalReference(localReference);
    matter.setName(matterName);
    matter.setTags(matterTags );
    matter.setTypeId(10011l);
 
    Status status = new Status();
    status.setName(statusText);
    // save status since it is not updated from the court case - ojb config to prevent object modified errors when the status is changed
    getBoSvc().save(status);
    status.refresh();
    matter.setStatusId(status.getId());
    matter.setClientPrincipalName(getTestUtils().getTestClientPrincipalName());
    getTestUtils().addClients(matter);
   
    return matter;
  }
View Full Code Here

Examples of org.martinlaw.bo.Matter

   * @param qualifiedMatterClassName - the default name
   * @param matterId - the primary key
   * @return @see {@link #getKeyValues(ViewModel)}
   */
  protected String retrieveQualifiedMatterClassName(String qualifiedMatterClassName, Long matterId) {
    Matter matter = getBusinessObjectService().findBySinglePrimaryKey(Matter.class, matterId);
    if (matter != null) {
      qualifiedMatterClassName = matter.getConcreteClass();
    }
   
    return qualifiedMatterClassName;
  }
View Full Code Here

Examples of org.martinlaw.bo.Matter

   * unit test in {@link org.martinlaw.test.contract.ContractTransactionDocBOTest#testClientNamesKeyValues()}
   */
  @Override
  public List<KeyValue> getKeyValues(ViewModel model) {
    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    Matter matter = null;
    if (model instanceof MatterTxForm) {
      MatterTxForm form = (MatterTxForm) model;
      if (form.getDocument() != null) {
        MatterTxDocBase doc = ((MatterTxDocBase)form.getDocument());
        if (doc.isMatterIdValid()) {
          matter = getBusinessObjectService().findBySinglePrimaryKey(
            Matter.class, doc.getMatterId());
        }
      }
    } else if (model instanceof InquiryForm) {
      InquiryForm form = (InquiryForm) model;
      if (form.getDataObject() instanceof Matter) {
        matter = (Matter) form.getDataObject();
      } else if (form.getDataObject() instanceof MatterConsideration) {
        matter = ((MatterConsideration) form.getDataObject()).getMatter();
      }
    }
    if (matter != null && matter.getClients() != null && !matter.getClients().isEmpty()) {
      for (Object clientObj: matter.getClients()) {
        MatterClient client = (MatterClient)clientObj;
        String value = client.getPerson().getName();
        if (StringUtils.isEmpty(value)) {
          value = client.getPrincipalName();
        }
View Full Code Here

Examples of org.martinlaw.bo.Matter

    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    MatterTxForm form = (MatterTxForm) model;
    if (form.getDocument() != null) {
      MatterTxDocBase doc = ((MatterTxDocBase)form.getDocument());
      if (doc.isMatterIdValid()) {
        Matter matter = KRADServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(
            Matter.class, doc.getMatterId());
        if (matter.getConsiderations() != null && !matter.getConsiderations().isEmpty()) {
          for (Object considObj: matter.getConsiderations()) {
            MatterConsideration consideration = (MatterConsideration)considObj;
            StringBuilder value = new StringBuilder();
            value.append(consideration.getConsiderationType().getName());
            value.append(" - ");
            value.append(consideration.getCurrency());
View Full Code Here

Examples of org.martinlaw.bo.Matter

  @Test
  public void testMatterMaintenanceRouting() throws WorkflowException {
    try {
      // with custom doc searching enabled, saving the document first introduces errors in which the kr users is recorded as routing the doc
      Matter matter = getTestMatter();
      matter.setClientPrincipalName("Emma Njau");
      testMaintenanceRoutingInitToFinal(getDocTypeName(), matter);
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("localReference", getLocalReference());
      Collection<? extends Matter> cases = KRADServiceLocator.getBusinessObjectService().findMatching(getDataObjectClass(), params);
      assertEquals("Should have found one case", 1, cases.size());
      Matter cse = cases.iterator().next();
      assertEquals("local reference differs", getLocalReference(), cse.getLocalReference());
      assertNotNull("status should not be null", cse.getStatus());
      testCreatedMatter(cse);
      log.info("created status with id " + cse.getStatus().getId());
     
      String msg = "expected principal name differs";
      assertEquals(msg, "emma_njau", cse.getClientPrincipalName());
      // the names are blank since they are saved via bosvc rather than identity svc
      // assertEquals("main client first name differs", "Emma", cse.getClient().getFirstName());
     
      assertEquals("number of clients expected differs", 2, cse.getClients().size());
      assertEquals(msg, "joseph_ndungu", cse.getClients().get(0).getPrincipalName());
      assertEquals(msg, "joseph_thube", cse.getClients().get(1).getPrincipalName());
    } catch (Exception e) {
      log.error("test failed", e);
      fail("test failed due to an exception - " + e.getClass());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.