Source code: com/flexstor/common/data/ejb/disguiserecord/LayoutRoleData.java
1 /*
2 * LayoutRoleData.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 /**
14 * The AssetRoleData object specific for Layout assets.
15 */
16 public class LayoutRoleData
17 extends AssetRoleData
18 {
19 static final long serialVersionUID = 313087205802572438L;
20
21 /**
22 * The number of pages within this layout
23 */
24 protected int nNumOfPages = 0;
25
26 /**
27 * True if a thumbnail of every page within a layout should be created.
28 */
29 protected boolean bThumbAllPages = false;
30
31 /**
32 * Size of the current page
33 */
34 protected int nPageSize = 0;
35
36 public LayoutRoleData()
37 {
38 this.nAssetRoleId = com.flexstor.common.constants.AssetRolesI.LAYOUT;
39 }
40
41 public int getNoOfPages()
42 {
43 return nNumOfPages;
44 }
45
46 public boolean setNoOfPages(int pages)
47 {
48 nNumOfPages = pages;
49 return true;
50 }
51
52 /**
53 * Should a thumbnail be created for every page?
54 */
55 public boolean isThumbAllPages()
56 {
57 if(bThumbAllPages) return true;
58 else return false;
59 }
60
61 /**
62 * Set to true if a thumbnail should be created for every page
63 */
64 public boolean setThumbAllPages(boolean thumbAllPages)
65 {
66 bThumbAllPages = thumbAllPages;
67 return bThumbAllPages;
68 }
69
70 public int getPageSize()
71 {
72 return nPageSize;
73 }
74
75 public boolean setPageSize(int size)
76 {
77 nPageSize = size;
78 return true;
79 }
80
81 /**
82 * Creates a String[] with all the values for all fields in this object
83 */
84 public String[] gatherData()
85 {
86 String[] values = new String[4];
87
88 values[0] = getAssetFileType();
89 values[1] = String.valueOf( getNoOfPages() );
90 if ( isThumbAllPages() )
91 values[2] = "Y";
92 else
93 values[2] = "N";
94 values[3] = String.valueOf( getPageSize() );
95
96 return values;
97 }
98
99 /**
100 * Returns a cloned version of this LayoutRoleData object
101 */
102 public Object cloneRole()
103 {
104 LayoutRoleData clonedObject = new LayoutRoleData();
105 clonedObject.setNoOfPages( nNumOfPages );
106 clonedObject.setThumbAllPages( bThumbAllPages );
107 clonedObject.setPageSize( nPageSize );
108
109 return clonedObject;
110 }
111 }
112