Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Certification work item convergence, part 2: work item outcome as URI…
… (+ fixed XMLs in tests).
- Loading branch information
Showing
20 changed files
with
164 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...certification-api/src/main/java/com/evolveum/midpoint/certification/api/OutcomeUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (c) 2010-2017 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.evolveum.midpoint.certification.api; | ||
|
||
import com.evolveum.midpoint.schema.constants.SchemaConstants; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemOutcomeType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemResultType; | ||
import org.apache.commons.lang.BooleanUtils; | ||
|
||
/** | ||
* TEMPORARY | ||
* ========= | ||
* | ||
* @author mederly | ||
*/ | ||
public class OutcomeUtils { | ||
|
||
public static String toUri(AccessCertificationResponseType response) { | ||
if (response == null || response == AccessCertificationResponseType.NO_RESPONSE) { | ||
return null; | ||
} | ||
switch (response) { | ||
case ACCEPT: return SchemaConstants.MODEL_CERTIFICATION_OUTCOME_ACCEPT; | ||
case REVOKE: return SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REVOKE; | ||
case REDUCE: return SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REDUCE; | ||
case NOT_DECIDED: return SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NOT_DECIDED; | ||
default: throw new AssertionError("Unexpected response: " + response); | ||
} | ||
} | ||
|
||
public static AccessCertificationResponseType fromUri(String uri) { | ||
if (uri == null) { | ||
return null; | ||
} else if (SchemaConstants.MODEL_CERTIFICATION_OUTCOME_ACCEPT.equals(uri)) { | ||
return AccessCertificationResponseType.ACCEPT; | ||
} else if (SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REVOKE.equals(uri)) { | ||
return AccessCertificationResponseType.REVOKE; | ||
} else if (SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REDUCE.equals(uri)) { | ||
return AccessCertificationResponseType.REDUCE; | ||
} else if (SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NOT_DECIDED.equals(uri)) { | ||
return AccessCertificationResponseType.NOT_DECIDED; | ||
} else { | ||
throw new IllegalArgumentException("Unrecognized URI: " + uri); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.