permissionDetails = new HashMap();
permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME,
documentTypeName);
return getPermissionService().isAuthorizedByTemplateName(
user.getPrincipalId(), nameSpaceCode,
KimConstants.PermissionTemplateNames.INITIATE_DOCUMENT,
permissionDetails, null);
}
public final boolean canReceiveAdHoc(Document document, Person user,
String actionRequestCode) {
Map additionalPermissionDetails = new HashMap();
additionalPermissionDetails.put(KimConstants.AttributeConstants.ACTION_REQUEST_CD, actionRequestCode);
return isAuthorizedByTemplate(document,
KRADConstants.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, KRADConstants.KRAD_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, KRADConstants.KRAD_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, KRADConstants.KRAD_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, KRADConstants.KRAD_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, KRADConstants.KRAD_NAMESPACE,
KimConstants.PermissionTemplateNames.SEND_AD_HOC_REQUEST, user
.getPrincipalId(), additionalPermissionDetails, null);
}
public boolean canEditDocumentOverview(Document document, Person user){
return isAuthorizedByTemplate(document,
KRADConstants.KRAD_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)) {
RoutePath routePath = KewApiServiceLocator.getDocumentTypeService().getRoutePathForDocumentTypeName(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
Process process = routePath.getPrimaryProcess();
if (process != null) {
if (process.getInitialRouteNode() == null) {
return false;
}
} else {
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, KRADConstants.KRAD_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) {
WorkflowDocument wd = document.getDocumentHeader()
.getWorkflowDocument();
attributes.put(KimConstants.AttributeConstants.DOCUMENT_NUMBER, document
.getDocumentNumber());
attributes.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, wd.getDocumentTypeName());
if (wd.isInitiated() || wd.isSaved()) {
attributes.put(KimConstants.AttributeConstants.ROUTE_NODE_NAME,
PRE_ROUTING_ROUTE_NAME);
} else {
attributes.put(KimConstants.AttributeConstants.ROUTE_NODE_NAME, KRADServiceLocatorWeb.getWorkflowDocumentService().getCurrentRouteNodeNames(wd));
}
attributes.put(KimConstants.AttributeConstants.ROUTE_STATUS_CODE, wd.getStatus().getCode());
}
protected boolean isDocumentInitiator(Document document, Person user) {
WorkflowDocument 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);
}
]]>
primaryKeys = new HashMap(4);
primaryKeys.put(SESSION_ID, sessionId);
if (documentNumber != null) {
primaryKeys.put(DOCUMENT_NUMBER, documentNumber);
}
primaryKeys.put(PRINCIPAL_ID, userSession.getPrincipalId());
primaryKeys.put(IP_ADDRESS, ipAddress);
SessionDocument sessionDoc = getBusinessObjectService().findByPrimaryKey(SessionDocument.class, primaryKeys);
if (sessionDoc != null) {
byte[] formAsBytes = sessionDoc.getSerializedDocumentForm();
if (sessionDoc.isEncrypted()) {
formAsBytes = getEncryptionService().decryptBytes(formAsBytes);
}
ByteArrayInputStream baip = new ByteArrayInputStream(formAsBytes);
ObjectInputStream ois = new ObjectInputStream(baip);
return ois.readObject();
}
return null;
}
@Override
public WorkflowDocument getDocumentFromSession(UserSession userSession, String docId) {
@SuppressWarnings("unchecked") Map workflowDocMap =
(Map) userSession
.retrieveObject(KEWConstants.WORKFLOW_DOCUMENT_MAP_ATTR_NAME);
if (workflowDocMap == null) {
workflowDocMap = new HashMap();
userSession.addObject(KEWConstants.WORKFLOW_DOCUMENT_MAP_ATTR_NAME, workflowDocMap);
return null;
}
return workflowDocMap.get(docId);
}
/**
* @see org.kuali.rice.krad.service.SessionDocumentService#addDocumentToUserSession(org.kuali.rice.krad.UserSession,
* org.kuali.rice.krad.workflow.service.KualiWorkflowDocument)
*/
@Override
public void addDocumentToUserSession(UserSession userSession, WorkflowDocument document) {
@SuppressWarnings("unchecked") Map workflowDocMap =
(Map) userSession
.retrieveObject(KEWConstants.WORKFLOW_DOCUMENT_MAP_ATTR_NAME);
if (workflowDocMap == null) {
workflowDocMap = new HashMap();
}
workflowDocMap.put(document.getDocumentId(), document);
userSession.addObject(KEWConstants.WORKFLOW_DOCUMENT_MAP_ATTR_NAME, workflowDocMap);
}
/**
* @see org.kuali.rice.krad.service.SessionDocumentService#purgeDocumentForm(String
* documentNumber, String docFormKey, UserSession userSession)
*/
@Override
public void purgeDocumentForm(String documentNumber, String docFormKey, UserSession userSession, String ipAddress) {
synchronized (userSession) {
LOG.debug("purge document form from session");
userSession.removeObject(docFormKey);
try {
LOG.debug("purge document form from database");
HashMap primaryKeys = new HashMap(4);
primaryKeys.put(SESSION_ID, userSession.getKualiSessionId());
primaryKeys.put(DOCUMENT_NUMBER, documentNumber);
primaryKeys.put(PRINCIPAL_ID, userSession.getPrincipalId());
primaryKeys.put(IP_ADDRESS, ipAddress);
getBusinessObjectService().deleteMatching(SessionDocument.class, primaryKeys);
} catch (Exception e) {
LOG.error("purgeDocumentForm failed for SessId/DocNum/PrinId/IP:" + userSession.getKualiSessionId() +
"/" + documentNumber + "/" + userSession.getPrincipalId() + "/" + ipAddress, e);
}
}
}
/**
* @see org.kuali.rice.krad.service.SessionDocumentService#setDocumentForm(org.kuali.rice.krad.web.form.DocumentFormBase,
* org.kuali.rice.krad.UserSession, java.lang.String)
*/
@Override
public void setDocumentForm(DocumentFormBase form, UserSession userSession, String ipAddress) {
]]>
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) {
]]>
getAttributes() {
return attributes;
}
public void setAttributes(Map attributes) {
this.attributes = Collections.unmodifiableMap(Maps.newHashMap(attributes));
}
@Override
public Responsibility build() {
]]>
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(
getGroupService().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;
]]>
primaryKeys = new HashMap(4);
primaryKeys.put(SESSION_ID, sessionId);
primaryKeys.put(DOCUMENT_NUMBER, documentNumber);
primaryKeys.put(PRINCIPAL_ID, userSession.getPrincipalId());
primaryKeys.put(IP_ADDRESS, ipAddress);
SessionDocument sessionDocument =
getBusinessObjectService().findByPrimaryKey(SessionDocument.class, primaryKeys);
if (sessionDocument == null) {
sessionDocument = new SessionDocument();
sessionDocument.setSessionId(sessionId);
sessionDocument.setDocumentNumber(documentNumber);
sessionDocument.setPrincipalId(userSession.getPrincipalId());
sessionDocument.setIpAddress(ipAddress);
}
sessionDocument.setSerializedDocumentForm(formAsBytes);
sessionDocument.setEncrypted(encryptContent);
sessionDocument.setLastUpdatedDate(currentTime);
businessObjectService.save(sessionDocument);
} catch (Exception e) {
final String className = form != null ? form.getClass().getName() : "null";
LOG.error("setDocumentForm failed for SessId/DocNum/PrinId/IP/class:" + userSession.getKualiSessionId() +
"/" + documentNumber + "/" + userSession.getPrincipalId() + "/" + ipAddress + "/" + className, e);
}
}
/**
* @see org.kuali.rice.krad.service.SessionDocumentService#purgeAllSessionDocuments(java.sql.Timestamp)
*/
@Override
public void purgeAllSessionDocuments(Timestamp expirationDate) {
sessionDocumentDao.purgeAllSessionDocuments(expirationDate);
}
protected SessionDocumentDao getSessionDocumentDao() {
return this.sessionDocumentDao;
}
public void setSessionDocumentDao(SessionDocumentDao sessionDocumentDao) {
this.sessionDocumentDao = sessionDocumentDao;
}
protected BusinessObjectService getBusinessObjectService() {
return this.businessObjectService;
}
public void setBusinessObjectService(BusinessObjectService businessObjectService) {
this.businessObjectService = businessObjectService;
}
public int getMaxCacheSize() {
return maxCacheSize;
}
public void setMaxCacheSize(int maxCacheSize) {
this.maxCacheSize = maxCacheSize;
}
protected EncryptionService getEncryptionService() {
if (encryptionService == null) {
encryptionService = CoreApiServiceLocator.getEncryptionService();
}
return encryptionService;
}
protected DataDictionaryService getDataDictionaryService() {
if (dataDictionaryService == null) {
dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
}
return dataDictionaryService;
}
}
]]>
l = Arrays.asList(valueEntered.split("\\.\\."));
for(String value : l){
bSplit = true;
if(!isPassesDefaultValidation(value)){
bRet = false;
}
}
}
if (StringUtils.contains(valueEntered, SearchOperator.OR.op())) {
//splitValueList.addAll(Arrays.asList(StringUtils.split(valueEntered, KRADConstants.OR_LOGICAL_OPERATOR)));
List l = Arrays.asList(StringUtils.split(valueEntered, SearchOperator.OR.op()));
for(String value : l){
bSplit = true;
if(!isPassesDefaultValidation(value)){
bRet = false;
}
}
}
if (StringUtils.contains(valueEntered, SearchOperator.AND.op())) {
//splitValueList.addAll(Arrays.asList(StringUtils.split(valueEntered, KRADConstants.AND_LOGICAL_OPERATOR)));
List l = Arrays.asList(StringUtils.split(valueEntered, SearchOperator.AND.op()));
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()) {
]]>
getFields() {
]]>
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(KRADUtils
.getNamespaceAndComponentSimpleName(maintDoc.getNewMaintainableObject().getDataObjectClass()));
}
}
}
@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(KRADUtils
.getNamespaceAndComponentSimpleName(maintDoc.getNewMaintainableObject().getDataObjectClass()));
attributes.put(KRADConstants.MAINTENANCE_ACTN,
maintDoc.getNewMaintainableObject().getMaintenanceAction());
}
}
}
]]>
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;
}
]]>
emptyMap();
this.active = builder.isActive();
this.versionNumber = builder.getVersionNumber();
this.objectId = builder.getObjectId();
}
/**
* @see ResponsibilityContract#getId()
*/
@Override
public String getId() {
return id;
}
/**
* @see ResponsibilityContract#getNamespaceCode()
*/
@Override
public String getNamespaceCode() {
return namespaceCode;
}
/**
* @see ResponsibilityContract#getName()
*/
@Override
public String getName() {
return name;
}
/**
* @see ResponsibilityContract#getDescription()
*/
@Override
public String getDescription() {
return description;
}
/**
* @see ResponsibilityContract#getTemplate()
*/
@Override
public Template getTemplate() {
return template;
}
/**
* @see org.kuali.rice.core.api.mo.common.active.ImmutableInactivatable#isActive()
*/
@Override
public boolean isActive() {
return active;
}
/**
*
* @see ResponsibilityContract#getAttributes()
*/
@Override
public Map getAttributes() {
return this.attributes;
}
/**
* @see org.kuali.rice.core.api.mo.common.Versioned#getVersionNumber()
*/
@Override
public Long getVersionNumber() {
return versionNumber;
}
/**
* @see org.kuali.rice.core.api.mo.common.GloballyUnique#getObjectId()
*/
@Override
public String getObjectId() {
return objectId;
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);
}
@Override
public boolean equals(Object obj) {
return EqualsBuilder.reflectionEquals(obj, this, Constants.HASH_CODE_EQUALS_EXCLUDE);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
/**
* This builder constructs a Responsibility enforcing the constraints of the {@link ResponsibilityContract}.
*/
public static final class Builder implements ResponsibilityContract, ModelBuilder, Serializable {
]]>
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.setApplicationContent(notificationAsXml);
document.setAttributeContent("" + gac.generateContent(attrFields) + "");
document.setTitle(notification.getTitle());
document.route("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, KRADConstants.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);
// }
}
]]>
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) {
]]>
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()
&& (ActionRequestStatus.INITIALIZED.getCode().equals( ar.getStatus() ) || ActionRequestStatus.ACTIVATED.getCode()
.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,
]]>
getPolicies() {
return this.policies;
}
@Override
public Long getVersionNumber() {
return this.versionNumber;
}
]]>
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( "
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(SearchOperator.OR.op());
}
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());
}
}
}
]]>
errors = ((WorkflowAttributeXmlValidator) attribute).validateClientRoutingData();
if (!errors.isEmpty()) {
inError = true;
errorMessage += "Error validating attribute " + definitionVO.getAttributeName() + " ";
for (WorkflowAttributeValidationError error : errors) {
errorMessage += error.getMessage() + " ";
}
}
}
// dont add to xml if attribute is in error
if (!inError) {
if (attribute instanceof WorkflowAttribute) {
String attributeDocContent = ((WorkflowAttribute) attribute).getDocContent();
if (!StringUtils.isEmpty(attributeDocContent)) {
XmlHelper.appendXml(contentSectionElement, attributeDocContent);
}
} else if (attribute instanceof SearchableAttribute) {
String searcheAttributeContent =
((SearchableAttribute) attribute).getSearchContent(DocSearchUtils.getDocumentSearchContext("", documentTypeName, ""));
]]>
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());
]]>
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(KRADConstants.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) {
]]>
getVariables() {
return this.variables;
]]>
getQualifier() {
return this.qualifier;
}
@Override
public List getDelegates() {
]]>
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);
String 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) {
]]>
cachedObjects;
private EncryptionService encryptionService;
private int maxCacheSize;
private BusinessObjectService businessObjectService;
private DataDictionaryService dataDictionaryService;
private SessionDocumentDao sessionDocumentDao;
public static class CachedObject {
private UserSession userSession;
private String formKey;
CachedObject(UserSession userSession, String formKey) {
this.userSession = userSession;
this.formKey = formKey;
}
@Override
public String toString() {
return "CachedObject: principalId=" + userSession.getPrincipalId() + " / objectWithFormKey=" +
userSession.retrieveObject(formKey);
}
public UserSession getUserSession() {
return this.userSession;
}
public String getFormKey() {
return this.formKey;
}
}
@Override
]]>
userGroupIds = new ArrayList();
for(String id: KimApiServiceLocator.getGroupService().getGroupIdsForPrincipal(principalId)){
userGroupIds.add(id);
}
if (!userGroupIds.isEmpty()) {
groupCrit.in("delegatorGroupId", userGroupIds);
}
orCrit.or(userCrit);
orCrit.or(groupCrit);
crit.and(orCrit);
crit.eq("delegationType", DelegationType.PRIMARY.getCode());
filter.setDelegationType(DelegationType.PRIMARY.getCode());
filter.setExcludeDelegationType(false);
addToFilterDescription(filteredByItems, "Primary Delegator Id");
addedDelegationCriteria = true;
filterOn = true;
}
]]>
> 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";
]]>
\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.krad.service.PersistenceStructureService#listReferenceObjectFieldNames(org.kuali.rice.krad.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) {
]]>
(getPermissionDetailValues(dataObject));
}
return getPermissionService().isAuthorized(principalId, namespaceCode, permissionName,
permissionDetails, roleQualifiers);
}
public final boolean isAuthorizedByTemplate(Object dataObject, String namespaceCode, String permissionTemplateName,
String principalId, Map collectionOrFieldLevelPermissionDetails,
Map collectionOrFieldLevelRoleQualification) {
Map roleQualifiers = new HashMap(getRoleQualification(dataObject, principalId));
Map permissionDetails = new HashMap(getPermissionDetailValues(dataObject));
if (collectionOrFieldLevelRoleQualification != null) {
roleQualifiers.putAll(collectionOrFieldLevelRoleQualification);
}
if (collectionOrFieldLevelPermissionDetails != null) {
permissionDetails.putAll(collectionOrFieldLevelPermissionDetails);
}
return getPermissionService().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) {
]]>
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 = KRADServiceLocatorWeb.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());
}
}
}
]]>
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);
}
]]>
> values;
@SuppressWarnings("unused")
@XmlAnyElement
private final Collection _futureElements = null;
/**
* Should only be invoked by JAXB.
*/
@SuppressWarnings("unused")
private NotInPredicate() {
]]>
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";
]]>
activeRequests = new ArrayList();
for ( ActionRequestValue ar : document.getActionRequests() ) {
if ( (ar.getCurrentIndicator() != null && ar.getCurrentIndicator()) && StringUtils.equals( ar.getStatus(), ActionRequestStatus.ACTIVATED.getCode() ) ) {
activeRequests.add(ar);
}
}
for (String actionTakenCode : actionMap.keySet())
{
List parameters = new ArrayList();
parameters.add(new DataDefinition(document));
parameters.add(new DataDefinition(principal));
ActionTakenEvent actionEvent = createAction(actionTakenCode, parameters);
if (StringUtils.isEmpty(actionEvent.validateActionRules(activeRequests)))
{
]]>
roleIds = getRoleIdsForPermissionTemplate( namespaceCode, permissionTemplateName, permissionDetails);
if ( roleIds.isEmpty() ) {
return results;
}
Collection roleMembers = roleService.getRoleMembers( roleIds,qualification);
for ( RoleMembership rm : roleMembers ) {
List delegateBuilderList = new ArrayList();
if (!rm.getDelegates().isEmpty()) {
for (DelegateType delegate : rm.getDelegates()){
delegateBuilderList.add(DelegateType.Builder.create(delegate));
}
}
if ( rm.getMemberTypeCode().equals( Role.PRINCIPAL_MEMBER_TYPE ) ) {
results.add (Assignee.Builder.create(rm.getMemberId(), null, delegateBuilderList).build());
} else { // a group membership
]]>
1) {
String expandedNot = SearchOperator.NOT + StringUtils.join(splitPropVal, SearchOperator.AND.op() + SearchOperator.NOT.op());
]]>
return value");
record.setReturnUrl(returnUrl.toString());
String destinationUrl = "report";
record.setDestinationUrl(destinationUrl);
displayList.add(ruleDelegation);
]]>
():origDelegationImplTemp.getMembers();
newKimDelegation.setMembers(getDelegationMembers(roleDocumentDelegation.getMembers(), origMembers, activatingInactive, newDelegationIdAssigned));
kimDelegations.add(newKimDelegation);
activatingInactive = false;
}
}
return kimDelegations;
}
protected List getDelegationMembers(List delegationMembers,
]]>
ticketContext = new HashMap();
ticketContext.put(KRADPropertyConstants.DOCUMENT_NUMBER, document.getDocumentNumber());
ticketContext.put(KRADConstants.CALLING_METHOD, caller);
ticketContext.put(KRADPropertyConstants.NAME, fieldName);
boolean questionAsked = GlobalVariables.getUserSession().hasMatchingSessionTicket(
KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET, ticketContext);
// start in logic for confirming the sensitive data
if (containsSensitiveData && warnForSensitiveData && !questionAsked) {
Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
if (question == null || !KRADConstants.DOCUMENT_SENSITIVE_DATA_QUESTION.equals(question)) {
]]>
roleQualifier = new HashMap(getRoleQualification(form, methodToCall));
Map permissionDetails = KRADUtils.getNamespaceAndActionClass(this.getClass());
if (!KimApiServiceLocator.getPermissionService()
.isAuthorizedByTemplateName(principalId, KRADConstants.KRAD_NAMESPACE,
KimConstants.PermissionTemplateNames.USE_SCREEN, permissionDetails,
roleQualifier)) {
throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(),
methodToCall, this.getClass().getSimpleName());
}
}
/**
* Override this method to add data from the form for role qualification in
* the authorization check
*/
protected Map getRoleQualification(UifFormBase form, String methodToCall) {
]]>
criteriaComponentsByFormKey = new HashMap();
for (SearchableAttribute searchableAttribute : docType.getSearchableAttributes()) {
for (Row row : searchableAttribute.getSearchingRows(
DocSearchUtils.getDocumentSearchContext("", docType.getName(), ""))) {
for (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());
]]>
delegatorGroupIds = KimApiServiceLocator.getGroupService().getGroupIdsForPrincipal(principalId);
if (delegatorGroupIds != null && !delegatorGroupIds.isEmpty()) {
groupCrit.addIn("delegatorGroupId", delegatorGroupIds);
}
orCrit.addOrCriteria(userCrit);
orCrit.addOrCriteria(groupCrit);
crit.addAndCriteria(orCrit);
crit.addEqualTo("delegationType", DelegationType.PRIMARY.getCode());
filter.setDelegationType(DelegationType.PRIMARY.getCode());
filter.setExcludeDelegationType(false);
addToFilterDescription(filteredByItems, "Primary Delegator Id");
addedDelegationCriteria = true;
filterOn = true;
}
]]>
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);
}
]]>
getConfigurationParameters() {
]]>
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() {
]]>
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);
]]>
qualifications, @XmlJavaTypeAdapter(value = SqlDateAdapter.class) @WebParam(name = "activeFromDate") Date activeFromDate, @XmlJavaTypeAdapter(value = SqlDateAdapter.class) @WebParam(name = "activeToDate") Date activeToDate) throws UnsupportedOperationException {
]]>
)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();
]]>
las = roleIdToMembershipMap.get(roleMemberBo.getRoleId());
if (las == null) {
las = new ArrayList();
roleIdToMembershipMap.put(roleMemberBo.getRoleId(), las);
}
RoleMembership mi = RoleMembership.Builder.create(
roleMemberBo.getRoleId(),
roleMemberBo.getRoleMemberId(),
roleMemberBo.getMemberId(),
roleMemberBo.getMemberTypeCode(),
roleMemberBo.getAttributes()).build();
las.add(mi);
} else {
results.add(roleMemberBo.getAttributes());
}
} else if (roleMemberBo.getMemberTypeCode().equals(Role.ROLE_MEMBER_TYPE)) {
]]>
extensionValues) {
Criteria crit = new Criteria();
crit.addEqualTo("currentInd", Boolean.TRUE);
crit.addEqualTo("templateRuleInd", Boolean.FALSE);
if (activeInd != null) {
crit.addEqualTo("activeInd", activeInd);
}
if (docTypeName != null) {
crit.addLike("UPPER(docTypeName)", docTypeName.toUpperCase());
}
if (ruleDescription != null && !ruleDescription.trim().equals("")) {
crit.addLike("UPPER(description)", ruleDescription.toUpperCase());
}
if (ruleTemplateId != null) {
crit.addEqualTo("ruleTemplateId", ruleTemplateId);
}
if (extensionValues != null && !extensionValues.isEmpty()) {
]]>
")
|| propertyValue.startsWith("<") ) ) {
addStringRangeCriteria(propertyName, propertyValue, criteria);
} else {
if (treatWildcardsAndOperatorsAsLiteral) {
propertyValue = StringUtils.replace(propertyValue, "*", "\\*");
}
criteria.addLike(propertyName, propertyValue);
]]>
();
}
/**
* 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);
}
]]>
());
}
public final boolean canMaintain(Object dataObject, Person user) {
Map permissionDetails = new HashMap(2);
permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME,
]]>
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(KRADPropertyConstants.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);
]]>
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) {
]]>
qualifications, @XmlJavaTypeAdapter(value = SqlDateAdapter.class) @WebParam(name = "activeFromDate") Date activeFromDate, @XmlJavaTypeAdapter(value = SqlDateAdapter.class) @WebParam(name = "activeToDate") Date activeToDate) throws UnsupportedOperationException {
]]>
_futureElements = null;
/**
* Private constructor used only by JAXB.
*
*/
private EntityName() {
]]>
roleQualifier = new HashMap(getRoleQualification(form, methodToCall));
Map permissionDetails = KRADUtils.getNamespaceAndActionClass(this.getClass());
if (!KimApiServiceLocator.getPermissionService().isAuthorizedByTemplateName(principalId, KRADConstants.KRAD_NAMESPACE,
KimConstants.PermissionTemplateNames.USE_SCREEN, permissionDetails, roleQualifier ))
{
throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(),
]]>
permissionDetails ) {
return !getRoleIdsForPermission(namespaceCode, permissionName, permissionDetails).isEmpty();
}
public boolean isPermissionDefined( String namespaceCode, String permissionName, Map permissionDetails ) {
// get all the permission objects whose name match that requested
PermissionBo permissions = getPermissionImplsByName( namespaceCode, permissionName );
// now, filter the full list by the detail passed
return !getMatchingPermissions( Collections.singletonList(permissions), permissionDetails ).isEmpty();
}
public boolean isPermissionDefinedForTemplateName( String namespaceCode, String permissionTemplateName, Map permissionDetails ) {
]]>
findRuleBaseValuesByResponsibilityReviewerTemplateDoc(String ruleTemplateName, String documentType, String reviewerName, String type) {
Criteria crit = new Criteria();
]]>
definitions, String content, String elementName, String documentTypeName) throws TransformerException, SAXException, IOException, ParserConfigurationException {
Element contentSectionElement = existingAttributeElement;
// if they've updated the content, we're going to re-build the content section element from scratch
if (content != null) {
if (!org.apache.commons.lang.StringUtils.isEmpty(content)) {
contentSectionElement = document.createElement(elementName);
// if they didn't merely clear the content, let's build the content section element by combining the children
// of the incoming XML content
Element incomingAttributeElement = XmlHelper.readXml(content).getDocumentElement();
NodeList children = incomingAttributeElement.getChildNodes();
for (int index = 0; index < children.getLength(); index++) {
contentSectionElement.appendChild(document.importNode(children.item(index), true));
}
} else {
contentSectionElement = null;
}
}
// if they have new definitions we're going to append those to the existing content section
if (definitions != null && !definitions.isEmpty()) {
]]>
_futureElements = null;
/**
* This constructor should never be called. It is only present for use during JAXB unmarshalling.
*/
private CampusType() {
]]>
(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 + "%");
]]>
)
*/
public boolean hasPermissionByTemplateName(String principalId, String namespaceCode, String permissionTemplateName, Map permissionDetails) {
return isAuthorizedByTemplateName( principalId, namespaceCode, permissionTemplateName, permissionDetails, null );
}
/**
* @see org.kuali.rice.kim.service.PermissionService#isAuthorized( java.lang.String, String, java.lang.String, Map, Map)
*/
public boolean isAuthorizedByTemplateName(String principalId, String namespaceCode, String permissionTemplateName, Map permissionDetails, Map qualification ) {
List roleIds = getRoleIdsForPermissionTemplate( namespaceCode, permissionTemplateName, permissionDetails );
if ( roleIds.isEmpty() ) {
return false;
}
return roleService.principalHasRole( principalId, roleIds, qualification);
]]>
permissionDetails = new HashMap();
permissionDetails.put(KimConstants.AttributeConstants.NAMESPACE_CODE, parm.getNamespaceCode());
permissionDetails.put(KimConstants.AttributeConstants.COMPONENT_NAME, parm.getComponentCode());
permissionDetails.put(KimConstants.AttributeConstants.PARAMETER_NAME, parm.getName());
allowsEdit = KimApiServiceLocator.getPermissionService().isAuthorizedByTemplateName(
GlobalVariables.getUserSession().getPerson().getPrincipalId(),
KRADConstants.KRAD_NAMESPACE,
KimConstants.PermissionTemplateNames.MAINTAIN_SYSTEM_PARAMETER,
permissionDetails, null);
]]>
attributes;
private Long versionNumber = 1L;
private String objectId;
private boolean active;
private Builder(String namespaceCode, String name, Template.Builder template) {
setNamespaceCode(namespaceCode);
setName(name);
setTemplate(template);
}
/**
* Creates a Responsibility with the required fields.
*/
public static Builder create(String namespaceCode, String name, Template.Builder template) {
return new Builder(namespaceCode, name, template);
}
/**
* Creates a Responsibility from an existing {@link ResponsibilityContract}.
*/
public static Builder create(ResponsibilityContract contract) {
]]>
responsibilityIds = new HashSet();
Map rulesToSave = new HashMap();
Collections.sort(rules, new RuleDelegationSorter());
]]>
result = components.getSearchResults();
// for (DocumentSearchResult documentSearchResult : result) {
displayList = result;//.getResultContainers();
// }
//####BEGIN COPIED CODE#########
setBackLocation((String) lookupForm.getFieldsForLookup().get(KRADConstants.BACK_LOCATION));
setDocFormKey((String) lookupForm.getFieldsForLookup().get(KRADConstants.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() {
]]>
roleQualifier = new HashMap(getRoleQualification(form, methodToCall));
Map permissionDetails = KRADUtils.getNamespaceAndActionClass(this.getClass());
if (!KimApiServiceLocator.getPermissionService()
.isAuthorizedByTemplateName(principalId, KRADConstants.KRAD_NAMESPACE,
KimConstants.PermissionTemplateNames.USE_SCREEN, permissionDetails,
roleQualifier)) {
throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(),
]]>
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()});
}
]]>