Aspect name in Alfresco showing up as undefined in 'Manage Aspect' - java

I was working with Alfresco-entreprise 4.1.1.3 and i moved to alfresco-community 5.0.2.
In this migration i copied all the config files of my custom aspects to the same locations as it was in
Alfresco-entreprise 4.1.1.3
I have set them to visible in share UI and I can see them in the share UI.
The problem is that when I right click on a site or folder and choose 'Manage Aspect', i see that the aspect name is listed as
undefined (gifapidocument:MyAspect)
I am not sure why it is showing up as undefined. When I click on manage rules -> add aspect , I see that the name is showing up correctly.
When i try to add a document to Alfresco from my application it works but the document is added without any properties and empty Aspects.
the paths of my configs are :
share-config-custom.xml : ./tomcat/shared/classes/alfresco/web-extension
In <alfresco-config><config><aspects><visible>, i added :
<aspect name="gifapidocument:*MyAspect*" />
In <alfresco-config><config><forms><form>, i added :
<field-visibility>
<show id="gifapidocument:typeDocumentXXXX" />
</field-visibility>
<field-visibility>
<show id="gifapidocument:idXXXXXXXX" />
</field-visibility>
another path of my configs :
myAppDocument-model.xml : ./tomcat/shared/classes/alfresco/extension/myApp/model
In <model><aspects>, i added :
<aspect name="gifapidocument:*MyAspect*">
<properties>
<property name="gifapidocument:typeDocumentXXXX">
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="gifapidocument:idXXXXXXXX">
<type>d:text</type>
<mandatory>false</mandatory>
</property>
</properties>
</aspect>
and finaly :
myApp.properties : ./tomcat/shared/classes/alfresco/extension/myApp/messages
i added :
aspect.gifapidocument_*myAspect*=GIF-API-MYAPP-*myAspect*

