Package org.openbravo.model.ad.system

Examples of org.openbravo.model.ad.system.Client


      if (log4j.isDebugEnabled())
        log4j.debug("InitialClientSetup - createClient - CLIENT INFO CREATED");
      if (log4j.isDebugEnabled())
        log4j.debug("InitialClientSetup - createClient - m_info: " + m_info.toString());
      // Add images
      Client newClient = OBDal.getInstance().get(Client.class, AD_Client_ID);
      SystemInformation sys = OBDal.getInstance().get(SystemInformation.class, "0");
      if (sys.getYourCompanyBigImage() != null) {
        Image yourCompanyBigImage = OBProvider.getInstance().get(Image.class);
        yourCompanyBigImage.setClient(newClient);
        yourCompanyBigImage.setBindaryData(sys.getYourCompanyBigImage().getBindaryData());
        yourCompanyBigImage.setName(sys.getYourCompanyBigImage().getName());
        newClient.getClientInformationList().get(0).setYourCompanyBigImage(yourCompanyBigImage);
        OBDal.getInstance().save(yourCompanyBigImage);
      }

      if (sys.getYourCompanyDocumentImage() != null) {
        Image yourCompanyDocumentImage = OBProvider.getInstance().get(Image.class);
        yourCompanyDocumentImage.setClient(newClient);
        yourCompanyDocumentImage.setBindaryData(sys.getYourCompanyDocumentImage().getBindaryData());
        yourCompanyDocumentImage.setName(sys.getYourCompanyBigImage().getName());
        newClient.getClientInformationList().get(0).setYourCompanyDocumentImage(
            yourCompanyDocumentImage);
        OBDal.getInstance().save(yourCompanyDocumentImage);
      }

      if (sys.getYourCompanyMenuImage() != null) {
        Image yourCompanyMenuImage = OBProvider.getInstance().get(Image.class);
        yourCompanyMenuImage.setClient(newClient);
        yourCompanyMenuImage.setBindaryData(sys.getYourCompanyMenuImage().getBindaryData());
        yourCompanyMenuImage.setName(sys.getYourCompanyMenuImage().getName());
        newClient.getClientInformationList().get(0).setYourCompanyMenuImage(yourCompanyMenuImage);
        OBDal.getInstance().save(yourCompanyMenuImage);
      }

      OBDal.getInstance().save(newClient);
      OBDal.getInstance().flush();
View Full Code Here


  private void replaceName(String originalName, BaseOBObject bob) {
    if (newName == null || newName.trim().length() == 0) {
      return;
    }
    if (bob instanceof Client) {
      final Client client = (Client) bob;
      client.setName(newName);
      client.setDescription(newName);
      client.setSearchKey(newName);
    } else if (bob instanceof Role) {
      final Role role = (Role) bob;
      if (role.getName().indexOf(originalName) == -1) {
        role.setName(getNewName() + "_" + role.getName());
      } else {
View Full Code Here

      // write the xml to a file in WEB-INF
      log.debug("Writing export file " + exportFile.getAbsolutePath());
      DataExportService.getInstance().exportClientToXML(params, exportAuditInfo, fw);
      fw.close();

      final Client client = OBDal.getInstance().get(Client.class, clientId);

      final OBError msg = new OBError();
      msg.setType("Success");
      msg.setMessage("Client " + client.getName() + " has been exported to "
          + exportFile.getAbsolutePath());
      msg.setTitle("Done");
      bundle.setResult(msg);

    } catch (final Exception e) {
View Full Code Here

              writableOrgs.iterator().next()));
        }
      }

      if (localClientId != null) {
        final Client c = getOne(Client.class, "select r from " + Client.class.getName()
            + " r where " + " r." + Client.PROPERTY_ID + "='" + localClientId + "'");
        setCurrentClient(c);
      } else if (getUser().getDefaultClient() != null && getUser().getDefaultClient().isActive()) {
        setCurrentClient(getUser().getDefaultClient());
      } else {
View Full Code Here

    final User currentUser = obContext.getUser();
    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());
View Full Code Here

    // defined in the database which means that certain fields are conditionally mandatory.

    final boolean prevMode = OBContext.getOBContext().setInAdministratorMode(true);
    try {
      TriggerHandler.getInstance().disable();
      final Client client = OBDal.getInstance().get(Client.class, clientId);
      for (Entity e : ModelProvider.getInstance().getModel()) {
        if (!e.isClientEnabled()) {
          continue;
        }
        nullifyManyToOnes(e, client);
View Full Code Here

        throw new OBException("No dataset found with name " + CLIENT_DATA_SET_NAME);
      }
      dataSet = obc.list().get(0);

      // read the client
      final Client client = OBDal.getInstance().get(Client.class,
          parameters.get(CLIENT_ID_PARAMETER_NAME));

      // the export part may not be run as superuser
      log.debug("Exporting dataset " + dataSet.getName());
      final EntityXMLConverter exc = EntityXMLConverter.newInstance();
View Full Code Here

    final OBContext obContext = OBContext.getOBContext();
    if (o instanceof ClientEnabled) {
      final ClientEnabled ce = (ClientEnabled) o;
      // reread the client
      if (ce.getClient() == null) {
        final Client client = SessionHandler.getInstance().find(Client.class,
            obContext.getCurrentClient().getId());
        ce.setClient(client);
      }
    }
    if (o instanceof OrganizationEnabled) {
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) {
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of org.openbravo.model.ad.system.Client

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.