Retrieve all of the Memento-related link headers given a stream of VersionRange objects
@param identifier the public identifier for the resource
@param mementos a stream of memento values
@return a stream of link headers
763923
public static Stream<Link> getMementoLinks(final String identifier, final List<VersionRange> mementos) {
        return concat(getTimeMap(identifier, mementos.stream()), mementos.stream().map(mementoToLink(identifier)));
    }
177744
public String getHeadings(int i) {
    if (DataTable_Type.featOkTst && ((DataTable_Type)jcasType).casFeat_headings == null)
      jcasType.jcas.throwFeatMissing("headings", "ch.epfl.bbp.uima.types.DataTable");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DataTable_Type)jcasType).casFeatCode_headings), i);
    return jcasType.ll_cas.ll_getStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DataTable_Type)jcasType).casFeatCode_headings), i);}
1332191
public Url fromIdentifier(String identifier) {
        Matcher matcher = identifierPattern.matcher(identifier);
        if (!matcher.matches()) {
            throw new RuntimeException(String.format("Couldn't parse identifier %s", identifier));
        }

        String resourceType = matcher.group(1);
        if (resourceType != null) {
            resourceType(resourceType);
        }

        String type = matcher.group(2);
        if (type != null) {
            type(type);
        }

        String version = matcher.group(3);
        if (version != null) {
            version(version);
        }

        String publicId = matcher.group(4);
        if (publicId != null) {
            publicId(publicId);
        }

        String format = matcher.group(5);
        if (format != null) {
            format(format);
        }

        // Signature (group 6) is not used

        return this;
    }
1288684
public ResponseBuilder getTimeGateBuilder(final SortedSet<Instant> mementos, final TrellisRequest req,
            final String baseUrl) {
        final String identifier = fromUri(baseUrl).path(req.getPath()).build().toString();
        return status(FOUND)
            .location(fromUri(identifier + "?version=" + req.getDatetime().getInstant().getEpochSecond()).build())
            .link(identifier, ORIGINAL + " " + TIMEGATE)
            .links(getMementoLinks(identifier, mementos).map(this::filterLinkParams).toArray(Link[]::new))
            .header(VARY, ACCEPT_DATETIME);
    }
1222537
@SuppressWarnings("unchecked")
    public Pair<Item, Integer> getItemById(final long identifier) {
        if (identifier == -1) {
            return null;
        }
        Triple result = recursive(new AdapterPredicate() {
            @Override
            public boolean apply(@NonNull IAdapter lastParentAdapter, int lastParentPosition, @NonNull IItem item, int position) {
                return item.getIdentifier() == identifier;
            }
        }, true);
        if (result.second == null) {
            return null;
        } else {
            return new Pair(result.second, result.third);
        }
    }
640354
private HashMap<String, String> createRegistrationHeaders() {
        HashMap<String, String> headers = new HashMap<>();
        addSessionIdHeader(headers);

        return headers;
    }
319496
private static OIdentifiable linkToStream(final StringBuilder buffer, final ORecordSchemaAware<?> iParentRecord, Object iLinked) {
    if (iLinked == null)
      // NULL REFERENCE
      return null;

    OIdentifiable resultRid = null;
    ORID rid;

    final ODatabaseRecord database = ODatabaseRecordThreadLocal.INSTANCE.get();

    if (iLinked instanceof ORID) {
      // JUST THE REFERENCE
      rid = (ORID) iLinked;

      if (rid.isValid() && rid.isNew()) {
        // SAVE AT THE FLY AND STORE THE NEW RID
        final ORecord<?> record = rid.getRecord();

        if (database.getTransaction().isActive()) {
          // USE THE DEFAULT CLUSTER
          database.save((ORecordInternal<?>) record);

        } else
          database.save((ORecordInternal<?>) record);

        if (record != null)
          rid = record.getIdentity();
        resultRid = rid;
      }
    } else {
      if (iLinked instanceof String)
        iLinked = new ORecordId((String) iLinked);
      else if (!(iLinked instanceof ORecordInternal<?>)) {
        // NOT RECORD: TRY TO EXTRACT THE DOCUMENT IF ANY
        final String boundDocumentField = OObjectSerializerHelperManager.getInstance().getDocumentBoundField(iLinked.getClass());
        if (boundDocumentField != null)
          iLinked = OObjectSerializerHelperManager.getInstance().getFieldValue(iLinked, boundDocumentField);
      }

      if (!(iLinked instanceof OIdentifiable))
        throw new IllegalArgumentException("Invalid object received. Expected a OIdentifiable but received type="
            + iLinked.getClass().getName() + " and value=" + iLinked);

      // RECORD
      ORecordInternal<?> iLinkedRecord = ((OIdentifiable) iLinked).getRecord();
      rid = iLinkedRecord.getIdentity();

      if (rid.isNew() || iLinkedRecord.isDirty()) {
        if (iLinkedRecord instanceof ODocument) {
          final OClass schemaClass = ((ODocument) iLinkedRecord).getSchemaClass();
          database.save(iLinkedRecord, schemaClass != null ? database.getClusterNameById(schemaClass.getDefaultClusterId()) : null);
        } else
          // STORE THE TRAVERSED OBJECT TO KNOW THE RECORD ID. CALL THIS VERSION TO AVOID CLEAR OF STACK IN THREAD-LOCAL
          database.save(iLinkedRecord);

        final ODatabaseComplex<?> dbOwner = database.getDatabaseOwner();
        dbOwner.registerUserObjectAfterLinkSave(iLinkedRecord);

        resultRid = iLinkedRecord;
      }

      if (iParentRecord != null && database instanceof ODatabaseRecord) {
        final ODatabaseRecord db = database;
        if (!db.isRetainRecords())
          // REPLACE CURRENT RECORD WITH ITS ID: THIS SAVES A LOT OF MEMORY
          resultRid = iLinkedRecord.getIdentity();
      }
    }

    if (rid.isValid())
      rid.toString(buffer);

    return resultRid;
  }
