use of org.alfresco.web.bean.repository.DataDictionary in project acs-community-packaging by Alfresco.
the class UIChildAssociation method generateItem.
protected void generateItem(FacesContext context, UIPropertySheet propSheet) throws IOException {
String associationName = (String) getName();
// get details of the association
DataDictionary dd = (DataDictionary) FacesContextUtils.getRequiredWebApplicationContext(context).getBean(Application.BEAN_DATA_DICTIONARY);
AssociationDefinition assocDef = dd.getAssociationDefinition(propSheet.getNode(), associationName);
if (assocDef == null) {
logger.warn("Failed to find child association definition for association '" + associationName + "'");
} else {
// that the association is a parent child one
if (assocDef.isChild() == false) {
logger.warn("The association named '" + associationName + "' is not a child association");
} else {
String displayLabel = (String) getDisplayLabel();
if (displayLabel == null) {
// try and get the repository assigned label
displayLabel = assocDef.getTitle(dd.getDictionaryService());
// if the label is still null default to the local name of the property
if (displayLabel == null) {
displayLabel = assocDef.getName().getLocalName();
}
}
// generate the label and type specific control
generateLabel(context, propSheet, displayLabel);
generateControl(context, propSheet, assocDef);
}
}
}
use of org.alfresco.web.bean.repository.DataDictionary in project acs-community-packaging by Alfresco.
the class UIAssociation method generateItem.
protected void generateItem(FacesContext context, UIPropertySheet propSheet) throws IOException {
String associationName = (String) getName();
// get details of the association
DataDictionary dd = (DataDictionary) FacesContextUtils.getRequiredWebApplicationContext(context).getBean(Application.BEAN_DATA_DICTIONARY);
AssociationDefinition assocDef = dd.getAssociationDefinition(propSheet.getNode(), associationName);
if (assocDef == null) {
logger.warn("Failed to find association definition for association '" + associationName + "'");
} else {
// that the association is not a parent child one
if (assocDef.isChild()) {
logger.warn("The association named '" + associationName + "' is not an association");
} else {
String displayLabel = (String) getDisplayLabel();
if (displayLabel == null) {
// try and get the repository assigned label
displayLabel = assocDef.getTitle(dd.getDictionaryService());
// if the label is still null default to the local name of the property
if (displayLabel == null) {
displayLabel = assocDef.getName().getLocalName();
}
}
// generate the label and type specific control
generateLabel(context, propSheet, displayLabel);
generateControl(context, propSheet, assocDef);
}
}
}
use of org.alfresco.web.bean.repository.DataDictionary in project acs-community-packaging by Alfresco.
the class UIProperty method generateItem.
protected void generateItem(FacesContext context, UIPropertySheet propSheet) throws IOException {
Node node = propSheet.getNode();
String propertyName = (String) getName();
DataDictionary dd = (DataDictionary) FacesContextUtils.getRequiredWebApplicationContext(context).getBean(Application.BEAN_DATA_DICTIONARY);
PropertyDefinition propDef = dd.getPropertyDefinition(node, propertyName);
if (propDef == null) {
// Or, if the ignoreIfMissing flag is set to false, show the property
if (node.hasProperty(propertyName) || getIgnoreIfMissing() == false) {
String displayLabel = (String) getDisplayLabel();
if (displayLabel == null) {
displayLabel = propertyName;
}
// generate the label and generic control
generateLabel(context, propSheet, displayLabel);
generateControl(context, propSheet, propertyName);
} else {
// warn the user that the property was not found anywhere
if (missingPropsLogger.isWarnEnabled())
missingPropsLogger.warn("Failed to find property '" + propertyName + "' for node: " + node.getNodeRef().toString());
}
} else {
String displayLabel = (String) getDisplayLabel();
if (displayLabel == null) {
// try and get the repository assigned label
displayLabel = propDef.getTitle(dd.getDictionaryService());
// if the label is still null default to the local name of the property
if (displayLabel == null) {
displayLabel = propDef.getName().getLocalName();
}
}
// generate the label and type specific control
generateLabel(context, propSheet, displayLabel);
generateControl(context, propSheet, propDef);
}
}
Aggregations