Generate a URL for a file in an archive without requesting it.

        @param entity_id The ID of the entity to look up.
        @param filename The name of the file in the archive.
        @param channel Optional channel name.
332310
def file_url(self, entity_id, filename, channel=None):
        '''
        '''
        url = '{}/{}/archive/{}'.format(self.url, _get_path(entity_id),
                                        filename)
        return _add_channel(url, channel)
177204
@SuppressWarnings("unchecked")
    public String generateDocumentId(String databaseName, Object entity) {
        Class<?> clazz = entity.getClass();

        for (Tuple<Class, BiFunction<String, Object, String>> listOfRegisteredIdConvention : _listOfRegisteredIdConventions) {
            if (listOfRegisteredIdConvention.first.isAssignableFrom(clazz)) {
                return listOfRegisteredIdConvention.second.apply(databaseName, entity);
            }
        }

        return _documentIdGenerator.apply(databaseName, entity);
    }
295880
public void setEntityId(String v) {
    if (DictTerm_Type.featOkTst && ((DictTerm_Type)jcasType).casFeat_entityId == null)
      jcasType.jcas.throwFeatMissing("entityId", "ch.epfl.bbp.uima.types.DictTerm");
    jcasType.ll_cas.ll_setStringValue(addr, ((DictTerm_Type)jcasType).casFeatCode_entityId, v);}
311026
public static FileChannel newFileChannel(Closeable ioObject, FileDescriptor fd, int mode) {
      ChannelFactory factory = ChannelFactory.INSTANCE;
      if (factory == null) {
        throw new LibraryNotLinkedError("Channel support", "jre_channels",
            "JavaNioChannelFactoryImpl");
      }
      return factory.newFileChannel(ioObject, fd, mode);
    }
105003
private String generateLongUrlWithParams(String baseUrl) {
        String longUrl = baseUrl;
        try {
            if (Branch.getInstance().isTrackingDisabled() && !longUrl.contains(DEF_BASE_URL)) {
                // By def the base url contains identity id as query param. This should be removed when tracking is disabled.
                longUrl = longUrl.replace(new URL(longUrl).getQuery(), "");
            }
            longUrl += longUrl.contains("?") ? "" : "?";
            longUrl += longUrl.endsWith("?") ? "" : "&";

            Collection<String> tags = linkPost_.getTags();
            if (tags != null) {
                for (String tag : tags) {
                    if (tag != null && tag.length() > 0)
                        longUrl = longUrl + Defines.LinkParam.Tags + "=" + URLEncoder.encode(tag, "UTF8") + "&";
                }
            }
            String alias = linkPost_.getAlias();
            if (alias != null && alias.length() > 0) {
                longUrl = longUrl + Defines.LinkParam.Alias + "=" + URLEncoder.encode(alias, "UTF8") + "&";
            }

            String channel = linkPost_.getChannel();
            if (channel != null && channel.length() > 0) {
                longUrl = longUrl + Defines.LinkParam.Channel + "=" + URLEncoder.encode(channel, "UTF8") + "&";
            }

            String feature = linkPost_.getFeature();
            if (feature != null && feature.length() > 0) {
                longUrl = longUrl + Defines.LinkParam.Feature + "=" + URLEncoder.encode(feature, "UTF8") + "&";
            }

            String stage = linkPost_.getStage();
            if (stage != null && stage.length() > 0) {
                longUrl = longUrl + Defines.LinkParam.Stage + "=" + URLEncoder.encode(stage, "UTF8") + "&";
            }

            String campaign = linkPost_.getCampaign();
            if (campaign != null && campaign.length() > 0) {
                longUrl = longUrl + Defines.LinkParam.Campaign + "=" + URLEncoder.encode(campaign, "UTF8") + "&";
            }

            long type = linkPost_.getType();
            longUrl = longUrl + Defines.LinkParam.Type + "=" + type + "&";

            long duration = linkPost_.getDuration();
            longUrl = longUrl + Defines.LinkParam.Duration + "=" + duration;

            String params = linkPost_.getParams().toString();
            if (params != null && params.length() > 0) {
                byte[] data = params.getBytes();
                String base64Data = Base64.encodeToString(data, android.util.Base64.NO_WRAP);
                String urlEncodedBase64Data = URLEncoder.encode(base64Data, "UTF8");
                longUrl = longUrl + "&source=android&data=" + urlEncodedBase64Data;
            }
        } catch (Exception ignore) {
            callback_.onLinkCreate(null, new BranchError("Trouble creating a URL.", BranchError.ERR_BRANCH_INVALID_REQUEST));
        }

        return longUrl;
    }
