Foros de discusión

access variable defined in Document and Media

thumbnail
babak naddaf, modificado hace 9 años.

access variable defined in Document and Media

New Member Mensajes: 23 Fecha de incorporación: 6/07/11 Mensajes recientes
Hello Every one

I have a problem fetching information (through JAVA API) stored under the variable defined in the Structure of Document and Media Portlet.
I can retrieve the name of the defined variables but the value of that variable is missing:

.
.
.

DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.getDLFileEntry(classPk);
Map<String, Fields> map = dlFileEntry.getFieldsMap(dlFileEntry.getFileVersion().getFileVersionId());
Set<String> set = map.keySet();
Collection<Fields> fieldses = map.values();

for(Fields f : fieldses){
Set<String> list = f.getNames();
for(String s : list){
document = f.get(s).getDDMStructure().getDocument();
}
}

System.out.println(" the xml file which contains information about related entry : " + document.asXML());

if(Validator.isNotNull(document)) {
Node fieldContent = document.selectSingleNode("//*/dynamic-element[@name='"+fieldName+"']/meta-data/entry[@name='label']");
if(fieldContent != null) {
fieldValue = fieldContent.getText();
}
}
.
.
.

is anyone can help me?

BEST
thumbnail
Prakash Khanchandani, modificado hace 9 años.

RE: access variable defined in Document and Media

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
Which variables value do you want? Can you explain a little more in detail as to what you want to do and what & where exactly its failing.

Thanks,
Prakash
thumbnail
babak naddaf, modificado hace 9 años.

RE: access variable defined in Document and Media

New Member Mensajes: 23 Fecha de incorporación: 6/07/11 Mensajes recientes
Thank Prakash for your quick answer:

The problem is as follow:

I have defined two variable for a Document Type in Document and Media ( Content -> Document and Media -> Manage-> Document Types).
for example: var1= PODCASTIMAGE , var2=PODCASTDATE. Then i have created a content under that document type. After that i have tried to fetch information of that variables by liferay java apis (in order to use them in Application Display Template by FreeMarker).

note: there is no problem in FreeMaker, i can simply use a java service in FreeMarker by using SpringBeanLocator and VelocityBeanLocator.

note: the main problem is finding a java api which returns the values of PODCASTIMAG and PODCASTDATE for a specific content.

BEST