Asserts that an item, identified by it's unique id, is not found in the repository session.

@param session
the session to be searched
@param itemId
the item expected not to be found
@throws RepositoryException
185378
public static void assertNodeNotExistById(final Session session, final String itemId) throws RepositoryException {
        try {
            session.getNodeByIdentifier(itemId);
            fail("ItemNotFoundException expected");
        } catch (final ItemNotFoundException e) { // NOSONAR
            // this was expected
        }
    }
572472
public void setRepositoriesNotFound(java.util.Collection<String> repositoriesNotFound) {
        if (repositoriesNotFound == null) {
            this.repositoriesNotFound = null;
            return;
        }

        this.repositoriesNotFound = new java.util.ArrayList<String>(repositoriesNotFound);
    }
923532
protected boolean checkValid() throws InvalidItemStateException
   {
      try
      {
         session.checkLive();
      }
      catch (RepositoryException e)
      {
         throw new InvalidItemStateException("This kind of operation is forbidden after a session.logout().", e);
      }

      if (data == null)
      {
         throw new InvalidItemStateException("Invalid item state. Item was removed or discarded.");
      }

      session.updateLastAccessTime();
      return true;
   }
689167
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
      throws RemoteException {
    LineItemServiceInterface lineItemService =
        adManagerServices.get(session, LineItemServiceInterface.class);

    // Create a statement to select line items.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("isMissingCreatives = :isMissingCreatives")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("isMissingCreatives", true);

    // Retrieve a small amount of line items at a time, paging through
    // until all line items have been retrieved.
    int totalResultSetSize = 0;
    do {
      LineItemPage page =
          lineItemService.getLineItemsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        // Print out some information for each line item.
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (LineItem lineItem : page.getResults()) {
          System.out.printf(
              "%d) Line item with ID %d and name '%s' was found.%n",
              i++,
              lineItem.getId(),
              lineItem.getName()
          );
        }
      }

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);

    System.out.printf("Number of results found: %d%n", totalResultSetSize);
  }
112455
@Override
    public Identifiable checkId(Identifiable item) {
        if (item.getIdentifier() == -1) {
            item.withIdentifier(nextId(item));
        }
        return item;
    }
665962
public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
        Collection<String> items = new ArrayList<>(1);
        items.add(itemId);
        deleteItem(items);
    }
1118573
public void put(T item, String itemId) throws Exception
    {
        put(item, itemId, 0, null);
    }
1034803
@Programmatic
    public SessionLogEntry findBySessionId(final String sessionId) {
        return repositoryService.firstMatch(
                new QueryDefault<>(SessionLogEntry.class,
                        "findBySessionId",
                        "sessionId", sessionId));
    }
370815
public ArtifactResult resolveArtifact(final RepositorySystemSession session, final ArtifactRequest request)
            throws ArtifactResolutionException {
        return system.resolveArtifact(session, request);
    }
479112
protected void checkIntegrity(WorkspaceEntry wsConfig, RepositoryEntry repConfig)
      throws RepositoryConfigurationException
   {
      DatabaseStructureType dbType = DBInitializerHelper.getDatabaseType(wsConfig);

      for (WorkspaceEntry wsEntry : repConfig.getWorkspaceEntries())
      {
         if (wsEntry.getName().equals(wsConfig.getName())
            || !wsEntry.getContainer().getType().equals(wsConfig.getContainer().getType())
            || !wsEntry.getContainer().getType().equals(this.getClass().getName()))
         {
            continue;
         }

         if (!DBInitializerHelper.getDatabaseType(wsEntry).equals(dbType))
         {
            throw new RepositoryConfigurationException("All workspaces must be of same DB type. But "
               + wsEntry.getName() + "=" + DBInitializerHelper.getDatabaseType(wsEntry) + " and " + wsConfig.getName()
               + "=" + dbType);
         }

         // source name
         String wsSourceName = null;
         String newWsSourceName = null;
         try
         {
            wsSourceName = wsEntry.getContainer().getParameterValue("sourceName");
            newWsSourceName = wsConfig.getContainer().getParameterValue("sourceName");
         }
         catch (RepositoryConfigurationException e)
         {
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }

         if (wsSourceName != null && newWsSourceName != null)
         {
            if (dbType.isShareSameDatasource())
            {
               if (!wsSourceName.equals(newWsSourceName))
               {
                  throw new RepositoryConfigurationException("SourceName must be equals in " + dbType
                     + "-database repository." + " Check " + wsEntry.getName() + " and " + wsConfig.getName());
               }
            }
            else
            {
               if (wsSourceName.equals(newWsSourceName))
               {
                  throw new RepositoryConfigurationException("SourceName " + wsSourceName + " already in use in "
                     + wsEntry.getName() + ". SourceName must be different in " + dbType
                     + "-database structure type. Check configuration for " + wsConfig.getName());
               }
            }

            continue;
         }
      }
   }
389665
public final void setSession( AbstractSession session ) throws JMSException
    {
        if (session == null)
            this.sessionRef = null;
        else
        {
        	// Consistency check
        	if (sessionRef != null && sessionRef.get() != session)
        		throw new FFMQException("Message session already set","CONSISTENCY");
        		
            this.sessionRef = new WeakReference<>(session);
        }
    }
455959
public Boolean persist(final String id, final Map<String, Object> snapshot, final int maxInactiveInterval) {
        final String sid = sessionPrefix + ":" + id;
        try {
            this.executor.execute(new RedisCallback<Void>() {
                public Void execute(Jedis jedis) {
                    if (snapshot.isEmpty()) {
                        // delete session
                        jedis.del(sid);
                    } else {
                        // set session
                        jedis.setex(sid, maxInactiveInterval, serializer.serialize(snapshot));
                    }
                    return null;
                }
            });
            return Boolean.TRUE;
        } catch (Exception e) {
            log.error("failed to persist session(id={}, snapshot={}), cause:{}",
                    sid, snapshot, Throwables.getStackTraceAsString(e));
            return Boolean.FALSE;
        }
    }
730904
private static void verifyId(final EntityMetadata entityMetadata) {
        if (!entityMetadata.hasIdProperty()) {
            throw new RepositoryMappingException("No field annotated with @Id present.");
        }

        if (entityMetadata.idProperty().type() != String.class) {
            throw new RepositoryMappingException("The @Id Field needs to be of type String.");
        }
    }
1084304
public static void assertNodeTypeExists(final Session session, final String nodeTypeName)
            throws RepositoryException {

        final NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
        assertTrue("NodeType " + nodeTypeName + " does not exist", ntm.hasNodeType(nodeTypeName));
    }
1272767
protected void updateRepositoryBase(RepositoryBase value, String xmlTag, Counter counter, Element element)
   {
      boolean shouldExist = value != null;
      Element root = updateElement(counter, element, xmlTag, shouldExist);
      if (shouldExist)
      {
         Counter innerCount = new Counter(counter.getDepth() + 1);
         findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), null);
         findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null);
         findAndReplaceSimpleElement(innerCount, root, "url", value.getUrl(), null);
         findAndReplaceSimpleElement(innerCount, root, "layout", value.getLayout(), "default");
      }
   }
978604
public void set(String propName, Object value) {
        if (propName.equals("repositoryId")) {
            setRepositoryId(((String) value));
        }
        if (propName.equals("repositoryCheckPoint")) {
            setRepositoryCheckPoint(((String) value));
        }
    }
118550
public void complete(Session session) {
        try {
            session.complete();
            sessionCache.put(session.getId(), session);
        } catch (Exception e) {
            log.warn("Session failed to complete", e);
        }
    }