1004314
public String retrieve(String entityID, String propertyID) throws Exception {
		
		// first step
		String wikiDataReq = "https://www.wikidata.org/w/api.php?action=wbgetclaims&entity=" + entityID + "&property=" + propertyID + "&format=json";
		
		// (2) request for getting the image name
		String imageName = processWikidataRequest(wikiDataReq, entityID, propertyID);
		
		// TODO
		// encode imageName (blank spaces)
		String encodedImageName = _encode (imageName);
		
	
		// (3) Wikimedia 
		String wikimediaReq = "https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&iiprop=url&titles=File:" + encodedImageName + "&format=json";
		
		// (4) get URL
		return getImageURLFromWikimedia(wikimediaReq);
		
	}
760592
@Process(actionType = AddJdbcRepository.class)
    public void addJdbcRepository(final AddJdbcRepository action, final Channel channel) {
        operationDelegate.onCreateResource(JDBC_REPOSITORY_ADDRESS,
                action.getProperty().getName(), action.getProperty().getValue(),
                new ChannelCallback(statementContext, channel));
    }
438853
def create_entity(file, io = nil, properties = {})
      params = { deviceid: @device_id, serviceid: @service_id, filename: file.name, type: file.type }.merge(properties)
      params[:parentid] = file.parent_id unless file.parent_id.nil?

      if params[:properties]
        params[:properties] = params[:properties].to_json
      end

      file_handle = unless file.id
        response = get('/createFile', params)
        File.from_json(response.body['file'])
      else
        file
      end

      if io
        HttpHelper.send_file(files_url, @token, @device_id, @service_id, file_handle, io, @logger)
        file_handle.size = io.size
      end

      file_handle
    end
1083969
public function channel($channel_id, $source_factory = null, $emitter_factory = null)
    {
        if (isset($this->channel_list[$channel_id])){
            return $this->channel_list[$channel_id];
        }

        $source = null;
        if ($source_factory){
            if (is_callable($source_factory)){
                $source = call_user_func($source_factory);
            }
            else if ($source_factory instanceof EventSourceFactoryInterface){
                $source = $source_factory->createEventSource();
            }
        }

        $emitter = null;
        if ($emitter_factory){
            if (is_callable($emitter_factory)){
                $emitter = call_user_func($emitter_factory);
            }
            else if ($emitter_factory instanceof EventSourceFactoryInterface){
                $emitter = $emitter_factory->createEventEmitter();
            }
        }

        $channel = new EventChannel($source, $emitter);
        $this->channel_list[$channel_id] = $channel;

        return $channel;
    }
54941
public String getFileThumbnailUrl(final String fileId) {
		FileWidgetUpload file = getFile(fileId);
		if (file == null) {
			return null;
		}

		// Check static resource
		Image thumbnail = file.getThumbnail();
		if (thumbnail instanceof InternalResource) {
			return ((InternalResource) thumbnail).getTargetUrl();
		}

		Environment env = getEnvironment();
		Map<String, String> parameters = env.getHiddenParameters();
		parameters.put(Environment.TARGET_ID, getTargetId());

		if (Util.empty(file.getThumbnailCacheKey())) {
			// Add some randomness to the URL to prevent caching
			String random = WebUtilities.generateRandom();
			parameters.put(Environment.UNIQUE_RANDOM_PARAM, random);
		} else {
			// Remove step counter as not required for cached content
			parameters.remove(Environment.STEP_VARIABLE);
			parameters.remove(Environment.SESSION_TOKEN_VARIABLE);
			// Add the cache key
			parameters.put(Environment.CONTENT_CACHE_KEY, file.getThumbnailCacheKey());
		}

		// File id
		parameters.put(FILE_UPLOAD_ID_KEY, fileId);

		// Thumbnail flag
		parameters.put(FILE_UPLOAD_THUMB_NAIL_KEY, "Y");

		// The targetable path needs to be configured for the portal environment.
		String url = env.getWServletPath();

		// Note the last parameter. In javascript we don't want to encode "&".
		return WebUtilities.getPath(url, parameters, true);
	}
