Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/flexstor/common/data/ejb/disguiserecord/DisguiseAssetRecordData.java


1   /*
2    * DisguiseAssetRecordData.java
3    *
4    * Copyright $Date: 2003/08/11 02:22:28 $ FLEXSTOR.net Inc.
5    *
6    * This work is licensed for use and distribution under license terms found at
7    * http://www.flexstor.org/license.html
8    *
9    */
10  
11  package com.flexstor.common.data.ejb.disguiserecord;
12  
13  import java.util.Date;
14  import java.util.Enumeration;
15  import java.util.Vector;
16  
17  import com.flexstor.common.constants.AssetRolesI;
18  import com.flexstor.common.constants.RsrcForkConstantsI;
19  import com.flexstor.common.util.FlexHashtable;
20  //import java.util.Hashtable;
21  
22  /**
23  * AssetRecord is a class that encapsulates the data 
24  * for an asset (file) to be imported into the database
25  */
26  public class DisguiseAssetRecordData
27  extends GenericBucketRecordData
28  {
29      static final long serialVersionUID = -786161977507236539L;
30  
31     /**
32     * History of this asset.
33     */
34     protected int              nHistoryId        = 0;
35     /**
36     * Checked out value (during import, it should be false)
37     */
38     protected boolean          bCheckedOut       = false;
39     /**
40     * The archive status (default to zero - online)
41     */
42     protected int              nArchiveStatus    = 0;
43     /**
44     * DisguiseAssetRecordData children of this asset.
45     */
46     protected Vector           vChildAssets      = null;
47     /**
48     * Mark this asset as a default view for others.
49     */
50     protected boolean          bDefaultView      = false;
51     /**
52     * Holds the asset id of the default view asset for this asset.
53     */
54     protected long             nDefaultViewAssetId = -1;
55     /**
56     * Full path of the asset; used by Oracle's Context Service
57     * URL format: http://server.domain/path/file
58     */
59     protected String           sFullPath         = null;
60     /**
61     * Full path of the asset; used by Oracle's VIR Service
62     * If HTTP protocol, path is: server.domain/path/file
63     * If FILE protocol, path is: ORDVIRDIR ( Directory Object name in database )
64     */
65     protected String           sVisualPath       = null;
66     /**
67     * Protocol used for VIR Service (either HTTP or FILE)
68     */
69     protected String           sVIRProtocol      = null;
70     /**
71     * Protocol used for Context Service (either HTTP or FILE)
72     */
73     protected String           sContextProtocol  = null;
74     /**
75     * The specific asset role object ( HIGHRES, THUMBNAIL, AUDIO, VIDEO, etc. )
76     */
77     protected AssetRoleData  assetRole         = null;
78     /**
79     * Vector of available versions for this asset.
80     */
81     protected Vector           vVersions         = null;
82     /**
83     * Size (in bytes) of this File
84     */
85     protected long             nFileSize         = -1;
86     /**
87     * Valid FLEXSTORdb user id
88     */
89     protected String           sUserId           = null;
90     /**
91     * Date this file is received into the system.
92     */
93     protected Date             dReceived         = null;
94     /**
95     * Date this file was created or last modified
96     */
97     protected Date             dFileDate         = null;
98     /**
99     * Name of the file represented by this asset. Not including path
100    */
101    protected String           sFileName         = null;
102    /**
103    * Path of the file represented by this asset. Not including name.
104    * Path shouuld be a system dependent path
105    */
106    protected String           sLocation         = null;
107    /**
108    * Server name (not fully qualified DNS Name) where this file is physically stored.
109    * Server name should be a valid server name from the server table in the database.
110    */
111    protected String           sServer           = null;
112    /**
113    * Original name of the file represented by this asset before an ImportCopyService (if called).
114    * Not including path.
115    */
116    protected String           sCopySourceFileName = null;
117    /**
118    * Original path of the file represented by this asset before an ImportCopyService (if called).
119    * Not including name. Path shouuld be a system dependent path
120    */
121    protected String           sCopySourceLocation = null;
122    /**
123    * Original server name (not fully qualified DNS Name) where this file is physically stored
124    * before an ImportCopyService (if called).
125    * Server name should be a valid server name from the server table in the database.
126    */
127    protected String           sCopySourceServer  = null;
128    /**
129    * True if this asset was copied to a new location during an ImportCopyService.
130    */
131    protected boolean          bCopySource = false;
132    /**
133    * The parent of this asset if this is a child asset. If this is a primary asset,
134    * parentAsset should be null.
135    */
136    protected DisguiseAssetRecordData parentAsset = null;
137 
138    /**
139    * Holds values for properties needed along services.
140    * This is differentiated from hUserData because the latter is
141    * used to hold user defined fields in the database, while the
142    * properties held by the htProperties Hashtable are not part of
143    * the database information.
144    */
145    protected FlexHashtable htProperties = new FlexHashtable();
146 
147    /**
148    * Holds values for user defined fields.
149    * used during import services, so that values in user defined fields
150    * can be updated from external services (third party services)
151    **/
152    protected FlexHashtable hUserData = new FlexHashtable();
153 
154    public DisguiseAssetRecordData()
155    {
156       super();
157       assetRole = new AssetRoleData();
158    }
159 
160 
161    public int getAssetRoleId()
162    {
163      if ( assetRole != null )
164         return assetRole.getAssetRoleId();
165      else
166         return 0;
167    }
168 
169    public String getAssetFileType()
170    {
171      if ( assetRole != null )
172         return assetRole.getAssetFileType();
173      else
174         return null;
175    }
176 
177    public int getArchiveStatus()
178    {
179       return nArchiveStatus;
180    }
181 
182    /**
183     * Retrieves the asset role for this asset record.
184     *
185     * @return a AssetRole for this asset record.
186     */
187    public AssetRoleData getAssetRole()
188    {
189       return assetRole;
190    }
191 
192    /**
193     * Retrieves the list of children assets contained in this
194     * DisguiseAssetRecordData object.
195     *
196     * @return an array of children assets.
197     */
198 
199    public DisguiseAssetRecordData[] getChildAssets()
200    {
201       if ( vChildAssets != null && vChildAssets.size() > 0 )
202       {
203          DisguiseAssetRecordData[] assets = new DisguiseAssetRecordData[ vChildAssets.size() ];
204          vChildAssets.copyInto( assets );
205          return assets;
206       }
207       return null;
208    }
209    
210    /**
211    * Get the first occurrence of a child with the specified role id.
212    * @param nRoleId the role id for the requested asset.
213    *
214    * @see com.flexstor.common.constants.AssetRolesI
215    */
216    public DisguiseAssetRecordData getChildAsset( int nRoleId )
217    {
218       if ( vChildAssets != null && vChildAssets.size() > 0 )
219       {
220          DisguiseAssetRecordData child = null;
221          boolean bChildFound = false;
222          for ( int i = 0; i < vChildAssets.size(); i++ )
223          {
224             child = (DisguiseAssetRecordData) vChildAssets.elementAt(i);
225             if ( child.getAssetRoleId() == nRoleId )
226             {
227                bChildFound = true;
228                break;
229             }
230          }
231          if ( bChildFound )
232             return child;
233       }
234       return null;
235    }
236 
237    /**
238    * Get the first ocurrence of a non-temporary child with the specified role id.
239    * @param nRoleId the role id for the requested asset.
240    *
241    * @see com.flexstor.common.constants.AssetRolesI
242    */
243    public DisguiseAssetRecordData getChildAssetNoTemp( int nRoleId )
244    {
245       DisguiseAssetRecordData child = getChildAsset( nRoleId );
246       if ( child == null || child.getAssetRole().isTempRole() )
247          return null;
248       else
249          return child;
250    }
251    
252    /**
253    * Tests if this asset has children
254    */
255    public boolean hasChildren()
256    {
257       if ( vChildAssets == null || vChildAssets.size() == 0 )
258          return false;
259       else
260          return true;
261    }
262 
263    public String getFullTextPath()
264    {
265      return sFullPath;
266    }
267 
268    public int getHistoryId()
269    {
270       return nHistoryId;
271    }
272 
273    /**
274    * Get the parent asset for this asset.
275    */
276    public DisguiseAssetRecordData getParent()
277    {
278       return parentAsset;
279    }
280 
281    public String getVisualPath()
282    {
283      return sVisualPath;
284    }
285 
286    public String getVIRProtocol()
287    {
288      return sVIRProtocol;
289    }
290 
291    public String getContextProtocol()
292    {
293      return sContextProtocol;
294    }
295 
296    public String getFileName()
297    {
298       return sFileName;
299    }
300 
301    public String getLocation()
302    {
303       return sLocation;
304    }
305 
306    public String getServer()
307    {
308       return sServer;
309    }
310    
311    public boolean isSourceCopied()
312    {
313       return bCopySource;
314    }
315    
316    public String getCopySourceFileName()
317    {
318       return sCopySourceFileName;
319    }
320 
321    public String getCopySourceLocation()
322    {
323       return sCopySourceLocation;
324    }
325 
326    public String getCopySourceServer()
327    {
328       return sCopySourceServer;
329    }
330    
331    public int[] getVersions()
332    {
333       if ( vVersions != null && vVersions.size() > 0 )
334       {
335          int[] nVersions = new int[ vVersions.size() ];
336          for (int i = 0; i < vVersions.size(); i++)
337             nVersions[i] = ((Integer)vVersions.elementAt(i)).intValue();
338          
339          return nVersions;
340       }
341       return null;
342    }
343    
344    public int getAppleTalkVendor()
345    {
346       String sAppleTalkVendor = (String) hUserData.get("Apple Talk Vendor");
347       try
348       {
349          return Integer.valueOf(sAppleTalkVendor).intValue();
350       }
351       catch (NumberFormatException nfe )
352       {
353          return RsrcForkConstantsI.NONE;
354       }
355    }
356    
357    public long getFileSize()
358    {
359       return nFileSize;
360    }
361    
362    public String getUserId()
363    {
364       return sUserId;
365    }
366    
367    public Date getReceived()
368    {
369       return dReceived;
370    }
371    
372    public Date getFileDate()
373    {
374       return dFileDate;
375    }
376    
377    public boolean isCheckedOut()
378    {
379      return bCheckedOut;
380    }
381 
382    public boolean isDefaultView()
383    {
384       return bDefaultView;
385    }
386 
387    public boolean isPrimaryParent()
388    {
389       return parentAsset == null ? true : false;
390    }
391    
392    /**
393    * Deletes any temporary asset associated with this asset.
394    */
395    public boolean deleteTempChildren()
396    {
397       Vector vClonedAssets = (Vector)vChildAssets.clone();
398       for( Enumeration e = vClonedAssets.elements(); e.hasMoreElements(); )
399       {
400           DisguiseAssetRecordData childAsset = (DisguiseAssetRecordData)e.nextElement();
401           AssetRoleData childRole = childAsset.getAssetRole();
402           if(childRole.isTempRole())
403             vChildAssets.removeElement(childAsset);
404 
405           childAsset.deleteTempChildren();
406       }
407 
408       return true;
409 
410    }
411    
412    public boolean hasChildrenNoTemp()
413    {
414       if ( vChildAssets == null || vChildAssets.size() == 0 )
415          return false;
416       else
417       {
418         //need to test to see if the children are temps
419         int nChildren = vChildAssets.size();
420         int nTempChildren = 0;
421         //loop through checking the role of each asset.  If the role is temp, increment nTempChildren.
422         for( Enumeration e = vChildAssets.elements(); e.hasMoreElements(); )
423         {
424           DisguiseAssetRecordData childAsset = (DisguiseAssetRecordData)e.nextElement();
425           AssetRoleData childRole = childAsset.getAssetRole();
426           if(childRole.isTempRole())
427           {
428             nTempChildren = nTempChildren + 1;
429           }
430         }
431         //if nChildren > than nTempChildren, then has valid Children that aren't temps
432        if (nChildren > nTempChildren)
433          return true;
434        else
435          return false;
436       }
437    }
438    
439    /**
440    * Deletes a specific child from this asset.
441    */
442    public void deleteChildAsset( int index )
443    {
444       if ( vChildAssets != null )
445          vChildAssets.removeElementAt( index );
446    }
447    
448    public void deleteChildAsset( DisguiseAssetRecordData assetChild )
449    {
450       if(vChildAssets != null)
451          vChildAssets.removeElement(assetChild);
452    }
453    
454    public boolean setArchiveStatus(int status)
455    {
456       nArchiveStatus = status;
457       return true;
458    }
459 
460    /**
461    * Set the asset role object for this asset.
462    */
463    public boolean setAssetRole(AssetRoleData role)
464    {
465      assetRole = role;
466      return true;
467    }
468 
469    public boolean setAssetRoleId(int id)
470    {
471      if ( assetRole != null )
472      {
473          assetRole.setAssetRoleId( id );
474         return true;
475      }
476      else
477         return false;
478    }
479 
480    public boolean setAssetFileType(String sType)
481    {
482      if ( assetRole != null )
483      {
484          assetRole.setAssetFileType( sType );
485         return true;
486      }
487      else
488         return false;
489    }
490 
491    public boolean setCheckedOut(boolean status)
492    {
493      bCheckedOut = status;
494      return true;
495    }
496    
497    /**
498    * Adds a child to the list of children assets.
499    */
500    public void addChildAsset( DisguiseAssetRecordData assetChild )
501    {
502       if ( vChildAssets == null )
503          vChildAssets = new Vector();
504          
505       vChildAssets.addElement( assetChild );
506       assetChild.setParent( this );
507    }
508 
509    /**
510    * Sets the list of children assets for this asset.
511    */
512    public boolean setChildAssets(DisguiseAssetRecordData[] children)
513    {
514       if ( children != null && children.length > 0 )
515       {
516          vChildAssets = new Vector();
517          for(int i = 0; i < children.length; i++)
518             vChildAssets.addElement( children[i] );
519 
520          return true;
521       }
522       return false;
523    }
524 
525    public boolean setDefaultView(boolean view)
526    {
527       bDefaultView = view;
528       return true;
529    }
530 
531    public boolean setFullTextPath(String fullPath)
532    {
533       sFullPath = fullPath;
534       return true;
535    }
536 
537    public boolean setHistoryId(int id)
538    {
539       nHistoryId = id;
540       return true;
541    }
542 
543    /**
544    * Set the parent asset for this asset.
545    */
546    public boolean setParent(DisguiseAssetRecordData parent)
547    {
548       parentAsset = parent;
549       return true;
550    }
551 
552    public boolean setVisualPath(String visualPath)
553    {
554       sVisualPath = visualPath;
555 
556       return true;
557    }
558 
559    public boolean setVIRProtocol(String virProtocol)
560    {
561       sVIRProtocol = virProtocol;
562 
563       return true;
564    }
565 
566    public boolean setContextProtocol(String contextProtocol)
567    {
568       sContextProtocol = contextProtocol;
569 
570       return true;
571    }
572 
573    public void setFileName(String sFileName)
574    {
575       this.sFileName = sFileName;
576    }
577 
578    public void setLocation(String sLocation)
579    {
580      setLocation(sLocation, java.io.File.separator);
581    }
582 
583    public void setLocation(String sLocation, String file_sep)
584    {
585       if ( sLocation != null ) 
586       {
587          if ( sLocation.startsWith( file_sep ) )
588             sLocation = sLocation.substring( 1 );
589          if ( sLocation.endsWith( file_sep ) == false )
590             sLocation += file_sep;
591       }
592       this.sLocation = sLocation;
593    }
594    
595    
596    /**
597    * The server should be a valid entry from the server table in the database.
598    */
599    public void setServer(String sServer)
600    {
601       this.sServer = sServer;
602    }
603    
604    public void setCopySource( boolean bCopySource )
605    {
606       this.bCopySource = bCopySource;
607    }
608    
609    public void setCopySourceFileName(String sCopySourceFileName)
610    {
611       this.sCopySourceFileName = sCopySourceFileName;
612    }
613 
614    public void setCopySourceLocation(String sCopySourceLocation)
615    {
616       if ( sCopySourceLocation != null )
617       {
618          if ( sCopySourceLocation.startsWith( java.io.File.separator ) )
619             sCopySourceLocation = sCopySourceLocation.substring( 1 );
620          if ( sCopySourceLocation.endsWith( java.io.File.separator ) == false )
621             sCopySourceLocation += java.io.File.separator;
622       }
623       this.sCopySourceLocation = sCopySourceLocation;
624    }
625 
626    /**
627    * The server should be a valid entry from the server table in the database.
628    */
629    public void setCopySourceServer(String sCopySourceServer)
630    {
631       this.sCopySourceServer = sCopySourceServer;
632    }
633    
634    public boolean setVersions( int[] nVersions )
635    {
636       if ( nVersions != null && nVersions.length > 0 )
637       {
638          vVersions = new Vector();
639          for ( int i = 0; i < nVersions.length; i++ )
640             vVersions.addElement( new Integer( nVersions[i] ) );
641             
642          return true;
643       }
644       return false;
645    }
646    
647    public void setAppleTalkVendor( int nAppleTalkVendor )
648    {
649       hUserData.put( "Apple Talk Vendor", String.valueOf(nAppleTalkVendor) );
650    }
651    
652    public void setFileSize( long nFileSize )
653    {
654       this.nFileSize = nFileSize;
655    }
656    
657    public void setUserId( String sUserId )
658    {
659       this.sUserId = sUserId;
660    }
661    
662    public void setReceived( Date dReceived )
663    {
664       this.dReceived = dReceived;
665    }
666    
667    public void setFileDate( Date dFileDate )
668    {
669       this.dFileDate = dFileDate;
670    }
671    
672    public boolean setDefaultViewAssetId( long nDefaultViewAssetId )
673    {
674       if ( this.nDefaultViewAssetId == -1 )
675       {
676          this.nDefaultViewAssetId = nDefaultViewAssetId;
677          return true;
678       }
679       else
680          return false;
681    }
682    
683    public long getDefaultViewAssetId()
684    {
685       return nDefaultViewAssetId;
686    }
687    
688    /**
689    * Get a list of assets (stored in the passing vector) which meets the criteria
690    * of the arguments.
691    *
692    * @param vAssets a Vector holding the result of the search.
693    * @param nRoleId the role of the assets requested
694    * @param sType the type of the assets requested
695    * @param sFlag the flag of the assets requested( PARENT, CHILDREN, TEMP, ALL )
696    */
697    public void getAssets( Vector vAssets, String sRole, String sType, String sFlag )
698    {
699       getAssets( null, vAssets, sRole, sType, sFlag );
700    }
701 
702    /**
703    * Get a list of assets (stored in the passing vector) which meets the criteria
704    * of the arguments.
705    *
706    * @param vTraversalPath a Vector holding the traversal path for the asset
707    * @param vAssets a Vector holding the result of the search
708    * @param nRoleId the role of the assets requested
709    * @param sType the type of the assets requested
710    * @param sFlag the flag of the assets requested( PARENT, CHILDREN, TEMP, ALL )
711    */
712    void getAssets( Vector vTraversalPath, Vector vAssets, String sRole, String sType, String sFlag )
713    {
714       if ( processAsset(sFlag) )
715          getAssets( vTraversalPath, vAssets, sRole, sType );
716 
717       getChildren( vTraversalPath, vAssets, sRole, sType, sFlag );
718    }
719 
720    public void getChildren( Vector vAssets, String sRole, String sType, String sFlag)
721    {
722       getChildren( null, vAssets, sRole, sType, sFlag );
723    }
724 
725    void getChildren( Vector vTraversalPath, Vector vAssets, String sRole, String sType, String sFlag)
726    {
727       if ( !(sFlag.equalsIgnoreCase("PARENT")) && !(sFlag.equalsIgnoreCase("TEMP_PARENT")) && vChildAssets != null )
728       {
729          for ( int i = 0; i < vChildAssets.size(); i++ )
730             ((DisguiseAssetRecordData)vChildAssets.elementAt(i)).getAssets( vTraversalPath, vAssets, sRole, sType, sFlag );
731       }
732    }
733 
734    private void getAssets( Vector vTraversalPath, Vector vAssets, String sRole, String sType )
735    {
736       int nRoleId = getRoleId( sRole );
737       // If role == -1 ( Get ALL )
738       //  or asset role id matches the role,
739       // then get the assets
740       if ( nRoleId == -1 || assetRole.getAssetRoleId() == nRoleId )
741       {
742          if ( sType.equalsIgnoreCase("ALL") ) // Don't check for type
743          {
744             if ( vTraversalPath != null )
745                this.setTraversalPath( (Vector)vTraversalPath.clone() );
746             vAssets.addElement(this);
747          }
748          else
749          {
750             if ( assetRole.getAssetFileType().equalsIgnoreCase(sType) )
751             {
752                if ( vTraversalPath != null )
753                   this.setTraversalPath( (Vector)vTraversalPath.clone() );
754                vAssets.addElement(this);
755             }
756          }
757       }
758    }
759 
760    /**
761    * Deletes the assets of a specific role, type and flag from this structure
762    */
763    public boolean deleteAssets( String sRole, String sType, String sFlag )
764    {
765       int nRoleId = getRoleId(sRole);
766       boolean bDelete = false;
767       
768       if ( processAsset(sFlag) && assetRole.getAssetRoleId() == nRoleId && assetRole.getAssetFileType().equals(sType) )
769          bDelete = true;
770       
771       if ( !(sFlag.equalsIgnoreCase("PARENT")) && !(sFlag.equalsIgnoreCase("TEMP_PARENT")) && vChildAssets != null )
772       {
773          Vector vChildClone = (Vector) vChildAssets.clone();
774          for ( Enumeration e = vChildClone.elements(); e.hasMoreElements(); )
775          {
776             DisguiseAssetRecordData childAsset = (DisguiseAssetRecordData) e.nextElement();
777             if ( childAsset.deleteAssets( sRole, sType, sFlag ) )
778                vChildAssets.removeElement( childAsset );
779          }
780       }
781       return bDelete;
782    }
783    
784    /**
785    * Will delete an asset, this or a child if it meets the criteria of the argument asset.
786    * For now the criteria will be that the server/location/filename are the same.
787    *
788    * @param assetToDelete
789    * @param nAssetsDeleted keeps a count of the assets deleted so far, at the end of the
790    *        method, this value will be updated with the number of assets (including children
791    *        and itself) deleted.
792    * @return true if this asset should be deleted.
793    */
794    public boolean deleteAsset( DisguiseAssetRecordData assetToDelete, int[] nAssetsDeleted )
795    {
796       if ( vChildAssets != null )
797       {
798          DisguiseAssetRecordData childAsset = null;
799          // Create a shallow clone for scanning and to delete items from the original vector
800          Vector vChildClone = (Vector) vChildAssets.clone();
801          for ( Enumeration e = vChildClone.elements(); e.hasMoreElements(); )
802          {
803             childAsset = (DisguiseAssetRecordData) e.nextElement();
804             if ( childAsset.deleteAsset( assetToDelete, nAssetsDeleted ) )
805                vChildAssets.removeElement( childAsset );
806          }
807       }
808       
809       // Find out if we need to delete this asset
810       if ( this.sServer.equals( assetToDelete.getServer() ) &&
811               this.sLocation.equals( assetToDelete.getLocation() ) &&
812                  this.sFileName.equals( assetToDelete.getFileName() ) )
813       {
814          nAssetsDeleted[0]++;
815          return true;
816       }
817       else
818          return false;
819    }
820 
821    /**
822    * If the role and type of the [FLAG] asset don't match the arguments, return true.
823    */
824    public boolean deleteAssetsNotInRoleType( String sRole, String sType, String sFlag )
825    {
826       int nRoleId = getRoleId(sRole);
827       boolean bDelete = false;
828       
829       if ( processAsset(sFlag) && ( assetRole.getAssetRoleId() != nRoleId || !(assetRole.getAssetFileType().equals(sType)) ) )
830             bDelete = true;
831       
832       if ( !(sFlag.equalsIgnoreCase("PARENT")) && !(sFlag.equalsIgnoreCase("TEMP_PARENT")) && vChildAssets != null )
833       {
834          Vector vChildClone = (Vector) vChildAssets.clone();
835          for ( Enumeration e = vChildClone.elements(); e.hasMoreElements(); )
836          {
837             DisguiseAssetRecordData childAsset = (DisguiseAssetRecordData) e.nextElement();
838             if ( childAsset.deleteAssetsNotInRoleType( sRole, sType, sFlag ) )
839                vChildAssets.removeElement( childAsset );
840          }
841       }
842       return bDelete;
843    }
844 
845    public FlexHashtable getUserData()
846    {
847       return hUserData;
848    }
849 
850    public void addUserData(String key, String value)
851    {
852       hUserData.put(key, value);
853    }
854 
855    public FlexHashtable getProperties()
856    {
857       return htProperties;
858    }
859 
860    public void addProperty( String key, Object value )
861    {
862       htProperties.put( key, value );
863    }
864 
865    public Object getProperty( String key )
866    {
867       return htProperties.get( key );
868    }
869 
870    private boolean processAsset( String sFlag )
871    {
872       if ( sFlag.equalsIgnoreCase( "PARENT" ) )
873       {
874          if ( parentAsset == null && !(assetRole.isTempRole()) )
875             return true;
876       }
877       else if ( sFlag.equalsIgnoreCase( "TEMP_PARENT" ) )
878       {
879          if ( parentAsset == null && assetRole.isTempRole() )
880             return true;
881       }
882       else if ( sFlag.equalsIgnoreCase("CHILDREN") )
883       {
884          if ( parentAsset != null && !(assetRole.isTempRole()) )
885             return true;
886       }
887       else if ( sFlag.equalsIgnoreCase("TEMP_CHILDREN") )
888       {
889          if ( parentAsset != null && assetRole.isTempRole() )
890             return true;
891       }
892       else if ( sFlag.equalsIgnoreCase("ALL") )
893       {
894          if ( !(assetRole.isTempRole()) )
895             return true;
896       }
897       else if ( sFlag.equalsIgnoreCase("TEMP_ALL") || sFlag.equalsIgnoreCase("TEMP"))
898       {
899          // TEMP flag is left for backward compatibility. This flag is now deprecated.
900          if ( assetRole.isTempRole() )
901             return true;
902       }
903       return false;
904    }
905 
906    private int getRoleId( String sRole )
907    {
908       // Get the proper Role Id
909       if ( sRole.equalsIgnoreCase("LOWRES") )
910          return AssetRolesI.LOWRES;
911       else if ( sRole.equalsIgnoreCase("THUMBNAIL") )
912          return AssetRolesI.THUMBNAIL;
913       else if ( sRole.equalsIgnoreCase("LAYOUT") )
914          return AssetRolesI.LAYOUT;
915       else if ( sRole.equalsIgnoreCase("AUDIO") )
916          return AssetRolesI.AUDIO;
917       else if ( sRole.equalsIgnoreCase("VIDEO") )
918          return AssetRolesI.VIDEO;
919       else  if ( sRole.equalsIgnoreCase("ALL") )
920          return -1;
921       else
922          return AssetRolesI.HIGHRES; // HIGHRES is the default
923    }
924    
925    /**
926    * Clones the asset. The bFullClone argument determines if this clone will
927    * include a clone copy of all children of this asset, or not. This provides
928    * for creating lite clones of the object.
929    */
930    public synchronized Object cloneAsset( boolean bFullClone )
931    {
932       DisguiseAssetRecordData clonedObject = new DisguiseAssetRecordData();
933       super.cloneRecord( clonedObject );
934       clonedObject.setAssetRoleId( this.getAssetRoleId() );
935       clonedObject.setHistoryId( this.nHistoryId );
936       clonedObject.setCheckedOut( this.bCheckedOut );
937       clonedObject.setArchiveStatus( this.nArchiveStatus );
938       clonedObject.setDefaultView( this.bDefaultView );
939       clonedObject.setFullTextPath( this.sFullPath );
940       clonedObject.setVisualPath( this.sVisualPath );
941       clonedObject.setVersions( this.getVersions() ); // This should be ok to use same reference
942       clonedObject.setAppleTalkVendor( this.getAppleTalkVendor() );
943       clonedObject.setFileSize( this.nFileSize );
944       clonedObject.setUserId( this.sUserId );
945       clonedObject.setReceived( this.dReceived );
946       clonedObject.setFileDate( this.dFileDate );
947       clonedObject.setFileName( this.sFileName );
948       clonedObject.setLocation( this.sLocation );
949       clonedObject.setServer( this.sServer );
950       clonedObject.setCopySourceFileName( this.sCopySourceFileName );
951       clonedObject.setCopySourceLocation( this.sCopySourceLocation );
952       clonedObject.setCopySourceServer( this.sCopySourceServer );
953       clonedObject.setCopySource( this.isSourceCopied() );
954       clonedObject.hUserData = this.hUserData;
955       clonedObject.htProperties = this.htProperties;
956 
957       if ( assetRole != null )
958          clonedObject.setAssetRole( (AssetRoleData)assetRole.cloneAssetRole() );
959 
960       if ( bFullClone && vChildAssets != null )
961       {
962          for ( int i = 0; i < vChildAssets.size(); i++ )
963          {
964             DisguiseAssetRecordData aChildAsset = (DisguiseAssetRecordData) vChildAssets.elementAt(i);
965             clonedObject.addChildAsset( (DisguiseAssetRecordData)aChildAsset.cloneAsset(true) );
966          }
967       }
968 
969       return clonedObject;
970    }
971 } // end of class