public static AllowableActions convert(CmisAllowableActionsType allowableActions) {
if (allowableActions == null) {
return null;
}
AllowableActionsImpl result = new AllowableActionsImpl();
Set<Action> set = EnumSet.noneOf(Action.class);
if (Boolean.TRUE.equals(allowableActions.isCanAddObjectToFolder())) {
set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
}
if (Boolean.TRUE.equals(allowableActions.isCanApplyACL())) {
set.add(Action.CAN_APPLY_ACL);
}
if (Boolean.TRUE.equals(allowableActions.isCanApplyPolicy())) {
set.add(Action.CAN_APPLY_POLICY);
}
if (Boolean.TRUE.equals(allowableActions.isCanCancelCheckOut())) {
set.add(Action.CAN_CANCEL_CHECK_OUT);
}
if (Boolean.TRUE.equals(allowableActions.isCanCheckIn())) {
set.add(Action.CAN_CHECK_IN);
}
if (Boolean.TRUE.equals(allowableActions.isCanCheckOut())) {
set.add(Action.CAN_CHECK_OUT);
}
if (Boolean.TRUE.equals(allowableActions.isCanCreateDocument())) {
set.add(Action.CAN_CREATE_DOCUMENT);
}
if (Boolean.TRUE.equals(allowableActions.isCanCreateFolder())) {
set.add(Action.CAN_CREATE_FOLDER);
}
if (Boolean.TRUE.equals(allowableActions.isCanCreateRelationship())) {
set.add(Action.CAN_CREATE_RELATIONSHIP);
}
if (Boolean.TRUE.equals(allowableActions.isCanCreateItem())) {
set.add(Action.CAN_CREATE_ITEM);
}
if (Boolean.TRUE.equals(allowableActions.isCanDeleteContentStream())) {
set.add(Action.CAN_DELETE_CONTENT_STREAM);
}
if (Boolean.TRUE.equals(allowableActions.isCanDeleteObject())) {
set.add(Action.CAN_DELETE_OBJECT);
}
if (Boolean.TRUE.equals(allowableActions.isCanDeleteTree())) {
set.add(Action.CAN_DELETE_TREE);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetACL())) {
set.add(Action.CAN_GET_ACL);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetAllVersions())) {
set.add(Action.CAN_GET_ALL_VERSIONS);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetAppliedPolicies())) {
set.add(Action.CAN_GET_APPLIED_POLICIES);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetChildren())) {
set.add(Action.CAN_GET_CHILDREN);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetContentStream())) {
set.add(Action.CAN_GET_CONTENT_STREAM);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetDescendants())) {
set.add(Action.CAN_GET_DESCENDANTS);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetFolderParent())) {
set.add(Action.CAN_GET_FOLDER_PARENT);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetFolderTree())) {
set.add(Action.CAN_GET_FOLDER_TREE);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetObjectParents())) {
set.add(Action.CAN_GET_OBJECT_PARENTS);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetObjectRelationships())) {
set.add(Action.CAN_GET_OBJECT_RELATIONSHIPS);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetProperties())) {
set.add(Action.CAN_GET_PROPERTIES);
}
if (Boolean.TRUE.equals(allowableActions.isCanGetRenditions())) {
set.add(Action.CAN_GET_RENDITIONS);
}
if (Boolean.TRUE.equals(allowableActions.isCanMoveObject())) {
set.add(Action.CAN_MOVE_OBJECT);
}
if (Boolean.TRUE.equals(allowableActions.isCanRemoveObjectFromFolder())) {
set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
}
if (Boolean.TRUE.equals(allowableActions.isCanRemovePolicy())) {
set.add(Action.CAN_REMOVE_POLICY);
}
if (Boolean.TRUE.equals(allowableActions.isCanSetContentStream())) {
set.add(Action.CAN_SET_CONTENT_STREAM);
}
if (Boolean.TRUE.equals(allowableActions.isCanUpdateProperties())) {
set.add(Action.CAN_UPDATE_PROPERTIES);
}
result.setAllowableActions(set);
// handle extensions
convertExtension(allowableActions, result);
return result;