/**
   * Adds a structure referencing a default parent structure, using the portal property <code>
   * dynamic.data.lists.storage.type</code> storage type and default structure type.
   *
   * @param userId the primary key of the structure's creator/owner
   * @param groupId the primary key of the group
   * @param classNameId the primary key of the class name for the structure's related model
   * @param nameMap the structure's locales and localized names
   * @param descriptionMap the structure's locales and localized descriptions
   * @param xsd the structure's XML schema definition
   * @param serviceContext the structure's service context. Can set the UUID, creation date,
   *     modification date, guest permissions, and group permissions for the structure.
   * @return the structure
   * @throws PortalException if a user with the primary key could not be found, if the user did not
   *     have permission to add the structure, if the XSD was not well-formed, or if a portal
   *     exception occurred
   * @throws SystemException if a system exception occurred
   */
  public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap addStructure(
      long userId,
      long groupId,
      long classNameId,
      java.lang.String[] nameMapLanguageIds,
      java.lang.String[] nameMapValues,
      java.lang.String[] descriptionMapLanguageIds,
      java.lang.String[] descriptionMapValues,
      java.lang.String xsd,
      com.liferay.portal.service.ServiceContext serviceContext)
      throws RemoteException {
    try {
      Map<Locale, String> nameMap =
          LocalizationUtil.getLocalizationMap(nameMapLanguageIds, nameMapValues);
      Map<Locale, String> descriptionMap =
          LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds, descriptionMapValues);

      com.liferay.portlet.dynamicdatamapping.model.DDMStructure returnValue =
          DDMStructureServiceUtil.addStructure(
              userId, groupId, classNameId, nameMap, descriptionMap, xsd, serviceContext);

      return com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  /**
   * Updates the structure matching the structure ID, replacing the old parent structure ID, name
   * map, description map, and XSD with the new values.
   *
   * @param structureId the primary key of the structure
   * @param parentStructureId the new parent structure primary key
   * @param nameMap the structure's new locales and localized names
   * @param descriptionMap the structure's new locales and localized description
   * @param definition the new XML schema definition of the structure
   * @param serviceContext the service context to be applied. Can set the modification date.
   * @return the updated structure
   * @throws PortalException if the user did not have permission to update the structure or if a
   *     portal exception occurred
   * @deprecated As of 7.0.0, replaced by {@link #updateStructure(long, long, Map, Map, DDMForm,
   *     DDMFormLayout, ServiceContext)}
   */
  @Deprecated
  public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap updateStructure(
      long structureId,
      long parentStructureId,
      java.lang.String[] nameMapLanguageIds,
      java.lang.String[] nameMapValues,
      java.lang.String[] descriptionMapLanguageIds,
      java.lang.String[] descriptionMapValues,
      java.lang.String definition,
      com.liferay.portal.service.ServiceContext serviceContext)
      throws RemoteException {
    try {
      Map<Locale, String> nameMap =
          LocalizationUtil.getLocalizationMap(nameMapLanguageIds, nameMapValues);
      Map<Locale, String> descriptionMap =
          LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds, descriptionMapValues);

      com.liferay.portlet.dynamicdatamapping.model.DDMStructure returnValue =
          DDMStructureServiceUtil.updateStructure(
              structureId, parentStructureId, nameMap, descriptionMap, definition, serviceContext);

      return com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  /**
   * Returns the structure matching the class name ID, structure key, and group.
   *
   * @param groupId the primary key of the structure's group
   * @param classNameId the primary key of the class name for the structure's related model
   * @param structureKey the unique string identifying the structure
   * @return the matching structure
   * @throws PortalException if the user did not have permission to view the structure or if a
   *     matching structure could not be found
   */
  public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap getStructure(
      long groupId, long classNameId, java.lang.String structureKey) throws RemoteException {
    try {
      com.liferay.portlet.dynamicdatamapping.model.DDMStructure returnValue =
          DDMStructureServiceUtil.getStructure(groupId, classNameId, structureKey);

      return com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap[] getStructures(
      long[] groupIds, long classNameId, int start, int end) throws RemoteException {
    try {
      java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> returnValue =
          DDMStructureServiceUtil.getStructures(groupIds, classNameId, start, end);

      return com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap.toSoapModels(
          returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap copyStructure(
      long structureId, com.liferay.portal.service.ServiceContext serviceContext)
      throws RemoteException {
    try {
      com.liferay.portlet.dynamicdatamapping.model.DDMStructure returnValue =
          DDMStructureServiceUtil.copyStructure(structureId, serviceContext);

      return com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap.toSoapModel(returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap[]
      getJournalFolderStructures(long[] groupIds, long journalFolderId, int restrictionType)
          throws RemoteException {
    try {
      java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> returnValue =
          DDMStructureServiceUtil.getJournalFolderStructures(
              groupIds, journalFolderId, restrictionType);

      return com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap.toSoapModels(
          returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  /**
   * Returns an ordered range of all the structures matching the groups and class name IDs, and
   * matching the keywords in the structure names and descriptions.
   *
   * <p>Useful when paginating results. Returns a maximum of <code>end -
   * start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are
   * indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting
   * both <code>start</code> and <code>end</code> to {@link
   * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
   *
   * @param companyId the primary key of the structure's company
   * @param groupIds the primary keys of the groups
   * @param classNameIds the primary keys of the class names of the models the structures are
   *     related to
   * @param keywords the keywords (space separated), which may occur in the structure's name or
   *     description (optionally <code>null</code>)
   * @param start the lower bound of the range of structures to return
   * @param end the upper bound of the range of structures to return (not inclusive)
   * @param orderByComparator the comparator to order the structures (optionally <code>null</code>)
   * @return the range of matching structures ordered by the comparator
   * @throws SystemException if a system exception occurred
   */
  public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap[] search(
      long companyId,
      long[] groupIds,
      long[] classNameIds,
      java.lang.String keywords,
      int start,
      int end,
      com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
      throws RemoteException {
    try {
      java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> returnValue =
          DDMStructureServiceUtil.search(
              companyId, groupIds, classNameIds, keywords, start, end, orderByComparator);

      return com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap.toSoapModels(
          returnValue);
    } catch (Exception e) {
      _log.error(e, e);

      throw new RemoteException(e.getMessage());
    }
  }
  /**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static DDMStructure toModel(DDMStructureSoap soapModel) {
    DDMStructure model = new DDMStructureImpl();

    model.setUuid(soapModel.getUuid());
    model.setStructureId(soapModel.getStructureId());
    model.setGroupId(soapModel.getGroupId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setClassNameId(soapModel.getClassNameId());
    model.setStructureKey(soapModel.getStructureKey());
    model.setName(soapModel.getName());
    model.setDescription(soapModel.getDescription());
    model.setXsd(soapModel.getXsd());
    model.setStorageType(soapModel.getStorageType());
    model.setType(soapModel.getType());

    return model;
  }
  public static DDMStructureSoap toSoapModel(DDMStructure model) {
    DDMStructureSoap soapModel = new DDMStructureSoap();

    soapModel.setUuid(model.getUuid());
    soapModel.setStructureId(model.getStructureId());
    soapModel.setGroupId(model.getGroupId());
    soapModel.setCompanyId(model.getCompanyId());
    soapModel.setUserId(model.getUserId());
    soapModel.setUserName(model.getUserName());
    soapModel.setVersionUserId(model.getVersionUserId());
    soapModel.setVersionUserName(model.getVersionUserName());
    soapModel.setCreateDate(model.getCreateDate());
    soapModel.setModifiedDate(model.getModifiedDate());
    soapModel.setParentStructureId(model.getParentStructureId());
    soapModel.setClassNameId(model.getClassNameId());
    soapModel.setStructureKey(model.getStructureKey());
    soapModel.setVersion(model.getVersion());
    soapModel.setName(model.getName());
    soapModel.setDescription(model.getDescription());
    soapModel.setDefinition(model.getDefinition());
    soapModel.setStorageType(model.getStorageType());
    soapModel.setType(model.getType());
    soapModel.setLastPublishDate(model.getLastPublishDate());

    return soapModel;
  }