1
2
3
4 package org.rcfaces.core.model;
5
6 import javax.faces.context.FacesContext;
7
8 import org.rcfaces.core.internal.contentAccessor.ContentAccessorFactory;
9 import org.rcfaces.core.internal.contentAccessor.IContentAccessor;
10 import org.rcfaces.core.internal.contentAccessor.IGeneratedResourceInformation;
11 import org.rcfaces.core.internal.contentAccessor.IGenerationResourceInformation;
12 import org.rcfaces.core.lang.IContentFamily;
13
14
15
16
17
18
19 public abstract class AbstractContentModel implements IContentModel {
20 private static final String REVISION = "$Revision: 1.4 $";
21
22 private Object wrappedData;
23
24 private String contentEngineId;
25
26 public AbstractContentModel() {
27 }
28
29 public AbstractContentModel(Object wrappedData) {
30 this.wrappedData = wrappedData;
31 }
32
33 public void setInformations(IGenerationResourceInformation generationInformation,
34 IGeneratedResourceInformation generatedInformation) {
35 }
36
37 public Object getWrappedData() {
38 return wrappedData;
39 }
40
41 public void setWrappedData(Object wrappedData) {
42 this.wrappedData = wrappedData;
43 }
44
45 public String computeURL() {
46 return computeURL(this);
47 }
48
49 public static String computeURL(IContentModel contentModel) {
50 FacesContext facesContext = FacesContext.getCurrentInstance();
51
52 IContentAccessor contentAccessor = ContentAccessorFactory
53 .createFromWebResource(facesContext, contentModel,
54 IContentFamily.USER);
55
56 if (contentAccessor == null) {
57 return null;
58 }
59
60 return contentAccessor.resolveURL(facesContext, null, null);
61 }
62
63 public String getContentEngineId() {
64 return contentEngineId;
65 }
66
67 public void setContentEngineId(String contentEngineId) {
68 this.contentEngineId = contentEngineId;
69 }
70
71 public boolean checkNotModified() {
72 return true;
73 }
74
75 }