Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.ClassName;
import com.liferay.portal.kernel.model.RoleConstants;
import com.liferay.portal.kernel.search.Indexer;
import com.liferay.portal.kernel.search.IndexerRegistryUtil;
Expand All @@ -67,6 +68,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;

/**
* Created by mapa, guno..
Expand Down Expand Up @@ -354,6 +356,16 @@ public static void addDDMTemplate(final Adt template, final long groupId)
throws SystemException, PortalException, IOException, URISyntaxException {

LOG.info("Adding ADT " + template.getName());

Optional<ClassName> className =
ClassNameLocalServiceUtil.getClassNames(0, ClassNameLocalServiceUtil.getClassNamesCount()).stream()
.filter(cName -> cName.getClassName().equals(template.getClassName())).findFirst();

if (!className.isPresent()) {
throw new IllegalArgumentException(
"The class name " + template.getClassName() + " does not exist within Liferay.");
}

long classNameId = PortalUtil.getClassNameId(template.getClassName());

long resourceClassnameId = Validator.isBlank(template.getResourceClassName())
Expand Down