- protected void initModelResources(Session adminSession) throws RepositoryException {
- // initialisation
- ResourceService resourceService = getResourceService();
- resourceService.initialiseResources(adminSession);
-
- // Resource resource = initResources.get("Countries");
- // if (resourceService.getTagLikeResourceParent(adminSession,
- // PeopleConstants.RESOURCE_COUNTRY) == null
- // && resource != null) {
- // resourceService.createTagLikeResourceParent(adminSession,
- // PeopleConstants.RESOURCE_COUNTRY,
- // PeopleTypes.PEOPLE_TAG_ENCODED_INSTANCE, PeopleNames.PEOPLE_CODE,
- // getBasePath(null),
- // JcrUiUtils.getLocalJcrItemName(NodeType.NT_UNSTRUCTURED), new
- // ArrayList<String>());
- // String EN_SHORT_NAME = "English short name (upper-lower case)";
- // String ISO_CODE = "Alpha-2 code";
- // new EncodedTagCsvFileParser(resourceService, adminSession,
- // PeopleConstants.RESOURCE_COUNTRY, ISO_CODE,
- // EN_SHORT_NAME).parse(resource.getInputStream(), "UTF-8");
- // }
- //
- // resource = initResources.get("Languages");
- // if (resourceService.getTagLikeResourceParent(adminSession,
- // PeopleConstants.RESOURCE_LANG) == null
- // && resource != null) {
- // resourceService.createTagLikeResourceParent(adminSession,
- // PeopleConstants.RESOURCE_LANG,
- // PeopleTypes.PEOPLE_TAG_ENCODED_INSTANCE, PeopleNames.PEOPLE_CODE,
- // getBasePath(null),
- // JcrUiUtils.getLocalJcrItemName(NodeType.NT_UNSTRUCTURED), new
- // ArrayList<String>());
- // String EN_SHORT_NAME = "Language name";
- // String ISO_CODE = "639-1";
- // new EncodedTagCsvFileParser(resourceService, adminSession,
- // PeopleConstants.RESOURCE_LANG, ISO_CODE,
- // EN_SHORT_NAME).parse(resource.getInputStream(), "UTF-8");
- // }
-
- // Create tag & mailing list parents
- if (resourceService.getTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_TAG) == null)
- resourceService.createTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_TAG,
- PeopleTypes.PEOPLE_TAG_INSTANCE, null, getBasePath(null), PeopleTypes.PEOPLE_ENTITY,
- PeopleNames.PEOPLE_TAGS);
- if (resourceService.getTagLikeResourceParent(adminSession, PeopleTypes.PEOPLE_MAILING_LIST) == null)
- resourceService.createTagLikeResourceParent(adminSession, null, PeopleTypes.PEOPLE_MAILING_LIST, null,
- getBasePath(null), PeopleTypes.PEOPLE_ENTITY, PeopleNames.PEOPLE_MAILING_LISTS);
-
- if (adminSession.hasPendingChanges()) {
- adminSession.save();
- log.info("Resources have been added to People's model");
+ protected void initModelResources(Session adminSession) {
+ try {
+ // initialisation
+ ResourceService resourceService = getResourceService();
+ resourceService.initialiseResources(adminSession);
+
+ Resource resource = initResources.get("Countries");
+ if (resourceService.getTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_COUNTRY) == null
+ && resource != null) {
+ resourceService.createTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_COUNTRY,
+ PeopleTypes.PEOPLE_TAG_ENCODED_INSTANCE, PeopleNames.PEOPLE_CODE, getBasePath(null),
+ ConnectJcrUtils.getLocalJcrItemName(NodeType.NT_UNSTRUCTURED), new ArrayList<String>());
+ String EN_SHORT_NAME = "English short name (upper-lower case)";
+ String ISO_CODE = "Alpha-2 code";
+ new EncodedTagCsvFileParser(resourceService, adminSession, PeopleConstants.RESOURCE_COUNTRY, ISO_CODE,
+ EN_SHORT_NAME).parse(resource.getInputStream(), "UTF-8");
+ }
+
+ resource = initResources.get("Languages");
+ if (resourceService.getTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_LANG) == null
+ && resource != null) {
+ resourceService.createTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_LANG,
+ PeopleTypes.PEOPLE_TAG_ENCODED_INSTANCE, PeopleNames.PEOPLE_CODE, getBasePath(null),
+ ConnectJcrUtils.getLocalJcrItemName(NodeType.NT_UNSTRUCTURED), new ArrayList<String>());
+ String EN_SHORT_NAME = "Language name";
+ String ISO_CODE = "639-1";
+ new EncodedTagCsvFileParser(resourceService, adminSession, PeopleConstants.RESOURCE_LANG, ISO_CODE,
+ EN_SHORT_NAME).parse(resource.getInputStream(), "UTF-8");
+ }
+
+ // Create tag & mailing list parents
+ if (resourceService.getTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_TAG) == null)
+ resourceService.createTagLikeResourceParent(adminSession, PeopleConstants.RESOURCE_TAG,
+ PeopleTypes.PEOPLE_TAG_INSTANCE, null, getBasePath(null), PeopleTypes.PEOPLE_ENTITY,
+ PeopleNames.PEOPLE_TAGS);
+ if (resourceService.getTagLikeResourceParent(adminSession, PeopleTypes.PEOPLE_MAILING_LIST) == null)
+ resourceService.createTagLikeResourceParent(adminSession, null, PeopleTypes.PEOPLE_MAILING_LIST, null,
+ getBasePath(null), PeopleTypes.PEOPLE_ENTITY, PeopleNames.PEOPLE_MAILING_LISTS);
+
+ // Initialise catalogues
+ importCatalogue(adminSession, initResources.get("SimpleTasks"), PeopleTypes.PEOPLE_TASK);
+
+ if (adminSession.hasPendingChanges()) {
+ adminSession.save();
+ log.info("Resources have been added to Argeo Suite model");
+ }
+ } catch (IOException | RepositoryException e) {
+ throw new SuiteException("Cannot initialise resources ", e);