BrightSide Workbench Full Report + Source Code
org.turro.elephant.web.context.WebResource Class Reference

Public Member Functions

void setResource (File file)
 
File getResource ()
 
void addEditable (String modified, File file)
 
Map< String, File > getEditables ()
 
File getCurrentEditable ()
 
void addFile (WebResourceParts wrp, File file)
 
void cleanEditables (String current)
 
int hashCode ()
 
boolean equals (Object obj)
 

Static Public Member Functions

static WebResourceParts decompose (File file)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 34 of file WebResource.java.

Member Function Documentation

◆ addEditable()

void org.turro.elephant.web.context.WebResource.addEditable ( String  modified,
File  file 
)

Definition at line 49 of file WebResource.java.

49  {
50  editables.put(modified, file);
51  }
Here is the caller graph for this function:

◆ addFile()

void org.turro.elephant.web.context.WebResource.addFile ( WebResourceParts  wrp,
File  file 
)

Definition at line 61 of file WebResource.java.

61  {
62  if(!wrp.isEmpty()) {
63  if(wrp.isResource()) {
64  setResource(file);
65  } else {
66  addEditable(wrp.getModified(), file);
67  }
68  }
69  }
void addEditable(String modified, File file)
Here is the call graph for this function:

◆ cleanEditables()

void org.turro.elephant.web.context.WebResource.cleanEditables ( String  current)

Definition at line 79 of file WebResource.java.

79  {
80  Set<String> toRemove = new HashSet<>();
81  Long previous = ((Date) ObjectString.parseString(current,
82  ObjectString.COMPRESSED_DATE_PATTERN, Date.class, false)).getTime();
83  for(String modified : editables.descendingKeySet()) {
84  long modification = ((Date) ObjectString.parseString(modified,
85  ObjectString.COMPRESSED_DATE_PATTERN, Date.class, false)).getTime();
86  if(previous != null) {
87  if(previous - modification < MAX_DIFFERENCE) {
88  toRemove.add(modified);
89  }
90  }
91  previous = modification;
92  }
93  toRemove.forEach(e -> {
94  editables.get(e).delete();
95  editables.remove(e);
96  });
97  }
Here is the caller graph for this function:

◆ decompose()

static WebResourceParts org.turro.elephant.web.context.WebResource.decompose ( File  file)
static

Definition at line 73 of file WebResource.java.

73  {
74  return new WebResourceParts(file);
75  }

◆ equals()

boolean org.turro.elephant.web.context.WebResource.equals ( Object  obj)

Definition at line 109 of file WebResource.java.

109  {
110  if (this == obj) {
111  return true;
112  }
113  if (obj == null) {
114  return false;
115  }
116  if (getClass() != obj.getClass()) {
117  return false;
118  }
119  final WebResource other = (WebResource) obj;
120  return Objects.equals(this.resource, other.resource);
121  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrentEditable()

File org.turro.elephant.web.context.WebResource.getCurrentEditable ( )

Definition at line 57 of file WebResource.java.

57  {
58  return editables.lastEntry().getValue();
59  }

◆ getEditables()

Map<String, File> org.turro.elephant.web.context.WebResource.getEditables ( )

Definition at line 53 of file WebResource.java.

53  {
54  return editables;
55  }
Here is the caller graph for this function:

◆ getResource()

File org.turro.elephant.web.context.WebResource.getResource ( )

Definition at line 45 of file WebResource.java.

45  {
46  return resource;
47  }
Here is the caller graph for this function:

◆ hashCode()

int org.turro.elephant.web.context.WebResource.hashCode ( )

Definition at line 102 of file WebResource.java.

102  {
103  int hash = 5;
104  hash = 37 * hash + Objects.hashCode(this.resource);
105  return hash;
106  }

◆ setResource()

void org.turro.elephant.web.context.WebResource.setResource ( File  file)

Definition at line 41 of file WebResource.java.

41  {
42  this.resource = file;
43  }
Here is the caller graph for this function:

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