Package org.openbravo.dal.security

Examples of org.openbravo.dal.security.OrganizationStructureProvider


  public OrganizationStructureProvider getOrganizationStructureProvider() {
    return getOrganizationStructureProvider(getCurrentClient().getId());
  }

  public OrganizationStructureProvider getOrganizationStructureProvider(String clientId) {
    OrganizationStructureProvider orgProvider = organizationStructureProviderByClient.get(clientId);

    // create one
    if (orgProvider == null) {
      orgProvider = OBProvider.getInstance().get(OrganizationStructureProvider.class);
      orgProvider.setClientId(clientId);
      organizationStructureProviderByClient.put(clientId, orgProvider);
    }
    return orgProvider;
  }
View Full Code Here


  /**
   * Tests valid organizations trees for different organizations.
   */
  public void testOrganizationTree() {
    setBigBazaarAdminContext();
    final OrganizationStructureProvider osp = new OrganizationStructureProvider();
    osp.setClientId("1000000");

    checkResult("1000001", osp, new String[] { "1000001" });
    checkResult("1000002", osp, new String[] { "1000003", "1000004", "1000000", "0", "1000002" });
    checkResult("1000003", osp, new String[] { "1000003", "1000000", "0", "1000002" });
    checkResult("1000004", osp, new String[] { "1000004", "1000000", "0", "1000002" });
View Full Code Here

  // part of client import:
  // 8509: References in the database without using foreign keys can go wrong in import
  // https://issues.openbravo.com/view.php?id=8509
  private void testMantis8509(String clientId) {
    setUserContext("0");
    final OrganizationStructureProvider osp = new OrganizationStructureProvider();
    osp.setClientId(clientId);
    final Client client = OBDal.getInstance().get(Client.class, clientId);
    final OBCriteria<Organization> os = OBDal.getInstance().createCriteria(Organization.class);
    os.setFilterOnReadableClients(false);
    os.setFilterOnReadableOrganization(false);
    os.setFilterOnActive(false);
    os.add(Expression.eq("client", client));
    for (Organization o : os.list()) {
      final Set<String> naturalTree = osp.getNaturalTree(o.getId());
      // all the organizations should at least have a tree of size 2
      if (naturalTree.size() <= 1) {
        fail("Naturaltree computation fails for organization " + o.getId() + " in imported client "
            + clientId);
      }
View Full Code Here

TOP

Related Classes of org.openbravo.dal.security.OrganizationStructureProvider

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.