BrightSide Workbench Full Report + Source Code
org.turro.documentation.DocumentDefinition Class Reference
Inheritance diagram for org.turro.documentation.DocumentDefinition:
Collaboration diagram for org.turro.documentation.DocumentDefinition:

Public Member Functions

 DocumentDefinition (String name, DocumentType type)
 
DocumentDefinition allowedRoot (String root)
 
DocumentDefinition description (String text)
 
DocumentDefinition allowMultiple ()
 
DocumentDefinition uploadControl ()
 
DocumentDefinition min (int min)
 
DocumentDefinition max (int max)
 
String getName ()
 
DocumentType getType ()
 
void setAllowedRoot (String allowedRoot)
 
String getAllowedRoot ()
 
void setDescription (String description)
 
String getDescription ()
 
boolean isAllowMultiple ()
 
void setAllowMultiple (boolean allowMultiple)
 
boolean isUploadControl ()
 
void setUploadControl (boolean uploadControl)
 
void setMin (int min)
 
int getMin ()
 
void setMax (int max)
 
int getMax ()
 
boolean isInformation ()
 
boolean isFiltered ()
 
boolean matches (String root)
 
Map< String, List< Document > > getDocumentsMap ()
 
List< Document > getDocumentsFor (IContact contact)
 
Folder getFolder ()
 
String getFolderString ()
 
String getFolderName ()
 
boolean canDelete ()
 
int hashCode ()
 
boolean equals (Object obj)
 
int compareTo (DocumentDefinition o)
 

Public Attributes

final String name
 
final DocumentType type
 
String description
 
boolean allowMultiple
 
int min
 

Detailed Description

Constructor & Destructor Documentation

◆ DocumentDefinition()

org.turro.documentation.DocumentDefinition.DocumentDefinition ( String  name,
DocumentType  type 
)

Member Function Documentation

◆ allowedRoot()

DocumentDefinition org.turro.documentation.DocumentDefinition.allowedRoot ( String  root)

Definition at line 57 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

57  {
58  this.allowedRoot = root;
59  return this;
60  }

◆ allowMultiple()

DocumentDefinition org.turro.documentation.DocumentDefinition.allowMultiple ( )

◆ canDelete()

boolean org.turro.documentation.DocumentDefinition.canDelete ( )

Definition at line 201 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

201  {
202  return SqlClause.select("count(ed)")
203  .from("EntityDocumentation ed")
204  .where().equal("ed.documentation", name)
205  .dao(new AttachPU())
206  .singleResult(Long.class) == 0L;
207  }
Here is the caller graph for this function:

◆ compareTo()

int org.turro.documentation.DocumentDefinition.compareTo ( DocumentDefinition  o)

Definition at line 232 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

232  {
233  return CompareUtil.compare(name, o.name);
234  }

◆ description()

DocumentDefinition org.turro.documentation.DocumentDefinition.description ( String  text)

◆ equals()

boolean org.turro.documentation.DocumentDefinition.equals ( Object  obj)

Definition at line 217 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