446976
protected List<PropertyData> getReferencedPropertiesData(final String identifier) throws RepositoryException
   {
      List<PropertyData> refProps = null;
      if (cache.isEnabled())
      {
         refProps = cache.getReferencedProperties(identifier);
         if (refProps != null)
         {
            return refProps;
         }
      }
      final DataRequest request = new DataRequest(identifier, DataRequest.GET_REFERENCES);

      try
      {
         request.start();
         if (cache.isEnabled())
         {
            // Try first to get the value from the cache since a
            // request could have been launched just before
            refProps = cache.getReferencedProperties(identifier);
            if (refProps != null)
            {
               return refProps;
            }
         }
         return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
         {
            public List<PropertyData> run() throws RepositoryException
            {
               List<PropertyData> refProps = CacheableWorkspaceDataManager.super.getReferencesData(identifier, false);
               if (cache.isEnabled())
               {
                  cache.addReferencedProperties(identifier, refProps);
               }
               return refProps;
            }
         });
      }
      finally
      {
         request.done();
      }
   }
1180061
public IDrawerItem getDrawerItem(long identifier) {
        Pair<IDrawerItem, Integer> res = getAdapter().getItemById(identifier);
        if (res != null) {
            return res.first;
        } else {
            return null;
        }
    }
630996
public static List<Link> getLinks(final AnnotatedElement annotatedElement) {
        final List<Link> result = new ArrayList<>();
        result.addAll(extractLinks(annotatedElement, io.qameta.allure.Link.class, ResultsUtils::createLink));
        result.addAll(extractLinks(annotatedElement, io.qameta.allure.Issue.class, ResultsUtils::createLink));
        result.addAll(extractLinks(annotatedElement, io.qameta.allure.TmsLink.class, ResultsUtils::createLink));
        return result;
    }
796324
@SuppressWarnings("unchecked")
	public ListIterator<Address> getAddressHeaders(String name)
			throws ServletParseException {
		if(logger.isDebugEnabled()) {
			logger.debug("getAddressHeaders - name=" + name);
		}

		String hName = getFullHeaderName(name);

		// Fix from Thomas Leseney from Nexcom systems
//		if (!isAddressTypeHeader(hName)) {
//			throw new ServletParseException(
//					"Header [" + hName + "] is not address type header");
//		}
		LinkedList<Address> retval = new LinkedList<Address>();
		String nameToSearch = getCorrectHeaderName(hName);

		for (Iterator<Header> it = this.message.getHeaders(nameToSearch); it
				.hasNext();) {
			Header header = (Header) it.next();
			if (header instanceof HeaderAddress) {
				HeaderAddress aph = (HeaderAddress) header;
				try {
					AddressImpl addressImpl = new AddressImpl(
							aph, getModifiableRule(hName));
					retval.add(addressImpl);
				} catch (ParseException ex) {
					throw new ServletParseException("Bad header", ex);
				}
			}  else {
				Parameterable parametrable = createParameterable(header, header.getName(), message instanceof Request);
				try {
					AddressImpl addressImpl = new AddressImpl(SipFactoryImpl.addressFactory.createAddress(parametrable.getValue()), ((ParameterableHeaderImpl)parametrable).getInternalParameters(), getModifiableRule(hName));
					retval.add(addressImpl);
				} catch (ParseException e) {
					throw new ServletParseException("Impossible to parse the following header " + name + " as an address.", e);
				}
			}
		}
		return retval.listIterator();
	}
