additionalPermissionDetails = new HashMap();
additionalPermissionDetails.put(KimConstants.AttributeConstants.ACTION_REQUEST_CD, actionRequestCode);
return isAuthorizedByTemplate(document,
KNSConstants.KUALI_RICE_WORKFLOW_NAMESPACE,
KimConstants.PermissionTemplateNames.AD_HOC_REVIEW_DOCUMENT,
user.getPrincipalId(), additionalPermissionDetails, null );
}
public final boolean canOpen(Document document, Person user) {
return isAuthorizedByTemplate(document, KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.OPEN_DOCUMENT, user
.getPrincipalId());
}
public final boolean canAddNoteAttachment(Document document,
String attachmentTypeCode, Person user) {
Map additionalPermissionDetails = new HashMap();
if (attachmentTypeCode != null) {
additionalPermissionDetails.put(KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE,
attachmentTypeCode);
}
return isAuthorizedByTemplate(document, KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.ADD_NOTE_ATTACHMENT, user
.getPrincipalId(), additionalPermissionDetails, null);
}
public final boolean canDeleteNoteAttachment(Document document,
String attachmentTypeCode, String createdBySelfOnly, Person user) {
Map additionalPermissionDetails = new HashMap();
if (attachmentTypeCode != null) {
additionalPermissionDetails.put(KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE,
attachmentTypeCode);
}
additionalPermissionDetails.put(KimConstants.AttributeConstants.CREATED_BY_SELF,
createdBySelfOnly);
return isAuthorizedByTemplate(document, KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.DELETE_NOTE_ATTACHMENT,
user.getPrincipalId(), additionalPermissionDetails, null);
}
public final boolean canViewNoteAttachment(Document document,
String attachmentTypeCode, Person user) {
Map additionalPermissionDetails = new HashMap();
if (attachmentTypeCode != null) {
additionalPermissionDetails.put(KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE,
attachmentTypeCode);
}
return isAuthorizedByTemplate(document, KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.VIEW_NOTE_ATTACHMENT, user
.getPrincipalId(), additionalPermissionDetails, null);
}
public final boolean canSendAdHocRequests(Document document,
String actionRequestCd, Person user) {
Map additionalPermissionDetails = new HashMap();
if (actionRequestCd != null) {
additionalPermissionDetails.put(KimConstants.AttributeConstants.ACTION_REQUEST_CD,
actionRequestCd);
}
return isAuthorizedByTemplate(document, KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.SEND_AD_HOC_REQUEST, user
.getPrincipalId(), additionalPermissionDetails, null);
}
public boolean canEditDocumentOverview(Document document, Person user){
return isAuthorizedByTemplate(document,
KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.EDIT_DOCUMENT,
user.getPrincipalId()) && this.isDocumentInitiator(document, user);
}
protected final boolean canSendAnyTypeAdHocRequests(Document document, Person user) {
if(canSendAdHocRequests(document, KEWConstants.ACTION_REQUEST_FYI_REQ, user)) {
try {
DocumentTypeDTO docType = KNSServiceLocatorWeb.getWorkflowInfoService().getDocType(document.getDocumentHeader().getWorkflowDocument().getDocumentType());
ProcessDTO process = docType.getRoutePath().getPrimaryProcess();
if (process != null) {
if (process.getInitialRouteNode() == null) {
return false;
}
} else {
return false;
}
} catch (WorkflowException e) {
return false;
}
return true;
}else if(canSendAdHocRequests(document, KEWConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, user)){
return true;
}
return canSendAdHocRequests(document, KEWConstants.ACTION_REQUEST_APPROVE_REQ, user);
}
protected boolean canTakeRequestedAction(Document document,
String actionRequestCode, Person user) {
Map additionalPermissionDetails = new HashMap();
additionalPermissionDetails.put(KimConstants.AttributeConstants.ACTION_REQUEST_CD,
actionRequestCode);
return isAuthorizedByTemplate(document, KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.TAKE_REQUESTED_ACTION,
user.getPrincipalId(), additionalPermissionDetails, null);
}
@Override
protected void addPermissionDetails(Object dataObject,
Map attributes) {
super.addPermissionDetails(dataObject, attributes);
if (dataObject instanceof Document) {
addStandardAttributes((Document) dataObject, attributes);
}
}
@Override
protected void addRoleQualification(Object dataObject,
Map attributes) {
super.addRoleQualification(dataObject, attributes);
if (dataObject instanceof Document) {
addStandardAttributes((Document) dataObject, attributes);
}
}
protected void addStandardAttributes(Document document,
Map attributes) {
KualiWorkflowDocument wd = document.getDocumentHeader()
.getWorkflowDocument();
attributes.put(KimConstants.AttributeConstants.DOCUMENT_NUMBER, document
.getDocumentNumber());
attributes.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, wd.getDocumentType());
if (wd.stateIsInitiated() || wd.stateIsSaved()) {
attributes.put(KimConstants.AttributeConstants.ROUTE_NODE_NAME,
PRE_ROUTING_ROUTE_NAME);
} else {
attributes.put(KimConstants.AttributeConstants.ROUTE_NODE_NAME, wd
.getCurrentRouteNodeNames());
}
attributes.put(KimConstants.AttributeConstants.ROUTE_STATUS_CODE, wd.getRouteHeader()
.getDocRouteStatus());
}
protected boolean isDocumentInitiator(Document document, Person user) {
KualiWorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
return workflowDocument.getInitiatorPrincipalId().equalsIgnoreCase(user.getPrincipalId());
}
}
]]>
model)
throws IllegalArgumentException, ErrorList {
ErrorList errors = new ErrorList();
Notification notification = new Notification();
// grab data from form
// channel name
String channelName = request.getParameter("channelName");
if (StringUtils.isEmpty(channelName) || StringUtils.equals(channelName, NONE_CHANNEL)) {
errors.addError("You must choose a channel.");
} else {
model.put("channelName", channelName);
}
// priority name
String priorityName = request.getParameter("priorityName");
if (StringUtils.isEmpty(priorityName)) {
errors.addError("You must choose a priority.");
} else {
model.put("priorityName", priorityName);
}
// sender names
String senderNames = request.getParameter("senderNames");
String[] senders = null;
if (StringUtils.isEmpty(senderNames)) {
errors.addError("You must enter at least one sender.");
} else {
senders = StringUtils.split(senderNames, ",");
model.put("senderNames", senderNames);
}
// delivery type
String deliveryType = request.getParameter("deliveryType");
if (StringUtils.isEmpty(deliveryType)) {
errors.addError("You must choose a type.");
} else {
if (deliveryType
.equalsIgnoreCase(NotificationConstants.DELIVERY_TYPES.FYI)) {
deliveryType = NotificationConstants.DELIVERY_TYPES.FYI;
} else {
deliveryType = NotificationConstants.DELIVERY_TYPES.ACK;
}
model.put("deliveryType", deliveryType);
}
// get datetime when form was initially rendered
String originalDateTime = request.getParameter("originalDateTime");
Date origdate = null;
Date senddate = null;
Date removedate = null;
try {
origdate = Util.parseUIDateTime(originalDateTime);
} catch (ParseException pe) {
errors.addError("Original date is invalid.");
}
// send date time
String sendDateTime = request.getParameter("sendDateTime");
if (StringUtils.isBlank(sendDateTime)) {
sendDateTime = Util.getCurrentDateTime();
}
try {
senddate = Util.parseUIDateTime(sendDateTime);
} catch (ParseException pe) {
errors.addError("You specified an invalid Send Date/Time. Please use the calendar picker.");
}
if(senddate != null && senddate.before(origdate)) {
errors.addError("Send Date/Time cannot be in the past.");
}
model.put("sendDateTime", sendDateTime);
// auto remove date time
String autoRemoveDateTime = request.getParameter("autoRemoveDateTime");
if (StringUtils.isNotBlank(autoRemoveDateTime)) {
try {
removedate = Util.parseUIDateTime(autoRemoveDateTime);
} catch (ParseException pe) {
errors.addError("You specified an invalid Auto-Remove Date/Time. Please use the calendar picker.");
}
if(removedate != null) {
if(removedate.before(origdate)) {
errors.addError("Auto-Remove Date/Time cannot be in the past.");
} else if (senddate != null && removedate.before(senddate)){
errors.addError("Auto-Remove Date/Time cannot be before the Send Date/Time.");
}
}
}
model.put("autoRemoveDateTime", autoRemoveDateTime);
// user recipient names
String[] userRecipients = parseUserRecipients(request);
// workgroup recipient names
String[] workgroupRecipients = parseWorkgroupRecipients(request);
// workgroup namespace codes
String[] workgroupNamespaceCodes = parseWorkgroupNamespaceCodes(request);
// title
String title = request.getParameter("title");
if (!StringUtils.isEmpty(title)) {
model.put("title", title);
} else {
errors.addError("You must fill in a title");
}
// message
String message = request.getParameter("message");
if (StringUtils.isEmpty(message)) {
errors.addError("You must fill in a message.");
} else {
model.put("message", message);
}
]]>
getRows() {
List superRows = super.getRows();
List returnRows = new ArrayList();
returnRows.addAll(superRows);
returnRows.addAll(rows);
return returnRows;
}
@Override
public boolean checkForAdditionalFields(Map fieldValues) {
String ruleTemplateNameParam = (String) fieldValues.get(RULE_TEMPLATE_PROPERTY_NAME);
if (ruleTemplateNameParam != null && !ruleTemplateNameParam.equals("")) {
rows = new ArrayList();
RuleTemplate ruleTemplate = null;
ruleTemplate = getRuleTemplateService().findByRuleTemplateName(ruleTemplateNameParam);
for (Object element : ruleTemplate.getActiveRuleTemplateAttributes()) {
RuleTemplateAttribute ruleTemplateAttribute = (RuleTemplateAttribute) element;
if (!ruleTemplateAttribute.isWorkflowAttribute()) {
continue;
}
WorkflowAttribute attribute = ruleTemplateAttribute.getWorkflowAttribute();
RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute();
if (ruleAttribute.getType().equals(KEWConstants.RULE_XML_ATTRIBUTE_TYPE)) {
((GenericXMLRuleAttribute) attribute).setRuleAttribute(ruleAttribute);
}
// run through the attributes fields once to populate field values we have to do this
// to allow rows dependent on another row value to populate correctly in the loop below
List searchRows = null;
if (attribute instanceof OddSearchAttribute) {
searchRows = ((OddSearchAttribute) attribute).getSearchRows();
} else {
searchRows = attribute.getRuleRows();
}
for (Row row : searchRows) {
List fields = new ArrayList();
for (Field field2 : row.getFields()) {
Field field = field2;
if (fieldValues.get(field.getPropertyName()) != null) {
field.setPropertyValue(fieldValues.get(field.getPropertyName()));
}
fields.add(field);
fieldValues.put(field.getPropertyName(), field.getPropertyValue());
}
}
if (attribute instanceof OddSearchAttribute) {
((OddSearchAttribute) attribute).validateSearchData(fieldValues);
} else {
attribute.validateRuleData(fieldValues);// populate attribute
}
if (attribute instanceof OddSearchAttribute) {
searchRows = ((OddSearchAttribute) attribute).getSearchRows();
} else {
searchRows = attribute.getRuleRows();
}
for (Object element2 : searchRows) {
Row row = (Row) element2;
List fields = new ArrayList();
for (Field field : row.getFields()) {
if (fieldValues.get(field.getPropertyName()) != null) {
field.setPropertyValue(fieldValues.get(field.getPropertyName()));
}
fields.add(field);
fieldValues.put(field.getPropertyName(), field.getPropertyValue());
}
row.setFields(fields);
rows.add(row);
}
}
return true;
}
rows.clear();
return false;
}
@Override
public List extends BusinessObject> getSearchResults(Map fieldValues) {
]]>
boClass, Person user) {
AttributeSet permissionDetails = new AttributeSet();
permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME,
getMaintenanceDocumentDictionaryService().getDocumentTypeName(
boClass));
permissionDetails.put(KNSConstants.MAINTENANCE_ACTN,
KNSConstants.MAINTENANCE_NEW_ACTION);
return !permissionExistsByTemplate(KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS,
permissionDetails)
|| getIdentityManagementService()
.isAuthorizedByTemplateName(
user.getPrincipalId(),
KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS,
permissionDetails, new AttributeSet());
}
public final boolean canMaintain(Object dataObject, Person user) {
Map permissionDetails = new HashMap(2);
permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME,
getMaintenanceDocumentDictionaryService().getDocumentTypeName(
dataObject.getClass()));
permissionDetails.put(KNSConstants.MAINTENANCE_ACTN,
KNSConstants.MAINTENANCE_EDIT_ACTION);
return !permissionExistsByTemplate(KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS,
permissionDetails)
|| isAuthorizedByTemplate(
dataObject,
KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS,
user.getPrincipalId(), permissionDetails, null);
}
public final boolean canCreateOrMaintain(
MaintenanceDocument maintenanceDocument, Person user) {
return !permissionExistsByTemplate(maintenanceDocument,
KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS)
|| isAuthorizedByTemplate(
maintenanceDocument,
KNSConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS,
user.getPrincipalId());
}
public Set getSecurePotentiallyHiddenSectionIds() {
return new HashSet();
}
public Set getSecurePotentiallyReadOnlySectionIds() {
return new HashSet();
}
@SuppressWarnings("unchecked")
@Override
protected void addRoleQualification(Object dataObject, Map attributes) {
super.addRoleQualification(dataObject, attributes);
if (dataObject instanceof MaintenanceDocument) {
MaintenanceDocument maintDoc = (MaintenanceDocument)dataObject;
if ( maintDoc.getNewMaintainableObject() != null ) {
attributes.putAll(KNSUtils.getNamespaceAndComponentSimpleName(maintDoc.getNewMaintainableObject().getBoClass()));
}
}
}
@SuppressWarnings("unchecked")
@Override
protected void addPermissionDetails(Object dataObject, Map attributes) {
super.addPermissionDetails(dataObject, attributes);
if (dataObject instanceof MaintenanceDocument) {
MaintenanceDocument maintDoc = (MaintenanceDocument)dataObject;
if ( maintDoc.getNewMaintainableObject() != null ) {
attributes.putAll(KNSUtils.getNamespaceAndComponentSimpleName(maintDoc.getNewMaintainableObject().getBoClass()));
attributes.put(KNSConstants.MAINTENANCE_ACTN,maintDoc.getNewMaintainableObject().getMaintenanceAction());
}
}
}
protected final MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService() {
if (maintenanceDocumentDictionaryService == null) {
maintenanceDocumentDictionaryService = KNSServiceLocatorWeb.getMaintenanceDocumentDictionaryService();
}
return maintenanceDocumentDictionaryService;
}
}
]]>
0) {
recipientsExist = true;
for (String userRecipientId : userRecipients) {
if (isUserRecipientValid(userRecipientId, errors)) {
NotificationRecipient recipient = new NotificationRecipient();
recipient.setRecipientType(KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE);
recipient.setRecipientId(userRecipientId);
notification.addRecipient(recipient);
}
}
}
if (workgroupRecipients != null && workgroupRecipients.length > 0) {
recipientsExist = true;
if (workgroupNamespaceCodes != null && workgroupNamespaceCodes.length > 0) {
if (workgroupNamespaceCodes.length == workgroupRecipients.length) {
for (int i = 0; i < workgroupRecipients.length; i++) {
if (isWorkgroupRecipientValid(workgroupRecipients[i], workgroupNamespaceCodes[i], errors)) {
NotificationRecipient recipient = new NotificationRecipient();
recipient.setRecipientType(KimGroupMemberTypes.GROUP_MEMBER_TYPE);
recipient.setRecipientId(
getIdentityManagementService().getGroupByName(workgroupNamespaceCodes[i], workgroupRecipients[i]).getId());
notification.addRecipient(recipient);
}
}
} else {
errors.addError("The number of groups must match the number of namespace codes");
}
} else {
errors.addError("You must specify a namespace code for every group name");
}
} else if (workgroupNamespaceCodes != null && workgroupNamespaceCodes.length > 0) {
errors.addError("You must specify a group name for every namespace code");
}
// check to see if there were any errors
if (errors.getErrors().size() > 0) {
throw errors;
}
notification.setTitle(title);
notification.setDeliveryType(deliveryType);
// simpledateformat is not threadsafe, have to sync and validate
Date d = null;
]]>
,MaxAgeSoftReference>> permissionToRoleCache = Collections.synchronizedMap( new HashMap,MaxAgeSoftReference>>() );
// Not ThreadLocal or time limited- should not change during the life of the system
private Map permissionTypeServiceByNameCache = Collections.synchronizedMap( new HashMap() );
private static final long CACHE_MAX_AGE_SECONDS = 60L;
protected BusinessObjectService getBusinessObjectService() {
if ( businessObjectService == null ) {
businessObjectService = KNSServiceLocator.getBusinessObjectService();
}
return businessObjectService;
}
public void flushPermissionImplCache() {
getCacheAdministrator().flushGroup(PERMISSION_IMPL_CACHE_GROUP);
}
/**
* @return the permissionTypeServiceByNameCache
*/
protected Map getPermissionTypeServiceByNameCache() {
return this.permissionTypeServiceByNameCache;
}
protected void addRolesForPermissionsToCache( List key, List roleIds ) {
permissionToRoleCache.put( key, new MaxAgeSoftReference>( CACHE_MAX_AGE_SECONDS, roleIds ) );
}
protected List getRolesForPermissionsFromCache( List key ) {
List roleIds = null;
MaxAgeSoftReference> cacheRef = permissionToRoleCache.get( key );
if ( cacheRef != null ) {
roleIds = cacheRef.get();
}
return roleIds;
}
protected String getPermissionImplByTemplateNameCacheKey( String namespaceCode, String permissionTemplateName ) {
return PERMISSION_IMPL_CACHE_PREFIX + namespaceCode + "-" + permissionTemplateName;
}
protected String getPermissionImplByNameCacheKey( String namespaceCode, String permissionName ) {
return PERMISSION_IMPL_NAME_CACHE_PREFIX + namespaceCode + "-" + permissionName;
}
protected String getPermissionImplByIdCacheKey( String permissionId ) {
return PERMISSION_IMPL_ID_CACHE_PREFIX + permissionId;
}
protected String getNewAttributeDataId(){
SequenceAccessorService sas = getSequenceAccessorService();
Long nextSeq = sas.getNextAvailableSequenceNumber(
KimConstants.SequenceNames.KRIM_ATTR_DATA_ID_S,
]]>
findDelegateMembersCompleteInfo(final Map fieldValues){
List delegateMembersCompleteInfo = new ArrayList();
DelegateMemberCompleteInfo delegateMemberCompleteInfo;
List delegations = (List)getLookupService().findCollectionBySearchHelper(
KimDelegationImpl.class, fieldValues, true);
if(delegations!=null && !delegations.isEmpty()){
Map delegationMemberFieldValues = new HashMap();
for(String key: fieldValues.keySet()){
if(key.startsWith(KimConstants.KimUIConstants.MEMBER_ID_PREFIX)){
delegationMemberFieldValues.put(
key.substring(key.indexOf(
KimConstants.KimUIConstants.MEMBER_ID_PREFIX)+KimConstants.KimUIConstants.MEMBER_ID_PREFIX.length()),
fieldValues.get(key));
}
}
StringBuffer memberQueryString = new StringBuffer();
for(KimDelegationImpl delegation: delegations)
memberQueryString.append(delegation.getDelegationId()+KimConstants.KimUIConstants.OR_OPERATOR);
delegationMemberFieldValues.put(KimConstants.PrimaryKeyConstants.DELEGATION_ID,
KimCommonUtilsInternal.stripEnd(memberQueryString.toString(), KimConstants.KimUIConstants.OR_OPERATOR));
List delegateMembers = (List)getLookupService().findCollectionBySearchHelper(
KimDelegationMemberImpl.class, delegationMemberFieldValues, true);
KimDelegationImpl delegationTemp;
for(KimDelegationMemberImpl delegateMember: delegateMembers){
delegateMemberCompleteInfo = delegateMember.toSimpleInfo();
delegationTemp = getDelegationImpl(delegations, delegateMember.getDelegationId());
delegateMemberCompleteInfo.setRoleId(delegationTemp.getRoleId());
delegateMemberCompleteInfo.setDelegationTypeCode(delegationTemp.getDelegationTypeCode());
Object member = getMember(delegateMemberCompleteInfo.getMemberTypeCode(), delegateMemberCompleteInfo.getMemberId());
delegateMemberCompleteInfo.setMemberName(getMemberName(member));
delegateMemberCompleteInfo.setMemberNamespaceCode(getMemberNamespaceCode(member));
delegateMembersCompleteInfo.add(delegateMemberCompleteInfo);
}
}
return delegateMembersCompleteInfo;
}
]]>
getFields() {
]]>
l = Arrays.asList(valueEntered.split("\\.\\."));
for(String value : l){
bSplit = true;
if(!isPassesDefaultValidation(value)){
bRet = false;
}
}
}
if (StringUtils.contains(valueEntered, KNSConstants.OR_LOGICAL_OPERATOR)) {
//splitValueList.addAll(Arrays.asList(StringUtils.split(valueEntered, KNSConstants.OR_LOGICAL_OPERATOR)));
List l = Arrays.asList(StringUtils.split(valueEntered, KNSConstants.OR_LOGICAL_OPERATOR));
for(String value : l){
bSplit = true;
if(!isPassesDefaultValidation(value)){
bRet = false;
}
}
}
if (StringUtils.contains(valueEntered, KNSConstants.AND_LOGICAL_OPERATOR)) {
//splitValueList.addAll(Arrays.asList(StringUtils.split(valueEntered, KNSConstants.AND_LOGICAL_OPERATOR)));
List l = Arrays.asList(StringUtils.split(valueEntered, KNSConstants.AND_LOGICAL_OPERATOR));
for(String value : l){
bSplit = true;
if(!isPassesDefaultValidation(value)){
bRet = false;
}
}
}
if(bSplit){
return bRet;
}
Pattern pattern = Pattern.compile(DEFAULT_VALIDATION_REGEX_EXPRESSION);
Matcher matcher = pattern.matcher(SQLUtils.cleanNumericOfValidOperators(valueEntered).trim());
if(!matcher.matches()){
bRet = false;
}
return bRet;
}
/* (non-Javadoc)
* @see org.kuali.rice.kew.docsearch.SearchableAttributeValue#isRangeValid(java.lang.String, java.lang.String)
*/
public Boolean isRangeValid(String lowerValue, String upperValue) {
if (allowsRangeSearches()) {
]]>
unpopulatedFields = new ArrayList();
// yelp if nulls were passed in
if (bo == null) {
throw new IllegalArgumentException("The Class passed in for the BusinessObject argument was null.");
}
if (StringUtils.isBlank(referenceName)) {
throw new IllegalArgumentException("The String passed in for the referenceName argument was null or empty.");
}
PropertyDescriptor propertyDescriptor = null;
// make sure the attribute exists at all, throw exception if not
try {
propertyDescriptor = PropertyUtils.getPropertyDescriptor(bo, referenceName);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (propertyDescriptor == null) {
throw new ReferenceAttributeDoesntExistException("Requested attribute: '" + referenceName + "' does not exist " + "on class: '" + bo.getClass().getName() + "'.");
}
// get the class of the attribute name
Class referenceClass = propertyDescriptor.getPropertyType();
// make sure the class of the attribute descends from BusinessObject,
// otherwise throw an exception
if (!PersistableBusinessObject.class.isAssignableFrom(referenceClass)) {
throw new ObjectNotABusinessObjectRuntimeException("Attribute requested (" + referenceName + ") is of class: " + "'" + referenceClass.getName() + "' and is not a " + "descendent of BusinessObject. Only descendents of BusinessObject " + "can be used.");
}
]]>
propertyTypes = new HashMap();
boolean hasReturnableRow = false;
List returnKeys = getReturnKeys();
List pkNames = getBusinessObjectMetaDataService().listPrimaryKeyFieldNames(getBusinessObjectClass());
Person user = GlobalVariables.getUserSession().getPerson();
// iterate through result list and wrap rows with return url and action urls
for (Iterator iter = displayList.iterator(); iter.hasNext();) {
BusinessObject element = (BusinessObject) iter.next();
if(element instanceof PersistableBusinessObject){
lookupForm.setLookupObjectId(((PersistableBusinessObject)element).getObjectId());
}
BusinessObjectRestrictions businessObjectRestrictions = getBusinessObjectAuthorizationService().getLookupResultRestrictions(element, user);
HtmlData returnUrl = getReturnUrl(element, lookupForm, returnKeys, businessObjectRestrictions);
String actionUrls = getActionUrls(element, pkNames, businessObjectRestrictions);
//Fix for JIRA - KFSMI-2417
if("".equals(actionUrls)){
actionUrls = ACTION_URLS_EMPTY;
}
]]>
model = new HashMap();
String view;
try {
document = NotificationWorkflowDocument.createNotificationDocument(
initiatorId,
NotificationConstants.KEW_CONSTANTS.SEND_NOTIFICATION_REQ_DOC_TYPE);
//parse out the application content into a Notification BO
Notification notification = populateNotificationInstance(request,
model);
// now get that content in an understandable XML format and pass into document
String notificationAsXml = messageContentService
.generateNotificationMessage(notification);
Map attrFields = new HashMap();
List reviewers = notification.getChannel().getReviewers();
int ui = 0;
int gi = 0;
for (NotificationChannelReviewer reviewer: reviewers) {
String prefix;
int index;
if (KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.equals(reviewer.getReviewerType())) {
prefix = "user";
index = ui;
ui++;
} else if (KimGroupMemberTypes.GROUP_MEMBER_TYPE.equals(reviewer.getReviewerType())) {
prefix = "group";
index = gi;
gi++;
} else {
LOG.error("Invalid type for reviewer " + reviewer.getReviewerId() + ": " + reviewer.getReviewerType());
continue;
}
attrFields.put(prefix + index, reviewer.getReviewerId());
}
GenericAttributeContent gac = new GenericAttributeContent("channelReviewers");
document.getDocumentContent().setApplicationContent(notificationAsXml);
document.getDocumentContent().setAttributeContent("" + gac.generateContent(attrFields) + "");
document.setTitle(notification.getTitle());
document.routeDocument("This message was submitted via the simple notification message submission form by user "
]]>
propertyTypes = new HashMap();
boolean hasReturnableRow = false;
List returnKeys = getReturnKeys();
List pkNames = getBusinessObjectMetaDataService().listPrimaryKeyFieldNames(getBusinessObjectClass());
Person user = GlobalVariables.getUserSession().getPerson();
// iterate through result list and wrap rows with return url and action urls
for (Iterator iter = displayList.iterator(); iter.hasNext();) {
BusinessObject element = (BusinessObject) iter.next();
if(element instanceof PersistableBusinessObject){
lookupForm.setLookupObjectId(((PersistableBusinessObject)element).getObjectId());
}
BusinessObjectRestrictions businessObjectRestrictions = getBusinessObjectAuthorizationService().getLookupResultRestrictions(element, user);
HtmlData returnUrl = getReturnUrl(element, lookupForm, returnKeys, businessObjectRestrictions);
String actionUrls = getActionUrls(element, pkNames, businessObjectRestrictions);
//Fix for JIRA - KFSMI-2417
if("".equals(actionUrls)){
actionUrls = ACTION_URLS_EMPTY;
}
List columns = getColumns();
for (Object element2 : columns) {
Column col = (Column) element2;
]]>
REASONABLE_IMMEDIATE_TIME_THRESHOLD;
LOG.info("Time: " + new Date(time) + " is in the future? " + future);
return future;
}
/**
* Returns whether the specified Notification can be reasonably expected to have recipients.
* This is determined on whether the channel has default recipients, is subscribably, and whether
* the send date time is far enough in the future to expect that if there are no subscribers, there
* may actually be some by the time the notification is sent.
* @param notification the notification to test
* @return whether the specified Notification can be reasonably expected to have recipients
*/
private boolean hasPotentialRecipients(Notification notification) {
LOG.info("notification channel " + notification.getChannel() + " is subscribable: " + notification.getChannel().isSubscribable());
return notification.getChannel().getRecipientLists().size() > 0 ||
notification.getChannel().getSubscriptions().size() > 0 ||
(notification.getChannel().isSubscribable() && timeIsInTheFuture(notification.getSendDateTime().getTime()));
}
protected NotificationService notificationService;
protected NotificationWorkflowDocumentService notificationWorkflowDocService;
protected NotificationChannelService notificationChannelService;
protected NotificationRecipientService notificationRecipientService;
protected NotificationMessageContentService messageContentService;
protected GenericDao businessObjectDao;
/**
* Set the NotificationService
* @param notificationService
*/
public void setNotificationService(NotificationService notificationService) {
this.notificationService = notificationService;
}
/**
* This method sets the NotificationWorkflowDocumentService
* @param s
*/
public void setNotificationWorkflowDocumentService(
NotificationWorkflowDocumentService s) {
this.notificationWorkflowDocService = s;
}
/**
* Sets the notificationChannelService attribute value.
* @param notificationChannelService The notificationChannelService to set.
*/
public void setNotificationChannelService(
NotificationChannelService notificationChannelService) {
this.notificationChannelService = notificationChannelService;
}
/**
* Sets the notificationRecipientService attribute value.
* @param notificationRecipientService
*/
public void setNotificationRecipientService(
NotificationRecipientService notificationRecipientService) {
this.notificationRecipientService = notificationRecipientService;
}
/**
* Sets the messageContentService attribute value.
* @param messageContentService
*/
public void setMessageContentService(
NotificationMessageContentService notificationMessageContentService) {
this.messageContentService = notificationMessageContentService;
}
/**
* Sets the businessObjectDao attribute value.
* @param businessObjectDao The businessObjectDao to set.
*/
public void setBusinessObjectDao(GenericDao businessObjectDao) {
this.businessObjectDao = businessObjectDao;
}
/**
* Handles the display of the form for sending a simple notification message
* @param request : a servlet request
* @param response : a servlet response
* @throws ServletException : an exception
* @throws IOException : an exception
* @return a ModelAndView object
*/
public ModelAndView sendSimpleNotificationMessage(
]]>
maxResultCap) {
LOG.warn("Document Search Generator (" + docSearchGenerator.getClass().getName() + ") gives result set cap of " + resultCap + " which is greater than parameter " + KEWConstants.DOC_SEARCH_RESULT_CAP + " value of " + maxResultCap);
resultCap = maxResultCap;
} else if (maxResultCap <= 0) {
LOG.warn(KEWConstants.DOC_SEARCH_RESULT_CAP + " was less than or equal to zero. Please use a positive integer.");
}
} catch (NumberFormatException e) {
LOG.warn(KEWConstants.DOC_SEARCH_RESULT_CAP + " is not a valid number. Value was " + resultCapValue);
}
}
return resultCap;
}
// TODO delyea: use searchable attribute count here?
private int getFetchMoreIterationLimit() {
int fetchMoreLimit = DEFAULT_FETCH_MORE_ITERATION_LIMIT;
String fetchMoreLimitValue = CoreFrameworkServiceLocator.getParameterService().getParameterValueAsString(KEWConstants.KEW_NAMESPACE, KNSConstants.DetailTypes.DOCUMENT_SEARCH_DETAIL_TYPE, KEWConstants.DOC_SEARCH_FETCH_MORE_ITERATION_LIMIT);
if (!StringUtils.isBlank(fetchMoreLimitValue)) {
try {
fetchMoreLimit = Integer.parseInt(fetchMoreLimitValue);
if (fetchMoreLimit < 0) {
LOG.warn(KEWConstants.DOC_SEARCH_FETCH_MORE_ITERATION_LIMIT + " was less than zero. Please use a value greater than or equal to zero.");
fetchMoreLimit = DEFAULT_FETCH_MORE_ITERATION_LIMIT;
}
} catch (NumberFormatException e) {
LOG.warn(KEWConstants.DOC_SEARCH_FETCH_MORE_ITERATION_LIMIT + " is not a valid number. Value was " + fetchMoreLimitValue);
}
}
return fetchMoreLimit;
}
//
// protected DatabasePlatform getPlatform() {
// return (DatabasePlatform)GlobalResourceLoader.getService(KEWServiceLocator.DB_PLATFORM);
// }
}
]]>
getAuthorizedPermissions(
]]>
0) {
cacheKey.append(",");
}
// handle weird cache bug:
// if you call a one-arg method foo with a null arg i.e. foo(null),
// and then call it with an argument whose toString evaluates to "null",
// OSCache gets stuck in an infinite wait() call because it somehow thinks
// another thread is already updating this cache entry
//
// workaround: change so that args which are actually null literal have
// some weird, unlikely-to-be-encountered String representation
if (argValues[i] == null) {
cacheKey.append("");
}
else {
cacheKey.append(argValues[i]);
}
}
}
return cacheKey.toString();
}
/**
* @param key
* @return true if the cache contains an entry with the given key
*/
public boolean containsCacheKey(String key) {
boolean contains = false;
try {
cache.getFromCache(key);
contains = true;
}
catch (NeedsRefreshException e) {
// it is imperative that you call cancelUpdate if you aren't going to update the cache entry that caused the
// NeedsRefreshException above
cache.cancelUpdate(key);
contains = false;
}
return contains;
}
/**
* Removes a method cache if one exists for the given key.
* @param cacheKey - key for method signature and parameters - see buildCacheKey
*/
public void removeCacheKey(String cacheKey) {
if (!containsCacheKey(cacheKey)) {
return;
}
if ( LOG.isDebugEnabled() ) {
LOG.debug("removing method cache for key: " + cacheKey);
}
cache.cancelUpdate(cacheKey);
cache.flushEntry(cacheKey);
}
// Kuali Foundation modification: removed getCacheKey(String, String, Object[])
// end Kuali Foundation modification
}
]]>
propertyTypes = new HashMap();
boolean hasReturnableRow = false;
List returnKeys = getReturnKeys();
List pkNames = getBusinessObjectMetaDataService().listPrimaryKeyFieldNames(getBusinessObjectClass());
Person user = GlobalVariables.getUserSession().getPerson();
// iterate through result list and wrap rows with return url and action urls
for (Iterator iter = displayList.iterator(); iter.hasNext();) {
BusinessObject element = (BusinessObject) iter.next();
if(element instanceof PersistableBusinessObject){
lookupForm.setLookupObjectId(((PersistableBusinessObject)element).getObjectId());
}
BusinessObjectRestrictions businessObjectRestrictions = getBusinessObjectAuthorizationService().getLookupResultRestrictions(element, user);
HtmlData returnUrl = getReturnUrl(element, lookupForm, returnKeys, businessObjectRestrictions);
String actionUrls = getActionUrls(element, pkNames, businessObjectRestrictions);
//Fix for JIRA - KFSMI-2417
if("".equals(actionUrls)){
actionUrls = ACTION_URLS_EMPTY;
}
]]>
1) ) {
// no user and more than one workgroup id
ruleResponsibilityNameCrit = new Criteria();
ruleResponsibilityNameCrit.addIn("ruleResponsibilityName", workgroupIds);
ruleResponsibilityNameCrit.addEqualTo("ruleResponsibilityType", KEWConstants.RULE_RESPONSIBILITY_GROUP_ID);
}
if (ruleResponsibilityNameCrit != null) {
]]>
1) {
throw new RuntimeException("EBO Links don't work for relationships with multiple-field primary keys.");
}
String boProperty = rd.getPrimitiveAttributes().get(0).getSourceName();
String eboProperty = rd.getPrimitiveAttributes().get(0).getTargetName();
StringBuffer boPropertyValue = new StringBuffer();
// loop over the results, making a string that the lookup
// DAO will convert into an
// SQL "IN" clause
for (Object ebo : eboResults) {
if (boPropertyValue.length() != 0) {
boPropertyValue.append("|");
}
try {
boPropertyValue.append(PropertyUtils.getProperty(ebo, eboProperty).toString());
} catch (Exception ex) {
LOG.warn("Unable to get value for " + eboProperty + " on " + ebo);
}
}
if (eboParentPropertyName == null) {
// non-nested property containing the EBO
nonEboFieldValues.put(boProperty, boPropertyValue.toString());
} else {
// property nested within the main searched-for BO that
// contains the EBO
nonEboFieldValues.put(eboParentPropertyName + "." + boProperty, boPropertyValue.toString());
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("Passing these results into the lookup service: " + nonEboFieldValues);
}
// add those results as criteria
// run the normal search (but with the EBO critieria added)
searchResults = (List>) getLookupService().findCollectionBySearchHelper(getDataObjectClass(), nonEboFieldValues, unbounded);
]]>
generatedActionItems = new ArrayList();
List requests = new ArrayList();
if ( context.isSimulation() ) {
for ( ActionRequestValue ar : context.getDocument().getActionRequests() ) {
// logic check below duplicates behavior of the
// ActionRequestService.findPendingRootRequestsByDocIdAtRouteNode(documentId,
// routeNodeInstanceId) method
if ( ar.getCurrentIndicator()
&& (KEWConstants.ACTION_REQUEST_INITIALIZED.equals( ar.getStatus() ) || KEWConstants.ACTION_REQUEST_ACTIVATED
.equals( ar.getStatus() ))
&& ar.getNodeInstance().getRouteNodeInstanceId().equals(
nodeInstance.getRouteNodeInstanceId() )
&& ar.getParentActionRequest() == null ) {
requests.add( ar );
}
}
requests.addAll( context.getEngineState().getGeneratedRequests() );
} else {
requests = KEWServiceLocator.getActionRequestService()
.findPendingRootRequestsByDocIdAtRouteNode( document.getDocumentId(),
nodeInstance.getRouteNodeInstanceId() );
}
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Pending Root Requests " + requests.size() );
}
boolean requestActivated = activateRequestsCustom( context, requests, generatedActionItems,
]]>
getColumns() {
List columns = super.getColumns();
for (Row row : rows) {
for (Field field : row.getFields()) {
Column newColumn = new Column();
newColumn.setColumnTitle(field.getFieldLabel());
newColumn.setMaxLength(field.getMaxLength());
newColumn.setPropertyName(field.getPropertyName());
columns.add(newColumn);
}
}
return columns;
}
@Override
public List getCustomActionUrls(BusinessObject businessObject,
List pkNames) {
]]>
getResourceLoadersToRegister() throws Exception {
// create the plugin registry
PluginRegistry registry = null;
String pluginRegistryEnabled = ConfigContext.getCurrentContextConfig().getProperty("plugin.registry.enabled");
if (!StringUtils.isBlank(pluginRegistryEnabled) && Boolean.valueOf(pluginRegistryEnabled).booleanValue()) {
registry = new PluginRegistryFactory().createPluginRegistry();
}
final Collection rls = new ArrayList();
for (ResourceLoader rl : RiceResourceLoaderFactory.getSpringResourceLoaders()) {
CoreResourceLoader coreResourceLoader =
new CoreResourceLoader(rl, registry);
coreResourceLoader.start();
//wait until core resource loader is started to attach to GRL; this is so startup
//code can depend on other things hooked into GRL without incomplete KEW resources
//messing things up.
GlobalResourceLoader.addResourceLoader(coreResourceLoader);
// now start the plugin registry if there is one
if (registry != null) {
registry.start();
// the registry resourceloader is now being handled by the CoreResourceLoader
//GlobalResourceLoader.addResourceLoader(registry);
}
rls.add(coreResourceLoader);
}
return rls;
}
private ClientProtocol getClientProtocol() {
return ClientProtocol.valueOf(ConfigContext.getCurrentContextConfig().getProperty("client.protocol"));
}
public DataSource getDataSource() {
return dataSource;
}
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
}
]]>
clazz, StringBuffer sb, Map overrides ) {
// first get annotation overrides
if ( overrides == null ) {
overrides = new HashMap();
}
if ( clazz.getAnnotation( AttributeOverride.class ) != null ) {
AttributeOverride ao = (AttributeOverride)clazz.getAnnotation( AttributeOverride.class );
if ( !overrides.containsKey(ao.name() ) ) {
overrides.put(ao.name(), ao);
}
}
if ( clazz.getAnnotation( AttributeOverrides.class ) != null ) {
for ( AttributeOverride ao : ((AttributeOverrides)clazz.getAnnotation( AttributeOverrides.class )).value() ) {
if ( !overrides.containsKey(ao.name() ) ) {
overrides.put(ao.name(), ao);
}
overrides.put(ao.name(),ao);
}
}
for ( Field field : clazz.getDeclaredFields() ) {
Id id = (Id)field.getAnnotation( Id.class );
Column column = (Column)field.getAnnotation( Column.class );
if ( column != null ) {
sb.append( "
getInverseForeignKeysForCollection(Class boClass, String collectionName) {
// yelp if nulls were passed in
if (boClass == null) {
throw new IllegalArgumentException("The Class passed in for the boClass argument was null.");
}
if (collectionName == null) {
throw new IllegalArgumentException("The String passed in for the attributeName argument was null.");
}
PropertyDescriptor propertyDescriptor = null;
// make an instance of the class passed
Object classInstance;
try {
classInstance = boClass.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
// make sure the attribute exists at all, throw exception if not
try {
propertyDescriptor = PropertyUtils.getPropertyDescriptor(classInstance, collectionName);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (propertyDescriptor == null) {
throw new ReferenceAttributeDoesntExistException("Requested attribute: '" + collectionName + "' does not exist " + "on class: '" + boClass.getName() + "'. GFK");
}
// get the class of the attribute name
Class attributeClass = propertyDescriptor.getPropertyType();
// make sure the class of the attribute descends from BusinessObject,
// otherwise throw an exception
if (!Collection.class.isAssignableFrom(attributeClass)) {
throw new ObjectNotABusinessObjectRuntimeException("Attribute requested (" + collectionName + ") is of class: " + "'" + attributeClass.getName() + "' and is not a " + "descendent of Collection");
}
]]>
0) {
RuleAttribute ruleAttrib = KEWServiceLocator.getRuleAttributeService().findByName(attribute);
if (ruleAttrib == null) {
LOG.error("Invalid attribute referenced in EDocLite definition: " + attribute);
invalidAttributes.add("Attribute '" + attribute + "' referenced in field '" + fieldName + "' not found");
}
}
}
}
if (invalidAttributes.size() > 0) {
LOG.error("Invalid attributes referenced in EDocLite definition");
StringBuffer message = new StringBuffer("EDocLite definition contains references to non-existent attributes;\n");
Iterator it = invalidAttributes.iterator();
while (it.hasNext()) {
message.append(it.next());
message.append("\n");
}
throw new XmlIngestionException(message.toString());
]]>
getAuthorizedPermissionsByTemplateName(
@WebParam(name = "principalId") String principalId,
@WebParam(name = "namespaceCode") String namespaceCode,
@WebParam(name = "permissionTemplateName") String permissionTemplateName,
@WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
@WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
);
List getPermissionAssignees(
@WebParam(name = "namespaceCode") String namespaceCode,
@WebParam(name = "permissionName") String permissionName,
@WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
@WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
);
List getPermissionAssigneesForTemplateName(
@WebParam(name = "namespaceCode") String namespaceCode,
@WebParam(name = "permissionTemplateName") String permissionTemplateName,
@WebParam(name = "permissionDetails") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet permissionDetails,
@WebParam(name = "qualification") @XmlJavaTypeAdapter(value = AttributeSetAdapter.class) AttributeSet qualification
);
]]>
Map of component options
* that will export that options as a JavaScript Map for use in js and
* jQuery plugins.
*
* @return String of widget options formatted as JS Map
*/
@Override
public String getComponentOptionsJSString() {
if (getComponentOptions() == null) {
setComponentOptions(new HashMap());
}
StringBuffer sb = new StringBuffer();
sb.append("{");
for (String optionKey : getComponentOptions().keySet()) {
String optionValue = getComponentOptions().get(optionKey);
if (sb.length() > 1) {
sb.append(",");
}
sb.append(optionKey);
sb.append(":");
//If an option value starts with { or [, it would be a nested value and it should not use quotes around it
// If value is a function script do not use quotes
if (StringUtils.startsWith(optionValue, "{") || StringUtils.startsWith(optionValue, "[")
|| (StringUtils.startsWith(optionValue, "function") && StringUtils.endsWith(optionValue, "}"))
|| optionValue.equals("true") || optionValue.equals("false")){
sb.append(optionValue);
}else{
sb.append("\"" + optionValue + "\"");
}
}
sb.append("}");
return sb.toString();
}
]]>
removeExternalizableBusinessObjectFieldValues(Class> boClass, Map fieldValues) {
Map eboFieldValues = new HashMap();
try {
Object sampleBo = boClass.newInstance();
for (String key : fieldValues.keySet()) {
if (!isExternalBusinessObjectProperty(sampleBo, key)) {
eboFieldValues.put(key, fieldValues.get(key));
}
}
} catch (Exception ex) {
LOG.debug("Unable to check " + boClass + " for EBO properties.", ex);
}
return eboFieldValues;
}
/**
* Return the EBO fieldValue entries explicitly for the given eboPropertyName. (I.e., any properties with the given property name as a prefix.
*/
protected Map getExternalizableBusinessObjectFieldValues(String eboPropertyName, Map fieldValues) {
Map eboFieldValues = new HashMap();
for (String key : fieldValues.keySet()) {
if (key.startsWith(eboPropertyName + ".")) {
eboFieldValues.put(StringUtils.substringAfterLast(key, "."), fieldValues.get(key));
}
}
return eboFieldValues;
}
/**
* Get the complete list of all properties referenced in the fieldValues that are ExternalizableBusinessObjects.
*
* This is a list of the EBO object references themselves, not of the properties within them.
*/
protected List getExternalizableBusinessObjectProperties(Class> boClass, Map fieldValues) {
]]>
listReferenceObjectFields(Class boClass) {
// validate parameter
if (boClass == null) {
throw new IllegalArgumentException("Class specified in the parameter was null.");
}
if (!PersistableBusinessObject.class.isAssignableFrom(boClass)) {
throw new IllegalArgumentException("Class specified [" + boClass.getName() + "] must be a class that " + "inherits from BusinessObject.");
}
]]>
0 ) {
if ( cleanedValue.charAt( 0 ) == '-' ) {
cleanedValue = "-" + cleanedValue.replaceAll( "-", "" );
} else {
cleanedValue = cleanedValue.replaceAll( "-", "" );
}
}
// ensure only one decimal in the string
int decimalLoc = cleanedValue.lastIndexOf( '.' );
if ( cleanedValue.indexOf( '.' ) != decimalLoc ) {
cleanedValue = cleanedValue.substring( 0, decimalLoc ).replaceAll( "\\.", "" ) + cleanedValue.substring( decimalLoc );
}
try {
return new BigDecimal( cleanedValue );
} catch ( NumberFormatException ex ) {
GlobalVariables.getMessageMap().putError(KNSConstants.DOCUMENT_ERRORS, RiceKeyConstants.ERROR_CUSTOM, new String[] { "Invalid Numeric Input: " + value });
return null;
}
}
/**
* Adds to the criteria object based on query characters given
*/
private void addNumericRangeCriteria(String propertyName, String propertyValue, boolean treatWildcardsAndOperatorsAsLiteral, Criteria criteria) {
]]>
getDelegates() {
]]>
getRoleIdsForPermissions(Collection extends KimPermission> permissions) {
if ( permissions.isEmpty() ) {
return new ArrayList(0);
}
List permissionIds = new ArrayList( permissions.size() );
for ( KimPermission kp : permissions ) {
permissionIds.add( kp.getPermissionId() );
}
Criteria c = new Criteria();
c.addIn( "permissionId", permissionIds );
c.addEqualTo( "active", true );
Query query = QueryFactory.newQuery( RolePermissionImpl.class, c, true );
Collection coll = getPersistenceBrokerTemplate().getCollectionByQuery(query);
List roleIds = new ArrayList( coll.size() );
for ( RolePermissionImpl rp : coll ) {
roleIds.add( rp.getRoleId() );
}
return roleIds;
}
}
]]>
primaryKeys = new HashMap();
primaryKeys.put(propertyName, "code");
inquiry.buildInquiryLink(dataObject, propertyName, NamespaceBo.class, primaryKeys);
} else if(DETAIL_OBJECTS.equals(propertyName)){
//return getAttributesInquiryUrl(businessObject, DETAIL_OBJECTS);
super.buildInquirableLink(dataObject, propertyName, inquiry);
} else if(ASSIGNED_TO_ROLES.equals(propertyName)){
// return getAssignedRoleInquiryUrl(businessObject);
super.buildInquirableLink(dataObject, propertyName, inquiry);
}else{
super.buildInquirableLink(dataObject, propertyName, inquiry);
}
}
@Override
public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
/*
* - permission detail values (attribute name and value separated by colon, commas between attributes)
* - required role qualifiers (attribute name and value separated by colon, commas between attributes)
* - list of roles assigned: role type, role namespace, role name
*/
if(NAME.equals(attributeName) || NAME_TO_DISPLAY.equals(attributeName)){
List primaryKeys = new ArrayList();
primaryKeys.add(KimConstants.PrimaryKeyConstants.PERMISSION_ID);
]]>
actionRequestCodes) {
if ( (StringUtils.isEmpty(docTypeName)) &&
(StringUtils.isEmpty(ruleTemplateName)) &&
(StringUtils.isEmpty(ruleDescription)) &&
(StringUtils.isEmpty(groupId)) &&
(StringUtils.isEmpty(principalId)) &&
(extensionValues.isEmpty()) &&
(actionRequestCodes.isEmpty()) ) {
// all fields are empty
throw new IllegalArgumentException("At least one criterion must be sent");
}
RuleTemplate ruleTemplate = getRuleTemplateService().findByRuleTemplateName(ruleTemplateName);
Long ruleTemplateId = null;
if (ruleTemplate != null) {
ruleTemplateId = ruleTemplate.getRuleTemplateId();
}
if ( ( (extensionValues != null) && (!extensionValues.isEmpty()) ) &&
(ruleTemplateId == null) ) {
// cannot have extensions without a correct template
throw new IllegalArgumentException("A Rule Template Name must be given if using Rule Extension values");
}
Collection workgroupIds = new ArrayList();
if (principalId != null) {
]]>
> values) {
if (StringUtils.isBlank(propertyPath)) {
throw new IllegalArgumentException("Property path cannot be null or blank.");
}
CriteriaSupportUtils.validateValuesForMultiValuedPredicate(values);
this.propertyPath = propertyPath;
if (values == null) {
this.values = Collections.emptySet();
} else {
final Set> temp = new HashSet>();
for (CriteriaValue> value: values) {
if (value != null) {
temp.add(value);
}
}
this.values = Collections.unmodifiableSet(temp);
}
}
@Override
public String getPropertyPath() {
return propertyPath;
}
@Override
public Set> getValues() {
return Collections.unmodifiableSet(values);
}
/**
* Defines some internal constants used on this class.
*/
static class Constants {
final static String ROOT_ELEMENT_NAME = "notIn";
]]>
1) {
String expandedNot = "!" + StringUtils.join(splitPropVal, KNSConstants.AND_LOGICAL_OPERATOR + KNSConstants.NOT_LOGICAL_OPERATOR);
// we know that since this method was called, treatWildcardsAndOperatorsAsLiteral must be false
addCriteria(propertyName, expandedNot, propertyType, caseInsensitive, false, criteria);
}
else {
// only one so add a not like
criteria.addNotLike(propertyName, splitPropVal[0]);
]]>
\r\n" );
for ( JoinColumn col : keys ) {
sb.append( " \r\n" );
}
sb.append( " \r\n" );
}
}
}
}
private static String getPropertyFromField( Class extends Object> clazz, String colName ) {
for ( Field field : clazz.getDeclaredFields() ) {
Column column = (Column)field.getAnnotation( Column.class );
if ( column != null ) {
if ( column.name().equals( colName ) ) {
return field.getName();
}
}
}
return "";
}
}
]]>
> originalCollections = orig.buildListOfDeletionAwareLists();
if (originalCollections != null && !originalCollections.isEmpty()) {
/*
* Prior to being saved, the version in the database will not yet reflect any deleted collections. So, a freshly
* retrieved version will contain objects that need to be removed:
*/
try {
List> copyCollections = copy.buildListOfDeletionAwareLists();
int size = originalCollections.size();
if (copyCollections.size() != size) {
throw new RuntimeException("size mismatch while attempting to process list of Collections to manage");
}
for (int i = 0; i < size; i++) {
Collection origSource = originalCollections.get(i);
Collection copySource = copyCollections.get(i);
List list = findUnwantedElements(copySource, origSource);
cleanse(template, origSource, list);
}
}
catch (ObjectRetrievalFailureException orfe) {
// object wasn't found, must be pre-save
}
}
}
]]>
subscriptions = this.userPreferenceService.getCurrentSubscriptions(userid);
Map currentsubs = new HashMap();
Iterator i = subscriptions.iterator();
while (i.hasNext()) {
UserChannelSubscription sub = i.next();
String subid = Long.toString(sub.getChannel().getId());
currentsubs.put(subid, subid);
LOG.debug("currently subscribed to: "+sub.getChannel().getId());
}
// get all subscribable channels
Collection channels = this.notificationChannelService.getSubscribableChannels();
Map model = new HashMap();
model.put("channels", channels);
model.put("currentsubs", currentsubs);
return new ModelAndView(view, model);
}
]]>
listCollectionObjectTypes(PersistableBusinessObject bo) {
// validate parameter
if (bo == null) {
throw new IllegalArgumentException("BO specified in the parameter was null.");
}
if (!(bo instanceof PersistableBusinessObject)) {
throw new IllegalArgumentException("BO specified [" + bo.getClass().getName() + "] must be a class that " + "inherits from BusinessObject.");
}
return listCollectionObjectTypes(bo.getClass());
}
/**
* @see org.kuali.rice.kns.service.PersistenceStructureService#listReferenceObjectFieldNames(org.kuali.rice.kns.bo.BusinessObject)
*/
public Map listReferenceObjectFields(PersistableBusinessObject bo) {
// validate parameter
if (bo == null) {
throw new IllegalArgumentException("BO specified in the parameter was null.");
}
if (!(bo instanceof PersistableBusinessObject)) {
throw new IllegalArgumentException("BO specified [" + bo.getClass().getName() + "] must be a class that " + "inherits from BusinessObject.");
}
return listReferenceObjectFields(bo.getClass());
}
@Cached
public boolean isReferenceUpdatable(Class boClass, String referenceName) {
]]>
userGroupIds = new ArrayList();
for(String id: KimApiServiceLocator.getIdentityManagementService().getGroupIdsForPrincipal(principalId)){
userGroupIds.add(id);
}
if (!userGroupIds.isEmpty()) {
groupCrit.in("delegatorGroupId", userGroupIds);
}
orCrit.or(userCrit);
orCrit.or(groupCrit);
crit.and(orCrit);
crit.eq("delegationType", KEWConstants.DELEGATION_PRIMARY);
filter.setDelegationType(KEWConstants.DELEGATION_PRIMARY);
filter.setExcludeDelegationType(false);
addToFilterDescription(filteredByItems, "Primary Delegator Id");
addedDelegationCriteria = true;
filterOn = true;
}
]]>
0) {
totalPrice = totalPrice - (totalPrice * entry.getDiscount().doubleValue() / 100);
}
}
entry.setTotalPrice(new KualiDecimal(totalPrice));
]]>
options = new ArrayList();
List selectedOptions = new ArrayList();
for (int k = 0; k < childNode.getChildNodes().getLength(); k++) {
Node displayChildNode = childNode.getChildNodes().item(k);
if ("type".equals(displayChildNode.getNodeName())) {
]]>
parameters) {
WebRuleUtils.processRuleForCopy(document.getDocumentNumber(), getOldRule(document), getNewRule(document));
super.processAfterCopy(document, parameters);
}
@Override
public void processAfterEdit(MaintenanceDocument document,
Map parameters) {
if (!getOldRule(document).getCurrentInd()) {
throw new RiceRuntimeException("Cannot edit a non-current version of a rule.");
}
WebRuleUtils.populateForCopyOrEdit(getOldRule(document), getNewRule(document));
getNewRule(document).setPreviousVersionId(getOldRule(document).getRuleBaseValuesId());
getNewRule(document).setDocumentId(document.getDocumentHeader().getDocumentNumber());
super.processAfterEdit(document, parameters);
}
]]>
value;
@SuppressWarnings("unused")
@XmlAnyElement
private final Collection _futureElements = null;
/**
* Should only be invoked by JAXB.
*/
@SuppressWarnings("unused")
private NotEqualPredicate() {
]]>
0) {
actionItemMap.put(potentialActionItem.getDocumentId(), potentialActionItem);
}
}
return actionItemMap.values();
}
/**
* Creates an Action List from the given collection of Action Items. The Action List should
* contain only one action item per user. The action item chosen should be the most "critical"
* or "important" one on the document.
*
* @return the Action List as a Collection of ActionItems
*/
private Collection createActionListForRouteHeader(Collection actionItems) {
Map actionItemMap = new HashMap();
ActionListPriorityComparator comparator = new ActionListPriorityComparator();
for (ActionItem potentialActionItem: actionItems) {
ActionItem existingActionItem = actionItemMap.get(potentialActionItem.getPrincipalId());
if (existingActionItem == null || comparator.compare(potentialActionItem, existingActionItem) > 0) {
actionItemMap.put(potentialActionItem.getPrincipalId(), potentialActionItem);
}
}
return actionItemMap.values();
}
private Collection getActionItemsInActionList(Class objectsToRetrieve, String principalId, ActionListFilter filter) {
]]>
components;
try {
components = KNSServiceLocatorWeb.getRiceApplicationConfigurationMediationService().getNonDatabaseComponents();
} catch (DataDictionaryException ex) {
throw new RuntimeException(
"Problem parsing data dictionary during full load required for inquiry to function: " +
ex.getMessage(), ex);
}
for (Component pdt : components) {
if (parameterDetailTypeCode.equals(pdt.getCode()) &&
parameterNamespaceCode.equals(pdt.getNamespaceCode())) {
result = ComponentBo.from(pdt);
break;
}
}
}
return result;
}
]]>
workgroupIds) {
Set workgroupIdStrings = new HashSet();
for (Long workgroupId : workgroupIds) {
workgroupIdStrings.add(workgroupId.toString());
}
Criteria responsibilityCrit = new Criteria();
responsibilityCrit.addIn("ruleResponsibilityName", workgroupIds);
responsibilityCrit.addEqualTo("ruleResponsibilityType", KEWConstants.RULE_RESPONSIBILITY_GROUP_ID);
ReportQueryByCriteria query = QueryFactory.newReportQuery(RuleResponsibility.class, responsibilityCrit);
query.setAttributes(new String[] { "ruleBaseValuesId" });
return query;
}
]]>
iterator = nodeInstance.getNextNodeInstances().iterator(); iterator.hasNext();) {
RouteNodeInstance routeNodeInstance = (RouteNodeInstance) iterator.next();
if (routeNodeInstance.getRouteNodeInstanceId() == null) {
routeNodeInstance.setRouteNodeInstanceId(context.getEngineState().getNextSimulationId());
}
}
if (nodeInstance.getProcess() != null && nodeInstance.getProcess().getRouteNodeInstanceId() == null) {
nodeInstance.getProcess().setRouteNodeInstanceId(context.getEngineState().getNextSimulationId());
}
if (nodeInstance.getBranch() != null && nodeInstance.getBranch().getBranchId() == null) {
nodeInstance.getBranch().setBranchId(context.getEngineState().getNextSimulationId());
}
}
}
]]>
boPKeys = businessObjectMetaDataService.listPrimaryKeyFieldNames(businessObjectClass);
final List> altKeys = this.getAltkeys(businessObjectClass);
altKeys.add(boPKeys);
boolean bFound = false;
for(List boKeys : altKeys ){
if(bFound)
break;
int keyCount = boKeys.size();
int foundCount = 0;
for (String boKey : boKeys) {
String pkParamName = boKey;
if (passedFromPreviousInquiry) {
pkParamName = KNSConstants.INQUIRY_PK_VALUE_PASSED_FROM_PREVIOUS_REQUEST_PREFIX + pkParamName;
}
if (request.getParameter(pkParamName) != null) {
foundCount++;
String parameter = request.getParameter(pkParamName);
Boolean forceUppercase = Boolean.FALSE;
try {
forceUppercase = dataDictionaryService.getAttributeForceUppercase(businessObjectClass, boKey);
} catch (UnknownBusinessClassAttributeException ex) {
// swallowing exception because this check for ForceUppercase would
// require a DD entry for the attribute. it is only checking keys
// so most likely there should be an entry.
LOG.warn("BO class " + businessObjectClassName + " property " + boKey + " should probably have a DD definition.", ex);
]]>
queryParameters = new HashMap();
for (Object parameterName : request.getParameterMap().keySet()) {
if (parameterName.toString().startsWith(UifParameters.QUERY_PARAMETER + ".")) {
String fieldName =
StringUtils.substringAfter(parameterName.toString(), UifParameters.QUERY_PARAMETER + ".");
String fieldValue = request.getParameter(parameterName.toString());
queryParameters.put(fieldName, fieldValue);
}
}
// retrieve id for field to perform query for
String queryFieldId = request.getParameter(UifParameters.QUERY_FIELD_ID);
if (StringUtils.isBlank(queryFieldId)) {
throw new RuntimeException(
"Unable to find id for field to perform query on under request parameter name: " +
UifParameters.QUERY_FIELD_ID);
}
]]>
ticketContext = new HashMap();
ticketContext.put(KNSPropertyConstants.DOCUMENT_NUMBER, document.getDocumentNumber());
ticketContext.put(KNSConstants.CALLING_METHOD, caller);
ticketContext.put(KNSPropertyConstants.NAME, fieldName);
boolean questionAsked = GlobalVariables.getUserSession().hasMatchingSessionTicket(
KNSConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET, ticketContext);
// start in logic for confirming the sensitive data
if (containsSensitiveData && warnForSensitiveData && !questionAsked) {
Object question = request.getParameter(KNSConstants.QUESTION_INST_ATTRIBUTE_NAME);
if (question == null || !KNSConstants.DOCUMENT_SENSITIVE_DATA_QUESTION.equals(question)) {
]]>
> values;
@SuppressWarnings("unused")
@XmlAnyElement
private final Collection _futureElements = null;
/**
* Should only be invoked by JAXB.
*/
@SuppressWarnings("unused")
private NotInPredicate() {
]]>
criteriaComponentsByFormKey = new HashMap();
for (SearchableAttribute searchableAttribute : docType.getSearchableAttributes()) {
for (Row row : searchableAttribute.getSearchingRows(
DocSearchUtils.getDocumentSearchContext("", docType.getName(), ""))) {
for (org.kuali.rice.kns.web.ui.Field field : row.getFields()) {
if (field instanceof Field) {
SearchableAttributeValue searchableAttributeValue = DocSearchUtils.getSearchableAttributeValueByDataTypeString(field.getFieldDataType());
SearchAttributeCriteriaComponent sacc = new SearchAttributeCriteriaComponent(field.getPropertyName(), null, field.getPropertyName(), searchableAttributeValue);
sacc.setRangeSearch(field.isMemberOfRange());
sacc.setCaseSensitive(!field.isUpperCase());
]]>
setupModelForSendSimpleNotification(
HttpServletRequest request) {
Map model = new HashMap();
model.put("defaultSender", request.getRemoteUser());
model.put("channels", notificationChannelService
.getAllNotificationChannels());
model.put("priorities", businessObjectDao
.findAll(NotificationPriority.class));
// set sendDateTime to current datetime if not provided
String sendDateTime = request.getParameter("sendDateTime");
String currentDateTime = Util.getCurrentDateTime();
if (StringUtils.isEmpty(sendDateTime)) {
sendDateTime = currentDateTime;
}
model.put("sendDateTime", sendDateTime);
// retain the original date time or set to current if
// it was not in the request
if (request.getParameter("originalDateTime") == null) {
model.put("originalDateTime", currentDateTime);
} else {
model.put("originalDateTime", request.getParameter("originalDateTime"));
}
model.put("userRecipients", request.getParameter("userRecipients"));
]]>
values) {
if (StringUtils.isBlank(propertyPath)) {
throw new IllegalArgumentException("Property path cannot be null or blank.");
}
this.propertyPath = propertyPath;
if (values == null) {
this.values = Collections.emptySet();
} else {
final Set temp = new HashSet();
for (CriteriaStringValue value: values) {
if (value != null) {
temp.add(value);
}
}
this.values = Collections.unmodifiableSet(temp);
}
}
@Override
public String getPropertyPath() {
return propertyPath;
}
@Override
public Set getValues() {
return Collections.unmodifiableSet(values);
}
/**
* Defines some internal constants used on this class.
*/
static class Constants {
final static String ROOT_ELEMENT_NAME = "notInIgnoreCase";
]]>
return value");
record.setReturnUrl(returnUrl.toString());
String destinationUrl = "report";
record.setDestinationUrl(destinationUrl);
displayList.add(ruleDelegation);
]]>
collectionOrFieldLevelPermissionDetails,
Map collectionOrFieldLevelRoleQualification) {
AttributeSet roleQualifiers = new AttributeSet(getRoleQualification(dataObject, principalId));
AttributeSet permissionDetails = new AttributeSet(getPermissionDetailValues(dataObject));
if (collectionOrFieldLevelRoleQualification != null) {
roleQualifiers.putAll(collectionOrFieldLevelRoleQualification);
}
if (collectionOrFieldLevelPermissionDetails != null) {
permissionDetails.putAll(collectionOrFieldLevelPermissionDetails);
}
return getIdentityManagementService().isAuthorizedByTemplateName(principalId, namespaceCode,
permissionTemplateName, permissionDetails, roleQualifiers);
}
/**
* Returns a role qualification map based off data from the primary business
* object or the document. DO NOT MODIFY THE MAP RETURNED BY THIS METHOD
*
* @param primaryDataObjectOrDocument
* the primary data object (i.e. the main object instance behind
* the lookup result row or inquiry) or the document
* @return a Map containing role qualifications
*/
protected final Map getRoleQualification(Object primaryDataObjectOrDocument) {
]]>
entry : fieldValues.entrySet()) {
if (entry.getKey().equals("kimTypeId")) {
kimTypeId=entry.getValue();
break;
}
}
AttributeDefinitionMap definitions = null;
for (Map.Entry entry : fieldValues.entrySet()) {
if (StringUtils.isNotBlank(entry.getValue())) {
if (entry.getKey().contains(".")) {
Criteria subCrit = new Criteria();
]]>
():origDelegationImplTemp.getMembers();
newKimDelegation.setMembers(getDelegationMembers(roleDocumentDelegation.getMembers(), origMembers, activatingInactive, newDelegationIdAssigned));
kimDelegations.add(newKimDelegation);
activatingInactive = false;
}
}
return kimDelegations;
}
protected List getDelegationMembers(List delegationMembers,
]]>
value;
@SuppressWarnings("unused")
@XmlAnyElement
private final Collection _futureElements = null;
/**
* Should only be invoked by JAXB.
*/
@SuppressWarnings("unused")
private LessThanPredicate() {
]]>
clazz, StringBuffer sb ) {
for ( Field field : clazz.getDeclaredFields() ) {
JoinColumns multiKey = (JoinColumns)field.getAnnotation( JoinColumns.class );
JoinColumn singleKey = (JoinColumn)field.getAnnotation( JoinColumn.class );
if ( multiKey != null || singleKey != null ) {
List keys = new ArrayList();
if ( singleKey != null ) {
keys.add( singleKey );
}
if ( multiKey != null ) {
for ( JoinColumn col : multiKey.value() ) {
keys.add( col );
}
}
]]>
primaryKeys = new ArrayList();
primaryKeys.add("code");
NamespaceBo parameterNamespace = new NamespaceBo();
parameterNamespace.setCode((String)ObjectUtils.getPropertyValue(businessObject, attributeName));
return getInquiryUrlForPrimaryKeys(NamespaceBo.class, parameterNamespace, primaryKeys, null);
} else if(DETAIL_OBJECTS.equals(attributeName)){
//return getAttributesInquiryUrl(businessObject, DETAIL_OBJECTS);
} else if(ASSIGNED_TO_ROLES.equals(attributeName)){
return getAssignedRoleInquiryUrl(businessObject);
}
return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
}
]]>
constructSortableByKey() {
Map sortable = new HashMap();
sortable
.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DOCUMENT_ID,
Boolean.TRUE);
sortable
.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DOC_TYPE_LABEL,
Boolean.TRUE);
sortable
.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DOCUMENT_TITLE,
Boolean.TRUE);
sortable
.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_STATUS_DESC,
Boolean.TRUE);
sortable.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DOC_STATUS,
Boolean.TRUE);
sortable.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_INITIATOR,
Boolean.TRUE);
sortable
.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DATE_CREATED,
Boolean.TRUE);
sortable.put(
KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_LOG,
Boolean.FALSE);
return sortable;
}
public Map getLabelsByKey() {
]]>
delegatorGroupIds = KimApiServiceLocator.getIdentityManagementService().getGroupIdsForPrincipal(principalId);
if (delegatorGroupIds != null && !delegatorGroupIds.isEmpty()) {
groupCrit.addIn("delegatorGroupId", delegatorGroupIds);
}
orCrit.addOrCriteria(userCrit);
orCrit.addOrCriteria(groupCrit);
crit.addAndCriteria(orCrit);
crit.addEqualTo("delegationType", KEWConstants.DELEGATION_PRIMARY);
filter.setDelegationType(KEWConstants.DELEGATION_PRIMARY);
filter.setExcludeDelegationType(false);
addToFilterDescription(filteredByItems, "Primary Delegator Id");
addedDelegationCriteria = true;
filterOn = true;
}
]]>
getParametersFromRequest(Map requestParameters) {
Map parameters = new HashMap();
if (requestParameters.containsKey(UifParameters.VIEW_NAME)) {
parameters.put(UifParameters.VIEW_NAME, requestParameters.get(UifParameters.VIEW_NAME));
}
else {
parameters.put(UifParameters.VIEW_NAME, UifConstants.DEFAULT_VIEW_NAME);
}
if (requestParameters.containsKey(UifParameters.DATA_OBJECT_CLASS_NAME)) {
parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME,
requestParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME));
}
]]>
Collection findMatching(Class clazz, Map fieldValues);
/**
* Finds all entities matching the passed in Rice JPA criteria
*
* @param the type of the entity that will be returned
* @param criteria the criteria to form the query with
* @return a Collection (most likely a List) of all matching entities
*/
//public abstract Collection findMatching(Criteria criteria);
/**
* This method retrieves a count of the business objects populated with data which match the criteria in the given Map.
*
* @param clazz
* @param fieldValues
* @return number of businessObjects of the given class whose fields match the values in the given expected-value Map
*/
public int countMatching(Class clazz, Map fieldValues);
/**
* This method retrieves a count of the business objects populated with data which match both the positive criteria
* and the negative criteria in the given Map.
*
* @param clazz
* @param positiveFieldValues
* @param negativeFieldValues
* @return number of businessObjects of the given class whose fields match the values in the given expected-value Maps
*/
public int countMatching(Class clazz, Map positiveFieldValues, Map negativeFieldValues);
/**
* This method retrieves a collection of business objects populated with data, such that each record in the database populates a
* new object instance. This will retrieve business objects by class type and also by criteria passed in as key-value pairs,
* specifically attribute name and its expected value. Performs an order by on sort field.
*
* @param clazz
* @param fieldValues
* @return
*/
public Collection findMatchingOrderBy(Class clazz, Map fieldValues, String sortField, boolean sortAscending);
/**
* Deletes a business object from the database.
*
* @param bo
*/
public void delete(PersistableBusinessObject bo);
/**
* Deletes each business object in the given List.
*
* @param boList
*/
public void delete(List extends PersistableBusinessObject> boList);
/**
* Deletes the object(s) matching the given field values
*
* @param clazz
* @param fieldValues
*/
public void deleteMatching(Class clazz, Map fieldValues);
/**
*
* This method attempts to retrieve the reference from a BO if it exists.
*
* @param bo - populated BusinessObject instance that includes the referenceName property
* @param referenceName - name of the member/property to load
* @return A populated object from the DB, if it exists
*
*/
public BusinessObject getReferenceIfExists(BusinessObject bo, String referenceName);
]]>
parameterMap = getFieldMapForRuleTemplateAttribute(rule, ruleTemplateAttribute);
]]>
)attribute.validateRuleData(fieldValues)) {
GlobalVariables.getMessageMap().putError(wsei.getMessage(), RiceKeyConstants.ERROR_CUSTOM, wsei.getArg1());
}
try {
List curExts = ruleTemplateAttribute.getRuleExtensions();
for (Object element : curExts) {
RuleExtension curExt = (RuleExtension) iter.next();
curExtId = curExt.getRuleExtensionId();
RuleBaseValues curRule = curExt.getRuleBaseValues();
attribute.validateRuleData(WebRuleUtils.getFieldMapForRuleTemplateAttribute(curRule, ruleTemplateAttribute));
}
} catch (Exception e) {
LOG.warn("Exception caught attempting to validate attribute data for extension id:" + curExtId + ". Reason: " + e.getCause());
}
searchRows = attribute.getRuleRows();
]]>
getRoleQualification(ActionForm form, String methodToCall) {
]]>
0) {
if (definitions == null) {
KimType kimTypeInfo = getKimTypeInfoService().getKimType(kimTypeId);
KimTypeService kimTypeService = KIMServiceLocatorWeb.getKimTypeService(kimTypeInfo);
definitions = kimTypeService.getAttributeDefinitions(kimTypeId);
}
AttributeDefinition definition = definitions.getByAttributeName(entry.getKey().substring(0, entry.getKey().indexOf('.')));
Criteria valuesCrit = new Criteria();
]]>
();
}
/**
* The number of property elements in this state object.
*
* @return
*/
public int numPropertyElements() {
return pathElements.size();
}
/**
* Adds an additional state element into this object.
*
* @param elementName
* @param propertyType the type of the property when it was serialized
*/
public void addSerializedProperty(String elementName, PropertyType propertyType) {
SerializationPropertyElement serializationPropertyElement = new SerializationPropertyElement(elementName, propertyType);
pathElements.add(serializationPropertyElement);
}
/**
* Removes the last added serialized property
*
*/
public void removeSerializedProperty() {
pathElements.remove(pathElements.size() - 1);
}
/**
* Retrieves the element name of the state element. A parameter value of 0 represents the first element that was added
* by calling {@link #addSerializedProperty(String, PropertyType)} that hasn't been removed, and a value of
* {@link #numPropertyElements()} - 1 represents the element last added that hasn't been removed.
*
* @param propertyIndex most be between 0 and the value returned by {@link #numPropertyElements()} - 1
* @return
*/
public String getElementName(int propertyIndex) {
return pathElements.get(propertyIndex).getElementName();
}
/**
* Retrieves the property type of the state element. A parameter value of 0 represents the first element that was added
* by calling {@link #addSerializedProperty(String, PropertyType)} that hasn't been removed, and a value of
* {@link #numPropertyElements()} - 1 represents the element last added that hasn't been removed.
*
* @param propertyIndex most be between 0 and the value returned by {@link #numPropertyElements()} - 1
* @return
*/
public PropertyType getPropertyType(int propertyIndex) {
return pathElements.get(propertyIndex).getPropertyType();
}
}
]]>
0) {
if (cleanedValue.charAt(0) == '-') {
cleanedValue = "-" + cleanedValue.replaceAll("-", "");
} else {
cleanedValue = cleanedValue.replaceAll("-", "");
}
}
// ensure only one decimal in the string
int decimalLoc = cleanedValue.lastIndexOf('.');
if (cleanedValue.indexOf('.') != decimalLoc) {
cleanedValue = cleanedValue.substring(0, decimalLoc).replaceAll("\\.", "") + cleanedValue.substring(decimalLoc);
}
]]>
= activeFromDate.getTime()) && (activeToDate == null || asOfDate < activeToDate.getTime());
}
@Override
public boolean isActive(Timestamp activeAsOf) {
long asOfDate = System.currentTimeMillis();
if (activeAsOf != null) {
asOfDate = activeAsOf.getTime();
}
return (activeFromDate == null || asOfDate >= activeFromDate.getTime()) && (activeToDate == null || asOfDate < activeToDate.getTime());
}
@Override
public int hashCode() {
]]>
getExternalizableBusinessObjectProperties(Class> boClass, Map fieldValues) {
Set eboPropertyNames = new HashSet();
try {
Object sampleBo = boClass.newInstance();
for (String key : fieldValues.keySet()) {
if (isExternalBusinessObjectProperty(sampleBo, key)) {
eboPropertyNames.add(StringUtils.substringBeforeLast(key, "."));
}
}
} catch (Exception ex) {
LOG.debug("Unable to check " + boClass + " for EBO properties.", ex);
}
return new ArrayList(eboPropertyNames);
}
/**
* Given an property on the main BO class, return the defined type of the ExternalizableBusinessObject. This will be used by other code to determine the correct module service to call for the
* lookup.
*
* @param boClass
* @param propertyName
* @return
*/
protected Class extends ExternalizableBusinessObject> getExternalizableBusinessObjectClass(Class> boClass, String propertyName) {
]]>
getParametersFromRequest(Map requestParameters) {
Map parameters = new HashMap();
if (requestParameters.containsKey(UifParameters.VIEW_NAME)) {
parameters.put(UifParameters.VIEW_NAME, requestParameters.get(UifParameters.VIEW_NAME));
}
else {
parameters.put(UifParameters.VIEW_NAME, UifConstants.DEFAULT_VIEW_NAME);
}
if (requestParameters.containsKey(UifParameters.DATA_OBJECT_CLASS_NAME)) {
parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME,
requestParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME));
}
else if (requestParameters.containsKey(KNSPropertyConstants.DOC_ID)) {
]]>
)wsee.getServiceErrors()) {
if(workflowServiceError.getMessageMap() != null && workflowServiceError.getMessageMap().hasErrors()){
// merge the message maps
GlobalVariables.getMessageMap().merge(workflowServiceError.getMessageMap());
}else{
//TODO: can we add something to this to get it to highlight the right field too? Maybe in arg1
GlobalVariables.getMessageMap().putError(workflowServiceError.getMessage(), RiceKeyConstants.ERROR_CUSTOM, workflowServiceError.getMessage());
}
};
}
if(!GlobalVariables.getMessageMap().hasNoErrors()) {
throw new ValidationException("errors in search criteria");
]]>
getParametersFromRequest(Map requestParameters) {
Map parameters = new HashMap();
if (requestParameters.containsKey(UifParameters.VIEW_NAME)) {
parameters.put(UifParameters.VIEW_NAME, requestParameters.get(UifParameters.VIEW_NAME));
}
else {
parameters.put(UifParameters.VIEW_NAME, UifConstants.DEFAULT_VIEW_NAME);
}
if (requestParameters.containsKey(UifParameters.DATA_OBJECT_CLASS_NAME)) {
parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME,
requestParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME));
}
]]>
m = persistenceStructureService.listCollectionObjectTypes(o.getClass());
c = m.get(parts[0]);
}
// Look into the attribute class to see if it is writeable.
try {
i = c.newInstance();
StringBuffer sb = new StringBuffer();
for (int x = 1; x < parts.length; x++) {
sb.append(1 == x ? "" : ".").append(parts[x]);
}
b = isWriteable(i, sb.toString(), persistenceStructureService);
]]>
las = roleIdToMembershipMap.get( rm.getRoleId() );
if ( las == null ) {
las = new ArrayList();
roleIdToMembershipMap.put( rm.getRoleId(), las );
}
RoleMembershipInfo mi = new RoleMembershipInfo( rm.getRoleId(), rm.getRoleMemberId(), rm.getMemberId(), rm.getMemberTypeCode(), rm.getQualifier() );
las.add( mi );
} else {
results.add(rm.getQualifier());
}
}
]]>
getFlattenedNodes(Process process) {
Map nodesMap = new HashMap();
if (process.getInitialRouteNode() != null) {
flattenNodeGraph(nodesMap, process.getInitialRouteNode());
List nodes = new ArrayList(nodesMap.values());
Collections.sort(nodes, new RouteNodeSorter());
return nodes;
} else {
List nodes = new ArrayList();
nodes.add(new RouteNode());
return nodes;
}
}
/**
* Recursively walks the node graph and builds up the map. Uses a map because we will
* end up walking through duplicates, as is the case with Join nodes.
*/
private void flattenNodeGraph(Map nodes, RouteNode node) {
]]>
")
|| propertyValue.startsWith("<") ) ) {
addStringRangeCriteria(propertyName, propertyValue, criteria);
} else {
if (treatWildcardsAndOperatorsAsLiteral) {
propertyValue = StringUtils.replace(propertyValue, "*", "\\*");
}
criteria.addLike(propertyName, propertyValue);
]]>
_futureElements = null;
/**
* This constructor should never be called. It is only present for use during JAXB unmarshalling.
*/
private CampusType() {
]]>
matchingMembers = roleTypeService.doRoleQualifiersMatchQualification( qualification, roleIdToMembershipMap.get( roleId ) );
for ( RoleMembershipInfo rmi : matchingMembers ) {
results.add( rmi.getQualifier() );
}
} catch (Exception ex) {
LOG.warn("Not able to retrieve RoleTypeService from remote system for role Id: " + roleId, ex);
}
}
return results;
}
public List getRoleQualifiersForPrincipal( String principalId, String namespaceCode, String roleName, AttributeSet qualification ) {
]]>
(tr.getParameterNames()));
}
if (parameters != null){
this.parameters = Collections.unmodifiableMap(new HashMap(parameters));
} else {
this.parameters = null;
}
}
]]>
0 ? ", " : "";
filteredByItems += "Document Route Status";
}
if (filter.getDocumentTitle() != null && !"".equals(filter.getDocumentTitle().trim())) {
String docTitle = filter.getDocumentTitle();
if (docTitle.trim().endsWith("*")) {
docTitle = docTitle.substring(0, docTitle.length() - 1);
}
if (filter.isExcludeDocumentTitle()) {
crit.addNotLike("docTitle", "%" + docTitle + "%");
]]>
result = components.getSearchResults();
// for (DocumentSearchResult documentSearchResult : result) {
displayList = result;//.getResultContainers();
// }
//####BEGIN COPIED CODE#########
setBackLocation((String) lookupForm.getFieldsForLookup().get(KNSConstants.BACK_LOCATION));
setDocFormKey((String) lookupForm.getFieldsForLookup().get(KNSConstants.DOC_FORM_KEY));
//###COMENTED OUT
// Collection displayList;
// // call search method to get results
// if (bounded) {
// displayList = getSearchResults(lookupForm.getFieldsForLookup());
// }
// else {
// displayList = getSearchResultsUnbounded(lookupForm.getFieldsForLookup());
// }
//##COMENTED OUT
HashMap propertyTypes = new HashMap();
boolean hasReturnableRow = false;
List returnKeys = getReturnKeys();
List pkNames = getBusinessObjectMetaDataService().listPrimaryKeyFieldNames(getBusinessObjectClass());
Person user = GlobalVariables.getUserSession().getPerson();
]]>
subscriptions = this.userPreferenceService.getCurrentSubscriptions(userid);
Map currentsubs = new HashMap();;
Iterator i = subscriptions.iterator();
while (i.hasNext()) {
UserChannelSubscription sub = i.next();
String subid = Long.toString(sub.getChannel().getId());
currentsubs.put(subid, subid);
LOG.debug("currently subscribed to: "+sub.getChannel().getId());
}
]]>
"+newStatusCode);
PostProcessor postProcessor = routeHeader.getDocumentType().getPostProcessor();
ProcessDocReport report = postProcessor.doRouteStatusChange(statusChangeEvent);
if (!report.isSuccess()) {
LOG.warn(report.getMessage(), report.getProcessException());
throw new InvalidActionTakenException(report.getMessage());
}
} catch (Exception ex) {
]]>
to) {
int tmp = from;
from = to;
to = tmp;
}
int num;
// not very random huh...
if (from == to) {
num = from;
]]>
getAttributes() {
]]>
fieldsToClear = new HashMap();
//for (Row row : this.getRows()) {
// for (Field field : row.getFields()) {
// String[] propertyValue = {};
// if(!Field.MULTI_VALUE_FIELD_TYPES.contains(field.getFieldType())) {
// propertyValue = new String[]{field.getPropertyValue()};
// } else {
// propertyValue = field.getPropertyValues();
// }
// fieldsToClear.put(field.getPropertyName(), propertyValue);
// }
//}
Map fixedParameters = new HashMap();
Map changedDateFields = preprocessDateFields(lookupForm.getFieldsForLookup());
fixedParameters.putAll(this.getParameters());
for (Map.Entry prop : changedDateFields.entrySet()) {
fixedParameters.remove(prop.getKey());
fixedParameters.put(prop.getKey(), new String[]{prop.getValue()});
}
]]>