cancel
Showing results for 
Search instead for 
Did you mean: 

Create Collection with a defined layout (thumbnail)- KM API

Former Member
0 Kudos

Hi, I have developed a code that create a folder (collection) in KM using de the API. But I have the problem, that the folder have to be set with thumbnail layout. Have anyone any idea of how to do that?. Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Martin,

I wrote this code to set a layout set in a folder:

configurarLayout receive as parameter a folder an a user. The idea is for this user and folder set a layout set profile "Managers_NewsBrowser_Profile".

Don't forget to create this profile, for it you only need to configure from portal.

private void configurarLayout(ICollection articulos, IUser user) throws WcmException {

IUriMapperService pepe = null;

ILayoutService layoutService;

layoutService = (ILayoutService) ResourceFactory.getInstance().getServiceFactory().getRepositoryService(articulos, IWcmConst.LAYOUT_SERVICE);

pepe = UriMapperServiceFactory.getInstance();

String user1 = pepe.getConstantID(articulos.getRID());

ILayoutContext context = layoutService.getContextForUser(user, user1);

logger.errorT("UserID " + context.getCommonContext().getUserID());

IProfileIterator iProfileIterator = layoutService.getProfiles().iterator();

IProfile profilePosta = null;

while (iProfileIterator.hasNext() && profilePosta == null) {

IProfile element = iProfileIterator.next();

if (element.getName().equalsIgnoreCase("Managers_NewsBrowser_Profile")) {

profilePosta = element;

}

}

boolean resultado = false;

resultado = layoutService.saveProfile(articulos, profilePosta, context.getCommonContext());

if (resultado = false)

logger.errorT("Grabacion erronea");

}

Patricio.