@Override protected StagedModel getStagedModel(String uuid, Group group) { try { return AssetCategoryLocalServiceUtil.getAssetCategoryByUuidAndGroupId( uuid, group.getGroupId()); } catch (Exception e) { return null; } }
private long[] _getLeftAndRightCategoryIds(long[] categoryIds) { long[] leftRightIds = new long[categoryIds.length * 3]; for (int i = 0; i < categoryIds.length; i++) { long categoryId = categoryIds[i]; try { AssetCategory category = AssetCategoryLocalServiceUtil.getCategory(categoryId); leftRightIds[3 * i] = category.getGroupId(); leftRightIds[3 * i + 1] = category.getLeftCategoryId(); leftRightIds[3 * i + 2] = category.getRightCategoryId(); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Error retrieving category " + categoryId); } } } return leftRightIds; }
@Override protected void validateImport( Map<String, List<StagedModel>> dependentStagedModelsMap, Group group) throws Exception { List<StagedModel> categoryDependentStagedModels = dependentStagedModelsMap.get(AssetCategory.class.getSimpleName()); Assert.assertEquals(1, categoryDependentStagedModels.size()); AssetCategory category = (AssetCategory) categoryDependentStagedModels.get(0); AssetCategoryLocalServiceUtil.getAssetCategoryByUuidAndGroupId( category.getUuid(), group.getGroupId()); List<StagedModel> vocabularyDependentStagedModels = dependentStagedModelsMap.get(AssetVocabulary.class.getSimpleName()); Assert.assertEquals(1, vocabularyDependentStagedModels.size()); AssetVocabulary vocabulary = (AssetVocabulary) vocabularyDependentStagedModels.get(0); AssetVocabularyLocalServiceUtil.getAssetVocabularyByUuidAndGroupId( vocabulary.getUuid(), group.getGroupId()); }