u can check yours aspects with:
yourhost/api/-default-/public/alfresco/versions/1/nodes/{{uiid}
it is shown in this properties"aspectNames": []
in my case when i click to manage aspect i cant see any thing in share but the aspect is added correctly.

Could the asterisks be in the name of aspect?

Related

How to expand non-entity reference in xml file with Ant

I have an XML file with the following content:
<root-tag>
<entry name="name1" value="/usr/bin" />
<entry name="full_path" value="${name2}" />
<entry name="name2" value="${name1}/dpkg" />
</root-tag>
I want to read this file in Ant and put the attribute value of value in the <entry> node whose name value is "full_path" into a property with Ant.
I can easily do this, e.g. using <xmltask> with its <copy> element:
<copy path="root-tag/entry[#name='full_path']/#value" property="outputProperty" />
However, what I get is ${name2}, which is meaningless to me. I need ${name2} to be resolved into the ${name1}/dpkg and then the ${name1} part is resolved into /usr/bin, as a result, /usr/bin/dpkg.
And I must look for "full_path" because the other two names can't be predicted.
Since this is not entity reference, <xmltask> can't automatically expand it.
How should I achieve my goal in Ant build file?
You can use anttask propertycopy for the same.
Refer link - http://ant-contrib.sourceforge.net/tasks/tasks/propertycopy.html

Front end label configuration in spring

I would like to have a external property (which has label name & value pairs) for each jsp pages in my web application.
I've done in this way like simply reading property file in a Map and placing in jsp using expression language.
Is there any other methodology to handle these in Java/Spring?
You can have these as message properties
http://www.mkyong.com/spring-mvc/spring-mvc-internationalization-example/
This also explains this in detail - http://www.journaldev.com/2610/spring-mvc-internationalization-i18n-and-localization-l10n-example
If you need these to be by locale, you can use localechangeInterceptor also.
You can PropertyPlaceholderConfigurer for external properties (eg the systemPropertiesMode property)
http://www.summa-tech.com/blog/2009/04/20/6-tips-for-managing-property-files-with-spring
There are also more ways to do this like http://howtodoinjava.com/2015/01/27/how-to-load-external-resources-files-into-spring-context/
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>locale\customer\messages</value>
</property>
</bean>
spring mvc and ReloadableResourceBundleMessageSource
Yes there is another way to show the labels in spring and this one is the best practice code.
enter link description here This will explain you how to use <spring:message code="label.viewUser" /> in your project.

IntelliJ IDEA plugin : Jump to declaration for custom xml

I have component based application. All of the components are defined in XML. The components may be defined in different xml files.
<!-- filename: components.xml -->
<components>
<component type="x" name="y">
<property1 attribute="attr"/>
<property2 attribute="attr"/>
</component>
<component type="a" name="b">
<property1 attribute="attr"/>
…
</component>
</components>
<!-- filename: extra-components.xml -->
<components>
<component type="x" name="z" extends="x:y"> <!-- this extends component x:y -->
<property3 attribute="attr"/>
</component>
</components>
Right now I'm trying to write a plugin so that I can jump from the child components to parent component. In the example above, the component type 'x' and name 'z' extends component type 'x' and name 'y'.
Going throughs some of the source from different plugins, I was able to add a menu item and grab content under the caret.
Say, if my caret is under "x:y" in second component, I can garb x and y so at least I can know the component type and component name to look for.
But I want to underline the contents under extends i.e. "x:y" when I press ctrl and search for the component and jump to the declaration of the component when ctrl+click like we jump to declaration of class.
I want guidance like which class should I look, how should I go or similar implementation.
Thanks
I think what you are looking for is a reference contributor.
See this answer for more details on how to set up a contributor. Once this contributor is created, I think you'll have two ways to find which XML element x:y refers to:
parse every potential XML file and try to find a tag with the correct attributes, then return the corresponding PsiElement
create an index of every component tag, and lookup x:y in this index (requires much more work)

Why would Spring be trying to use the properties variable reference string instead of the value?

Here's the problem in a nutshell:
<bean id="handlerFactory" class="com.westfieldgrp.audit.jdklogging.cpm.CPMHandlerFactory">
<property name="schemaName" value="${env.audit.databaseSchema}" />
<property name="bufferSize" value="${env.audit.bufferSize}" />
<property name="threaded" value="${env.audit.threadedAuditHandler}" />
<property name="dataSourceSelector" ref="dataSourceSelector" />
</bean>
bufferSize on the CPMHandlerFactory is an int. Spring is failing because it is trying to set the value to '${env.audit.bufferSize}' instead of the actual value from the properties file.
Now, when I change the name of the properties file or env.audit.bufferSize in the file, Spring complains that it can't find the property 'env.audit.bufferSize'. This says to me that it CAN find the property, but instead of setting the value to '20', it's trying to set it to '${env.audit.bufferSize}'. Can anyone explain why Spring might be doing this and what I can do about it?
Contents of the properties file below:
env.audit.databaseSchema=TDB2DATA
env.audit.dataSourceName=java:comp/env/AuditDataSourceAlias
env.audit.bufferSize=20
env.audit.threadedAuditHandler=true
Thanks,
Peter
EDIT:
Found the problem thanks to Jamestastic below. Here's what it was:
We have a "master" context file that looks like so:
<import resource="environmentBeans.xml" />
<import resource="serviceBeans.xml" />
<import resource="auditBeans.xml" />
The 'environmentBeans.xml' has the PropertyPlaceholderConfigurer in it. The problem was, I added some code that referenced the 'auditBeans.xml' context, which of course doesn't have the configurer. I switched it to reference the 'master' context and it works great.
The key was understanding why the values wouldn't get substituted out: because there was no property configurer.
So, Thanks!
Did you remember to add <context:property-placeholder /> or a PropertyPlaceholderConfigurer bean definition to your Spring context?

How do I make JPA POJO classes + Netbeans forms play well together?

I started using netbeans to design forms to edit the instances of various classes I have made in a small app I am writing. Basically, the app starts, an initial set of objects is selected from the DB and presented in a list, then an item in the list can be selected for editing. When the editor comes up it has form fields for many of the data fields in the class.
The problem I run into is that I have to create a controller that maps each of the data elements to the correct form element, and create an inordinate number of small conversion mapping lines of code to convert numbers into strings and set the correct element in a dropdown, then another inordinate amount of code to go back and update the underlying object with all the values from the form when the save button is clicked.
My question is; is there a more directly way to make the editing of the form directly modify the contents of my class instance? I would like to be able to have a default mapping "controller" that I can configure, then override the getter/setter for a particular field if needed. Ideally, there would be standard field validation for things like phone numbers, integers, floats, zip codes, etc...
I'm not averse to writing this myself, I would just like to see if it is already out there and use the right tool for the right job.
There are many approaches,
JBoss Seam, for instance, uses an Ant (And whether you do not know, NetBeans uses Ant behind the scenes) tool called hbmtemplate. It is a Template based Engine in which can be controlled by a user provided template or class. Along with Freemarker Template (.flt extension), it generates all of Application. If you want to see how see how Seam generates its Applications, Take a look at <SEAM_HOME>/seam-gen/view. There, you can see o lot of Freemarker Template.
Here is how Seam generates its Application
<hibernate templatepath="${templates.dir}">
<jpaconfiguration persistenceunit="${project.name}"/>
<classpath>
<dirset dir="${project.home}/exploded-archives">
<include name="*.war/WEB-INF/classes" if="project.war"/>
<include name="*.war/WEB-INF/dev" if="project.war"/>
<include name="*.jar" if="project.ear"/>
</dirset>
</classpath>
<property key="hibernatetool.util.toolclass" value="org.jboss.seam.tool.Util"/>
<hbmtemplate filepattern="{class-name}List.xhtml" template="view/list.xhtml.ftl" destdir="${project.home}/view" foreach="entity"/>
<hbmtemplate filepattern="{class-name}.xhtml" template="view/view.xhtml.ftl" destdir="${project.home}/view" foreach="entity"/>
<hbmtemplate filepattern="{class-name}.page.xml" template="view/view.page.xml.ftl" destdir="${project.home}/view" foreach="entity"/>
<hbmtemplate filepattern="{class-name}Edit.xhtml" template="view/edit.xhtml.ftl" destdir="${project.home}/view" foreach="entity"/>
<hbmtemplate filepattern="{class-name}Edit.page.xml" template="view/edit.page.xml.ftl" destdir="${project.home}/view" foreach="entity"/>
<hbmtemplate filepattern="${action.dir}/{class-name}List.java" template="src/EntityList.java.ftl" destdir="${project.home}/src" foreach="entity">
<property key="actionPackage" value="${action.package}"/>
</hbmtemplate>
<hbmtemplate filepattern="{class-name}List.page.xml" template="view/list.page.xml.ftl" destdir="${project.home}/view" foreach="entity"/>
<hbmtemplate filepattern="${action.dir}/{class-name}Home.java" template="src/EntityHome.java.ftl" destdir="${project.home}/src" foreach="entity">
<property key="actionPackage" value="${action.package}"/>
</hbmtemplate>
<hbmtemplate filepattern="menu.xhtml" template="view/layout/menu.xhtml.ftl" destdir="${project.home}/view/layout" foreach="entity"/>
</hibernate>
Here goes some code, not all, from FreeMarket Template view.xhtml.ftl
<#foreach property in pojo.allPropertiesIterator>
<#if !c2h.isCollection(property) && !isToOne(property) && property != pojo.versionProperty!>
<#include "viewproperty.xhtml.ftl">
</#if>
</#foreach>
I hope it can be useful to you
See my answer to your other question here. (In short: using beans binding would help a bit I hope)

Categories

Resources