217  {
218  if (this == obj) {
219  return true;
220  }
221  if (obj == null) {
222  return false;
223  }
224  if (getClass() != obj.getClass()) {
225  return false;
226  }
227  final DocumentDefinition other = (DocumentDefinition) obj;
228  return Objects.equals(this.name, other.name);
229  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllowedRoot()

String org.turro.documentation.DocumentDefinition.getAllowedRoot ( )

Definition at line 99 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

99  {
100  return allowedRoot;
101  }

◆ getDescription()

String org.turro.documentation.DocumentDefinition.getDescription ( )

Definition at line 107 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

107  {
108  return description;
109  }

◆ getDocumentsFor()

List<Document> org.turro.documentation.DocumentDefinition.getDocumentsFor ( IContact  contact)

Definition at line 171 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

171  {
172  List<Document> docs = new ArrayList<>();
173  Folder folder = getFolder();
174  try {
175  if(folder.exists()) docs.addAll(folder.documents());
176  Folder selfDocs = folder.child(contact.getId());
177  if(selfDocs.exists()) docs.addAll(selfDocs.documents());
178  IContact parent = contact.getBusiness();
179  if(parent != null) {
180  Folder parentDocs = folder.child(parent.getId());
181  if(parentDocs.exists()) docs.addAll(parentDocs.documents());
182  }
183  } catch (IOException ex) {
184  Logger.getLogger(DocumentDefinition.class.getName()).log(Level.SEVERE, null, ex);
185  }
186  return docs;
187  }
Here is the call graph for this function:

◆ getDocumentsMap()

Map<String, List<Document> > org.turro.documentation.DocumentDefinition.getDocumentsMap ( )

Definition at line 157 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

157  {
158  Map<String, List<Document>> docs = new TreeMap<>();
159  Folder folder = getFolder();
160  try {
161  if(folder.exists()) docs.put("*", folder.documents());
162  for(Folder child : folder.folders()) {
163  docs.put(child.name(), child.documents());
164  }
165  } catch (IOException ex) {
166  Logger.getLogger(DocumentDefinition.class.getName()).log(Level.SEVERE, null, ex);
167  }
168  return docs;
169  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFolder()

Folder org.turro.documentation.DocumentDefinition.getFolder ( )

Definition at line 189 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

189  {
190  return Folder.from(ElephantContext.getRealPath(getFolderString()));
191  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFolderName()

String org.turro.documentation.DocumentDefinition.getFolderName ( )

Definition at line 197 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFolderString()

String org.turro.documentation.DocumentDefinition.getFolderString ( )

Definition at line 193 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

193  {
194  return "/WEB-INF/files/doc-references/" + getFolderName();
195  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMax()

int org.turro.documentation.DocumentDefinition.getMax ( )

Definition at line 139 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

139  {
140  return max;
141  }
Here is the caller graph for this function:

◆ getMin()

int org.turro.documentation.DocumentDefinition.getMin ( )

Definition at line 131 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

131  {
132  return min;
133  }
Here is the caller graph for this function:

◆ getName()

String org.turro.documentation.DocumentDefinition.getName ( )

Definition at line 87 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

87  {
88  return name;
89  }
Here is the caller graph for this function:

◆ getType()

DocumentType org.turro.documentation.DocumentDefinition.getType ( )

Definition at line 91 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

91  {
92  return type;
93  }

◆ hashCode()

int org.turro.documentation.DocumentDefinition.hashCode ( )

Definition at line 210 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

210  {
211  int hash = 7;
212  hash = 73 * hash + Objects.hashCode(this.name);
213  return hash;
214  }
Here is the caller graph for this function:

◆ isAllowMultiple()

boolean org.turro.documentation.DocumentDefinition.isAllowMultiple ( )

Definition at line 111 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

111  {
112  return allowMultiple;
113  }
Here is the caller graph for this function:

◆ isFiltered()

boolean org.turro.documentation.DocumentDefinition.isFiltered ( )

Definition at line 149 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

149  {
150  return !"*".equals(Strings.isBlank(allowedRoot, "*"));
151  }
Here is the caller graph for this function:

◆ isInformation()

boolean org.turro.documentation.DocumentDefinition.isInformation ( )

Definition at line 145 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

145  {
146  return !Strings.isBlank(description) || !getFolder().isEmpty();
147  }
Here is the call graph for this function:

◆ isUploadControl()

boolean org.turro.documentation.DocumentDefinition.isUploadControl ( )

Definition at line 119 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

119  {
120  return uploadControl;
121  }
Here is the caller graph for this function:

◆ matches()

boolean org.turro.documentation.DocumentDefinition.matches ( String  root)

Definition at line 153 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

153  {
154  return !isFiltered() || (CompareUtil.compare(root, allowedRoot) == 0);
155  }
Here is the call graph for this function:

◆ max()

DocumentDefinition org.turro.documentation.DocumentDefinition.max ( int  max)

Definition at line 82 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

82  {
83  this.max = max;
84  return this;
85  }

◆ min()

DocumentDefinition org.turro.documentation.DocumentDefinition.min ( int  min)

Definition at line 77 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

77  {
78  this.min = min;
79  return this;
80  }

◆ setAllowedRoot()

void org.turro.documentation.DocumentDefinition.setAllowedRoot ( String  allowedRoot)

Definition at line 95 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

95  {
96  this.allowedRoot = allowedRoot;
97  }

◆ setAllowMultiple()

void org.turro.documentation.DocumentDefinition.setAllowMultiple ( boolean  allowMultiple)

◆ setDescription()

void org.turro.documentation.DocumentDefinition.setDescription ( String  description)

◆ setMax()

void org.turro.documentation.DocumentDefinition.setMax ( int  max)

Definition at line 135 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

135  {
136  this.max = max;
137  }

◆ setMin()

void org.turro.documentation.DocumentDefinition.setMin ( int  min)

Definition at line 127 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

127  {
128  this.min = min;
129  }

◆ setUploadControl()

void org.turro.documentation.DocumentDefinition.setUploadControl ( boolean  uploadControl)

Definition at line 123 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

123  {
124  this.uploadControl = uploadControl;
125  }

◆ uploadControl()

DocumentDefinition org.turro.documentation.DocumentDefinition.uploadControl ( )

Definition at line 72 of file elephant-attach/src/main/java/org/turro/documentation/DocumentDefinition.java.

72  {
73  this.uploadControl = true;
74  return this;
75  }

Member Data Documentation

◆ allowMultiple

boolean org.turro.documentation.DocumentDefinition.allowMultiple

◆ description

String org.turro.documentation.DocumentDefinition.description

◆ min

int org.turro.documentation.DocumentDefinition.min

◆ name

final String org.turro.documentation.DocumentDefinition.name

◆ type

final DocumentType org.turro.documentation.DocumentDefinition.type

The documentation for this class was generated from the following file: