fr.cnes.sitools.resources.order.utils
Class ListReferencesAPI

java.lang.Object
  extended by fr.cnes.sitools.resources.order.utils.ListReferencesAPI

public class ListReferencesAPI
extends java.lang.Object

Util class to manage Reference Lists for Order Resource.

It manages 2 lists, one for source file to order the other for the destination Reference. It can also generate index files into the admin storage for source list or into any storage for destination list

Author:
m.gond

Constructor Summary
ListReferencesAPI(java.lang.String rootPath)
          Default constructor
 
Method Summary
 void addNoDuplicateSourceRef(java.util.Set<java.lang.String> noDuplicateUrlSet)
          addNoDuplicateSourceRef
 void addNoDuplicateSourceRef(java.util.Set<java.lang.String> noDuplicateUrlSet, java.lang.String selectionId)
          addNoDuplicateSourceRef
 void addReferenceDest(org.restlet.data.Reference reference)
          Add a reference to the index
 void addReferenceSource(org.restlet.data.Reference reference)
          Add a reference to the index
 void clearReferencesDest()
          Clear the reference destination list
 void clearReferencesSource()
          Clear the reference source list
 org.restlet.data.Reference copyToAdminStorage(org.restlet.Context context, java.lang.String folderName, java.lang.String fileName, org.restlet.data.ClientInfo clientInfo)
          Copy the list of Reference Source to the admin storage ( root url is given by the function OrderResourceUtils.getResourceOrderStorageUrl(context)) with the specified.
 org.restlet.data.Reference copyToUserStorage(org.restlet.data.Reference rootRef, org.restlet.Context context, org.restlet.data.ClientInfo clientInfo)
          Copy the list of Reference destination to the given rootRef Reference
 java.util.List<org.restlet.data.Reference> getReferencesDest()
          Get the list of Reference in the index
 java.util.List<org.restlet.data.Reference> getReferencesSource()
          Get the list of Reference in the index
 java.util.Map<org.restlet.data.Reference,java.lang.String> getRefSourceTarget()
          Get the source reference target map
 void setRefSourceTarget(java.util.Map<org.restlet.data.Reference,java.lang.String> refSourceTarget)
          Set the reference sourcre target map
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListReferencesAPI

public ListReferencesAPI(java.lang.String rootPath)
Default constructor

Parameters:
rootPath - the root URL String added before each Reference in the index file. If the URLs are absolute set it to null
Method Detail

clearReferencesSource

public void clearReferencesSource()
Clear the reference source list


clearReferencesDest

public void clearReferencesDest()
Clear the reference destination list


addReferenceSource

public void addReferenceSource(org.restlet.data.Reference reference)
Add a reference to the index

Parameters:
reference - the reference to add

getReferencesSource

public java.util.List<org.restlet.data.Reference> getReferencesSource()
Get the list of Reference in the index

Returns:
the list of Reference in the index

addReferenceDest

public void addReferenceDest(org.restlet.data.Reference reference)
Add a reference to the index

Parameters:
reference - the reference to add

getReferencesDest

public java.util.List<org.restlet.data.Reference> getReferencesDest()
Get the list of Reference in the index

Returns:
the list of Reference in the index

getRefSourceTarget

public java.util.Map<org.restlet.data.Reference,java.lang.String> getRefSourceTarget()
Get the source reference target map

Returns:
the map

setRefSourceTarget

public void setRefSourceTarget(java.util.Map<org.restlet.data.Reference,java.lang.String> refSourceTarget)
Set the reference sourcre target map

Parameters:
refSourceTarget -

copyToUserStorage

public org.restlet.data.Reference copyToUserStorage(org.restlet.data.Reference rootRef,
                                                    org.restlet.Context context,
                                                    org.restlet.data.ClientInfo clientInfo)
                                             throws SitoolsException,
                                                    java.io.IOException
Copy the list of Reference destination to the given rootRef Reference

Parameters:
rootRef - the destination Reference
context - the Context
clientInfo - the ClientInfo
Returns:
the absolute Reference to the newly created file
Throws:
SitoolsException - if there is an error while copying the file to the file system
java.io.IOException - if there is an error while creating the file

copyToAdminStorage

public org.restlet.data.Reference copyToAdminStorage(org.restlet.Context context,
                                                     java.lang.String folderName,
                                                     java.lang.String fileName,
                                                     org.restlet.data.ClientInfo clientInfo)
                                              throws SitoolsException,
                                                     java.io.IOException
Copy the list of Reference Source to the admin storage ( root url is given by the function OrderResourceUtils.getResourceOrderStorageUrl(context)) with the specified. The name of file will be fileName and it will be located in the folder folderName.

Parameters:
context - the Context
folderName - the name of the folder where to create the file
fileName - the name of the file
clientInfo - the clientInfo
Returns:
the relative Reference to the newly created file
Throws:
SitoolsException - if there is an error while add the file to the file system
java.io.IOException - if there is an error while creating the file

addNoDuplicateSourceRef

public void addNoDuplicateSourceRef(java.util.Set<java.lang.String> noDuplicateUrlSet)
addNoDuplicateSourceRef

Parameters:
noDuplicateUrlSet -

addNoDuplicateSourceRef

public void addNoDuplicateSourceRef(java.util.Set<java.lang.String> noDuplicateUrlSet,
                                    java.lang.String selectionId)
addNoDuplicateSourceRef

Parameters:
noDuplicateUrlSet -
selectionId -


Copyright © 2010-2013 CNES. All Rights Reserved.