Package ru.bgcrm.dao

Class CommonLinkDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
ru.bgcrm.dao.CommonLinkDAO
Direct Known Subclasses:
CustomerLinkDAO, ProcessLinkDAO

public abstract class CommonLinkDAO extends CommonDAO
  • Constructor Details

    • CommonLinkDAO

      protected CommonLinkDAO(Connection con)
  • Method Details

    • getLinkDAO

      public static CommonLinkDAO getLinkDAO(String objectType, Connection con) throws BGException
      Throws:
      BGException
    • getObjectLinksWithType

      public List<CommonObjectLink> getObjectLinksWithType(int objectId, String typeLike) throws BGException
      Возвращает список привязанных к объекту сущностей.
      Parameters:
      objectId - код объекта.
      typeLike - MySQL Like выражение для фильтрации, необязательно.
      Returns:
      Throws:
      BGException
    • getLinkingObjectLinksWithType

      public List<CommonObjectLink> getLinkingObjectLinksWithType(int objectId, String typeLike) throws BGException
      Throws:
      BGException
    • getLinkedContracts

      public List<Contract> getLinkedContracts(int objectId) throws BGException
      Throws:
      BGException
    • getLinkedCustomer

      public Customer getLinkedCustomer(int objectID)
      Получение первого найденого Контрагента из привязок к объекту с id objectID
      Parameters:
      objectID - - id объекта у которого нужно получить привязанный КА
      Returns:
      - первый найденый привязанный Контрагент
    • getLinkedCustomers

      public List<Customer> getLinkedCustomers(int objectID)
      Получение всех прикрепленых контрагентов к объекту
      Parameters:
      objectID - - id объекта у которого нужно получить привязанные КА
      Returns:
      - список всех привязанных контрагентов
    • prepareLink

      public CommonObjectLink prepareLink(CommonObjectLink link)
    • updateLinkTitles

      public void updateLinkTitles(int linkedObjectId, String linkedObjectTypeLike, String title) throws BGException
      Throws:
      BGException
    • addLink

      public void addLink(CommonObjectLink link) throws BGException
      Привязка объекта.
      Parameters:
      link -
      Throws:
      BGException
    • addLinkIfNotExist

      public void addLinkIfNotExist(CommonObjectLink link) throws BGException
      Привязка объекта если он не привязан к данному объекту.
      Parameters:
      link -
      Throws:
      BGException
    • isLinkExists

      public boolean isLinkExists(CommonObjectLink link) throws BGException
      Проверка наличия привязки.
      Parameters:
      link -
      Returns:
      Throws:
      BGException
    • deleteLink

      public void deleteLink(CommonObjectLink link) throws BGException
      Удаляет ссылку объекта на один другой объект.
      Parameters:
      link -
      Throws:
      BGException
    • deleteObjectLinks

      public void deleteObjectLinks(int objectId) throws BGException
      Удаляет все ссылки объекта.
      Parameters:
      objectId -
      Throws:
      SQLException
      BGException
    • deleteLinksTo

      public void deleteLinksTo(CommonObjectLink link) throws BGException
      Удаляет все ссылки объектов данного типа на какой-то другой объект.
      Parameters:
      link -
      Throws:
      BGException
    • deleteLinksWithType

      public void deleteLinksWithType(CommonObjectLink link) throws BGException
      Удаляет все ссылки объектов данного типа на другие типы объектов.
      Parameters:
      link -
      Throws:
      BGException
    • copyLinks

      public void copyLinks(int objectFromId, int objectToId, String typePrefix) throws BGException
      Throws:
      BGException
    • copyLinks

      public void copyLinks(int objectFromId, int objectToId, String typePrefix, String excludeType) throws BGException
      Throws:
      BGException
    • getTable

      protected abstract String getTable()
    • getColumnName

      protected abstract String getColumnName()
    • getObjectType

      protected abstract String getObjectType()
    • addLinkAndLog

      public void addLinkAndLog(CommonObjectLink link, int userId) throws BGException
      Throws:
      BGException
    • deleteLinkAndLog

      public void deleteLinkAndLog(CommonObjectLink link, int userId) throws BGException
      Throws:
      BGException
    • getEntityLogDAO

      protected abstract EntityLogDAO getEntityLogDAO()