Package org.openbravo.model.common.enterprise

Examples of org.openbravo.model.common.enterprise.Organization


        // Client
        iOrder.setClient(extPos.getClient());

        // Organization
        final Organization syncOrgSel = (Organization) OBDal.getInstance().get(
                "Organization", erp_org);
        iOrder.setOrganization(syncOrgSel);

        // Sales representative
        iOrder.setSalesRepresentative(extPos.getSalesRepresentative());
View Full Code Here


        if (img == null)
          img = OBDal.getInstance().get(SystemInformation.class, "0").getYourCompanyBigImage();
      } else if (logo.equals("yourcompanydoc")) {
        String orgId = vars.getStringParameter("orgId");
        if (orgId != null && !orgId.equals("")) {
          Organization org = OBDal.getInstance().get(Organization.class, orgId);
          img = org.getOrganizationInformationList().get(0).getYourCompanyDocumentImage();
        }
        if (img == null)
          img = OBDal.getInstance().get(SystemInformation.class, "0").getYourCompanyDocumentImage();
      } else
        return;
View Full Code Here

        user.setUsername(getNewName() + "_" + user.getUsername());
      } else {
        user.setUsername(replace(user.getUsername(), originalName));
      }
    } else if (bob instanceof Organization) {
      final Organization org = (Organization) bob;
      if (org.getName().indexOf(originalName) == -1) {
        org.setName(getNewName() + "_" + org.getName());
      } else {
        org.setName(replace(org.getName(), originalName));
      }
    } else if (bob instanceof Warehouse) {
      final Warehouse wh = (Warehouse) bob;
      if (wh.getName().indexOf(originalName) == -1) {
        wh.setName(getNewName() + "_" + wh.getName());
View Full Code Here

            + RoleOrganization.PROPERTY_ROLE + "." + Organization.PROPERTY_ID + "='"
            + thisRole.getId() + "' and roa." + RoleOrganization.PROPERTY_ACTIVE + "='Y' and o."
            + Organization.PROPERTY_ACTIVE + "='Y'");
    organizationList = qry.list();
    for (final String orgId : additionalWritableOrganizations) {
      final Organization org = OBDal.getInstance().get(Organization.class, orgId);
      if (!organizationList.contains(org)) {
        organizationList.add(org);
      }
    }
    return organizationList;
View Full Code Here

      }

      Check.isNotNull(getRole(), "Role may not be null");

      if (orgId != null) {
        final Organization o = getOne(Organization.class, "select r from "
            + Organization.class.getName() + " r where " + " r." + Organization.PROPERTY_ID + "='"
            + orgId + "'");
        setCurrentOrganization(o);
      } else if (getUser().getDefaultOrganization() != null
          && getUser().getDefaultOrganization().isActive()) {
View Full Code Here

  private void checkReferencedOrganizations(Object entity, Object[] currentState,
      Object[] previousState, String[] propertyNames) {
    if (!(entity instanceof OrganizationEnabled)) {
      return;
    }
    final Organization o1 = ((OrganizationEnabled) entity).getOrganization();
    final OBContext obContext = OBContext.getOBContext();
    final BaseOBObject bob = (BaseOBObject) entity;
    boolean isNew = bob.getId() == null || bob.isNewOBObject();

    // check if the organization of the current object has changed, if so
    // then
    // check all references
    if (!isNew) {
      for (int i = 0; i < currentState.length; i++) {
        if (propertyNames[i].equals(PROPERTY_ORGANIZATION)) {
          if (currentState[i] != previousState[i]) {
            isNew = true;
            break;
          }
        }
      }
    }

    for (int i = 0; i < currentState.length; i++) {
      // TODO maybe use equals
      if ((isNew || currentState[i] != previousState[i])
          && !(currentState[i] instanceof Organization)
          && (currentState[i] instanceof BaseOBObject || currentState[i] instanceof HibernateProxy)
          && currentState[i] instanceof OrganizationEnabled) {
        // get the organization from the current state
        final OrganizationEnabled oe = (OrganizationEnabled) currentState[i];
        final Organization o2 = oe.getOrganization();

        if (!obContext.getOrganizationStructureProvider(o1.getClient().getId()).isInNaturalTree(o1,
            o2)) {
          throw new OBSecurityException("Entity " + bob.getIdentifier() + " ("
              + bob.getEntityName() + ") with organization " + o1.getIdentifier()
              + " references an entity " + ((BaseOBObject) currentState[i]).getIdentifier()
              + " through its property " + propertyNames[i] + " but this referenced entity"
              + " belongs to an organization " + o2.getIdentifier()
              + " which is not part of the natural tree of " + o1.getIdentifier());
        }
      }
    }
  }
View Full Code Here

    log
        .debug("OBEvent for new object " + t.getClass().getName() + " user "
            + currentUser.getName());

    Client client = null;
    Organization org = null;
    if (t instanceof ClientEnabled || t instanceof OrganizationEnabled) {
      // reread the client and organization
      client = SessionHandler.getInstance()
          .find(Client.class, obContext.getCurrentClient().getId());
      org = SessionHandler.getInstance().find(Organization.class,
View Full Code Here

    }
    if (o instanceof OrganizationEnabled) {
      final OrganizationEnabled oe = (OrganizationEnabled) o;
      // reread the client and organization
      if (oe.getOrganization() == null) {
        final Organization org = SessionHandler.getInstance().find(Organization.class,
            obContext.getCurrentOrganization().getId());
        oe.setOrganization(org);
      }
    }
  }
View Full Code Here

    // TODO: add warning if the entity is created in a different
    // client/organization than the inputted ones
    // Set the client and organization on the most detailed level
    // looking at the accesslevel of the entity
    Client setClient;
    Organization setOrg;
    if (entity.getAccessLevel() == AccessLevel.SYSTEM) {
      setClient = clientZero;
      setOrg = organizationZero;
    } else if (entity.getAccessLevel() == AccessLevel.SYSTEM_CLIENT) {
      setClient = client;
View Full Code Here

    strSummary.append(SALTO_LINEA).append(
        Utility.messageBD(this, "CreateOrgSuccess", vars.getLanguage())).append(SALTO_LINEA);
    if (log4j.isDebugEnabled())
      log4j.debug("InitialOrgSetup - createOrg - m_info last: " + m_info.toString());
    // Add images
    Organization newOrganization = OBDal.getInstance().get(Organization.class, AD_Org_ID);
    Client organizationClient = OBDal.getInstance().get(Client.class, AD_Client_ID);
    if (organizationClient.getClientInformationList().get(0).getYourCompanyDocumentImage() != null) {
      Image yourCompanyDocumentImage = OBProvider.getInstance().get(Image.class);
      yourCompanyDocumentImage.setClient(organizationClient);
      yourCompanyDocumentImage.setOrganization(newOrganization);
      yourCompanyDocumentImage.setBindaryData(organizationClient.getClientInformationList().get(0)
          .getYourCompanyDocumentImage().getBindaryData());
      yourCompanyDocumentImage.setName(organizationClient.getClientInformationList().get(0)
          .getYourCompanyDocumentImage().getName());
      newOrganization.getOrganizationInformationList().get(0).setYourCompanyDocumentImage(
          yourCompanyDocumentImage);
      yourCompanyDocumentImage.setOrganization(newOrganization);
      OBDal.getInstance().save(yourCompanyDocumentImage);
    }
    OBDal.getInstance().save(newOrganization);
View Full Code Here

TOP

Related Classes of org.openbravo.model.common.enterprise.Organization

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.