908933
protected void populateChannel(final Channel channel, final Element eChannel) {
        final String title = channel.getTitle();
        if (title != null) {
            eChannel.addContent(generateSimpleElement("title", title));
        }
        final String link = channel.getLink();
        if (link != null) {
            eChannel.addContent(generateSimpleElement("link", link));
        }
        final String description = channel.getDescription();
        if (description != null) {
            eChannel.addContent(generateSimpleElement("description", description));
        }
    }
1134742
def entity_readme_url(self, entity_id, channel=None):
        '''
        '''
        url = '{}/{}/readme'.format(self.url, _get_path(entity_id))
        return _add_channel(url, channel)
236407
protected FileContent handleGetFileContent(Class<? extends FileEntity> type, Integer entityId, Integer fileId) {
        Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForGetFile(BullhornEntityInfo.getTypesRestEntityName(type),
                entityId, fileId);
        String url = restUrlFactory.assembleGetFileUrl();
        String jsonString = this.performGetRequest(url, String.class, uriVariables);
        FileContent fileContent = restJsonConverter.jsonToEntityUnwrapRoot(jsonString, StandardFileContent.class);
        fileContent.setId(fileId);
        return fileContent;
    }
1351430
function generateReplicationId(src, target, opts) {
  var docIds = opts.doc_ids ? opts.doc_ids.sort(pouchdbCollate.collate) : '';
  var filterFun = opts.filter ? opts.filter.toString() : '';
  var queryParams = '';
  var filterViewName =  '';
  var selector = '';

  // possibility for checkpoints to be lost here as behaviour of
  // JSON.stringify is not stable (see #6226)
  /* istanbul ignore if */
  if (opts.selector) {
    selector = JSON.stringify(opts.selector);
  }

  if (opts.filter && opts.query_params) {
    queryParams = JSON.stringify(sortObjectPropertiesByKey(opts.query_params));
  }

  if (opts.filter && opts.filter === '_view') {
    filterViewName = opts.view.toString();
  }

  return Promise.all([src.id(), target.id()]).then(function (res) {
    var queryData = res[0] + res[1] + filterFun + filterViewName +
      queryParams + docIds + selector;
    return new Promise(function (resolve) {
      pouchdbMd5.binaryMd5(queryData, resolve);
    });
  }).then(function (md5sum) {
    // can't use straight-up md5 alphabet, because
    // the char '/' is interpreted as being for attachments,
    // and + is also not url-safe
    md5sum = md5sum.replace(/\//g, '.').replace(/\+/g, '_');
    return '_local/' + md5sum;
  });
}
1087504
protected FileWrapper handleGetFileContentWithMetaData(Class<? extends FileEntity> type, Integer entityId, Integer fileId) {
        FileWrapper fileWrapper = null;
        try {
            FileContent fileContent = this.handleGetFileContent(type, entityId, fileId);

            List<FileMeta> metaDataList = this.handleGetEntityMetaFiles(type, entityId);
            FileMeta correctMetaData = null;
            for (FileMeta metaData : metaDataList) {
                if (fileId.equals(metaData.getId())) {
                    correctMetaData = metaData;
                    break;
                }
            }

            fileWrapper = new StandardFileWrapper(fileContent, correctMetaData);
        } catch (Exception e) {
            log.error("Error getting file with id: " + fileId + " for " + type.getSimpleName() + " with id:" + entityId);
        }

        return fileWrapper;
    }
1161701
public void loadContentDefinition(final String entityId, final Command callback) {

        AsyncCallback<CmsContentDefinition> asyncCallback = new AsyncCallback<CmsContentDefinition>() {

            public void onFailure(Throwable caught) {

                onRpcError(caught);
            }

            public void onSuccess(CmsContentDefinition result) {

                registerContentDefinition(result);
                callback.execute();
            }
        };
        getService().loadContentDefinition(entityId, asyncCallback);
    }
946189
def _buildFileUrl(self, xml_req):
		""""""
		return '%(protocol)s://%(host)s:%(port)s%(xml_req)s'%{
			'protocol': self._protocol,
			'host': self._host,
			'port': self._port,
			'xml_req': xml_req,
		}