<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
</content-types>
<custom-properties>
<meta-data aspect="custom:DatiDocumento" property="custom:DatiDestinatario" />
<meta-data aspect="custom:DatiDocumento" property="custom:TipoDocumento" />
<meta-data aspect="custom:DatiDocumento" property="custom:CodiceArticolo" />
<meta-data aspect="custom:DatiDocumento" property="custom:NumeroDocumento" />
</custom-properties>
</advanced-search>
</config>
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
</content-types>
<custom-properties>
<meta-data aspect="custom:DatiLettera" property="custom:DestinatarioLettera" />
<meta-data aspect="custom:DatiLettera" property="custom:MittenteLettera" />
<meta-data aspect="custom:DatiLettera" property="custom:IndirizzoDestinatario" />
<meta-data aspect="custom:DatiLettera" property="custom:CodicePostale" />
</custom-properties>
</advanced-search>
</config>
ma queste mi compaiono tutte di seguito, mentre io vorrei che comparisse una display label anche nella maschera di ricerca che separasse le custom aspects
<a:panel label="#{msg.additional_options}" id="custom-panel" style="font-weight:bold" progressive="true"
expanded='#{SearchProperties.panels["custom-panel"]}' expandedActionListener="#{AdvancedSearchDialog.expandPanel}">
<r:searchCustomProperties id="customProps" bean="SearchProperties" var="customProperties" style="padding-left:12px;padding-top:4px" />
</a:panel>
l'unico problema è che non ho ancora capito come poterlo modificare in maniera tale da inserire due separatori con le rispettive label
<a:panel label="#{msg.additional_options}" id="custom-panel" style="font-weight:bold" progressive="true"
expanded='#{SearchProperties.panels["custom-panel"]}' expandedActionListener="#{AdvancedSearchDialog.expandPanel}">
serve a creare l'etichetta "additional options"
<r:searchCustomProperties id="customProps" bean="SearchProperties" var="customProperties" style="padding-left:12px;padding-top:4px" />
il problema è che ho provato a modificare i vari campi, ma senza ottenere risultati :cry:
package org.alfresco.web.bean.search;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectBoolean;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel;
import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.*;
import org.alfresco.service.cmr.repository.*;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.*;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.*;
import org.alfresco.web.config.AdvancedSearchConfigElement;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIModeList;
import org.alfresco.web.ui.common.component.UIPanel;
import org.alfresco.web.ui.repo.component.UIAjaxCategoryPicker;
// Referenced classes of package org.alfresco.web.bean.search:
// SearchContext, SearchProperties
public class AdvancedSearchDialog extends BaseDialogBean
{
private static final long serialVersionUID = 0x32c45b1b1704d56cL;
private transient PermissionService permissionService;
protected SearchProperties properties;
private static final String MSG_ALL_FORMATS = "all_formats";
private static final String MSG_ERROR_RESTORE_SEARCH = "error_restore_search";
private static final String MSG_SELECT_SAVED_SEARCH = "select_saved_search";
private static final String MSG_SAVE = "save";
private static final String OUTCOME_BROWSE = "browse";
private static final String PANEL_CUSTOM = "custom-panel";
private static final String PANEL_ATTRS = "attrs-panel";
private static final String PANEL_CATEGORIES = "categories-panel";
private static final String PANEL_RESTRICT = "restrict-panel";
private static final String PANEL_LOCATION = "location-panel";
private static final String INCLUDE_CHILDREN = "includeChildren";
private static final String MODE_ALL = "all";
private static final String MODE_FILES_TEXT = "files_text";
private static final String MODE_FILES = "files";
private static final String MODE_FOLDERS = "folders";
private static final String LOOKIN_ALL = "all";
private static final String LOOKIN_OTHER = "other";
private static final String SAVED_SEARCHES_USER = "user";
private static final String SAVED_SEARCHES_GLOBAL = "global";
private static final String NO_SELECTION = "NONE";
public AdvancedSearchDialog()
{
}
public void init(Map parameters)
{
super.init(parameters);
properties.getPanels().put("categories-panel", Boolean.valueOf(false));
properties.getPanels().put("attrs-panel", Boolean.valueOf(false));
properties.getPanels().put("custom-panel", Boolean.valueOf(false));
}
public void setPermissionService(PermissionService permissionService)
{
this.permissionService = permissionService;
}
protected PermissionService getPermissionService()
{
if(permissionService == null)
{
permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
}
return permissionService;
}
public void setProperties(SearchProperties properties)
{
this.properties = properties;
}
public boolean isAllowEdit()
{
boolean allow = properties.getSavedSearch() != null && !"NONE".equals(properties.getSavedSearch());
if(allow)
{
NodeRef savedSearchRef = new NodeRef(Repository.getStoreRef(), properties.getSavedSearch());
allow = getPermissionService().hasPermission(savedSearchRef, "Write") == AccessStatus.ALLOWED;
}
return allow;
}
public void setAllowEdit(boolean flag)
{
}
public DataModel getCategoriesDataModel()
{
if(properties.getCategoriesDataModel().getWrappedData() == null)
{
properties.getCategoriesDataModel().setWrappedData(properties.getCategories());
}
return properties.getCategoriesDataModel();
}
public List getContentTypes()
{
if(properties.getContentTypes() == null || Application.isDynamicConfig(FacesContext.getCurrentInstance()))
{
FacesContext context = FacesContext.getCurrentInstance();
DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService();
properties.setContentTypes(new ArrayList(5));
properties.getContentTypes().add(new SelectItem(ContentModel.TYPE_CONTENT.toString(), dictionaryService.getType(ContentModel.TYPE_CONTENT).getTitle()));
List types = getSearchConfig().getContentTypes();
if(types != null)
{
Iterator i$ = types.iterator();
do
{
if(!i$.hasNext())
{
break;
}
String type = (String)i$.next();
QName idQName = Repository.resolveToQName(type);
if(idQName != null)
{
TypeDefinition typeDef = dictionaryService.getType(idQName);
if(typeDef != null && dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT))
{
String label = typeDef.getTitle();
if(label == null)
{
label = idQName.getLocalName();
}
properties.getContentTypes().add(new SelectItem(idQName.toString(), label));
}
}
} while(true);
}
}
return properties.getContentTypes();
}
public List getFolderTypes()
{
if(properties.getFolderTypes() == null || Application.isDynamicConfig(FacesContext.getCurrentInstance()))
{
FacesContext context = FacesContext.getCurrentInstance();
DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService();
properties.setFolderTypes(new ArrayList(5));
properties.getFolderTypes().add(new SelectItem(ContentModel.TYPE_FOLDER.toString(), dictionaryService.getType(ContentModel.TYPE_FOLDER).getTitle()));
List types = getSearchConfig().getFolderTypes();
if(types != null)
{
Iterator i$ = types.iterator();
do
{
if(!i$.hasNext())
{
break;
}
String type = (String)i$.next();
QName idQName = Repository.resolveToQName(type);
if(idQName != null)
{
TypeDefinition typeDef = dictionaryService.getType(idQName);
if(typeDef != null && dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_FOLDER))
{
String label = typeDef.getTitle();
if(label == null)
{
label = idQName.getLocalName();
}
properties.getFolderTypes().add(new SelectItem(idQName.toString(), label));
}
}
} while(true);
}
}
return properties.getFolderTypes();
}
public List getContentFormats()
{
if(properties.getContentFormats() == null || Application.isDynamicConfig(FacesContext.getCurrentInstance()))
{
properties.setContentFormats(new ArrayList(80));
ServiceRegistry registry = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
MimetypeService mimetypeService = registry.getMimetypeService();
Map mimeTypes = mimetypeService.getDisplaysByMimetype();
String mimeType;
for(Iterator i$ = mimeTypes.keySet().iterator(); i$.hasNext(); properties.getContentFormats().add(new SelectItem(mimeType, (String)mimeTypes.get(mimeType))))
{
mimeType = (String)i$.next();
}
QuickSort sorter = new QuickSort(properties.getContentFormats(), "label", true, "case-insensitive");
sorter.sort();
properties.getContentFormats().add(0, new SelectItem("", Application.getMessage(FacesContext.getCurrentInstance(), "all_formats")));
}
return properties.getContentFormats();
}
public void reset(ActionEvent event)
{
resetFields();
properties.setSavedSearch(null);
}
private void resetFields()
{
properties.setText("");
properties.setMode("all");
properties.setLookin("all");
properties.setContentType(null);
properties.setContentFormat(null);
properties.setFolderType(null);
properties.setLocation(null);
properties.setLocationChildren(true);
properties.setCategories(new ArrayList(2));
properties.setCategoriesDataModel(null);
properties.setTitle(null);
properties.setDescription(null);
properties.setAuthor(null);
properties.setCreatedDateFrom(null);
properties.setCreatedDateTo(null);
properties.setModifiedDateFrom(null);
properties.setModifiedDateTo(null);
properties.setCreatedDateChecked(false);
properties.setModifiedDateChecked(false);
properties.getCustomProperties().clear();
}
public String search()
{
SearchContext search = new SearchContext();
search.setText(properties.getText());
search.setForceAndTerms(Application.getClientConfig(FacesContext.getCurrentInstance()).getForceAndTerms());
if(properties.getMode().equals("all"))
{
search.setMode(0);
} else
if(properties.getMode().equals("files_text"))
{
search.setMode(1);
} else
if(properties.getMode().equals("files"))
{
search.setMode(2);
} else
if(properties.getMode().equals("folders"))
{
search.setMode(3);
}
if(properties.getDescription() != null && properties.getDescription().length() != 0)
{
search.addAttributeQuery(ContentModel.PROP_DESCRIPTION, properties.getDescription());
}
if(properties.getTitle() != null && properties.getTitle().length() != 0)
{
search.addAttributeQuery(ContentModel.PROP_TITLE, properties.getTitle());
}
if(properties.getAuthor() != null && properties.getAuthor().length() != 0)
{
search.addAttributeQuery(ContentModel.PROP_AUTHOR, properties.getAuthor());
}
if(properties.getContentFormat() != null && properties.getContentFormat().length() != 0)
{
search.setMimeType(properties.getContentFormat());
}
if(properties.isCreatedDateChecked())
{
SimpleDateFormat df = CachingDateFormat.getDateFormat();
String strCreatedDate = df.format(properties.getCreatedDateFrom());
String strCreatedDateTo = df.format(properties.getCreatedDateTo());
search.addRangeQuery(ContentModel.PROP_CREATED, strCreatedDate, strCreatedDateTo, true);
}
if(properties.isModifiedDateChecked())
{
SimpleDateFormat df = CachingDateFormat.getDateFormat();
String strModifiedDate = df.format(properties.getModifiedDateFrom());
String strModifiedDateTo = df.format(properties.getModifiedDateTo());
search.addRangeQuery(ContentModel.PROP_MODIFIED, strModifiedDate, strModifiedDateTo, true);
}
Map customPropertyLookup = getCustomPropertyLookup();
Iterator i$ = properties.getCustomProperties().keySet().iterator();
do
{
if(!i$.hasNext())
{
break;
}
String qname = (String)i$.next();
Object value = properties.getCustomProperties().get(qname);
DataTypeDefinition typeDef = (DataTypeDefinition)customPropertyLookup.get(qname);
if(typeDef != null)
{
QName typeName = typeDef.getName();
if(DataTypeDefinition.DATE.equals(typeName) || DataTypeDefinition.DATETIME.equals(typeName))
{
if(value != null && Boolean.valueOf(value.toString()).booleanValue())
{
SimpleDateFormat df = CachingDateFormat.getDateFormat();
String strDateFrom = df.format(properties.getCustomProperties().get((new StringBuilder()).append("from_").append(qname).toString()));
String strDateTo = df.format(properties.getCustomProperties().get((new StringBuilder()).append("to_").append(qname).toString()));
search.addRangeQuery(QName.createQName(qname), strDateFrom, strDateTo, true);
}
} else
if(DataTypeDefinition.BOOLEAN.equals(typeName))
{
if(((Boolean)value).booleanValue())
{
search.addFixedValueQuery(QName.createQName(qname), value.toString());
}
} else
if(DataTypeDefinition.NODE_REF.equals(typeName) || DataTypeDefinition.CATEGORY.equals(typeName))
{
if(value != null)
{
search.addFixedValueQuery(QName.createQName(qname), value.toString());
}
} else
if(DataTypeDefinition.INT.equals(typeName) || DataTypeDefinition.LONG.equals(typeName) || DataTypeDefinition.FLOAT.equals(typeName) || DataTypeDefinition.DOUBLE.equals(typeName))
{
String strVal = value.toString();
if(strVal != null && strVal.length() != 0)
{
search.addFixedValueQuery(QName.createQName(qname), strVal);
}
} else
if(value != null)
{
Object item = properties.getCustomProperties().get((new StringBuilder()).append("item_").append(qname).toString());
if(item != null)
{
if(((Boolean)value).booleanValue())
{
search.addFixedValueQuery(QName.createQName(qname), item.toString());
}
} else
{
String strVal = value.toString();
if(strVal != null && strVal.length() != 0)
{
search.addAttributeQuery(QName.createQName(qname), strVal);
}
}
}
}
} while(true);
if(properties.getLookin().equals("other") && properties.getLocation() != null)
{
search.setLocation(SearchContext.getPathFromSpaceRef(properties.getLocation(), properties.isLocationChildren()));
}
if(properties.getCategories().size() != 0)
{
String paths[] = new String[properties.getCategories().size()];
for(int i = 0; i < paths.length; i++)
{
Node category = (Node)properties.getCategories().get(i);
boolean includeChildren = ((Boolean)category.getProperties().get("includeChildren")).booleanValue();
paths[i] = SearchContext.getPathFromSpaceRef(category.getNodeRef(), includeChildren);
}
search.setCategories(paths);
}
if(properties.getContentType() != null)
{
search.setContentType(properties.getContentType());
}
if(properties.getFolderType() != null)
{
search.setFolderType(properties.getFolderType());
}
navigator.setSearchContext(search);
return "browse";
}
public String saveNewSearch()
{
properties.setSearchDescription(null);
properties.setSearchName(null);
properties.setSearchSaveGlobal(false);
return "dialog:saveSearch";
}
public String saveEditSearch()
{
properties.setSearchDescription(null);
properties.setSearchName(null);
properties.setEditSearchName(null);
try
{
NodeRef searchRef = new NodeRef(Repository.getStoreRef(), properties.getSavedSearch());
Node searchNode = new Node(searchRef);
if(getNodeService().exists(searchRef) && searchNode.hasPermission("Write"))
{
Node node = new Node(searchRef);
properties.setSearchName(node.getName());
properties.setEditSearchName(properties.getSearchName());
properties.setSearchDescription((String)node.getProperties().get(ContentModel.PROP_DESCRIPTION));
} else
{
properties.setSavedSearch(null);
}
}
catch(Throwable err)
{
properties.setSavedSearch(null);
}
return "dialog:editSearch";
}
public List getSavedSearches()
{
List savedSearches = (List)properties.getCachedSavedSearches().get();
if(savedSearches == null)
{
FacesContext fc = FacesContext.getCurrentInstance();
ServiceRegistry services = Repository.getServiceRegistry(fc);
NodeRef searchesRef = null;
if("user".equals(properties.getSavedSearchMode()))
{
searchesRef = getUserSearchesRef();
} else
if("global".equals(properties.getSavedSearchMode()))
{
searchesRef = getGlobalSearchesRef();
}
if(searchesRef != null)
{
DictionaryService dd = services.getDictionaryService();
List childRefs = getNodeService().getChildAssocs(searchesRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
savedSearches = new ArrayList(childRefs.size() + 1);
if(childRefs.size() != 0)
{
Iterator i$ = childRefs.iterator();
do
{
if(!i$.hasNext())
{
break;
}
ChildAssociationRef ref = (ChildAssociationRef)i$.next();
Node childNode = new Node(ref.getChildRef());
if(dd.isSubClass(childNode.getType(), ContentModel.TYPE_CONTENT))
{
savedSearches.add(new SelectItem(childNode.getId(), childNode.getName()));
}
} while(true);
QuickSort sorter = new QuickSort(savedSearches, "label", true, "case-insensitive");
sorter.sort();
}
} else
{
savedSearches = new ArrayList(1);
}
savedSearches.add(0, new SelectItem("NONE", Application.getMessage(FacesContext.getCurrentInstance(), "select_saved_search")));
properties.getCachedSavedSearches().put(savedSearches);
}
return savedSearches;
}
public void savedSearchModeChanged(ActionEvent event)
{
UIModeList savedModeList = (UIModeList)event.getComponent();
String viewMode = savedModeList.getValue().toString();
properties.setSavedSearchMode(viewMode);
properties.getCachedSavedSearches().clear();
properties.setSavedSearch(null);
}
public void selectSearch(ActionEvent event)
{
if(!"NONE".equals(properties.getSavedSearch()))
{
NodeRef searchSearchRef = new NodeRef(Repository.getStoreRef(), properties.getSavedSearch());
ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
ContentService cs = services.getContentService();
try
{
if(services.getNodeService().exists(searchSearchRef))
{
ContentReader reader = cs.getReader(searchSearchRef, ContentModel.PROP_CONTENT);
SearchContext search = (new SearchContext()).fromXML(reader.getContentString());
initialiseFromContext(search);
}
}
catch(Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), "error_restore_search"), new Object[] {
err.getMessage()
}), err);
}
}
}
private void initialiseFromContext(SearchContext search)
{
resetFields();
properties.setText(search.getText());
switch(search.getMode())
{
case 0: // '\0'
properties.setMode("all");
break;
case 1: // '\001'
properties.setMode("files_text");
break;
case 2: // '\002'
properties.setMode("files");
break;
case 3: // '\003'
properties.setMode("folders");
break;
}
properties.getPanels().put("restrict-panel", Boolean.valueOf(true));
if(search.getLocation() != null)
{
properties.setLocationChildren(search.getLocation().endsWith("//*"));
properties.setLocation(findNodeRefFromPath(search.getLocation()));
properties.setLookin("other");
properties.getPanels().put("location-panel", Boolean.valueOf(true));
}
String categories[] = search.getCategories();
if(categories != null && categories.length != 0)
{
String arr$[] = categories;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
String category = arr$[i$];
NodeRef categoryRef = findNodeRefFromPath(category);
if(categoryRef != null)
{
Node categoryNode = new MapNode(categoryRef);
categoryNode.getProperties().put("includeChildren", Boolean.valueOf(category.endsWith("//*")));
properties.getCategories().add(categoryNode);
}
}
properties.getPanels().put("categories-panel", Boolean.valueOf(true));
}
properties.setContentType(search.getContentType());
properties.setContentFormat(search.getMimeType());
properties.setFolderType(search.getFolderType());
properties.setDescription(search.getAttributeQuery(ContentModel.PROP_DESCRIPTION));
properties.setTitle(search.getAttributeQuery(ContentModel.PROP_TITLE));
properties.setAuthor(search.getAttributeQuery(ContentModel.PROP_AUTHOR));
if(properties.getContentType() != null || properties.getContentFormat() != null || properties.getDescription() != null || properties.getTitle() != null || properties.getAuthor() != null)
{
properties.getPanels().put("attrs-panel", Boolean.valueOf(true));
}
SearchContext.RangeProperties createdDate = search.getRangeProperty(ContentModel.PROP_CREATED);
if(createdDate != null)
{
properties.setCreatedDateFrom(Utils.parseXMLDateFormat(createdDate.lower));
properties.setCreatedDateTo(Utils.parseXMLDateFormat(createdDate.upper));
properties.setCreatedDateChecked(true);
properties.getPanels().put("attrs-panel", Boolean.valueOf(true));
}
SearchContext.RangeProperties modifiedDate = search.getRangeProperty(ContentModel.PROP_MODIFIED);
if(modifiedDate != null)
{
properties.setModifiedDateFrom(Utils.parseXMLDateFormat(modifiedDate.lower));
properties.setModifiedDateTo(Utils.parseXMLDateFormat(modifiedDate.upper));
properties.setModifiedDateChecked(true);
properties.getPanels().put("attrs-panel", Boolean.valueOf(true));
}
Map customPropertyLookup = getCustomPropertyLookup();
Iterator i$ = customPropertyLookup.keySet().iterator();
do
{
if(!i$.hasNext())
{
break;
}
String qname = (String)i$.next();
DataTypeDefinition typeDef = (DataTypeDefinition)customPropertyLookup.get(qname);
if(typeDef != null)
{
QName typeName = typeDef.getName();
if(DataTypeDefinition.DATE.equals(typeName) || DataTypeDefinition.DATETIME.equals(typeName))
{
SearchContext.RangeProperties dateProps = search.getRangeProperty(QName.createQName(qname));
if(dateProps != null)
{
properties.getCustomProperties().put((new StringBuilder()).append("from_").append(qname).toString(), Utils.parseXMLDateFormat(dateProps.lower));
properties.getCustomProperties().put((new StringBuilder()).append("to_").append(qname).toString(), Utils.parseXMLDateFormat(dateProps.upper));
properties.getCustomProperties().put(qname, Boolean.valueOf(true));
properties.getPanels().put("custom-panel", Boolean.valueOf(true));
}
} else
if(DataTypeDefinition.BOOLEAN.equals(typeName))
{
String strBool = search.getFixedValueQuery(QName.createQName(qname));
if(strBool != null)
{
properties.getCustomProperties().put(qname, Boolean.valueOf(Boolean.parseBoolean(strBool)));
properties.getPanels().put("custom-panel", Boolean.valueOf(true));
}
} else
if(DataTypeDefinition.NODE_REF.equals(typeName) || DataTypeDefinition.CATEGORY.equals(typeName))
{
String strNodeRef = search.getFixedValueQuery(QName.createQName(qname));
if(strNodeRef != null)
{
properties.getCustomProperties().put(qname, new NodeRef(strNodeRef));
properties.getPanels().put("custom-panel", Boolean.valueOf(true));
}
} else
if(DataTypeDefinition.INT.equals(typeName) || DataTypeDefinition.LONG.equals(typeName) || DataTypeDefinition.FLOAT.equals(typeName) || DataTypeDefinition.DOUBLE.equals(typeName))
{
properties.getCustomProperties().put(qname, search.getFixedValueQuery(QName.createQName(qname)));
properties.getPanels().put("custom-panel", Boolean.valueOf(true));
} else
{
Object value = search.getFixedValueQuery(QName.createQName(qname));
if(value != null)
{
properties.getCustomProperties().put((new StringBuilder()).append("item_").append(qname).toString(), value);
properties.getCustomProperties().put(qname, Boolean.TRUE);
} else
{
properties.getCustomProperties().put(qname, search.getAttributeQuery(QName.createQName(qname)));
}
properties.getPanels().put("custom-panel", Boolean.valueOf(true));
}
}
} while(true);
}
private NodeRef findNodeRefFromPath(String xpath)
{
if(xpath.endsWith("//*"))
{
xpath = xpath.substring(0, xpath.lastIndexOf("//*"));
} else
if(xpath.endsWith("/*"))
{
xpath = xpath.substring(0, xpath.lastIndexOf("/*"));
}
NodeRef rootRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(FacesContext.getCurrentInstance()));
List results = null;
try
{
results = getSearchService().selectNodes(rootRef, xpath, null, getNamespaceService(), false);
}
catch(AccessDeniedException err) { }
return results == null || results.size() != 1 ? null : (NodeRef)results.get(0);
}
protected NodeRef getUserSearchesRef()
{
if(properties.getUserSearchesRef() == null)
{
NodeRef globalRef = getGlobalSearchesRef();
if(globalRef != null)
{
FacesContext fc = FacesContext.getCurrentInstance();
User user = Application.getCurrentUser(fc);
String userName = ISO9075.encode(user.getUserName());
String xpath = (new StringBuilder()).append("app:").append(QName.createValidLocalName(userName)).toString();
List results = null;
try
{
results = getSearchService().selectNodes(globalRef, xpath, null, getNamespaceService(), false);
}
catch(AccessDeniedException err) { }
if(results != null)
{
if(results.size() == 1)
{
properties.setUserSearchesRef((NodeRef)results.get(0));
} else
if(results.size() == 0 && (new Node(globalRef)).hasPermission("AddChildren"))
{
ChildAssociationRef childRef = getNodeService().createNode(globalRef, ContentModel.ASSOC_CONTAINS, QName.createQName("http://www.alfresco.org/model/application/1.0", QName.createValidLocalName(user.getUserName())), ContentModel.TYPE_FOLDER, null);
properties.setUserSearchesRef(childRef.getChildRef());
}
}
}
}
return properties.getUserSearchesRef();
}
protected NodeRef getGlobalSearchesRef()
{
if(properties.getGlobalSearchesRef() == null)
{
FacesContext fc = FacesContext.getCurrentInstance();
String xpath = (new StringBuilder()).append(Application.getRootPath(fc)).append("/").append(Application.getGlossaryFolderName(fc)).append("/").append(Application.getSavedSearchesFolderName(fc)).toString();
List results = null;
try
{
results = getSearchService().selectNodes(getNodeService().getRootNode(Repository.getStoreRef()), xpath, null, getNamespaceService(), false);
}
catch(AccessDeniedException err) { }
if(results != null && results.size() == 1)
{
properties.setGlobalSearchesRef((NodeRef)results.get(0));
}
}
return properties.getGlobalSearchesRef();
}
public void addCategory(ActionEvent event)
{
UIAjaxCategoryPicker selector = (UIAjaxCategoryPicker)event.getComponent().findComponent("catSelector");
UISelectBoolean chkChildren = (UISelectBoolean)event.getComponent().findComponent("chkCatChildren");
List categoryRefs = (List)selector.getValue();
if(categoryRefs != null)
{
Node categoryNode;
for(Iterator i$ = categoryRefs.iterator(); i$.hasNext(); properties.getCategories().add(categoryNode))
{
NodeRef categoryRef = (NodeRef)i$.next();
categoryNode = new MapNode(categoryRef);
categoryNode.getProperties().put("includeChildren", Boolean.valueOf(chkChildren.isSelected()));
}
selector.setValue(null);
}
}
public void removeCategory(ActionEvent event)
{
Node node = (Node)properties.getCategoriesDataModel().getRowData();
if(node != null)
{
properties.getCategories().remove(node);
}
}
private AdvancedSearchConfigElement getSearchConfig()
{
if(properties.getSearchConfigElement() == null)
{
properties.setSearchConfigElement((AdvancedSearchConfigElement)Application.getConfigService(FacesContext.getCurrentInstance()).getConfig("Advanced Search").getConfigElement("advanced-search"));
}
return properties.getSearchConfigElement();
}
private Map getCustomPropertyLookup()
{
if(properties.getCustomPropertyLookup() == null || Application.isDynamicConfig(FacesContext.getCurrentInstance()))
{
properties.setCustomPropertyLookup(new HashMap(7, 1.0F));
List customProps = getSearchConfig().getCustomProperties();
if(customProps != null)
{
DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
Iterator i$ = customProps.iterator();
do
{
if(!i$.hasNext())
{
break;
}
org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty customProp = (org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty)i$.next();
PropertyDefinition propDef = null;
QName propQName = Repository.resolveToQName(customProp.Property);
if(customProp.Type != null)
{
QName type = Repository.resolveToQName(customProp.Type);
TypeDefinition typeDef = dd.getType(type);
propDef = (PropertyDefinition)typeDef.getProperties().get(propQName);
} else
if(customProp.Aspect != null)
{
QName aspect = Repository.resolveToQName(customProp.Aspect);
AspectDefinition aspectDef = dd.getAspect(aspect);
propDef = (PropertyDefinition)aspectDef.getProperties().get(propQName);
}
if(propQName != null && propDef != null)
{
properties.getCustomPropertyLookup().put(propQName.toString(), propDef.getDataType());
}
} while(true);
}
}
return properties.getCustomPropertyLookup();
}
public void expandPanel(ActionEvent event)
{
if(event instanceof org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent)
{
properties.getPanels().put(event.getComponent().getId(), Boolean.valueOf(((org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent)event).State));
}
}
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "save");
}
protected String finishImpl(FacesContext context, String outcome)
throws Exception
{
return null;
}
}
Ciao a tutti
io ho implementato delle custom aspects di due tipi diversi (esatiFattura1 and DatiFattura2) che riesco a visualizzare in maniera separata nei dettagli dei files presenti nei miei spaces, grazie all'uso delle display labels; ho aggiunto nella maschera di advanced search quese custom aspects (nel file C:\Alfresco\tomcat\shared\classes\alfresco\extension\web-client-config-custom.xml )nel seguente modo:ma queste mi compaiono tutte di seguito, mentre io vorrei che comparisse una display label anche nella maschera di ricerca che separasse le custom aspects
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
</content-types>
<custom-properties>
<meta-data aspect="custom:DatiDocumento" property="custom:DatiDestinatario" />
<meta-data aspect="custom:DatiDocumento" property="custom:TipoDocumento" />
<meta-data aspect="custom:DatiDocumento" property="custom:CodiceArticolo" />
<meta-data aspect="custom:DatiDocumento" property="custom:NumeroDocumento" />
</custom-properties>
</advanced-search>
</config>
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
</content-types>
<custom-properties>
<meta-data aspect="custom:DatiLettera" property="custom:DestinatarioLettera" />
<meta-data aspect="custom:DatiLettera" property="custom:MittenteLettera" />
<meta-data aspect="custom:DatiLettera" property="custom:IndirizzoDestinatario" />
<meta-data aspect="custom:DatiLettera" property="custom:CodicePostale" />
</custom-properties>
</advanced-search>
</config>
es:
Dati Documento:
Destinatario della Fattura:
TipoDocumento:
CodiceArticolo:
NumeroDocumento
Dati Lettera:
DestinatarioLettera:
MittenteLettera:
IndirizzoDestinatario:
CAP:
come posso fare?
grazie
Valerio
PS: ho provato (su suggerimento del wiki) ad aggiungere codici del tipo <separator name="separatore" display-label="Nome etichetta" component-generator="HeaderSeparatorGenerator" /> ma non funziona
Archive content from product discussions in Italian.
This group is now closed and content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.