- return itemId instanceof OnapPDPGroup;
- }
-
- public synchronized void refreshGroups() {
- synchronized(this.groups) {
- this.groups.clear();
- try {
- this.groups.addAll(this.papEngine.getOnapPDPGroups());
- } catch (PAPException e) {
- String message = "Unable to retrieve Groups from server: " + e;
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + message, e);
- }
- LOGGER.info("refreshGroups");
- }
- //
- // Notify that we have changed
- //
- this.fireItemSetChange();
- }
-
- public List<OnapPDPGroup> getGroups() {
- return Collections.unmodifiableList(this.groups);
- }
-
- public void makeDefault(OnapPDPGroup group) {
- try {
- this.papEngine.setDefaultGroup(group);
- } catch (PAPException e) {
- String message = "Unable to set Default Group on server: " + e;
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + message, e);
- }
- return;
- }
-
- public void removeGroup(OnapPDPGroup group, OnapPDPGroup newGroup) throws PAPException {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("removeGroup: " + group + " new group for PDPs: " + newGroup);
- }
- if (group.isDefaultGroup()) {
- throw new UnsupportedOperationException("You can't remove the Default Group.");
- }
- try {
- this.papEngine.removeGroup(group, newGroup);
- } catch (NullPointerException | PAPException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to removeGroup " + group.getId(), e);
- throw new PAPException("Failed to remove group '" + group.getId()+ "'", e);
- }
- }
-
- public void removePDP(OnapPDP pdp, OnapPDPGroup group) throws PAPException {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("removePDP: " + pdp + " from group: " + group);
- }
- try {
- this.papEngine.removePDP(pdp);
- } catch (PAPException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to removePDP " + pdp.getId(), e);
- throw new PAPException("Failed to remove pdp '" + pdp.getId()+ "'", e);
- }
- }
-
- public void updatePDP(OnapPDP pdp) {
- try {
- papEngine.updatePDP(pdp);
- } catch (PAPException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
- }
-
- public void updateGroup(OnapPDPGroup group) {
- try {
- papEngine.updateGroup(group);
- } catch (PAPException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
- }
-
- @Override
- public Collection<?> getContainerPropertyIds() {
- return pDPProperties;
- }
-
- @Override
- public Collection<?> getItemIds() {
- final Collection<Object> items = new ArrayList<>();
- items.addAll(this.groups);
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getItemIds: " + items);
- }
- return Collections.unmodifiableCollection(items);
- }
-
- @Override
- public Class<?> getType(Object propertyId) {
+ return itemId instanceof OnapPDPGroup;
+ }
+
+ /**
+ * refreshGroups.
+ */
+ public synchronized void refreshGroups() {
+ synchronized (this.groups) {
+ this.groups.clear();
+ try {
+ this.groups.addAll(this.papEngine.getOnapPDPGroups());
+ } catch (PAPException e) {
+ String message = "Unable to retrieve Groups from server: " + e;
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + message, e);
+ }
+ LOGGER.info("refreshGroups");
+ }
+ //
+ // Notify that we have changed
+ //
+ this.fireItemSetChange();
+ }
+
+ public List<OnapPDPGroup> getGroups() {
+ return Collections.unmodifiableList(this.groups);
+ }
+
+ /**
+ * makeDefault.
+ *
+ * @param group OnapPDPGroup
+ */
+ public void makeDefault(OnapPDPGroup group) {
+ try {
+ this.papEngine.setDefaultGroup(group);
+ } catch (PAPException e) {
+ String message = "Unable to set Default Group on server: " + e;
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + message, e);
+ }
+ return;
+ }
+
+ /**
+ * removeGroup.
+ *
+ * @param group OnapPDPGroup
+ * @param newGroup OnapPDPGroup
+ * @throws PAPException PAPException
+ */
+ public void removeGroup(OnapPDPGroup group, OnapPDPGroup newGroup) throws PAPException {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("removeGroup: " + group + " new group for PDPs: " + newGroup);
+ }
+ if (group.isDefaultGroup()) {
+ throw new UnsupportedOperationException("You can't remove the Default Group.");
+ }
+ try {
+ this.papEngine.removeGroup(group, newGroup);
+ } catch (NullPointerException | PAPException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to removeGroup " + group.getId(), e);
+ throw new PAPException("Failed to remove group '" + group.getId() + "'", e);
+ }
+ }
+
+ /**
+ * removePDP.
+ *
+ * @param pdp OnapPDP
+ * @param group OnapPDPGroup
+ * @throws PAPException PAPException
+ */
+ public void removePDP(OnapPDP pdp, OnapPDPGroup group) throws PAPException {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("removePDP: " + pdp + " from group: " + group);
+ }
+ try {
+ this.papEngine.removePDP(pdp);
+ } catch (PAPException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to removePDP " + pdp.getId(), e);
+ throw new PAPException("Failed to remove pdp '" + pdp.getId() + "'", e);
+ }
+ }
+
+ /**
+ * updatePDP.
+ *
+ * @param pdp OnapPDP
+ */
+ public void updatePDP(OnapPDP pdp) {
+ try {
+ papEngine.updatePDP(pdp);
+ } catch (PAPException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+ }
+ }
+
+ /**
+ * updateGroup.
+ *
+ * @param group OnapPDPGroup
+ */
+ public void updateGroup(OnapPDPGroup group) {
+ try {
+ papEngine.updateGroup(group);
+ } catch (PAPException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+ }
+ }
+
+ /**
+ * Update group.
+ *
+ * @param group the group
+ * @param userName the user name
+ */
+ public void updateGroup(OnapPDPGroup group, String userName) {
+ try {
+ papEngine.updateGroup(group, userName);
+ } catch (PAPException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+ }
+ }
+
+ @Override
+ public Collection<?> getContainerPropertyIds() {
+ return pDPProperties;
+ }
+
+ @Override
+ public Collection<?> getItemIds() {
+ final Collection<Object> items = new ArrayList<>();
+ items.addAll(this.groups);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("getItemIds: " + items);
+ }
+ return Collections.unmodifiableCollection(items);
+ }
+
+ @Override
+ public List<?> getItemIds(int startIndex, int numberOfItems) {
+ synchronized (this.groups) {
+ int endIndex = startIndex + numberOfItems;
+ if (endIndex > this.groups.size()) {
+ endIndex = this.groups.size() - 1;
+ }
+ return this.groups.subList(startIndex, endIndex);
+ }
+ }
+
+ @Override
+ public Class<?> getType(Object propertyId) {