idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
26,700
protected Element createImageElement ( float x , float y , float width , float height , ImageResource resource ) throws IOException { StringBuilder pstyle = new StringBuilder ( "position:absolute;" ) ; pstyle . append ( "left:" ) . append ( x ) . append ( UNIT ) . append ( ';' ) ; pstyle . append ( "top:" ) . append ( ...
Creates an element that represents an image drawn at the specified coordinates in the page .
26,701
protected String createGlobalStyle ( ) { StringBuilder ret = new StringBuilder ( ) ; ret . append ( createFontFaces ( ) ) ; ret . append ( "\n" ) ; ret . append ( defaultStyle ) ; return ret . toString ( ) ; }
Generate the global CSS style for the whole document .
26,702
public void createPdfLayout ( Dimension dim ) { if ( pdfdocument != null ) { try { if ( createImage ) img = new BufferedImage ( dim . width , dim . height , BufferedImage . TYPE_INT_RGB ) ; Graphics2D ig = img . createGraphics ( ) ; log . info ( "Creating PDF boxes" ) ; VisualContext ctx = new VisualContext ( null , nu...
Creates the box tree for the PDF file .
26,703
protected BlockBox createBlock ( BlockBox parent , Element n , boolean replaced ) { BlockBox root ; if ( replaced ) { BlockReplacedBox rbox = new BlockReplacedBox ( ( Element ) n , ( Graphics2D ) parent . getGraphics ( ) . create ( ) , parent . getVisualContext ( ) . create ( ) ) ; rbox . setViewport ( viewport ) ; rbo...
Creates a new block box from the given element with the given parent . No style is assigned to the resulting box .
26,704
protected TextBox createTextBox ( BlockBox contblock , Text n ) { TextBox text = new TextBox ( n , ( Graphics2D ) contblock . getGraphics ( ) . create ( ) , contblock . getVisualContext ( ) . create ( ) ) ; text . setOrder ( next_order ++ ) ; text . setContainingBlockBox ( contblock ) ; text . setClipBlock ( contblock ...
Creates a text box with the given parent and text node assigned .
26,705
protected NodeData createBlockStyle ( ) { NodeData ret = CSSFactory . createNodeData ( ) ; TermFactory tf = CSSFactory . getTermFactory ( ) ; ret . push ( createDeclaration ( "display" , tf . createIdent ( "block" ) ) ) ; return ret ; }
Creates an empty block style definition .
26,706
protected NodeData createBodyStyle ( ) { NodeData ret = createBlockStyle ( ) ; TermFactory tf = CSSFactory . getTermFactory ( ) ; ret . push ( createDeclaration ( "background-color" , tf . createColor ( 255 , 255 , 255 ) ) ) ; return ret ; }
Creates a style definition used for the body element .
26,707
protected NodeData createPageStyle ( ) { NodeData ret = createBlockStyle ( ) ; TermFactory tf = CSSFactory . getTermFactory ( ) ; ret . push ( createDeclaration ( "position" , tf . createIdent ( "relative" ) ) ) ; ret . push ( createDeclaration ( "border-width" , tf . createLength ( 1f , Unit . px ) ) ) ; ret . push ( ...
Creates a style definition used for pages .
26,708
protected NodeData createRectangleStyle ( float x , float y , float width , float height , boolean stroke , boolean fill ) { float lineWidth = transformLength ( ( float ) getGraphicsState ( ) . getLineWidth ( ) ) ; float lw = ( lineWidth < 1f ) ? 1f : lineWidth ; float wcor = stroke ? lw : 0.0f ; NodeData ret = CSSFact...
Creates the style definition used for a rectangle element based on the given properties of the rectangle
26,709
protected Declaration createDeclaration ( String property , Term < ? > term ) { Declaration d = CSSFactory . getRuleFactory ( ) . createDeclaration ( ) ; d . unlock ( ) ; d . setProperty ( property ) ; d . add ( term ) ; return d ; }
Creates a single property declaration .
26,710
private void init ( ) { style = new BoxStyle ( UNIT ) ; textLine = new StringBuilder ( ) ; textMetrics = null ; graphicsPath = new Vector < PathSegment > ( ) ; startPage = 0 ; endPage = Integer . MAX_VALUE ; fontTable = new FontTable ( ) ; }
Internal initialization .
26,711
protected void updateFontTable ( ) { PDResources resources = pdpage . getResources ( ) ; if ( resources != null ) { try { processFontResources ( resources , fontTable ) ; } catch ( IOException e ) { log . error ( "Error processing font resources: " + "Exception: {} {}" , e . getMessage ( ) , e . getClass ( ) ) ; } } }
Updates the font table by adding new fonts used at the current page .
26,712
protected void finishBox ( ) { if ( textLine . length ( ) > 0 ) { String s ; if ( isReversed ( Character . getDirectionality ( textLine . charAt ( 0 ) ) ) ) s = textLine . reverse ( ) . toString ( ) ; else s = textLine . toString ( ) ; curstyle . setLeft ( textMetrics . getX ( ) ) ; curstyle . setTop ( textMetrics . ge...
Finishes the current box - empties the text line buffer and creates a DOM element from it .
26,713
protected void updateStyle ( BoxStyle bstyle , TextPosition text ) { String font = text . getFont ( ) . getName ( ) ; String family = null ; String weight = null ; String fstyle = null ; bstyle . setFontSize ( text . getFontSizeInPt ( ) ) ; bstyle . setLineHeight ( text . getHeight ( ) ) ; if ( font != null ) { for ( i...
Updates the text style according to a new text position
26,714
protected float transformLength ( float w ) { Matrix ctm = getGraphicsState ( ) . getCurrentTransformationMatrix ( ) ; Matrix m = new Matrix ( ) ; m . setValue ( 2 , 0 , w ) ; return m . multiply ( ctm ) . getTranslateX ( ) ; }
Transforms a length according to the current transformation matrix .
26,715
protected float [ ] transformPosition ( float x , float y ) { Point2D . Float point = super . transformedPoint ( x , y ) ; AffineTransform pageTransform = createCurrentPageTransformation ( ) ; Point2D . Float transformedPoint = ( Point2D . Float ) pageTransform . transform ( point , null ) ; return new float [ ] { ( fl...
Transforms a position according to the current transformation matrix and current page transformation .
26,716
protected String stringValue ( COSBase value ) { if ( value instanceof COSString ) return ( ( COSString ) value ) . getString ( ) ; else if ( value instanceof COSNumber ) return String . valueOf ( ( ( COSNumber ) value ) . floatValue ( ) ) ; else return "" ; }
Obtains a string from a PDF value
26,717
protected String colorString ( PDColor pdcolor ) { String color = null ; try { float [ ] rgb = pdcolor . getColorSpace ( ) . toRGB ( pdcolor . getComponents ( ) ) ; color = colorString ( rgb [ 0 ] , rgb [ 1 ] , rgb [ 2 ] ) ; } catch ( IOException e ) { log . error ( "colorString: IOException: {}" , e . getMessage ( ) )...
Creates a CSS rgb specification from a PDF color
26,718
public static File [ ] listAllFiles ( File directory ) { if ( directory == null ) { return new File [ 0 ] ; } File [ ] files = directory . listFiles ( ) ; return files != null ? files : new File [ 0 ] ; }
Return list of all files in the directory .
26,719
static boolean isOnClasspath ( String className ) { boolean isOnClassPath = true ; try { Class . forName ( className ) ; } catch ( ClassNotFoundException exception ) { isOnClassPath = false ; } return isOnClassPath ; }
Checks if class is on class path
26,720
public static LocationEngineResult extractResult ( Intent intent ) { LocationEngineResult result = null ; if ( isOnClasspath ( GOOGLE_PLAY_LOCATION_RESULT ) ) { result = extractGooglePlayResult ( intent ) ; } return result == null ? extractAndroidResult ( intent ) : result ; }
Extracts location result from intent object
26,721
public void onRequestPermissionsResult ( int requestCode , String [ ] permissions , int [ ] grantResults ) { switch ( requestCode ) { case REQUEST_PERMISSIONS_CODE : if ( listener != null ) { boolean granted = grantResults . length > 0 && grantResults [ 0 ] == PackageManager . PERMISSION_GRANTED ; listener . onPermissi...
You should call this method from your activity onRequestPermissionsResult .
26,722
public static String retrieveVendorId ( ) { if ( MapboxTelemetry . applicationContext == null ) { return updateVendorId ( ) ; } SharedPreferences sharedPreferences = obtainSharedPreferences ( MapboxTelemetry . applicationContext ) ; String mapboxVendorId = sharedPreferences . getString ( MAPBOX_SHARED_PREFERENCE_KEY_VE...
Do not call this method outside of activity!!!
26,723
private static boolean getSystemConnectivity ( Context context ) { try { ConnectivityManager cm = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; if ( cm == null ) { return false ; } NetworkInfo activeNetwork = cm . getActiveNetworkInfo ( ) ; return activeNetwork . isConnectedOrC...
Get the connectivity state as reported by the Android system
26,724
public static CrashReport fromJson ( String json ) throws IllegalArgumentException { try { return new CrashReport ( json ) ; } catch ( JSONException je ) { throw new IllegalArgumentException ( je . toString ( ) ) ; } }
Exports json encoded content to CrashReport object
26,725
static boolean uninstall ( ) { boolean uninstalled = false ; synchronized ( lock ) { if ( locationCollectionClient != null ) { locationCollectionClient . locationEngineController . onDestroy ( ) ; locationCollectionClient . settingsChangeHandlerThread . quit ( ) ; locationCollectionClient . sharedPreferences . unregist...
Uninstall current location collection client .
26,726
public GeoTarget getCanonAncestor ( GeoTarget . Type type ) { for ( GeoTarget target = this ; target != null ; target = target . canonParent ( ) ) { if ( target . key . type == type ) { return target ; } } return null ; }
Finds an ancestor of a specific type if possible .
26,727
public byte [ ] encrypt ( byte [ ] plainData ) { checkArgument ( plainData . length >= OVERHEAD_SIZE , "Invalid plainData, %s bytes" , plainData . length ) ; byte [ ] workBytes = plainData . clone ( ) ; ByteBuffer workBuffer = ByteBuffer . wrap ( workBytes ) ; boolean success = false ; try { int signature = hmacSignatu...
Encrypts data .
26,728
public static BoxConfig readFrom ( Reader reader ) throws IOException { JsonObject config = JsonObject . readFrom ( reader ) ; JsonObject settings = ( JsonObject ) config . get ( "boxAppSettings" ) ; String clientId = settings . get ( "clientID" ) . asString ( ) ; String clientSecret = settings . get ( "clientSecret" )...
Reads OAuth 2 . 0 with JWT app configurations from the reader . The file should be in JSON format .
26,729
public static BoxCollaborationWhitelist . Info create ( final BoxAPIConnection api , String domain , WhitelistDirection direction ) { URL url = COLLABORATION_WHITELIST_ENTRIES_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , HttpMethod . POST ) ; JsonObject reque...
Creates a new Collaboration Whitelist for a domain .
26,730
public void delete ( ) { BoxAPIConnection api = this . getAPI ( ) ; URL url = COLLABORATION_WHITELIST_ENTRY_URL_TEMPLATE . build ( api . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , HttpMethod . DELETE ) ; BoxAPIResponse response = request . send ( ) ; response . disconn...
Deletes this collaboration whitelist .
26,731
public static < T_Result , T_Source > List < T_Result > map ( Collection < T_Source > source , Mapper < T_Result , T_Source > mapper ) { List < T_Result > result = new LinkedList < T_Result > ( ) ; for ( T_Source element : source ) { result . add ( mapper . map ( element ) ) ; } return result ; }
Re - maps a provided collection .
26,732
public BoxFolder . Info createFolder ( String name ) { JsonObject parent = new JsonObject ( ) ; parent . add ( "id" , this . getID ( ) ) ; JsonObject newFolder = new JsonObject ( ) ; newFolder . add ( "name" , name ) ; newFolder . add ( "parent" , parent ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI (...
Creates a new child folder inside this folder .
26,733
public void rename ( String newName ) { URL url = FOLDER_INFO_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( this . getAPI ( ) , url , "PUT" ) ; JsonObject updateInfo = new JsonObject ( ) ; updateInfo . add ( "name" , newName ) ; request . ...
Renames this folder .
26,734
public BoxFile . Info uploadFile ( InputStream fileContent , String name , long fileSize , ProgressListener listener ) { FileUploadParams uploadInfo = new FileUploadParams ( ) . setContent ( fileContent ) . setName ( name ) . setSize ( fileSize ) . setProgressListener ( listener ) ; return this . uploadFile ( uploadInf...
Uploads a new file to this folder while reporting the progress to a ProgressListener .
26,735
public BoxFile . Info uploadFile ( FileUploadParams uploadParams ) { URL uploadURL = UPLOAD_FILE_URL . build ( this . getAPI ( ) . getBaseUploadURL ( ) ) ; BoxMultipartRequest request = new BoxMultipartRequest ( getAPI ( ) , uploadURL ) ; JsonObject fieldJSON = new JsonObject ( ) ; JsonObject parentIdJSON = new JsonObj...
Uploads a new file to this folder with custom upload parameters .
26,736
public Iterable < BoxItem . Info > getChildren ( final String ... fields ) { return new Iterable < BoxItem . Info > ( ) { public Iterator < BoxItem . Info > iterator ( ) { String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , fields ) . toString ( ) ; URL url = GET_ITEMS_URL . buildWithQuery ( getA...
Returns an iterable containing the items in this folder and specifies which child fields to retrieve from the API .
26,737
public Iterable < BoxItem . Info > getChildren ( String sort , SortDirection direction , final String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) . appendParam ( "sort" , sort ) . appendParam ( "direction" , direction . toString ( ) ) ; if ( fields . length > 0 ) { builder . appendParam ( "fi...
Returns an iterable containing the items in this folder sorted by name and direction .
26,738
public PartialCollection < BoxItem . Info > getChildrenRange ( long offset , long limit , String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) . appendParam ( "limit" , limit ) . appendParam ( "offset" , offset ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) . toStr...
Retrieves a specific range of child items in this folder .
26,739
public Iterator < BoxItem . Info > iterator ( ) { URL url = GET_ITEMS_URL . build ( this . getAPI ( ) . getBaseURL ( ) , BoxFolder . this . getID ( ) ) ; return new BoxItemIterator ( BoxFolder . this . getAPI ( ) , url ) ; }
Returns an iterator over the items in this folder .
26,740
public Metadata createMetadata ( String templateName , Metadata metadata ) { String scope = Metadata . scopeBasedOnType ( templateName ) ; return this . createMetadata ( templateName , scope , metadata ) ; }
Creates metadata on this folder using a specified template .
26,741
public Metadata createMetadata ( String templateName , String scope , Metadata metadata ) { URL url = METADATA_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) , scope , templateName ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "POST" ) ; request . addHeader ( "C...
Creates metadata on this folder using a specified scope and template .
26,742
public Metadata setMetadata ( String templateName , String scope , Metadata metadata ) { Metadata metadataValue = null ; try { metadataValue = this . createMetadata ( templateName , scope , metadata ) ; } catch ( BoxAPIException e ) { if ( e . getResponseCode ( ) == 409 ) { Metadata metadataToUpdate = new Metadata ( sc...
Sets the provided metadata on the folder overwriting any existing metadata keys already present .
26,743
public Metadata getMetadata ( String templateName ) { String scope = Metadata . scopeBasedOnType ( templateName ) ; return this . getMetadata ( templateName , scope ) ; }
Gets the metadata on this folder associated with a specified template .
26,744
public void deleteMetadata ( String templateName ) { String scope = Metadata . scopeBasedOnType ( templateName ) ; this . deleteMetadata ( templateName , scope ) ; }
Deletes the metadata on this folder associated with a specified template .
26,745
public void deleteMetadata ( String templateName , String scope ) { URL url = METADATA_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) , scope , templateName ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "DELETE" ) ; BoxAPIResponse response = request . send ( ) ;...
Deletes the metadata on this folder associated with a specified scope and template .
26,746
public String addClassification ( String classificationType ) { Metadata metadata = new Metadata ( ) . add ( Metadata . CLASSIFICATION_KEY , classificationType ) ; Metadata classification = this . createMetadata ( Metadata . CLASSIFICATION_TEMPLATE_KEY , "enterprise" , metadata ) ; return classification . getString ( M...
Adds a metadata classification to the specified file .
26,747
public BoxFile . Info uploadLargeFile ( InputStream inputStream , String fileName , long fileSize ) throws InterruptedException , IOException { URL url = UPLOAD_SESSION_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseUploadURL ( ) ) ; return new LargeFileUpload ( ) . upload ( this . getAPI ( ) , this . getID ( ) , in...
Creates a new file .
26,748
public Iterable < BoxMetadataCascadePolicy . Info > getMetadataCascadePolicies ( String ... fields ) { Iterable < BoxMetadataCascadePolicy . Info > cascadePoliciesInfo = BoxMetadataCascadePolicy . getAll ( this . getAPI ( ) , this . getID ( ) , fields ) ; return cascadePoliciesInfo ; }
Retrieves all Metadata Cascade Policies on a folder .
26,749
public static BoxRetentionPolicy . Info createIndefinitePolicy ( BoxAPIConnection api , String name ) { return createRetentionPolicy ( api , name , TYPE_INDEFINITE , 0 , ACTION_REMOVE_RETENTION ) ; }
Used to create a new indefinite retention policy .
26,750
public static BoxRetentionPolicy . Info createFinitePolicy ( BoxAPIConnection api , String name , int length , String action , RetentionPolicyParams optionalParams ) { return createRetentionPolicy ( api , name , TYPE_FINITE , length , action , optionalParams ) ; }
Used to create a new finite retention policy with optional parameters .
26,751
private static BoxRetentionPolicy . Info createRetentionPolicy ( BoxAPIConnection api , String name , String type , int length , String action ) { return createRetentionPolicy ( api , name , type , length , action , null ) ; }
Used to create a new retention policy .
26,752
private static BoxRetentionPolicy . Info createRetentionPolicy ( BoxAPIConnection api , String name , String type , int length , String action , RetentionPolicyParams optionalParams ) { URL url = RETENTION_POLICIES_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url ,...
Used to create a new retention policy with optional parameters .
26,753
public Iterable < BoxRetentionPolicyAssignment . Info > getFolderAssignments ( int limit , String ... fields ) { return this . getAssignments ( BoxRetentionPolicyAssignment . TYPE_FOLDER , limit , fields ) ; }
Returns iterable with all folder assignments of this retention policy .
26,754
public Iterable < BoxRetentionPolicyAssignment . Info > getEnterpriseAssignments ( int limit , String ... fields ) { return this . getAssignments ( BoxRetentionPolicyAssignment . TYPE_ENTERPRISE , limit , fields ) ; }
Returns iterable with all enterprise assignments of this retention policy .
26,755
public Iterable < BoxRetentionPolicyAssignment . Info > getAllAssignments ( int limit , String ... fields ) { return this . getAssignments ( null , limit , fields ) ; }
Returns iterable with all assignments of this retention policy .
26,756
private Iterable < BoxRetentionPolicyAssignment . Info > getAssignments ( String type , int limit , String ... fields ) { QueryStringBuilder queryString = new QueryStringBuilder ( ) ; if ( type != null ) { queryString . appendParam ( "type" , type ) ; } if ( fields . length > 0 ) { queryString . appendParam ( "fields" ...
Returns iterable with all assignments of given type of this retention policy .
26,757
public BoxRetentionPolicyAssignment . Info assignTo ( BoxFolder folder ) { return BoxRetentionPolicyAssignment . createAssignmentToFolder ( this . getAPI ( ) , this . getID ( ) , folder . getID ( ) ) ; }
Assigns this retention policy to folder .
26,758
public BoxRetentionPolicyAssignment . Info assignToMetadataTemplate ( String templateID , MetadataFieldFilter ... fieldFilters ) { return BoxRetentionPolicyAssignment . createAssignmentToMetadata ( this . getAPI ( ) , this . getID ( ) , templateID , fieldFilters ) ; }
Assigns this retention policy to a metadata template optionally with certain field values .
26,759
public static Iterable < BoxRetentionPolicy . Info > getAll ( final BoxAPIConnection api , String ... fields ) { return getAll ( null , null , null , DEFAULT_LIMIT , api , fields ) ; }
Returns all the retention policies .
26,760
public static Iterable < BoxRetentionPolicy . Info > getAll ( String name , String type , String userID , int limit , final BoxAPIConnection api , String ... fields ) { QueryStringBuilder queryString = new QueryStringBuilder ( ) ; if ( name != null ) { queryString . appendParam ( "policy_name" , name ) ; } if ( type !=...
Returns all the retention policies with specified filters .
26,761
public void start ( ) { if ( this . started ) { throw new IllegalStateException ( "Cannot start the EventStream because it isn't stopped." ) ; } final long initialPosition ; if ( this . startingPosition == STREAM_POSITION_NOW ) { BoxAPIRequest request = new BoxAPIRequest ( this . api , EVENT_URL . build ( this . api . ...
Starts this EventStream and begins long polling the API .
26,762
protected boolean isDuplicate ( String eventID ) { if ( this . receivedEvents == null ) { this . receivedEvents = new LRUCache < String > ( ) ; } return ! this . receivedEvents . add ( eventID ) ; }
Indicates whether or not an event ID is a duplicate .
26,763
public static BoxRetentionPolicyAssignment . Info createAssignmentToEnterprise ( BoxAPIConnection api , String policyID ) { return createAssignment ( api , policyID , new JsonObject ( ) . add ( "type" , TYPE_ENTERPRISE ) , null ) ; }
Assigns retention policy with givenID to the enterprise .
26,764
public static BoxRetentionPolicyAssignment . Info createAssignmentToFolder ( BoxAPIConnection api , String policyID , String folderID ) { return createAssignment ( api , policyID , new JsonObject ( ) . add ( "type" , TYPE_FOLDER ) . add ( "id" , folderID ) , null ) ; }
Assigns retention policy with givenID to the folder .
26,765
public static BoxRetentionPolicyAssignment . Info createAssignmentToMetadata ( BoxAPIConnection api , String policyID , String templateID , MetadataFieldFilter ... filter ) { JsonObject assignTo = new JsonObject ( ) . add ( "type" , TYPE_METADATA ) . add ( "id" , templateID ) ; JsonArray filters = null ; if ( filter . ...
Assigns a retention policy to all items with a given metadata template optionally matching on fields .
26,766
private static BoxRetentionPolicyAssignment . Info createAssignment ( BoxAPIConnection api , String policyID , JsonObject assignTo , JsonArray filter ) { URL url = ASSIGNMENTS_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "POST" ) ; JsonObject requestJSON = ne...
Assigns retention policy with givenID to folder or enterprise .
26,767
public static Iterable < Metadata > getAllMetadata ( BoxItem item , String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) ; } return new BoxResourceIterable < Metadata > ( item . getAPI ( ) , GET_ALL_METADATA_URL_TEMPLATE...
Used to retrieve all metadata associated with the item .
26,768
public Metadata add ( String path , String value ) { this . values . add ( this . pathToProperty ( path ) , value ) ; this . addOp ( "add" , path , value ) ; return this ; }
Adds a new metadata value .
26,769
public Metadata add ( String path , List < String > values ) { JsonArray arr = new JsonArray ( ) ; for ( String value : values ) { arr . add ( value ) ; } this . values . add ( this . pathToProperty ( path ) , arr ) ; this . addOp ( "add" , path , arr ) ; return this ; }
Adds a new metadata value of array type .
26,770
public Metadata replace ( String path , String value ) { this . values . set ( this . pathToProperty ( path ) , value ) ; this . addOp ( "replace" , path , value ) ; return this ; }
Replaces an existing metadata value .
26,771
public Metadata remove ( String path ) { this . values . remove ( this . pathToProperty ( path ) ) ; this . addOp ( "remove" , path , ( String ) null ) ; return this ; }
Removes an existing metadata value .
26,772
public String get ( String path ) { final JsonValue value = this . values . get ( this . pathToProperty ( path ) ) ; if ( value == null ) { return null ; } if ( ! value . isString ( ) ) { return value . toString ( ) ; } return value . asString ( ) ; }
Returns a value .
26,773
public Date getDate ( String path ) throws ParseException { return BoxDateFormat . parse ( this . getValue ( path ) . asString ( ) ) ; }
Get a value from a date metadata field .
26,774
public List < String > getMultiSelect ( String path ) { List < String > values = new ArrayList < String > ( ) ; for ( JsonValue val : this . getValue ( path ) . asArray ( ) ) { values . add ( val . asString ( ) ) ; } return values ; }
Get a value from a multiselect metadata field .
26,775
public List < String > getPropertyPaths ( ) { List < String > result = new ArrayList < String > ( ) ; for ( String property : this . values . names ( ) ) { if ( ! property . startsWith ( "$" ) ) { result . add ( this . propertyToPath ( property ) ) ; } } return result ; }
Returns a list of metadata property paths .
26,776
private String pathToProperty ( String path ) { if ( path == null || ! path . startsWith ( "/" ) ) { throw new IllegalArgumentException ( "Path must be prefixed with a \"/\"." ) ; } return path . substring ( 1 ) ; }
Converts a JSON patch path to a JSON property name . Currently the metadata API only supports flat maps .
26,777
private void addOp ( String op , String path , String value ) { if ( this . operations == null ) { this . operations = new JsonArray ( ) ; } this . operations . add ( new JsonObject ( ) . add ( "op" , op ) . add ( "path" , path ) . add ( "value" , value ) ) ; }
Adds a patch operation .
26,778
protected static BoxCollaboration . Info create ( BoxAPIConnection api , JsonObject accessibleBy , JsonObject item , BoxCollaboration . Role role , Boolean notify , Boolean canViewPath ) { String queryString = "" ; if ( notify != null ) { queryString = new QueryStringBuilder ( ) . appendParam ( "notify" , notify . toSt...
Create a new collaboration object .
26,779
public static Collection < Info > getPendingCollaborations ( BoxAPIConnection api ) { URL url = PENDING_COLLABORATIONS_URL . build ( api . getBaseURL ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = Js...
Gets all pending collaboration invites for the current user .
26,780
public Info getInfo ( ) { BoxAPIConnection api = this . getAPI ( ) ; URL url = COLLABORATION_URL_TEMPLATE . build ( api . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject jsonObject = Js...
Gets information about this collaboration .
26,781
public void updateInfo ( Info info ) { BoxAPIConnection api = this . getAPI ( ) ; URL url = COLLABORATION_URL_TEMPLATE . build ( api . getBaseURL ( ) , this . getID ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "PUT" ) ; request . setBody ( info . getPendingChanges ( ) ) ; BoxAPIResponse boxAPIRespo...
Updates the information about this collaboration with any info fields that have been modified locally .
26,782
public void delete ( ) { BoxAPIConnection api = this . getAPI ( ) ; URL url = COLLABORATION_URL_TEMPLATE . build ( api . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , "DELETE" ) ; BoxAPIResponse response = request . send ( ) ; response . disconnect ( ) ; }
Deletes this collaboration .
26,783
public static BoxLegalHoldAssignment . Info create ( BoxAPIConnection api , String policyID , String resourceType , String resourceID ) { URL url = ASSIGNMENTS_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "POST" ) ; JsonObject requestJSON = new JsonObject ( )...
Creates new legal hold policy assignment .
26,784
public void addCustomNotificationRecipient ( String userID ) { BoxUser user = new BoxUser ( null , userID ) ; this . customNotificationRecipients . add ( user . new Info ( ) ) ; }
Add a user by ID to the list of people to notify when the retention period is ending .
26,785
public static Iterable < BoxCollection . Info > getAllCollections ( final BoxAPIConnection api ) { return new Iterable < BoxCollection . Info > ( ) { public Iterator < BoxCollection . Info > iterator ( ) { URL url = GET_COLLECTIONS_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; return new BoxCollectionIterator ( api ,...
Gets an iterable of all the collections for the given user .
26,786
public PartialCollection < BoxItem . Info > getItemsRange ( long offset , long limit , String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) . appendParam ( "offset" , offset ) . appendParam ( "limit" , limit ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) . toString...
Retrieves a specific range of items in this collection .
26,787
public Iterator < BoxItem . Info > iterator ( ) { URL url = GET_COLLECTION_ITEMS_URL . build ( this . getAPI ( ) . getBaseURL ( ) , BoxCollection . this . getID ( ) ) ; return new BoxItemIterator ( BoxCollection . this . getAPI ( ) , url ) ; }
Returns an iterator over the items in this collection .
26,788
public static BoxCollaborationWhitelistExemptTarget . Info create ( final BoxAPIConnection api , String userID ) { URL url = COLLABORATION_WHITELIST_EXEMPT_TARGET_ENTRIES_URL_TEMPLATE . build ( api . getBaseURL ( ) ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , HttpMethod . POST ) ; JsonObject requestJSO...
Creates a collaboration whitelist for a Box User with a given ID .
26,789
public BoxCollaborationWhitelistExemptTarget . Info getInfo ( ) { URL url = COLLABORATION_WHITELIST_EXEMPT_TARGET_ENTRY_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , HttpMethod . GET ) ; BoxJSONResponse response = (...
Retrieves information for a collaboration whitelist for a given whitelist ID .
26,790
public static BoxDeveloperEditionAPIConnection getAppEnterpriseConnection ( String enterpriseId , String clientId , String clientSecret , JWTEncryptionPreferences encryptionPref , IAccessTokenCache accessTokenCache ) { BoxDeveloperEditionAPIConnection connection = new BoxDeveloperEditionAPIConnection ( enterpriseId , D...
Creates a new Box Developer Edition connection with enterprise token leveraging an access token cache .
26,791
public static BoxDeveloperEditionAPIConnection getAppEnterpriseConnection ( BoxConfig boxConfig ) { BoxDeveloperEditionAPIConnection connection = getAppEnterpriseConnection ( boxConfig . getEnterpriseId ( ) , boxConfig . getClientId ( ) , boxConfig . getClientSecret ( ) , boxConfig . getJWTEncryptionPreferences ( ) ) ;...
Creates a new Box Developer Edition connection with enterprise token leveraging BoxConfig .
26,792
public static BoxDeveloperEditionAPIConnection getAppUserConnection ( String userId , String clientId , String clientSecret , JWTEncryptionPreferences encryptionPref , IAccessTokenCache accessTokenCache ) { BoxDeveloperEditionAPIConnection connection = new BoxDeveloperEditionAPIConnection ( userId , DeveloperEditionEnt...
Creates a new Box Developer Edition connection with App User token .
26,793
public static BoxDeveloperEditionAPIConnection getAppUserConnection ( String userId , BoxConfig boxConfig ) { return getAppUserConnection ( userId , boxConfig . getClientId ( ) , boxConfig . getClientSecret ( ) , boxConfig . getJWTEncryptionPreferences ( ) ) ; }
Creates a new Box Developer Edition connection with App User token levaraging BoxConfig .
26,794
public void authenticate ( ) { URL url ; try { url = new URL ( this . getTokenURL ( ) ) ; } catch ( MalformedURLException e ) { assert false : "An invalid token URL indicates a bug in the SDK." ; throw new RuntimeException ( "An invalid token URL indicates a bug in the SDK." , e ) ; } String jwtAssertion = this . const...
Authenticates the API connection for Box Developer Edition .
26,795
public void refresh ( ) { this . getRefreshLock ( ) . writeLock ( ) . lock ( ) ; try { this . authenticate ( ) ; } catch ( BoxAPIException e ) { this . notifyError ( e ) ; this . getRefreshLock ( ) . writeLock ( ) . unlock ( ) ; throw e ; } this . notifyRefresh ( ) ; this . getRefreshLock ( ) . writeLock ( ) . unlock (...
Refresh s this connection s access token using Box Developer Edition .
26,796
public BoxTask . Info addTask ( BoxTask . Action action , String message , Date dueAt ) { JsonObject itemJSON = new JsonObject ( ) ; itemJSON . add ( "type" , "file" ) ; itemJSON . add ( "id" , this . getID ( ) ) ; JsonObject requestJSON = new JsonObject ( ) ; requestJSON . add ( "item" , itemJSON ) ; requestJSON . add...
Adds a new task to this file . The task can have an optional message to include and a due date .
26,797
public URL getDownloadURL ( ) { URL url = CONTENT_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "GET" ) ; request . setFollowRedirects ( false ) ; BoxRedirectResponse response = ( BoxRedirectResponse ) request . sen...
Gets an expiring URL for downloading a file directly from Box . This can be user for example for sending as a redirect to a browser to cause the browser to download the file directly from Box .
26,798
public void downloadRange ( OutputStream output , long rangeStart , long rangeEnd ) { this . downloadRange ( output , rangeStart , rangeEnd , null ) ; }
Downloads a part of this file s contents starting at rangeStart and stopping at rangeEnd .
26,799
public void downloadRange ( OutputStream output , long rangeStart , long rangeEnd , ProgressListener listener ) { URL url = CONTENT_URL_TEMPLATE . build ( this . getAPI ( ) . getBaseURL ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "GET" ) ; if ( rangeEnd > 0 ) { reque...
Downloads a part of this file s contents starting at rangeStart and stopping at rangeEnd while reporting the progress to a ProgressListener .