348825
public ResponseBuilder getTimeMapBuilder(final SortedSet<Instant> mementos, final TrellisRequest req,
            final String baseUrl) {

        final List<MediaType> acceptableTypes = req.getAcceptableMediaTypes();
        final String identifier = fromUri(baseUrl).path(req.getPath()).build().toString();
        final List<Link> links = getMementoLinks(identifier, mementos).collect(toList());

        final ResponseBuilder builder = ok().link(identifier, ORIGINAL + " " + TIMEGATE);
        builder.links(links.stream().map(this::filterLinkParams).toArray(Link[]::new))
            .link(Resource.getIRIString(), TYPE).link(RDFSource.getIRIString(), TYPE)
            .header(ALLOW, join(",", GET, HEAD, OPTIONS));

        final RDFSyntax syntax = getSyntax(trellis.getIOService(), acceptableTypes, APPLICATION_LINK_FORMAT);

        if (syntax != null) {
            final IRI profile = getProfile(acceptableTypes, syntax);
            final IRI jsonldProfile = profile != null ? profile : compacted;

            final StreamingOutput stream = new StreamingOutput() {
                @Override
                public void write(final OutputStream out) throws IOException {
                    trellis.getIOService().write(timemap.asRdf(identifier, links), out, syntax, jsonldProfile);
                }
            };

            return builder.type(syntax.mediaType()).entity(stream);
        }

        return builder.type(APPLICATION_LINK_FORMAT)
            .entity(links.stream().map(this::filterLinkParams).map(Link::toString).collect(joining(",\n")) + "\n");
    }
1266002
public <T extends Memory> T getNodeMemory(MemoryFactory<T> node) {
        return nodeMemories.getNodeMemory( node, this );
    }
604253
@Override
    public com.ibm.websphere.cache.CacheEntry getEntryFromMemory(Object id) {
        final String methodName = "getEntryFromMemory()";
        com.ibm.websphere.cache.CacheEntry ce = this.coreCache.get(id);
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " cacheEntry=" + ce);
        }
        return ce;
    }
925175
public static void addMementoDatetimeHeader(HttpServletResponse response,
			CaptureSearchResult result) {
		response.setHeader(MEMENTO_DATETIME, formatLinkDate(result.getCaptureDate()));
	}
920110
public FullTextLink getFullTextLinks(int i) {
    if (FullTextLinkList_Type.featOkTst && ((FullTextLinkList_Type)jcasType).casFeat_fullTextLinks == null)
      jcasType.jcas.throwFeatMissing("fullTextLinks", "de.julielab.jules.types.FullTextLinkList");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i);
    return (FullTextLink)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i)));}
211396
protected function addExistingNodeVariantInformationToResponse($identifier, ContentContext $context)
    {
        $nodeVariants = $context->getNodeVariantsByIdentifier($identifier);
        if (count($nodeVariants) > 0) {
            $this->response->setHeader('X-Neos-Node-Exists-In-Other-Dimensions', true);

            // If the node exists in another dimension, we want to know how many nodes in the rootline are also missing for the target
            // dimension. This is needed in the UI to tell the user if nodes will be materialized recursively upwards in the rootline.
            // To find the node path for the given identifier, we just use the first result. This is a safe assumption at least for
            // "Document" nodes (aggregate=true), because they are always moved in-sync.
            $node = reset($nodeVariants);
            /** @var NodeInterface $node */
            if ($node->getNodeType()->isAggregate()) {
                $pathSegmentsToSites = NodePaths::getPathDepth(SiteService::SITES_ROOT_PATH);
                $pathSegmentsToNodeVariant = NodePaths::getPathDepth($node->getPath());
                // Segments between the sites root "/sites" and the node variant (minimum 1)
                $pathSegments = $pathSegmentsToNodeVariant - $pathSegmentsToSites;
                // Nodes between (and including) the site root node and the node variant (minimum 1)
                $siteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $context->getCurrentSite()->getNodeName());
                $nodes = $context->getNodesOnPath($siteNodePath, $node->getPath());
                $missingNodesOnRootline = $pathSegments - count($nodes);
                if ($missingNodesOnRootline > 0) {
                    $this->response->setHeader('X-Neos-Nodes-Missing-On-Rootline', $missingNodesOnRootline);
                }
            }
        }
    }