conflict_resolution
stringlengths
27
16k
<<<<<<< import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.docsubmission.inbound.InboundDocSubmission; import gov.hhs.fha.nhinc.messaging.server.BaseService; ======= >>>>>>> import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.docsubmission.inbound.InboundDocSubmission; import gov.hhs.fha.nhinc.messaging.server.BaseService;
<<<<<<< import org.nhind.config.common.AddAnchor; ======= import org.nhind.config.common.AddCertificates; >>>>>>> import org.nhind.config.common.AddAnchor; import org.nhind.config.common.AddCertificates; <<<<<<< import org.nhind.config.common.Anchor; ======= import org.nhind.config.common.Certificate; >>>>>>> import org.nhind.config.common.Anchor; import org.nhind.config.common.Certificate; <<<<<<< import org.nhind.config.common.GetAnchorsForOwner; import org.nhind.config.common.RemoveAnchors; ======= import org.nhind.config.common.ListCertificates; import org.nhind.config.common.RemoveCertificates; >>>>>>> import org.nhind.config.common.GetAnchorsForOwner; import org.nhind.config.common.ListCertificates; import org.nhind.config.common.RemoveAnchors; import org.nhind.config.common.RemoveCertificates; <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. } @Override public void addCertificate(AddCertificates certificate) { try { directProxy.addCertificates(certificate); } catch (Exception ex) { LOG.error("Error While adding Certificate " + ex.getMessage(), ex); } } @Override public void deleteCertificate(RemoveCertificates removeCert) { try { directProxy.removeCertificate(removeCert); } catch (Exception ex) { LOG.error("Error While removing Certificate " + ex.getMessage(), ex); } <<<<<<< public void deleteCertificate(DirectCertificate cert) { throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= public List<Certificate> listCertificate(ListCertificates listCert) { List<Certificate> certs = null; try { certs = directProxy.listCertificates(listCert); } catch (Exception ex) { LOG.error("Error While retrieving Certificate " + ex.getMessage(), ex); } return certs; >>>>>>> public List<Certificate> listCertificate(ListCertificates listCert) { List<Certificate> certs = null; try { certs = directProxy.listCertificates(listCert); } catch (Exception ex) { LOG.error("Error While retrieving Certificate " + ex.getMessage(), ex); } return certs; <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. <<<<<<< throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. ======= throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates. >>>>>>> throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose // Tools | Templates.
<<<<<<< /** * * @return */ ======= >>>>>>> /** * * @return */ <<<<<<< /** * * @param directTabIndex * @return */ public String setDirectTabIndexNavigate(int directTabIndex){ ======= public String setDirectTabIndexNavigate(int directTabIndex) { >>>>>>> /** * * @param directTabIndex * @return */ public String setDirectTabIndexNavigate(int directTabIndex){
<<<<<<< @AdapterDelegationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") ======= /** *@param msg The AdhocQueryRequest message. *@param assertion Assertion received. *@return The AdhocQueryResponse received. */ >>>>>>> /** *@param msg The AdhocQueryRequest message. *@param assertion Assertion received. *@return The AdhocQueryResponse received. */ @AdapterDelegationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "")
<<<<<<< long tt1 = 0, tt2 = 0, tt3 = 0; ======= >>>>>>> long tt1 = 0, tt2 = 0, tt3 = 0; <<<<<<< tt3 += (System.nanoTime() - time); return res; ======= return res; >>>>>>> return res; <<<<<<< private Map<String, Coin> addToCoinMap(Transaction transaction) { Map<String, Coin> toMap = new HashMap<>(); ======= private void initUsedTxSets() { usedTxSets = new HashSet<>(); List<Transaction> allUnconfirmedTxs = unconfirmedTransactionStorageService.loadAllUnconfirmedList().getData(); for(Transaction tx : allUnconfirmedTxs) { CoinData coinData = tx.getCoinData(); if(coinData == null) { continue; } List<Coin> froms = tx.getCoinData().getFrom(); for(Coin from : froms) { usedTxSets.add(LedgerUtil.asString(from.getOwner())); } } } private Map<String,Coin> addToCoinMap(Transaction transaction) { Map<String,Coin> toMap = new HashMap<>(); >>>>>>> private void initUsedTxSets() { usedTxSets = new HashSet<>(); List<Transaction> allUnconfirmedTxs = unconfirmedTransactionStorageService.loadAllUnconfirmedList().getData(); for(Transaction tx : allUnconfirmedTxs) { CoinData coinData = tx.getCoinData(); if(coinData == null) { continue; } List<Coin> froms = tx.getCoinData().getFrom(); for(Coin from : froms) { usedTxSets.add(LedgerUtil.asString(from.getOwner())); } } } private Map<String,Coin> addToCoinMap(Transaction transaction) { Map<String,Coin> toMap = new HashMap<>(); private Map<String, Coin> addToCoinMap(Transaction transaction) { Map<String, Coin> toMap = new HashMap<>(); <<<<<<< long t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0; int count = 0; ======= >>>>>>> <<<<<<< t4 += System.nanoTime() - time; count++; if (count % 500 == 0) { Log.info("t1 is : " + t1 / 1000000 + " ms"); Log.info("t2 is : " + t2 / 1000000 + " ms"); Log.info("t3 is : " + t3 / 1000000 + " ms"); Log.info("t4 is : " + t4 / 1000000 + " ms"); Log.info("t5 is : " + t5 / 1000000 + " ms"); Log.info("----- tt1 is : " + tt1 / 1000000 + " ms"); Log.info("----- tt2 is : " + tt2 / 1000000 + " ms"); Log.info("----- tt3 is : " + tt3 / 1000000 + " ms"); } ======= >>>>>>>
<<<<<<< import gov.hhs.fha.nhinc.admindistribution.passthru.PassthruAdminDistributionOrchImpl; import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.cxf.extraction.SAML2AssertionExtractor; import gov.hhs.fha.nhinc.nhinclib.NhincConstants; ======= >>>>>>> import gov.hhs.fha.nhinc.admindistribution.passthru.PassthruAdminDistributionOrchImpl; import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.cxf.extraction.SAML2AssertionExtractor; import gov.hhs.fha.nhinc.nhinclib.NhincConstants;
<<<<<<< private void refreshServices() { CachingCXFUnsecuredServicePortBuilder.clearCache(); CachingCXFSecuredServicePortBuilder.clearCache(); } ======= @Override public DataHandler transformToHandler(byte[] encoded) { DataSource data = new CertificateSource(encoded); return new DataHandler(data); } @Override public byte[] transformToByteCode(DataHandler handler) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); handler.writeTo(output); return output.toByteArray(); } >>>>>>> private void refreshServices() { CachingCXFUnsecuredServicePortBuilder.clearCache(); CachingCXFSecuredServicePortBuilder.clearCache(); } @Override public DataHandler transformToHandler(byte[] encoded) { DataSource data = new CertificateSource(encoded); return new DataHandler(data); } @Override public byte[] transformToByteCode(DataHandler handler) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); handler.writeTo(output); return output.toByteArray(); }
<<<<<<< import java.util.List; import javax.xml.ws.WebServiceContext; import javax.xml.xpath.XPathExpressionException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.oasis_open.docs.wsn.b_2.UnableToDestroySubscriptionFaultType; import org.oasis_open.docs.wsn.b_2.Unsubscribe; import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse; import org.oasis_open.docs.wsn.bw_2.UnableToDestroySubscriptionFault; import org.w3c.dom.Element; import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType; import gov.hhs.fha.nhinc.common.nhinccommonentity.UnsubscribeRequestType; ======= import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetCommunitiesType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetCommunityType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType; import gov.hhs.fha.nhinc.common.nhinccommonentity.UnsubscribeRequestType; >>>>>>> import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType; import gov.hhs.fha.nhinc.common.nhinccommonentity.UnsubscribeRequestType; <<<<<<< import gov.hhs.fha.nhinc.nhinclib.NullChecker; import gov.hhs.fha.nhinc.nhinhiem.proxy.unsubscribe.NhinHiemUnsubscribeProxy; import gov.hhs.fha.nhinc.nhinhiem.proxy.unsubscribe.NhinHiemUnsubscribeProxyObjectFactory; import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor; import gov.hhs.fha.nhinc.subscription.repository.data.HiemSubscriptionItem; import gov.hhs.fha.nhinc.subscription.repository.service.HiemSubscriptionRepositoryService; import gov.hhs.fha.nhinc.subscription.repository.service.SubscriptionRepositoryException; import gov.hhs.fha.nhinc.xmlCommon.XmlUtility; ======= import gov.hhs.fha.nhinc.nhinclib.NullChecker; import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor; import gov.hhs.fha.nhinc.subscription.repository.data.HiemSubscriptionItem; import gov.hhs.fha.nhinc.subscription.repository.service.HiemSubscriptionRepositoryService; import gov.hhs.fha.nhinc.subscription.repository.service.SubscriptionRepositoryException; import gov.hhs.fha.nhinc.unsubscribe.entity.EntityUnsubscribeOrchImpl; import java.util.List; import javax.xml.ws.WebServiceContext; import javax.xml.xpath.XPathExpressionException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.oasis_open.docs.wsn.b_2.UnableToDestroySubscriptionFaultType; import org.oasis_open.docs.wsn.b_2.Unsubscribe; import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse; import org.oasis_open.docs.wsn.bw_2.ResourceUnknownFault; import org.oasis_open.docs.wsn.bw_2.UnableToDestroySubscriptionFault; >>>>>>> import gov.hhs.fha.nhinc.nhinclib.NullChecker; import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor; import gov.hhs.fha.nhinc.subscription.repository.data.HiemSubscriptionItem; import gov.hhs.fha.nhinc.subscription.repository.service.HiemSubscriptionRepositoryService; import gov.hhs.fha.nhinc.subscription.repository.service.SubscriptionRepositoryException; import gov.hhs.fha.nhinc.unsubscribe.entity.EntityUnsubscribeOrchImpl; import java.util.List; import javax.xml.ws.WebServiceContext; import javax.xml.xpath.XPathExpressionException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.oasis_open.docs.wsn.b_2.UnableToDestroySubscriptionFaultType; import org.oasis_open.docs.wsn.b_2.Unsubscribe; import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse; import org.oasis_open.docs.wsn.bw_2.ResourceUnknownFault; import org.oasis_open.docs.wsn.bw_2.UnableToDestroySubscriptionFault;
<<<<<<< import static org.junit.Assert.assertSame; ======= import static org.junit.Assert.assertSame; import javax.xml.ws.WebServiceContext; import org.hl7.v3.PRPAIN201305UV02; import org.hl7.v3.PRPAIN201306UV02; import org.jmock.Expectations; import org.jmock.Mockery; import org.jmock.integration.junit4.JUnit4Mockery; import org.jmock.lib.legacy.ClassImposteriser; import org.junit.Test; >>>>>>> import static org.junit.Assert.assertSame; import javax.xml.ws.WebServiceContext; <<<<<<< import java.sql.Timestamp; import javax.xml.ws.WebServiceContext; import org.hl7.v3.PRPAIN201305UV02; import org.hl7.v3.PRPAIN201306UV02; import org.jmock.Expectations; import org.jmock.Mockery; import org.jmock.integration.junit4.JUnit4Mockery; import org.jmock.lib.legacy.ClassImposteriser; import org.junit.Test; ======= >>>>>>> import java.sql.Timestamp; import javax.xml.ws.WebServiceContext; import org.hl7.v3.PRPAIN201305UV02; import org.hl7.v3.PRPAIN201306UV02; import org.jmock.Expectations; import org.jmock.Mockery; import org.jmock.integration.junit4.JUnit4Mockery; import org.jmock.lib.legacy.ClassImposteriser; import org.junit.Test;
<<<<<<< @AdapterDelegationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") ======= /** * The respondingGatewayCrossGatewayQuery method returns AdhocQueryResponse from Adapter interface. * @param msg The AdhocQueryRequest message. * @param assertion Assertion received. * @return AdhocQuery Response from Adapter interface. */ >>>>>>> /** * The respondingGatewayCrossGatewayQuery method returns AdhocQueryResponse from Adapter interface. * @param msg The AdhocQueryRequest message. * @param assertion Assertion received. * @return AdhocQuery Response from Adapter interface. */ @AdapterDelegationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "")
<<<<<<< NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { ======= NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { >>>>>>> NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException { <<<<<<< InvalidKeyException, NoSuchProviderException, SignatureException { ======= InvalidKeyException, NoSuchProviderException, SignatureException { >>>>>>> InvalidKeyException, NoSuchProviderException, SignatureException { <<<<<<< ======= final PropertyAccessor propertyAccessor = mock(PropertyAccessor.class); when(propertyAccessor.getProperty(Mockito.anyString(), Mockito.anyString())) .thenReturn(Boolean.TRUE.toString()); >>>>>>> <<<<<<< ======= final PropertyAccessor propertyAccessor = mock(PropertyAccessor.class); when(propertyAccessor.getProperty(Mockito.anyString(), Mockito.anyString())) .thenReturn(Boolean.FALSE.toString()); >>>>>>> <<<<<<< ======= final PropertyAccessor propertyAccessor = mock(PropertyAccessor.class); when(propertyAccessor.getProperty(Mockito.anyString(), Mockito.anyString())) .thenReturn(Boolean.FALSE.toString()); >>>>>>> <<<<<<< .createAuthenicationDecsionStatements(callbackProps, subject); ======= .createAuthorizationDecisionStatements(callbackProps, subject); >>>>>>> .createAuthorizationDecisionStatements(callbackProps, subject); <<<<<<< .thenReturn(Boolean.TRUE.toString()); ======= .thenReturn(Boolean.TRUE.toString()); >>>>>>> .thenReturn(Boolean.TRUE.toString()); <<<<<<< .createAuthenicationDecsionStatements(callbackProps, subject); ======= .createAuthorizationDecisionStatements(callbackProps, subject); >>>>>>> .createAuthorizationDecisionStatements(callbackProps, subject); <<<<<<< .thenReturn(Boolean.FALSE.toString()); ======= .thenReturn(Boolean.FALSE.toString()); >>>>>>> .thenReturn(Boolean.FALSE.toString()); <<<<<<< .createAuthenicationDecsionStatements(callbackProps, subject); ======= .createAuthorizationDecisionStatements(callbackProps, subject); >>>>>>> .createAuthorizationDecisionStatements(callbackProps, subject); <<<<<<< .thenReturn(Boolean.FALSE.toString()); ======= .thenReturn(Boolean.FALSE.toString()); >>>>>>> .thenReturn(Boolean.FALSE.toString()); <<<<<<< .createAuthenicationDecsionStatements(callbackProps, subject); ======= .createAuthorizationDecisionStatements(callbackProps, subject); >>>>>>> .createAuthorizationDecisionStatements(callbackProps, subject);
<<<<<<< import org.nhindirect.xd.common.DirectDocuments; ======= import org.nhindirect.gateway.smtp.SmtpAgent; >>>>>>> import org.nhindirect.xd.common.DirectDocuments; import org.nhindirect.gateway.smtp.SmtpAgent; <<<<<<< ======= /** * Make the smtp agent on this direct cliet available to the caller. * @return SmtpAgent property of this client. */ SmtpAgent getSmtpAgent(); >>>>>>> /** * Make the smtp agent on this direct cliet available to the caller. * @return SmtpAgent property of this client. */ SmtpAgent getSmtpAgent();
<<<<<<< import gov.hhs.fha.nhinc.direct.event.DirectEventLogger; import gov.hhs.fha.nhinc.direct.event.DirectEventType; ======= import gov.hhs.fha.nhinc.direct.edge.proxy.DirectEdgeProxy; import gov.hhs.fha.nhinc.direct.edge.proxy.DirectEdgeProxyObjectFactory; >>>>>>> import gov.hhs.fha.nhinc.direct.edge.proxy.DirectEdgeProxy; import gov.hhs.fha.nhinc.direct.edge.proxy.DirectEdgeProxyObjectFactory; <<<<<<< return null; } switch (edgeClientType) { case EDGE_CLIENT_TYPE_SMTP: handleMessageAsSmtp(processedMessage); break; case EDGE_CLIENT_TYPE_SOAP: handleMessageAsSoap(processedMessage); break; default: throw new DirectException("Unknown edge client type: " + edgeClientType); } return processedMessage.getMessage(); } private void logInboundEvent(MimeMessage message) { if (DirectClientUtils.isMdn(message)) { eventLogger.log(DirectEventType.INBOUND_MDN, message); } else { eventLogger.log(DirectEventType.INBOUND_DIRECT, message); } } /** * Handles the message for SMTP edge clients. * @param processedMessage decrypted message to be handled. */ private void handleMessageAsSmtp(MessageEnvelope processedMessage) { if (internalDirectClient == null) { throw new DirectException("Internal Direct Client is not set as a property on this Message Handler."); ======= return; >>>>>>> return null;
<<<<<<< import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.RespondingGatewayCrossGatewayQueryRequestTypeDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.entity.EntityDocQueryOrchImpl; ======= import gov.hhs.fha.nhinc.docquery.outbound.OutboundDocQuery; >>>>>>> import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.RespondingGatewayCrossGatewayQueryRequestTypeDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.outbound.OutboundDocQuery; <<<<<<< @Addressing(enabled = true) public class EntityDocQueryUnsecured implements gov.hhs.fha.nhinc.entitydocquery.EntityDocQueryPortType { private EntityDocQueryOrchImpl orchImpl; ======= @Addressing(enabled = true) public class EntityDocQueryUnsecured implements gov.hhs.fha.nhinc.entitydocquery.EntityDocQueryPortType { private OutboundDocQuery outboundDocQuery; >>>>>>> @Addressing(enabled = true) public class EntityDocQueryUnsecured implements gov.hhs.fha.nhinc.entitydocquery.EntityDocQueryPortType { private OutboundDocQuery outboundDocQuery; <<<<<<< @OutboundMessageEvent(beforeBuilder = RespondingGatewayCrossGatewayQueryRequestTypeDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "2.0") public AdhocQueryResponse respondingGatewayCrossGatewayQuery(RespondingGatewayCrossGatewayQueryRequestType request) { AdhocQueryResponse response = null; EntityDocQueryImpl impl = getEntityDocQueryImpl(); if (impl != null) { response = impl.respondingGatewayCrossGatewayQueryUnsecured(request, getWebServiceContext()); } return response; } protected EntityDocQueryImpl getEntityDocQueryImpl() { return new EntityDocQueryImpl(orchImpl); ======= public AdhocQueryResponse respondingGatewayCrossGatewayQuery(RespondingGatewayCrossGatewayQueryRequestType request) { return new EntityDocQueryImpl(outboundDocQuery).respondingGatewayCrossGatewayQueryUnsecured(request, context); >>>>>>> @OutboundMessageEvent(beforeBuilder = RespondingGatewayCrossGatewayQueryRequestTypeDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "2.0") public AdhocQueryResponse respondingGatewayCrossGatewayQuery(RespondingGatewayCrossGatewayQueryRequestType request) { return new EntityDocQueryImpl(outboundDocQuery).respondingGatewayCrossGatewayQueryUnsecured(request, context);
<<<<<<< protected ZeppelinConnection connection; private URI uri; ======= protected ThreadLocal<ZeppelinConnection> connection = new ThreadLocal<ZeppelinConnection>() { @Override protected ZeppelinConnection initialValue() { //Lazy Init by subClass impl return getConnection(); } }; >>>>>>> private URI uri; protected ThreadLocal<ZeppelinConnection> connection = new ThreadLocal<ZeppelinConnection>() { @Override protected ZeppelinConnection initialValue() { //Lazy Init by subClass impl return getConnection(); } };
<<<<<<< //FIXME transient private ZeppelinConnection conn; public ZQLJob(String jobName, Zengine zengine, JobListener listener) { ======= public ZQLJob(String jobName, JobListener listener) { >>>>>>> public ZQLJob(String jobName, Zengine zengine, JobListener listener) { <<<<<<< zz.withParams(p); zz.execute(); ======= zz.withParams(p); zz.execute(); >>>>>>> zz.withParams(p); zz.execute();
<<<<<<< } if (b) { Consensus<Agent> ca = consensusCacheManager.getCachedAgentByAddress(depositAddress); if (null != ca) { agentList.add(0, ca); } ======= >>>>>>> } if (b) { Consensus<Agent> ca = consensusCacheManager.getCachedAgentByAddress(depositAddress); if (null != ca) { agentList.add(0, ca); }
<<<<<<< String [] blockStart = new String[]{ "\"", "'", "<%", "N_<", "!"}; String [] blockEnd = new String[]{ "\"", "'", "%>", "N_>", ";" }; String [] t = Util.split(erbEvalGlobalScope(stmts), escapeSeq, escapeChar, blockStart, blockEnd, op, true); ======= String [] blockStart = new String[]{ "\"", "'", "<%", "<", "N_<", "!"}; String [] blockEnd = new String[]{ "\"", "'", "%>", ";", "N_>", ";" }; String [] t = Util.split(stmts, escapeSeq, escapeChar, blockStart, blockEnd, op, true); >>>>>>> String [] blockStart = new String[]{ "\"", "'", "<%", "<", "N_<", "!"}; String [] blockEnd = new String[]{ "\"", "'", "%>", ";", "N_>", ";" }; String [] t = Util.split(erbEvalGlobalScope(stmts), escapeSeq, escapeChar, blockStart, blockEnd, op, true);
<<<<<<< import org.glassfish.grizzly.asyncqueue.WriteQueueMessage; ======= import org.glassfish.grizzly.asyncqueue.PushBackHandler; >>>>>>> import org.glassfish.grizzly.asyncqueue.WriteQueueMessage; import org.glassfish.grizzly.asyncqueue.PushBackHandler; <<<<<<< public GrizzlyFuture<WriteResult<WriteQueueMessage, SocketAddress>> write( Connection connection, SocketAddress dstAddress, WriteQueueMessage message, CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, Interceptor<WriteResult<WriteQueueMessage, SocketAddress>> interceptor) ======= public GrizzlyFuture<WriteResult<Buffer, SocketAddress>> write( Connection connection, SocketAddress dstAddress, Buffer buffer, CompletionHandler<WriteResult<Buffer, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler) >>>>>>> public GrizzlyFuture<WriteResult<WriteQueueMessage, SocketAddress>> write( Connection connection, SocketAddress dstAddress, WriteQueueMessage message, CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler) <<<<<<< return write(connection, dstAddress, message, completionHandler, interceptor, ======= return write(connection, dstAddress, buffer, completionHandler, pushBackHandler, >>>>>>> return write(connection, dstAddress, message, completionHandler, pushBackHandler, <<<<<<< public GrizzlyFuture<WriteResult<WriteQueueMessage, SocketAddress>> write( Connection connection, SocketAddress dstAddress, WriteQueueMessage message, CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, Interceptor<WriteResult<WriteQueueMessage, SocketAddress>> interceptor, ======= public GrizzlyFuture<WriteResult<Buffer, SocketAddress>> write( Connection connection, SocketAddress dstAddress, Buffer message, CompletionHandler<WriteResult<Buffer, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler, >>>>>>> public GrizzlyFuture<WriteResult<WriteQueueMessage, SocketAddress>> write( Connection connection, SocketAddress dstAddress, WriteQueueMessage message, CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler,
<<<<<<< final WriteQueueMessage message, final CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, final Interceptor<WriteResult<WriteQueueMessage, SocketAddress>> interceptor) ======= final Buffer buffer, final CompletionHandler<WriteResult<Buffer, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler) >>>>>>> final WriteQueueMessage message, final CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler) <<<<<<< return write(connection, dstAddress, message, completionHandler, interceptor, null); ======= return write(connection, dstAddress, buffer, completionHandler, pushBackHandler, null); >>>>>>> return write(connection, dstAddress, message, completionHandler, pushBackHandler, null); <<<<<<< final WriteQueueMessage message, final CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, final Interceptor<WriteResult<WriteQueueMessage, SocketAddress>> interceptor, final MessageCloner<WriteQueueMessage> cloner) throws IOException { ======= final Buffer buffer, final CompletionHandler<WriteResult<Buffer, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler, final MessageCloner<Buffer> cloner) throws IOException { >>>>>>> final WriteQueueMessage message, final CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler, final MessageCloner<WriteQueueMessage> cloner) throws IOException { <<<<<<< protected AsyncWriteQueueRecord createRecord(final Connection connection, final WriteQueueMessage message, final Future<WriteResult<WriteQueueMessage, SocketAddress>> future, final WriteResult<WriteQueueMessage, SocketAddress> currentResult, final CompletionHandler<WriteResult<WriteQueueMessage, SocketAddress>> completionHandler, final SocketAddress dstAddress, final boolean isEmptyRecord) { return AsyncWriteQueueRecord.create(connection, message, future, currentResult, completionHandler, dstAddress, isEmptyRecord); } ======= >>>>>>> <<<<<<< while ((queueRecord = aggregate(connectionQueue)) != null) { ======= while ((queueRecord = aggregate(connectionQueue)) != null) { >>>>>>> while ((queueRecord = aggregate(connectionQueue)) != null) { <<<<<<< final int written = queueRecord.remaining() > 0 ? (int) write0(nioConnection, queueRecord) : 0; ======= if (!queueRecord.isChecked()) { switch (checkQueueSize(queueRecord, null)) { case PUSHBACK_CONTINUE: continue; case PUSHBACK_DONE: return AsyncResult.COMPLETE; } } final int bytesToRelease = queueRecord.isEmptyRecord() ? EMPTY_RECORD_SPACE_VALUE : write0(nioConnection, queueRecord); >>>>>>> if (!queueRecord.isChecked()) { switch (checkQueueSize(queueRecord, null)) { case PUSHBACK_CONTINUE: continue; case PUSHBACK_DONE: return AsyncResult.COMPLETE; } } final int written = queueRecord.remaining() > 0 ? (int) write0(nioConnection, queueRecord) : 0; <<<<<<< private static int getMaxQueueSize(final Connection connection) { return ((NIOConnection) connection).getMaxAsyncWriteQueueSize(); } private static void doFineLog(final String msg, final Object... params) { logger.log(Level.FINEST, msg, params); ======= private static void doFineLog(String msg, Object... params) { LOGGER.log(Level.FINEST, msg, params); >>>>>>> private static int getMaxQueueSize(final Connection connection) { return ((NIOConnection) connection).getMaxAsyncWriteQueueSize(); } private static void doFineLog(final String msg, final Object... params) { LOGGER.log(Level.FINEST, msg, params); <<<<<<< ======= private enum CheckResult {CONTINUE, PUSHBACK_DONE, PUSHBACK_CONTINUE} /** * {@link AsyncWriteQueueRecord} was added w/o size check (because of reentrants * limit), so check it. */ private CheckResult checkQueueSize( final AsyncWriteQueueRecord queueRecord, final PushBackContext pushBackContext) { final NIOConnection connection = (NIOConnection) queueRecord.getConnection(); final PushBackHandler pushBackHandler = queueRecord.getPushBackHandler(); final Buffer buffer = queueRecord.getMessage(); // For empty buffer reserve 1 byte space final int bytesToReserve = queueRecord.isEmptyRecord() ? EMPTY_RECORD_SPACE_VALUE : queueRecord.remaining(); final int pendingBytes = queueRecord.getMomentumQueueSize(); queueRecord.setMomentumQueueSize(-1); final boolean isCurrent = (pendingBytes == bytesToReserve); final int maxPendingBytesLocal = maxPendingBytes; // Check if the buffer size matches maxPendingBytes if (!isCurrent && maxPendingBytesLocal > 0 && pendingBytes > maxPendingBytesLocal) { // Get connection async write queue final TaskQueue<AsyncWriteQueueRecord> writeTaskQueue = connection.getAsyncWriteQueue(); final int remainingSize = writeTaskQueue.releaseSpace(bytesToReserve); if (pushBackHandler == null) { final Throwable error = new PendingWriteQueueLimitExceededException( "Max queued data limit exceeded: " + pendingBytes + '>' + maxPendingBytesLocal); queueRecord.notifyFailure(error); } else { final PushBackContext pbContextLocal = pushBackContext == null ? new PushBackContextImpl(queueRecord) : pushBackContext; pushBackHandler.onPushBack(connection, buffer, pbContextLocal); } return remainingSize == 0 ? CheckResult.PUSHBACK_DONE : CheckResult.PUSHBACK_CONTINUE; } if (pushBackHandler != null) { pushBackHandler.onAccept(connection, buffer); } return CheckResult.CONTINUE; } private final class PushBackContextImpl extends PushBackContext implements WriteHandler { public PushBackContextImpl(final AsyncWriteQueueRecord queueRecord) { super(queueRecord); } @Override public void retryWhenPossible() { final NIOConnection connection = (NIOConnection) queueRecord.getConnection(); notifyWritePossible(connection, this, queueRecord.remaining()); } @Override public void retryNow() { onWritePossible(); } @Override public void cancel() { queueRecord.notifyFailure( new CancellationException("write cancelled")); } @Override public void onWritePossible() { writeQueueRecord(queueRecord, null, this); } @Override public void onError(Throwable t) { queueRecord.notifyFailure(t); } } >>>>>>> private enum CheckResult {CONTINUE, PUSHBACK_DONE, PUSHBACK_CONTINUE} /** * {@link AsyncWriteQueueRecord} was added w/o size check (because of reentrants * limit), so check it. */ private CheckResult checkQueueSize( final AsyncWriteQueueRecord queueRecord, final PushBackContext pushBackContext) { final NIOConnection connection = (NIOConnection) queueRecord.getConnection(); final PushBackHandler pushBackHandler = queueRecord.getPushBackHandler(); final WriteQueueMessage message = queueRecord.getWriteQueueMessage(); // For empty buffer reserve 1 byte space final int bytesToReserve = (int) (queueRecord.isEmptyRecord() ? EMPTY_RECORD_SPACE_VALUE : queueRecord.remaining()); final int pendingBytes = queueRecord.getMomentumQueueSize(); queueRecord.setMomentumQueueSize(-1); final boolean isCurrent = (pendingBytes == bytesToReserve); final int maxPendingBytesLocal = getMaxQueueSize(connection); // Check if the buffer size matches maxPendingBytes if (!isCurrent && maxPendingBytesLocal > 0 && pendingBytes > maxPendingBytesLocal) { // Get connection async write queue final TaskQueue<AsyncWriteQueueRecord> writeTaskQueue = connection.getAsyncWriteQueue(); final int remainingSize = writeTaskQueue.releaseSpace(bytesToReserve); if (pushBackHandler == null) { final Throwable error = new PendingWriteQueueLimitExceededException( "Max queued data limit exceeded: " + pendingBytes + '>' + maxPendingBytesLocal); queueRecord.notifyFailure(error); } else { final PushBackContext pbContextLocal = pushBackContext == null ? new PushBackContextImpl(queueRecord) : pushBackContext; pushBackHandler.onPushBack(connection, message, pbContextLocal); } return remainingSize == 0 ? CheckResult.PUSHBACK_DONE : CheckResult.PUSHBACK_CONTINUE; } if (pushBackHandler != null) { pushBackHandler.onAccept(connection, message); } return CheckResult.CONTINUE; } private final class PushBackContextImpl extends PushBackContext implements WriteHandler { public PushBackContextImpl(final AsyncWriteQueueRecord queueRecord) { super(queueRecord); } @Override public void retryWhenPossible() { final NIOConnection connection = (NIOConnection) queueRecord.getConnection(); notifyWritePossible(connection, this, (int) queueRecord.remaining()); } @Override public void retryNow() { onWritePossible(); } @Override public void cancel() { queueRecord.notifyFailure( new CancellationException("write cancelled")); } @Override public void onWritePossible() { writeQueueRecord(queueRecord, null, this); } @Override public void onError(Throwable t) { queueRecord.notifyFailure(t); } }
<<<<<<< import org.springframework.social.UserIdSource; import org.springframework.social.config.annotation.EnableJdbcConnectionRepository; ======= import org.springframework.social.UserIdSource; import org.springframework.social.connect.Connection; >>>>>>> import org.springframework.social.UserIdSource; import org.springframework.social.config.annotation.EnableJdbcConnectionRepository; <<<<<<< import org.springframework.social.facebook.config.annotation.EnableFacebook; ======= import org.springframework.social.connect.web.ReconnectFilter; import org.springframework.social.facebook.api.Facebook; import org.springframework.social.facebook.api.impl.FacebookTemplate; import org.springframework.social.facebook.connect.FacebookConnectionFactory; >>>>>>> import org.springframework.social.connect.web.ReconnectFilter; import org.springframework.social.facebook.config.annotation.EnableFacebook;
<<<<<<< import io.openems.core.utilities.power.PGreaterEqualLimitation; import io.openems.core.utilities.power.PSmallerEqualLimitation; import io.openems.core.utilities.power.SymmetricPowerImpl; ======= import io.openems.impl.protocol.modbus.FaultModbus; >>>>>>> import io.openems.core.utilities.power.PGreaterEqualLimitation; import io.openems.core.utilities.power.PSmallerEqualLimitation; import io.openems.core.utilities.power.SymmetricPowerImpl; import io.openems.impl.protocol.modbus.FaultModbus; <<<<<<< private SymmetricPowerImpl power; private PGreaterEqualLimitation allowedChargeLimit; private PSmallerEqualLimitation allowedDischargeLimit; private ThingStateChannel thingState; ======= private ThingStateChannels thingState; >>>>>>> private SymmetricPowerImpl power; private PGreaterEqualLimitation allowedChargeLimit; private PSmallerEqualLimitation allowedDischargeLimit; private ThingStateChannels thingState; <<<<<<< public SymmetricPowerImpl getPower() { return power; } @Override public ThingStateChannel getStateChannel() { ======= public ThingStateChannels getStateChannel() { >>>>>>> public SymmetricPowerImpl getPower() { return power; } @Override public ThingStateChannels getStateChannel() {
<<<<<<< import io.openems.edge.bridge.modbus.api.task.Priority; import io.openems.edge.common.channel.Channel; ======= >>>>>>> import io.openems.edge.bridge.modbus.api.task.Priority; <<<<<<< private final Power power; private Battery battery; ======= @Reference private Power power; >>>>>>> @Reference private Power power; <<<<<<< Channel<Integer> wMaxChannel = this.channel(ChannelId.W_MAX); wMaxChannel.onUpdate(value -> { ======= this.channel(ChannelId.W_MAX).onChange(value -> { // TODO unchecked cast @SuppressWarnings("unchecked") >>>>>>> this.channel(ChannelId.W_MAX).onChange(value -> { // TODO unchecked cast @SuppressWarnings("unchecked") <<<<<<< Channel<Integer> wMaxSFChannel = this.channel(ChannelId.W_MAX_SF); wMaxSFChannel.onUpdate(value -> { ======= this.channel(ChannelId.W_MAX_SF).onChange(value -> { // TODO unchecked cast @SuppressWarnings("unchecked") >>>>>>> this.channel(ChannelId.W_MAX_SF).onChange(value -> { // TODO unchecked cast @SuppressWarnings("unchecked") <<<<<<< } private void refreshPower() { // TODO check if set correctly maxApparentPower = maxApparentPowerUnscaled * maxApparentPowerScaleFactor; if (maxApparentPower > 0) { this.maxApparentPowerConstraint.setRadius(maxApparentPower); } } @Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY) protected void setModbus(BridgeModbus modbus) { super.setModbus(modbus); } @Activate void activate(ComponentContext context, Config config) { // update filter for 'battery' if (OpenemsComponent.updateReferenceFilter(this.cm, config.service_pid(), "battery", config.battery_id())) { return; } ======= >>>>>>> } private void refreshPower() { if (maxApparentPower > 0) { this.maxApparentPowerConstraint.setRadius(maxApparentPower); } } @Reference(policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY, cardinality = ReferenceCardinality.MANDATORY) protected void setModbus(BridgeModbus modbus) { super.setModbus(modbus); } @Activate void activate(ComponentContext context, Config config) { // update filter for 'battery' if (OpenemsComponent.updateReferenceFilter(this.cm, config.service_pid(), "battery", config.battery_id())) { return; }
<<<<<<< import io.openems.core.utilities.power.SymmetricPowerImpl; ======= import io.openems.impl.protocol.modbus.ModbusBitWrappingChannel; >>>>>>> import io.openems.core.utilities.power.SymmetricPowerImpl; <<<<<<< private SymmetricPowerImpl power; public StatusBitChannels warning; ======= >>>>>>> private SymmetricPowerImpl power; <<<<<<< warning = new StatusBitChannels("Warning", this); ModbusProtocol protocol = new ModbusProtocol( // ======= return new ModbusProtocol( // >>>>>>> ModbusProtocol protocol = new ModbusProtocol( // <<<<<<< sysAlarmInfo = new ModbusReadLongChannel("SysAlarmInfo", this)// .label(0, "Warning State")// .label(1, "Protection State")// .label(2, "Derating State")// .label(4, "Charge Forbidden").label(16, "Discharge Forbidden")), ======= new ModbusBitWrappingChannel("SysAlarmInfo", this, this.thingState)// .warningBit(0, WarningEss.WarningState)// .warningBit(1, WarningEss.ProtectionState)// .warningBit(2, WarningEss.DeratingState)// .warningBit(3, WarningEss.ChargeForbidden)// .warningBit(4, WarningEss.DischargeForbidden)// ),// >>>>>>> new ModbusBitWrappingChannel("SysAlarmInfo", this, this.thingState)// .warningBit(0, WarningEss.WarningState)// .warningBit(1, WarningEss.ProtectionState)// .warningBit(2, WarningEss.DeratingState)// .warningBit(3, WarningEss.ChargeForbidden)// .warningBit(4, WarningEss.DischargeForbidden)// ),// <<<<<<< sysWorkStatus = new StatusBitChannel("SysWorkStatus", this)// .label(0, "Initial") // .label(1, "Fault") // .label(2, "Stop") // .label(4, "Hot Standby") // .label(8, "Monitoring") // .label(16, "Standby") // .label(32, "Operation") // .label(64, "Debug")), // ======= sysWorkStatus = new ModbusReadLongChannel("SysWorkStatus", this)// .label(1, "Initial") // .label(2, "Fault") // .label(4, "Stop") // .label(8, "Hot Standby") // .label(16, "Monitoring") // .label(32, "Standby") // .label(64, "Operation") // .label(128, "Debug")), // >>>>>>> sysWorkStatus = new ModbusReadLongChannel("SysWorkStatus", this)// .label(1, "Initial") // .label(2, "Fault") // .label(4, "Stop") // .label(8, "Hot Standby") // .label(16, "Monitoring") // .label(32, "Standby") // .label(64, "Operation") // .label(128, "Debug")), // <<<<<<< sysControlMode = new StatusBitChannel("SysControlMode", this)// .label(0, "Remote") // .label(1, "Local")), // ======= sysControlMode = new ModbusReadLongChannel("SysControlMode", this)// .label(1, "Remote") // .label(2, "Local")), // >>>>>>> sysControlMode = new ModbusReadLongChannel("SysControlMode", this)// .label(1, "Remote") // .label(2, "Local")), // <<<<<<< sysAlarmInfo = new StatusBitChannel("SysAlarmInfo", this)// .label(0, "Status abnormal of AC surge protector") // .label(1, "Close of control switch") // .label(2, "Emergency stop") // .label(4, "Status abnormal of frog detector") // .label(8, "Serious leakage") // .label(16, "Normal_leakage")), // ======= new ModbusBitWrappingChannel("SysAlarmInfo", this, thingState)// .warningBit(1, WarningEss.StatusAbnormalOfACSurgeProtector) // Status abnormal of AC surge protector .warningBit(2, WarningEss.CloseOfControlSwitch) // Close of control switch .warningBit(3, WarningEss.EmergencyStop) // Emergency stop .warningBit(5, WarningEss.StatusAbnormalOfFrogDetector) // Status_abnormal_of_frog_detector .warningBit(6, WarningEss.SeriousLeakage) // Serious_leakage .warningBit(7, WarningEss.NormalLeakage)), // Normal_leakage >>>>>>> new ModbusBitWrappingChannel("SysAlarmInfo", this, thingState)// .warningBit(1, WarningEss.StatusAbnormalOfACSurgeProtector) // Status abnormal of AC surge protector .warningBit(2, WarningEss.CloseOfControlSwitch) // Close of control switch .warningBit(3, WarningEss.EmergencyStop) // Emergency stop .warningBit(5, WarningEss.StatusAbnormalOfFrogDetector) // Status_abnormal_of_frog_detector .warningBit(6, WarningEss.SeriousLeakage) // Serious_leakage .warningBit(7, WarningEss.NormalLeakage)), // Normal_leakage <<<<<<< sysAlarmInfo2 = new StatusBitChannel("SysAlarmInfo2", this)// .label(0, "Failure of temperature sensor in control cabinet") // .label(1, "Close of control switch") // /* * TODO new OnOffBitItem(9, "Failure_of_humidity_sensor_in_control_cabinet"), // * new OnOffBitItem(12, "Failure_of_storage_device"), // * new OnOffBitItem(13, "Exceeding_of_humidity_in_control_cabinet")))); */ )), new ModbusRegisterRange(0x1300, new UnsignedWordElement(0x1300, // batteryStackVoltage = new ModbusReadLongChannel("BatteryStackVoltage", this) .multiplier(2).unit("mV")), new UnsignedWordElement(0x1301, // batteryStackCurrent = new ModbusReadLongChannel("BatteryStackCurrent", this) .multiplier(2).unit("mA")), new UnsignedWordElement(0x1302, // batteryStackPower = new ModbusReadLongChannel("BatteryStackPower", this) .multiplier(2).unit("W")), new UnsignedWordElement(0x1303, // batteryStackSoc = soc = new ModbusReadLongChannel("BatteryStackSoc", this) .unit("%")), new UnsignedWordElement(0x1304, // batteryStackSoh = new ModbusReadLongChannel("BatteryStackSoh", this).unit("%")), new UnsignedWordElement(0x1305, // batteryStackMaxChargeCurrent = new ModbusReadLongChannel( "BatteryStackMaxChargeCurrent", this).multiplier(2).unit("mA")), new UnsignedWordElement(0x1306, // batteryStackMaxDischargeCurrent = new ModbusReadLongChannel( "BatteryStackMaxDischargeCurrent", this).multiplier(2).unit("mA")), new UnsignedWordElement(0x1307, // batteryStackMaxChargePower = new ModbusReadLongChannel( "BatteryStackMaxChargePower", this).multiplier(2).unit("W")), new UnsignedWordElement(0x1308, // batteryStackMaxDischargePower = new ModbusReadLongChannel( "BatteryStackMaxDischargePower", this).multiplier(2).unit("W")), new UnsignedWordElement(0x1309, // batteryStackTotalCapacity = new ModbusReadLongChannel( "BatteryStackTotalCapacity", this).unit("Wh")), new UnsignedDoublewordElement(0x130A, // batteryStackTotalCharge = new ModbusReadLongChannel("BatteryStackTotalCharge", this).unit("kWh")), new UnsignedDoublewordElement(0x130C, // batteryStackTotalDischarge = new ModbusReadLongChannel( "BatteryStackTotalDischarge", this).unit("kWh")))); this.power = new SymmetricPowerImpl(125000, setActivePower, setReactivePower); return protocol; ======= new ModbusBitWrappingChannel("SysAlarmInfo2", this, thingState)// .warningBit(0, WarningEss.FailureOfTemperatureSensorInControlCabinet) // Failure of temperature sensor in control cabinet .warningBit(9, WarningEss.FailureOfHumiditySensorInControlCabinet) // Failure_of_humidity_sensor_in_control_cabinet .warningBit(12,WarningEss.FailureOfStorageDevice) // Failure_of_storage_device .warningBit(13,WarningEss.ExceedingOfHumidityInControlCabinet)) // Exceeding_of_humidity_in_control_cabinet ), new ModbusRegisterRange(0x1300, new UnsignedWordElement(0x1300, // batteryStackVoltage = new ModbusReadLongChannel("BatteryStackVoltage", this).multiplier(2) .unit("mV")), new UnsignedWordElement(0x1301, // batteryStackCurrent = new ModbusReadLongChannel("BatteryStackCurrent", this) .multiplier(2).unit("mA")), new UnsignedWordElement(0x1302, // batteryStackPower = new ModbusReadLongChannel( "BatteryStackPower", this).multiplier(2).unit("W")), new UnsignedWordElement(0x1303, // batteryStackSoc = soc = new ModbusReadLongChannel("BatteryStackSoc", this).unit("%")), new UnsignedWordElement(0x1304, // batteryStackSoh = new ModbusReadLongChannel("BatteryStackSoh", this).unit("%")), new UnsignedWordElement(0x1305, // batteryStackMaxChargeCurrent = new ModbusReadLongChannel( "BatteryStackMaxChargeCurrent", this).multiplier(2).unit("mA")), new UnsignedWordElement(0x1306, // batteryStackMaxDischargeCurrent = new ModbusReadLongChannel( "BatteryStackMaxDischargeCurrent", this).multiplier(2).unit("mA")), new UnsignedWordElement(0x1307, // batteryStackMaxChargePower = new ModbusReadLongChannel( "BatteryStackMaxChargePower", this).multiplier(2).unit("W")), new UnsignedWordElement(0x1308, // batteryStackMaxDischargePower = new ModbusReadLongChannel( "BatteryStackMaxDischargePower", this).multiplier(2).unit("W")), new UnsignedWordElement(0x1309, // batteryStackTotalCapacity = new ModbusReadLongChannel( "BatteryStackTotalCapacity", this).unit("Wh")), new UnsignedDoublewordElement(0x130A, // batteryStackTotalCharge = new ModbusReadLongChannel("BatteryStackTotalCharge", this) .unit("kWh")), new UnsignedDoublewordElement(0x130C, // batteryStackTotalDischarge = new ModbusReadLongChannel("BatteryStackTotalDischarge", this).unit("kWh")))); >>>>>>> new ModbusBitWrappingChannel("SysAlarmInfo2", this, thingState)// .warningBit(0, WarningEss.FailureOfTemperatureSensorInControlCabinet) // Failure of temperature sensor in control cabinet .warningBit(9, WarningEss.FailureOfHumiditySensorInControlCabinet) // Failure_of_humidity_sensor_in_control_cabinet .warningBit(12,WarningEss.FailureOfStorageDevice) // Failure_of_storage_device .warningBit(13,WarningEss.ExceedingOfHumidityInControlCabinet)) // Exceeding_of_humidity_in_control_cabinet ), new ModbusRegisterRange(0x1300, new UnsignedWordElement(0x1300, // batteryStackVoltage = new ModbusReadLongChannel("BatteryStackVoltage", this) .multiplier(2).unit("mV")), new UnsignedWordElement(0x1301, // batteryStackCurrent = new ModbusReadLongChannel("BatteryStackCurrent", this) .multiplier(2).unit("mA")), new UnsignedWordElement(0x1302, // batteryStackPower = new ModbusReadLongChannel("BatteryStackPower", this) .multiplier(2).unit("W")), new UnsignedWordElement(0x1303, // batteryStackSoc = soc = new ModbusReadLongChannel("BatteryStackSoc", this) .unit("%")), new UnsignedWordElement(0x1304, // batteryStackSoh = new ModbusReadLongChannel("BatteryStackSoh", this).unit("%")), new UnsignedWordElement(0x1305, // batteryStackMaxChargeCurrent = new ModbusReadLongChannel( "BatteryStackMaxChargeCurrent", this).multiplier(2).unit("mA")), new UnsignedWordElement(0x1306, // batteryStackMaxDischargeCurrent = new ModbusReadLongChannel( "BatteryStackMaxDischargeCurrent", this).multiplier(2).unit("mA")), new UnsignedWordElement(0x1307, // batteryStackMaxChargePower = new ModbusReadLongChannel( "BatteryStackMaxChargePower", this).multiplier(2).unit("W")), new UnsignedWordElement(0x1308, // batteryStackMaxDischargePower = new ModbusReadLongChannel( "BatteryStackMaxDischargePower", this).multiplier(2).unit("W")), new UnsignedWordElement(0x1309, // batteryStackTotalCapacity = new ModbusReadLongChannel( "BatteryStackTotalCapacity", this).unit("Wh")), new UnsignedDoublewordElement(0x130A, // batteryStackTotalCharge = new ModbusReadLongChannel("BatteryStackTotalCharge", this).unit("kWh")), new UnsignedDoublewordElement(0x130C, // batteryStackTotalDischarge = new ModbusReadLongChannel( "BatteryStackTotalDischarge", this).unit("kWh")))); this.power = new SymmetricPowerImpl(125000, setActivePower, setReactivePower); return protocol; <<<<<<< @Override public SymmetricPowerImpl getPower() { return power; } ======= @Override public ThingStateChannel getStateChannel() { return thingState; } >>>>>>> @Override public SymmetricPowerImpl getPower() { return power; }
<<<<<<< /******************************************************************************* * OpenEMS - Open Source Energy Management System * Copyright (c) 2016, 2017 FENECON GmbH and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * FENECON GmbH - initial API and implementation and initial documentation *******************************************************************************/ package io.openems.impl.controller.symmetric.powerbyfrequency; import io.openems.api.channel.ConfigChannel; import io.openems.api.controller.Controller; import io.openems.api.doc.ChannelInfo; import io.openems.api.doc.ThingInfo; import io.openems.api.exception.InvalidValueException; import io.openems.core.utilities.power.PowerException; @ThingInfo(title = "Power by frequency (Symmetric)", description = "Tries to keep the grid meter at a given frequency. For symmetric Ess.") public class PowerByFrequencyController extends Controller { /* * Constructors */ public PowerByFrequencyController() { super(); } public PowerByFrequencyController(String thingId) { super(thingId); } /* * Config */ @ChannelInfo(title = "Ess", description = "Sets the Ess device.", type = Ess.class) public final ConfigChannel<Ess> ess = new ConfigChannel<>("ess", this); @ChannelInfo(title = "Meter", description = "The meter for the frequency meassurement.", type = Meter.class) public final ConfigChannel<Meter> meter = new ConfigChannel<>("meter", this); @ChannelInfo(title = "Low SOC-Limit", description = "The low soc limit. Below this limit the Ess will charge with more power by the same frequency.", type = Integer.class, defaultValue = "30") public final ConfigChannel<Integer> lowSocLimit = new ConfigChannel<Integer>("lowSocLimit", this); @ChannelInfo(title = "High SOC-Limit", description = "The upper soc limit. Above this limit the Ess will discharge with more power by the same frequency.", type = Integer.class, defaultValue = "70") public final ConfigChannel<Integer> highSocLimit = new ConfigChannel<Integer>("highSocLimit", this); /* * Methods */ @Override public void run() { try { Ess ess = this.ess.value(); Meter meter = this.meter.value(); // Calculate required sum values long activePower = 0L; if (meter.frequency.value() >= 49990 && meter.frequency.value() <= 50010) { // charge if SOC isn't in the expected range if ((ess.soc.value() > highSocLimit.value() && meter.frequency.value() < 50000) || (ess.soc.value() < lowSocLimit.value() && meter.frequency.value() > 50000)) { activePower = (long) (ess.maxNominalPower.value() * (300.0 - 0.006 * meter.frequency.value())); } } else { // calculate minimal Power for Frequency activePower = (long) ((double) ess.maxNominalPower.value() * (250.0 - meter.frequency.value() / 200.0)); if ((meter.frequency.value() < 50000 && ess.soc.value() > highSocLimit.value()) || (meter.frequency.value() > 50000 && ess.soc.value() < lowSocLimit.value())) { // calculate maximal Power for frequency activePower = (long) (ess.maxNominalPower.value() * (300 - 0.006 * meter.frequency.value())); } } ess.limit.setP(activePower); ess.power.applyLimitation(ess.limit); } catch (InvalidValueException e) { log.error(e.getMessage()); } catch (PowerException e) { log.error("Failed to set Power!",e); } } } ======= /******************************************************************************* * OpenEMS - Open Source Energy Management System * Copyright (c) 2016, 2017 FENECON GmbH and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * FENECON GmbH - initial API and implementation and initial documentation *******************************************************************************/ package io.openems.impl.controller.symmetric.powerbyfrequency; import io.openems.api.channel.ConfigChannel; import io.openems.api.channel.thingstate.ThingStateChannel; import io.openems.api.controller.Controller; import io.openems.api.doc.ChannelInfo; import io.openems.api.doc.ThingInfo; import io.openems.api.exception.InvalidValueException; @ThingInfo(title = "Power by frequency (Symmetric)", description = "Tries to keep the grid meter at a given frequency. For symmetric Ess.") public class PowerByFrequencyController extends Controller { private ThingStateChannel thingState = new ThingStateChannel(this); /* * Constructors */ public PowerByFrequencyController() { super(); } public PowerByFrequencyController(String thingId) { super(thingId); } /* * Config */ @ChannelInfo(title = "Ess", description = "Sets the Ess device.", type = Ess.class) public final ConfigChannel<Ess> ess = new ConfigChannel<>("ess", this); @ChannelInfo(title = "Meter", description = "The meter for the frequency meassurement.", type = Meter.class) public final ConfigChannel<Meter> meter = new ConfigChannel<>("meter", this); @ChannelInfo(title = "Low SOC-Limit", description = "The low soc limit. Below this limit the Ess will charge with more power by the same frequency.", type = Integer.class, defaultValue = "30") public final ConfigChannel<Integer> lowSocLimit = new ConfigChannel<Integer>("lowSocLimit", this); @ChannelInfo(title = "High SOC-Limit", description = "The upper soc limit. Above this limit the Ess will discharge with more power by the same frequency.", type = Integer.class, defaultValue = "70") public final ConfigChannel<Integer> highSocLimit = new ConfigChannel<Integer>("highSocLimit", this); /* * Methods */ @Override public void run() { try { Ess ess = this.ess.value(); Meter meter = this.meter.value(); // Calculate required sum values long activePower = 0L; if (meter.frequency.value() >= 49990 && meter.frequency.value() <= 50010) { // charge if SOC isn't in the expected range if ((ess.soc.value() > highSocLimit.value() && meter.frequency.value() < 50000) || (ess.soc.value() < lowSocLimit.value() && meter.frequency.value() > 50000)) { activePower = (long) (ess.maxNominalPower.value() * (300.0 - 0.006 * meter.frequency.value())); } } else { // calculate minimal Power for Frequency activePower = (long) ((double) ess.maxNominalPower.value() * (250.0 - meter.frequency.value() / 200.0)); if ((meter.frequency.value() < 50000 && ess.soc.value() > highSocLimit.value()) || (meter.frequency.value() > 50000 && ess.soc.value() < lowSocLimit.value())) { // calculate maximal Power for frequency activePower = (long) (ess.maxNominalPower.value() * (300 - 0.006 * meter.frequency.value())); } } ess.power.setActivePower(activePower); ess.power.writePower(); log.info(ess.id() + " Set ActivePower [" + ess.power.getActivePower() + "]"); } catch (InvalidValueException e) { log.error(e.getMessage()); } } @Override public ThingStateChannel getStateChannel() { return this.thingState; } } >>>>>>> /******************************************************************************* * OpenEMS - Open Source Energy Management System * Copyright (c) 2016, 2017 FENECON GmbH and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * FENECON GmbH - initial API and implementation and initial documentation *******************************************************************************/ package io.openems.impl.controller.symmetric.powerbyfrequency; import io.openems.api.channel.ConfigChannel; import io.openems.api.channel.thingstate.ThingStateChannel; import io.openems.api.controller.Controller; import io.openems.api.doc.ChannelInfo; import io.openems.api.doc.ThingInfo; import io.openems.api.exception.InvalidValueException; import io.openems.core.utilities.power.PowerException; @ThingInfo(title = "Power by frequency (Symmetric)", description = "Tries to keep the grid meter at a given frequency. For symmetric Ess.") public class PowerByFrequencyController extends Controller { private ThingStateChannel thingState = new ThingStateChannel(this); /* * Constructors */ public PowerByFrequencyController() { super(); } public PowerByFrequencyController(String thingId) { super(thingId); } /* * Config */ @ChannelInfo(title = "Ess", description = "Sets the Ess device.", type = Ess.class) public final ConfigChannel<Ess> ess = new ConfigChannel<>("ess", this); @ChannelInfo(title = "Meter", description = "The meter for the frequency meassurement.", type = Meter.class) public final ConfigChannel<Meter> meter = new ConfigChannel<>("meter", this); @ChannelInfo(title = "Low SOC-Limit", description = "The low soc limit. Below this limit the Ess will charge with more power by the same frequency.", type = Integer.class, defaultValue = "30") public final ConfigChannel<Integer> lowSocLimit = new ConfigChannel<Integer>("lowSocLimit", this); @ChannelInfo(title = "High SOC-Limit", description = "The upper soc limit. Above this limit the Ess will discharge with more power by the same frequency.", type = Integer.class, defaultValue = "70") public final ConfigChannel<Integer> highSocLimit = new ConfigChannel<Integer>("highSocLimit", this); /* * Methods */ @Override public void run() { try { Ess ess = this.ess.value(); Meter meter = this.meter.value(); // Calculate required sum values long activePower = 0L; if (meter.frequency.value() >= 49990 && meter.frequency.value() <= 50010) { // charge if SOC isn't in the expected range if ((ess.soc.value() > highSocLimit.value() && meter.frequency.value() < 50000) || (ess.soc.value() < lowSocLimit.value() && meter.frequency.value() > 50000)) { activePower = (long) (ess.maxNominalPower.value() * (300.0 - 0.006 * meter.frequency.value())); } } else { // calculate minimal Power for Frequency activePower = (long) ((double) ess.maxNominalPower.value() * (250.0 - meter.frequency.value() / 200.0)); if ((meter.frequency.value() < 50000 && ess.soc.value() > highSocLimit.value()) || (meter.frequency.value() > 50000 && ess.soc.value() < lowSocLimit.value())) { // calculate maximal Power for frequency activePower = (long) (ess.maxNominalPower.value() * (300 - 0.006 * meter.frequency.value())); } } ess.limit.setP(activePower); ess.power.applyLimitation(ess.limit); } catch (InvalidValueException e) { log.error(e.getMessage()); } catch (PowerException e) { log.error("Failed to set Power!",e); } } @Override public ThingStateChannel getStateChannel() { return this.thingState; } }
<<<<<<< ======= import io.openems.core.utilities.power.symmetric.PGreaterEqualLimitation; import io.openems.core.utilities.power.symmetric.PSmallerEqualLimitation; import io.openems.core.utilities.power.symmetric.SymmetricPowerImpl; import io.openems.impl.protocol.modbus.FaultModbus; >>>>>>>
<<<<<<< /******************************************************************************* * OpenEMS - Open Source Energy Management System * Copyright (c) 2016, 2017 FENECON GmbH and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * FENECON GmbH - initial API and implementation and initial documentation *******************************************************************************/ package io.openems.impl.controller.symmetric.cosphicharacteristic; import java.util.List; import java.util.Optional; import java.util.TreeMap; import io.openems.api.channel.Channel; import io.openems.api.channel.ChannelChangeListener; import io.openems.api.channel.ConfigChannel; import io.openems.api.controller.Controller; import io.openems.api.doc.ChannelInfo; import io.openems.api.doc.ThingInfo; import io.openems.api.exception.InvalidValueException; import io.openems.core.utilities.power.PowerException; @ThingInfo(title = "Cos-Phi Characteristics (Symmetric)") public class CosPhiCharacteristicController extends Controller implements ChannelChangeListener{ /* * Constructors */ public CosPhiCharacteristicController() { super(); } public CosPhiCharacteristicController(String id) { super(id); } /* * Config */ @ChannelInfo(title = "Ess", description = "Sets the Ess device.", type = Ess.class) public ConfigChannel<Ess> ess = new ConfigChannel<Ess>("ess", this).addChangeListener(this); @ChannelInfo(title = "Cos-Phi characteristic", description = "The points of the characteristic (x = signed activePower, y = cosPhi IEEE Power Factor Sign Convention ).", type = Double[].class, isArray = true) public ConfigChannel<List<Double[]>> cosPhiPoints = new ConfigChannel<List<Double[]>>("cosPhiPoints", this) .addChangeListener(this); /* * Methods */ @Override public void run() { try { ess.value().power.applyLimitation(ess.value().limit); } catch (InvalidValueException | PowerException e) { log.error("Failed to set power limitation!",e); } } @Override public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) { if(ess.isValuePresent()) { TreeMap<Long,Double> points = new TreeMap<>(); if(cosPhiPoints.isValuePresent()) { for(Double[] point : cosPhiPoints.getValue()) { points.put(point[0].longValue(), point[1]); } } ess.getValue().limit.setCosPhi(0L, 0L, points); } } } ======= /******************************************************************************* * OpenEMS - Open Source Energy Management System * Copyright (c) 2016, 2017 FENECON GmbH and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * FENECON GmbH - initial API and implementation and initial documentation *******************************************************************************/ package io.openems.impl.controller.symmetric.cosphicharacteristic; import java.util.ArrayList; import java.util.List; import io.openems.api.channel.ConfigChannel; import io.openems.api.channel.thingstate.ThingStateChannel; import io.openems.api.controller.Controller; import io.openems.api.doc.ChannelInfo; import io.openems.api.doc.ThingInfo; import io.openems.api.exception.InvalidValueException; import io.openems.core.utilities.ControllerUtils; import io.openems.core.utilities.Point; @ThingInfo(title = "Cos-Phi Characteristics (Symmetric)") public class CosPhiCharacteristicController extends Controller { private ThingStateChannel thingState = new ThingStateChannel(this); /* * Constructors */ public CosPhiCharacteristicController() { super(); } public CosPhiCharacteristicController(String id) { super(id); } /* * Config */ @ChannelInfo(title = "Ess", description = "Sets the Ess device.", type = Ess.class) public ConfigChannel<Ess> ess = new ConfigChannel<>("ess", this); @ChannelInfo(title = "Cos-Phi characteristic", description = "The points of the characteristic (x = PowerRatio, y = cosPhi).", type = Long[].class, isArray = true) public ConfigChannel<List<Long[]>> cosPhiPoints = new ConfigChannel<List<Long[]>>("cosPhiPoints", this) .addChangeListener((channel, newValue, oldValue) -> { List<Point> points = new ArrayList<>(); if (newValue.isPresent()) { @SuppressWarnings("unchecked") List<Long[]> cosPhiPoints = (List<Long[]>) newValue.get(); for (Long[] arr : cosPhiPoints) { points.add(new Point(arr[0], arr[1])); } } else { log.error("found no cosPhiPoints!"); } cosPhiCharacteristic = points; }); /* * Fields */ public List<Point> cosPhiCharacteristic; /* * Methods */ @Override public void run() { try { if (ess.value().setActivePower.peekWrite().isPresent()) { double pRatio = (double) ess.value().setActivePower.peekWrite().get() / (double) ess.value().nominalPower.value() * 100; double cosPhi = ControllerUtils.getValueOfLine(cosPhiCharacteristic, pRatio) / 100; ess.value().power.setReactivePower( ControllerUtils.calculateReactivePower(ess.value().setActivePower.peekWrite().get(), cosPhi)); ess.value().power.writePower(); log.info("Set reactive power [{}] to get cosPhi [{}]", new Object[] { ess.value().power.getReactivePower(), cosPhi }); } else { log.error(ess.id() + " no ActivePower is Set."); } } catch (InvalidValueException e) { log.error("No ess found.", e); } } @Override public ThingStateChannel getStateChannel() { return this.thingState; } } >>>>>>> /******************************************************************************* * OpenEMS - Open Source Energy Management System * Copyright (c) 2016, 2017 FENECON GmbH and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * FENECON GmbH - initial API and implementation and initial documentation *******************************************************************************/ package io.openems.impl.controller.symmetric.cosphicharacteristic; import java.util.List; import java.util.Optional; import java.util.TreeMap; import io.openems.api.channel.Channel; import io.openems.api.channel.ChannelChangeListener; import io.openems.api.channel.ConfigChannel; import io.openems.api.channel.thingstate.ThingStateChannel; import io.openems.api.controller.Controller; import io.openems.api.doc.ChannelInfo; import io.openems.api.doc.ThingInfo; import io.openems.api.exception.InvalidValueException; import io.openems.core.utilities.power.PowerException; @ThingInfo(title = "Cos-Phi Characteristics (Symmetric)") public class CosPhiCharacteristicController extends Controller implements ChannelChangeListener{ private ThingStateChannel thingState = new ThingStateChannel(this); /* * Constructors */ public CosPhiCharacteristicController() { super(); } public CosPhiCharacteristicController(String id) { super(id); } /* * Config */ @ChannelInfo(title = "Ess", description = "Sets the Ess device.", type = Ess.class) public ConfigChannel<Ess> ess = new ConfigChannel<Ess>("ess", this).addChangeListener(this); @ChannelInfo(title = "Cos-Phi characteristic", description = "The points of the characteristic (x = signed activePower, y = cosPhi IEEE Power Factor Sign Convention ).", type = Double[].class, isArray = true) public ConfigChannel<List<Double[]>> cosPhiPoints = new ConfigChannel<List<Double[]>>("cosPhiPoints", this) .addChangeListener(this); /* * Methods */ @Override public void run() { try { ess.value().power.applyLimitation(ess.value().limit); } catch (InvalidValueException | PowerException e) { log.error("Failed to set power limitation!",e); } } @Override public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) { if(ess.isValuePresent()) { TreeMap<Long,Double> points = new TreeMap<>(); if(cosPhiPoints.isValuePresent()) { for(Double[] point : cosPhiPoints.getValue()) { points.put(point[0].longValue(), point[1]); } } ess.getValue().limit.setCosPhi(0L, 0L, points); } } @Override public ThingStateChannel getStateChannel() { return this.thingState; } }
<<<<<<< // @Reference ======= >>>>>>>
<<<<<<< setActivePower.removeChannel(ess.setActivePower()); setReactivePower.removeChannel(ess.setReactivePower()); ======= power.removeEss(ess); thingState.removeChildChannel(ess.getStateChannel()); >>>>>>> power.removeEss(ess); <<<<<<< setActivePower.addChannel(ess.setActivePower()); setReactivePower.addChannel(ess.setReactivePower()); ======= power.addEss(ess); this.thingState.addChildChannel(ess.getStateChannel()); >>>>>>> power.addEss(ess);
<<<<<<< for (WriteChannel<?> channel : thingRepository.getWriteChannels()) { channel.shadowCopyAndReset(); } for (Bridge bridge : thingRepository.getBridges()) { bridge.triggerWrite(); } } catch (DateTimeParseException | OpenemsException e) { ======= } catch (InvalidValueException | DateTimeParseException | ConfigException | ReflectionException e) { >>>>>>> } catch (DateTimeParseException | OpenemsException e) {
<<<<<<< ======= public static RestApiController instance = null; public RestApiController() { super(); RestApiController.instance = this; } public RestApiController(String thingId) { super(thingId); RestApiController.instance = this; } >>>>>>> public RestApiController() { super(); } public RestApiController(String thingId) { super(thingId); }
<<<<<<< @Override public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) { if(this.lastDischarge.equals(channel)) { if(newValue.isPresent()) { lastDischargeDate = Instant.ofEpochMilli((long) newValue.get()).atZone(ZoneId.systemDefault()).toLocalDate(); }else { lastDischargeDate = null; } } } ======= @Override public ThingStateChannels getStateChannel() { return this.thingState; } >>>>>>> @Override public void channelChanged(Channel channel, Optional<?> newValue, Optional<?> oldValue) { if(this.lastDischarge.equals(channel)) { if(newValue.isPresent()) { lastDischargeDate = Instant.ofEpochMilli((long) newValue.get()).atZone(ZoneId.systemDefault()).toLocalDate(); }else { lastDischargeDate = null; } } } @Override public ThingStateChannels getStateChannel() { return this.thingState; }
<<<<<<< public String encode(final Serializable value) { final var encoded = this.encryptionEnabled ? EncodingUtils.encryptValueAsJwt(this.secretKeyEncryptionKey, value, this.encryptionAlgorithm, this.contentEncryptionAlgorithmIdentifier) : value.toString(); ======= public String encode(final Serializable value, final Object[] parameters) { final String encoded = this.encryptionEnabled ? EncodingUtils.encryptValueAsJwt(this.secretKeyEncryptionKey, value, this.encryptionAlgorithm, this.contentEncryptionAlgorithmIdentifier) : value.toString(); >>>>>>> public String encode(final Serializable value, final Object[] parameters) { final String encoded = this.encryptionEnabled ? EncodingUtils.encryptValueAsJwt(this.secretKeyEncryptionKey, value, this.encryptionAlgorithm, this.contentEncryptionAlgorithmIdentifier) : value.toString(); <<<<<<< public String decode(final Serializable value) { final var encoded = verifySignature(value.toString().getBytes(StandardCharsets.UTF_8)); ======= public String decode(final Serializable value, final Object[] parameters) { final byte[] encoded = verifySignature(value.toString().getBytes(StandardCharsets.UTF_8)); >>>>>>> public String decode(final Serializable value, final Object[] parameters) { final var encoded = verifySignature(value.toString().getBytes(StandardCharsets.UTF_8));
<<<<<<< @Transactional(transactionManager = "ticketTransactionManager", readOnly = false) @Timed("DELETE_TICKET_TIMER") ======= @Transactional(transactionManager = "ticketTransactionManager") @Timed(name = "DELETE_TICKET_TIMER") @Metered(name = "DELETE_TICKET_METER") @Counted(name = "DELETE_TICKET_COUNTER", monotonic = true) >>>>>>> @Transactional(transactionManager = "ticketTransactionManager") @Timed("DELETE_TICKET_TIMER")
<<<<<<< final RegisteredServiceProperty.RegisteredServiceProperties property) { final var result = getRegisteredServiceFromRequest(request); ======= final RegisteredServiceProperties property) { final Optional<RegisteredService> result = getRegisteredServiceFromRequest(request); >>>>>>> final RegisteredServiceProperties property) { final var result = getRegisteredServiceFromRequest(request);
<<<<<<< final var sch = applicationContext.getBean(ScheduledAnnotationBeanPostProcessor.class); sch.setEmbeddedValueResolver(resolver); ======= try { final ScheduledAnnotationBeanPostProcessor sch = applicationContext.getBean(ScheduledAnnotationBeanPostProcessor.class); sch.setEmbeddedValueResolver(resolver); } catch (final NoSuchBeanDefinitionException e) { LOGGER.warn("Unable to locate [ScheduledAnnotationBeanPostProcessor] as a bean. Support for duration syntax (i.e. PT2S) may not be available"); LOGGER.trace(e.getMessage(), e); } >>>>>>> try { final var sch = applicationContext.getBean(ScheduledAnnotationBeanPostProcessor.class); sch.setEmbeddedValueResolver(resolver); } catch (final NoSuchBeanDefinitionException e) { LOGGER.warn("Unable to locate [ScheduledAnnotationBeanPostProcessor] as a bean. Support for duration syntax (i.e. PT2S) may not be available"); LOGGER.trace(e.getMessage(), e); }
<<<<<<< final var memcached = casProperties.getMonitor().getMemcached(); final var factory = new MemcachedPooledClientConnectionFactory(memcached, memcachedMonitorTranscoder()); final ObjectPool<MemcachedClientIF> pool = new GenericObjectPool<>(factory); return new MemcachedHealthIndicator(pool, casProperties.getMonitor().getWarn().getEvictionThreshold(), casProperties.getMonitor().getWarn().getThreshold()); ======= return new MemcachedHealthIndicator(memcachedHealthClientPool(), casProperties); } @Bean public ObjectPool<MemcachedClientIF> memcachedHealthClientPool() { final MonitorProperties.Memcached memcached = casProperties.getMonitor().getMemcached(); final MemcachedPooledClientConnectionFactory factory = new MemcachedPooledClientConnectionFactory(memcached, memcachedMonitorTranscoder()); return new GenericObjectPool<>(factory); >>>>>>> return new MemcachedHealthIndicator(memcachedHealthClientPool(), casProperties); } @Bean public ObjectPool<MemcachedClientIF> memcachedHealthClientPool() { return new GenericObjectPool<>(factory); casProperties.getMonitor().getWarn().getEvictionThreshold(), casProperties.getMonitor().getWarn().getThreshold());
<<<<<<< private Authenticator authenticator; ======= private final Authenticator authenticator; /** * Component name. */ private String name = LdapAuthenticationHandler.class.getSimpleName(); >>>>>>> private final Authenticator authenticator;
<<<<<<< import lombok.AllArgsConstructor; import lombok.Getter; import lombok.ToString; import lombok.extern.slf4j.Slf4j; ======= import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.ToString; import lombok.extern.slf4j.Slf4j; >>>>>>> import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.ToString; import lombok.extern.slf4j.Slf4j; <<<<<<< protected Event doExecute(final RequestContext context) { final var request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final var response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); ======= public Event doExecute(final RequestContext context) { final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final HttpServletResponse response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); >>>>>>> public Event doExecute(final RequestContext context) { final var request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final var response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); <<<<<<< private void establishDelegatedAuthenticationSession(final RequestContext context, final Service service, final Credentials credentials, final BaseClient client) { final var clientCredential = new ClientCredential(credentials, client.getName()); final var authenticationResult = ======= /** * Establish delegated authentication session. * * @param context the context * @param service the service * @param credentials the credentials * @param client the client */ protected void establishDelegatedAuthenticationSession(final RequestContext context, final Service service, final Credentials credentials, final BaseClient client) { final ClientCredential clientCredential = new ClientCredential(credentials, client.getName()); final AuthenticationResult authenticationResult = >>>>>>> /** * Establish delegated authentication session. * * @param context the context * @param service the service * @param credentials the credentials * @param client the client */ protected void establishDelegatedAuthenticationSession(final RequestContext context, final Service service, final Credentials credentials, final BaseClient client) { final var clientCredential = new ClientCredential(credentials, client.getName()); final var authenticationResult = <<<<<<< private BaseClient<Credentials, CommonProfile> findDelegatedClientByName(final HttpServletRequest request, final String clientName, final Service service) { final var client = (BaseClient<Credentials, CommonProfile>) this.clients.findClient(clientName); ======= /** * Find delegated client by name base client. * * @param request the request * @param clientName the client name * @param service the service * @return the base client */ protected BaseClient<Credentials, CommonProfile> findDelegatedClientByName(final HttpServletRequest request, final String clientName, final Service service) { final BaseClient<Credentials, CommonProfile> client = (BaseClient<Credentials, CommonProfile>) this.clients.findClient(clientName); >>>>>>> /** * Find delegated client by name base client. * * @param request the request * @param clientName the client name * @param service the service * @return the base client */ protected BaseClient<Credentials, CommonProfile> findDelegatedClientByName(final HttpServletRequest request, final String clientName, final Service service) { <<<<<<< private Optional<ProviderLoginPageConfiguration> buildProviderConfiguration(final IndirectClient client, final WebContext webContext, final WebApplicationService service) { final var name = client.getName(); final var matcher = PAC4J_CLIENT_SUFFIX_PATTERN.matcher(client.getClass().getSimpleName()); final var type = matcher.replaceAll(StringUtils.EMPTY).toLowerCase(); final var uriBuilder = UriComponentsBuilder ======= /** * Build provider configuration optional. * * @param client the client * @param webContext the web context * @param service the service * @return the optional */ protected Optional<ProviderLoginPageConfiguration> buildProviderConfiguration(final IndirectClient client, final WebContext webContext, final WebApplicationService service) { final String name = client.getName(); final Matcher matcher = PAC4J_CLIENT_SUFFIX_PATTERN.matcher(client.getClass().getSimpleName()); final String type = matcher.replaceAll(StringUtils.EMPTY).toLowerCase(); final UriComponentsBuilder uriBuilder = UriComponentsBuilder >>>>>>> /** * Build provider configuration optional. * * @param client the client * @param webContext the web context * @param service the service * @return the optional */ protected Optional<ProviderLoginPageConfiguration> buildProviderConfiguration(final IndirectClient client, final WebContext webContext, final WebApplicationService service) { final var name = client.getName(); final var matcher = PAC4J_CLIENT_SUFFIX_PATTERN.matcher(client.getClass().getSimpleName()); final var type = matcher.replaceAll(StringUtils.EMPTY).toLowerCase(); final var uriBuilder = UriComponentsBuilder <<<<<<< private String getCssClass(final String name) { var computedCssClass = "fa fa-lock"; ======= protected String getCssClass(final String name) { String computedCssClass = "fa fa-lock"; >>>>>>> protected String getCssClass(final String name) { var computedCssClass = "fa fa-lock";
<<<<<<< ======= import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; >>>>>>> import org.junit.ClassRule; import org.junit.Rule; <<<<<<< import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.runner.RunWith; ======= import org.junit.experimental.categories.Category; import org.opensaml.saml.metadata.resolver.MetadataResolver; >>>>>>> import org.junit.experimental.categories.Category; import org.junit.jupiter.api.BeforeEach; <<<<<<< ======= import java.util.Collection; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; >>>>>>> import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j;
<<<<<<< public void verifyValidation() throws Exception { final var validator = new SimpleUrlValidatorFactoryBean(false).getObject(); ======= public void verifyValidation() { final UrlValidator validator = new SimpleUrlValidatorFactoryBean(false).getObject(); >>>>>>> public void verifyValidation() { final var validator = new SimpleUrlValidatorFactoryBean(false).getObject(); <<<<<<< public void verifyValidationWithLocalUrlAllowed() throws Exception { final var validator = new SimpleUrlValidatorFactoryBean(true).getObject(); ======= public void verifyValidationWithLocalUrlAllowed() { final UrlValidator validator = new SimpleUrlValidatorFactoryBean(true).getObject(); >>>>>>> public void verifyValidationWithLocalUrlAllowed() { final var validator = new SimpleUrlValidatorFactoryBean(true).getObject(); <<<<<<< public void verifyValidationWithRegEx() throws Exception { final var validator = new SimpleUrlValidatorFactoryBean(false, "\\w{2}\\.\\w{4}\\.authority", true).getObject(); ======= public void verifyValidationWithRegEx() { final UrlValidator validator = new SimpleUrlValidatorFactoryBean(false, "\\w{2}\\.\\w{4}\\.authority", true).getObject(); >>>>>>> public void verifyValidationWithRegEx() { final var validator = new SimpleUrlValidatorFactoryBean(false, "\\w{2}\\.\\w{4}\\.authority", true).getObject(); <<<<<<< public void verifyValidationWithRegExCaseInsensitiv() throws Exception { final var validator = new SimpleUrlValidatorFactoryBean(false, "\\w{2}\\.\\w{4}\\.authority", false).getObject(); ======= public void verifyValidationWithRegExCaseInsensitiv() { final UrlValidator validator = new SimpleUrlValidatorFactoryBean(false, "\\w{2}\\.\\w{4}\\.authority", false).getObject(); >>>>>>> public void verifyValidationWithRegExCaseInsensitiv() { final var validator = new SimpleUrlValidatorFactoryBean(false, "\\w{2}\\.\\w{4}\\.authority", false).getObject(); <<<<<<< public void verifyValidationWithRegExAndLocalUrlAllowed() throws Exception { final var validator = new SimpleUrlValidatorFactoryBean(true, "\\w{2}\\.\\w{4}\\.authority", true).getObject(); ======= public void verifyValidationWithRegExAndLocalUrlAllowed() { final UrlValidator validator = new SimpleUrlValidatorFactoryBean(true, "\\w{2}\\.\\w{4}\\.authority", true).getObject(); >>>>>>> public void verifyValidationWithRegExAndLocalUrlAllowed() { final var validator = new SimpleUrlValidatorFactoryBean(true, "\\w{2}\\.\\w{4}\\.authority", true).getObject();
<<<<<<< import org.junit.runner.RunWith; ======= import org.junit.experimental.categories.Category; import org.opensaml.saml.metadata.resolver.MetadataResolver; >>>>>>> import org.junit.experimental.categories.Category; <<<<<<< ======= import java.util.Collection; import lombok.extern.slf4j.Slf4j; >>>>>>> import lombok.extern.slf4j.Slf4j;
<<<<<<< @Test public void testBadCredentialsOnTicketGrantingTicketCreation() throws Exception { try { getCentralAuthenticationService().createTicketGrantingTicket( ======= @Test(expected=TicketException.class) public void testBadCredentialsOnTicketGrantingTicketCreation() throws TicketException { getCentralAuthenticationService().createTicketGrantingTicket( >>>>>>> @Test(expected=AuthenticationException.class) public void testBadCredentialsOnTicketGrantingTicketCreation() throws Exception { getCentralAuthenticationService().createTicketGrantingTicket( <<<<<<< fail(TestUtils.CONST_EXCEPTION_EXPECTED); } catch (AuthenticationException e) { // nothing to do here, exception is expected. } ======= >>>>>>> <<<<<<< ======= } catch (final TicketException e) { fail(TestUtils.CONST_EXCEPTION_NON_EXPECTED); } >>>>>>> } catch (final TicketException e) { fail(TestUtils.CONST_EXCEPTION_NON_EXPECTED); } <<<<<<< @Test public void testDestroyTicketGrantingTicketWithInvalidTicket() throws Exception { ======= @Test(expected=ClassCastException.class) public void testDestroyTicketGrantingTicketWithInvalidTicket() throws TicketException { >>>>>>> @Test(expected=ClassCastException.class) public void testDestroyTicketGrantingTicketWithInvalidTicket() throws Exception { <<<<<<< @Test public void testGrantServiceTicketWithInvalidTicketGrantingTicket() throws Exception { ======= @Test(expected=TicketException.class) public void testGrantServiceTicketWithInvalidTicketGrantingTicket() throws TicketException { >>>>>>> @Test(expected=TicketException.class) public void testGrantServiceTicketWithInvalidTicketGrantingTicket() throws Exception { <<<<<<< @Test public void testGrantServiceTicketWithExpiredTicketGrantingTicket() throws Exception { ((CentralAuthenticationServiceImpl) getCentralAuthenticationService()).setTicketGrantingTicketExpirationPolicy(new ExpirationPolicy() { ======= @Test(expected=TicketException.class) public void testGrantServiceTicketWithExpiredTicketGrantingTicket() throws TicketException { ((CentralAuthenticationServiceImpl) getCentralAuthenticationService()).setTicketGrantingTicketExpirationPolicy( new ExpirationPolicy() { >>>>>>> @Test(expected=TicketException.class) public void testGrantServiceTicketWithExpiredTicketGrantingTicket() throws Exception { ((CentralAuthenticationServiceImpl) getCentralAuthenticationService()).setTicketGrantingTicketExpirationPolicy( new ExpirationPolicy() { <<<<<<< @Test public void testValidateServiceTicketWithInvalidService() throws Exception { ======= @Test(expected=UnauthorizedServiceException.class) public void testValidateServiceTicketWithInvalidService() throws TicketException { >>>>>>> @Test(expected=UnauthorizedServiceException.class) public void testValidateServiceTicketWithInvalidService() throws Exception { <<<<<<< @Test public void testValidateServiceTicketWithInvalidServiceTicket() throws Exception { ======= @Test(expected=TicketException.class) public void testValidateServiceTicketWithInvalidServiceTicket() throws TicketException { >>>>>>> @Test(expected=TicketException.class) public void testValidateServiceTicketWithInvalidServiceTicket() throws Exception {
<<<<<<< public void expire(final LocalDate onOrBefore) { final var results = storage.asMap() ======= public void expire(final LocalDateTime onOrBefore) { final Set<MultifactorAuthenticationTrustRecord> results = storage.asMap() >>>>>>> public void expire(final LocalDateTime onOrBefore) { final var results = storage.asMap()
<<<<<<< final var impl = new SamlServiceFactory().createService(request); ======= final SamlService impl = samlServiceFactory.createService(request); >>>>>>> final var impl = samlServiceFactory.createService(request); <<<<<<< final var impl = new SamlServiceFactory().createService(request); ======= final Service impl = samlServiceFactory.createService(request); >>>>>>> final Service impl = samlServiceFactory.createService(request); <<<<<<< final var impl = new SamlServiceFactory().createService(request); final var response = new SamlServiceResponseBuilder( ======= final WebApplicationService impl = samlServiceFactory.createService(request); final Response response = new SamlServiceResponseBuilder( >>>>>>> final WebApplicationService impl = samlServiceFactory.createService(request); final var response = new SamlServiceResponseBuilder( <<<<<<< final var service = new DefaultArgumentExtractor(new SamlServiceFactory()).extractService(request); final Service impl = new DefaultArgumentExtractor(new SamlServiceFactory()).extractService(request); ======= final WebApplicationService service = new DefaultArgumentExtractor(samlServiceFactory).extractService(request); final Service impl = new DefaultArgumentExtractor(samlServiceFactory).extractService(request); >>>>>>> final var service = new DefaultArgumentExtractor(samlServiceFactory).extractService(request); final Service impl = new DefaultArgumentExtractor(samlServiceFactory).extractService(request); <<<<<<< final var service = new DefaultArgumentExtractor(new SamlServiceFactory()).extractService(request2); ======= final WebApplicationService service = new DefaultArgumentExtractor(samlServiceFactory).extractService(request2); >>>>>>> final var service = new DefaultArgumentExtractor(samlServiceFactory).extractService(request2); <<<<<<< final var serviceWritten = new SamlServiceFactory().createService(request); ======= final SamlService serviceWritten = samlServiceFactory.createService(request); >>>>>>> final var serviceWritten = samlServiceFactory.createService(request);
<<<<<<< var naked = point; while (naked.getArgs().length > 0 && naked.getArgs()[0] instanceof JoinPoint) { ======= JoinPoint naked = point; while (naked.getArgs() != null && naked.getArgs().length > 0 && naked.getArgs()[0] instanceof JoinPoint) { >>>>>>> var naked = point; while (naked.getArgs() != null && naked.getArgs().length > 0 && naked.getArgs()[0] instanceof JoinPoint) {
<<<<<<< final var match = matcher.group(); final var newId = matcher.group(1) + '-' + StringUtils.repeat("*", match.length() - VISIBLE_TAIL_LENGTH) + StringUtils.right(match, VISIBLE_TAIL_LENGTH); ======= final String match = matcher.group(); final String group = matcher.group(1); int replaceLength = group.length() - VISIBLE_TAIL_LENGTH - (HOST_NAME_LENGTH + 1); if (replaceLength <= 0) { replaceLength = group.length(); } final String newId = match.replace(group.substring(0, replaceLength), StringUtils.repeat("*", replaceLength)); >>>>>>> final var match = matcher.group(); final var group = matcher.group(1); var replaceLength = group.length() - VISIBLE_TAIL_LENGTH - (HOST_NAME_LENGTH + 1); if (replaceLength <= 0) { replaceLength = group.length(); } final var newId = match.replace(group.substring(0, replaceLength), StringUtils.repeat("*", replaceLength));
<<<<<<< /** * Sets principal factory to create principal objects. * * @param principalFactory the principal factory */ public void setPrincipalFactory(final PrincipalFactory principalFactory) { this.principalFactory = principalFactory; } ======= public boolean isTypedIdUsed() { return typedIdUsed; } public void setTypedIdUsed(final boolean typedIdUsed) { this.typedIdUsed = typedIdUsed; } >>>>>>> public boolean isTypedIdUsed() { return typedIdUsed; } public void setTypedIdUsed(final boolean typedIdUsed) { this.typedIdUsed = typedIdUsed; } public void setPrincipalFactory(final PrincipalFactory principalFactory) { this.principalFactory = principalFactory; }
<<<<<<< final Exception ex; if (ScriptingUtils.isInlineGroovyScript(script)) { final var args = CollectionUtils.wrap("principal", auth.getPrincipal(), "logger", LOGGER); ex = ScriptingUtils.executeGroovyShellScript(script, args, Exception.class); ======= final Optional<Exception> ex; final Matcher matcherInline = ScriptingUtils.getMatcherForInlineGroovyScript(script); if (matcherInline.find()) { final Map<String, Object> args = CollectionUtils.wrap("principal", auth.getPrincipal(), "logger", LOGGER); final String inlineScript = matcherInline.group(1); ex = ScriptingUtils.executeGroovyShellScript(inlineScript, args, Optional.class); >>>>>>> final Optional<Exception> ex; final var matcherInline = ScriptingUtils.getMatcherForInlineGroovyScript(script); if (matcherInline.find()) { final var inlineScript = matcherInline.group(1); ex = ScriptingUtils.executeGroovyShellScript(inlineScript, args, Optional.class);
<<<<<<< import org.junit.jupiter.api.BeforeAll; ======= import org.junit.BeforeClass; import org.junit.Test; >>>>>>> import org.junit.jupiter.api.BeforeAll; import org.junit.Test; <<<<<<< @BeforeAll ======= public LdapServiceRegistryTests(final Class<? extends RegisteredService> registeredServiceClass) { super(registeredServiceClass); } @BeforeClass >>>>>>> public LdapServiceRegistryTests(final Class<? extends RegisteredService> registeredServiceClass) { super(registeredServiceClass); }
<<<<<<< import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; ======= import java.util.Set; import org.apereo.cas.oidc.OidcConstants; >>>>>>> import java.util.Set; import org.apereo.cas.oidc.OidcConstants; <<<<<<< ======= import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; >>>>>>> import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; <<<<<<< final var auth = oidcAuthorizationRequestSupport.isCasAuthenticationAvailable(context); auth.ifPresent(authentication -> oidcAuthorizationRequestSupport.configureClientForMaxAgeAuthorizationRequest(casClient, context, authentication)); ======= boolean renew = casClient.getConfiguration().isRenew(); boolean gateway = casClient.getConfiguration().isGateway(); >>>>>>> boolean renew = casClient.getConfiguration().isRenew(); boolean gateway = casClient.getConfiguration().isGateway(); <<<<<<< final var action = super.build(casClient, context); ======= final RedirectAction action = super.build(casClient, context, renew, gateway); >>>>>>> final RedirectAction action = super.build(casClient, context, renew, gateway);
<<<<<<< final var contentString = text.getText(); if (!contentString.isEmpty() && contentString.trim().isEmpty()) { ======= final String contentString = text.getText(); if (!contentString.isEmpty()) { >>>>>>> final var contentString = text.getText(); if (!contentString.isEmpty()) {
<<<<<<< public Optional<RsaJsonWebKey> load(final String issuer) throws Exception { final var jwks = buildJsonWebKeySet(); ======= public Optional<RsaJsonWebKey> load(final String issuer) { final Optional<JsonWebKeySet> jwks = buildJsonWebKeySet(); >>>>>>> public Optional<RsaJsonWebKey> load(final String issuer) { final var jwks = buildJsonWebKeySet();
<<<<<<< ======= import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; >>>>>>> import org.junit.ClassRule; import org.junit.Rule; <<<<<<< import org.junit.jupiter.api.BeforeEach; import org.junit.runner.RunWith; ======= import org.junit.experimental.categories.Category; >>>>>>> import org.junit.experimental.categories.Category;
<<<<<<< final var strategy = createLdapPasswordPolicyHandlingStrategy(l); ======= final AuthenticationPasswordPolicyHandlingStrategy strategy = createLdapPasswordPolicyHandlingStrategy(l); >>>>>>> final AuthenticationPasswordPolicyHandlingStrategy strategy = createLdapPasswordPolicyHandlingStrategy(l); <<<<<<< final var cfg = createLdapPasswordPolicyConfiguration(l, authenticator, multiMapAttributes); ======= final PasswordPolicyConfiguration cfg = createLdapPasswordPolicyConfiguration(passwordPolicy, authenticator, multiMapAttributes); >>>>>>> final PasswordPolicyConfiguration cfg = createLdapPasswordPolicyConfiguration(passwordPolicy, authenticator, multiMapAttributes); <<<<<<< final var location = l.getPasswordPolicy().getGroovy().getLocation(); if (l.getPasswordPolicy().getStrategy() == PasswordPolicyProperties.PasswordPolicyHandlingOptions.GROOVY && location != null) { ======= final Resource location = l.getPasswordPolicy().getGroovy().getLocation(); if (l.getPasswordPolicy().getStrategy() == LdapPasswordPolicyProperties.PasswordPolicyHandlingOptions.GROOVY && location != null) { >>>>>>> final var location = l.getPasswordPolicy().getGroovy().getLocation(); if (l.getPasswordPolicy().getStrategy() == LdapPasswordPolicyProperties.PasswordPolicyHandlingOptions.GROOVY && location != null) { <<<<<<< private LdapPasswordPolicyConfiguration createLdapPasswordPolicyConfiguration(final LdapAuthenticationProperties l, final Authenticator authenticator, final Multimap<String, Object> attributes) { final var passwordPolicy = l.getPasswordPolicy(); final var cfg = new LdapPasswordPolicyConfiguration(passwordPolicy); ======= private PasswordPolicyConfiguration createLdapPasswordPolicyConfiguration(final LdapPasswordPolicyProperties passwordPolicy, final Authenticator authenticator, final Multimap<String, Object> attributes) { final PasswordPolicyConfiguration cfg = new PasswordPolicyConfiguration(passwordPolicy); >>>>>>> private PasswordPolicyConfiguration createLdapPasswordPolicyConfiguration(final LdapPasswordPolicyProperties passwordPolicy, final Authenticator authenticator, final Multimap<String, Object> attributes) { final PasswordPolicyConfiguration cfg = new PasswordPolicyConfiguration(passwordPolicy); <<<<<<< ======= final OptionalWarningLdapAccountStateHandler accountHandler = new OptionalWarningLdapAccountStateHandler(); >>>>>>> final OptionalWarningLdapAccountStateHandler accountHandler = new OptionalWarningLdapAccountStateHandler(); <<<<<<< final var accountHandler = new DefaultLdapLdapAccountStateHandler(); ======= final DefaultLdapAccountStateHandler accountHandler = new DefaultLdapAccountStateHandler(); >>>>>>> final DefaultLdapAccountStateHandler accountHandler = new DefaultLdapAccountStateHandler();
<<<<<<< LOGGER.debug("Evaluating request to determine if warning cookie should be generated"); final var response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); ======= LOGGER.trace("Evaluating request to determine if warning cookie should be generated"); final HttpServletResponse response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); >>>>>>> LOGGER.trace("Evaluating request to determine if warning cookie should be generated"); final var response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
<<<<<<< final var props = new SamlIdPProperties(); final var resolver = new UrlResourceMetadataResolver(props, openSamlConfigBean); final var service = new SamlRegisteredService(); ======= final SamlIdPProperties props = new SamlIdPProperties(); props.getMetadata().setLocation(new FileSystemResource(FileUtils.getTempDirectory())); final UrlResourceMetadataResolver resolver = new UrlResourceMetadataResolver(props, openSamlConfigBean); final SamlRegisteredService service = new SamlRegisteredService(); >>>>>>> final var props = new SamlIdPProperties(); props.getMetadata().setLocation(new FileSystemResource(FileUtils.getTempDirectory())); final var resolver = new UrlResourceMetadataResolver(props, openSamlConfigBean); final var service = new SamlRegisteredService();
<<<<<<< final var tUsername = up.getUsername(); final var surrogateUsername = tUsername.substring(0, tUsername.indexOf(this.separator)); final var realUsername = tUsername.substring(tUsername.indexOf(this.separator) + 1); ======= final String tUsername = up.getUsername(); final String surrogateUsername = tUsername.substring(0, tUsername.indexOf(this.separator)); final String realUsername = tUsername.substring(tUsername.indexOf(this.separator) + 1); LOGGER.debug("Converting to surrogate credential for username [{}], surrogate username [{}]", realUsername, surrogateUsername); >>>>>>> final var tUsername = up.getUsername(); final var surrogateUsername = tUsername.substring(0, tUsername.indexOf(this.separator)); final var realUsername = tUsername.substring(tUsername.indexOf(this.separator) + 1); LOGGER.debug("Converting to surrogate credential for username [{}], surrogate username [{}]", realUsername, surrogateUsername); <<<<<<< private static void deconvertFromSurrogatePrincipal(final RequestContext context) { final var c = WebUtils.getCredential(context); if (c instanceof SurrogateUsernamePasswordCredential) { final var sc = SurrogateUsernamePasswordCredential.class.cast(c); final var up = new UsernamePasswordCredential(); up.setUsername(sc.getUsername()); up.setPassword(sc.getPassword()); WebUtils.putCredential(context, up); } } ======= >>>>>>>
<<<<<<< * Sets whether we should bother to read the attribute list or not. * * @return true if we should read it, false otherwise. */ boolean isIgnoreAttributes(); /** * Returns the list of allowed attributes. * * @return the list of attributes */ List<String> getAllowedAttributes(); /** * Get the proxy policy rules for this service. ======= * Is this application allowed to take part in the proxying capabilities of * CAS? >>>>>>> * Get the proxy policy rules for this service.
<<<<<<< import org.jasig.cas.support.saml.util.DefaultSaml20ObjectBuilder; ======= import org.jasig.cas.support.saml.util.GoogleSaml20ObjectBuilder; import org.jasig.cas.util.ISOStandardDateFormat; >>>>>>> import org.jasig.cas.support.saml.util.DefaultSaml20ObjectBuilder; import org.jasig.cas.util.ISOStandardDateFormat;
<<<<<<< Block block; while ((block = blockQueue.take(queueName)) != null) { ======= Block block = null; while((block = blockQueue.take(queueName)) != null) { if(block.getHeader() == null) { break; } >>>>>>> Block block; while((block = blockQueue.take(queueName)) != null) { if(block.getHeader() == null) { break; }
<<<<<<< if (this.persistentIdGenerator == null) { throw new IllegalArgumentException("No persistent id generator is defined"); } final var id = this.persistentIdGenerator.generate(principal, new Service() { private static final long serialVersionUID = 178464253829044870L; @Override public boolean matches(final Service service) { return false; } @Override public String getId() { return null; } }); ======= final String id = this.persistentIdGenerator.generate(principal, service); >>>>>>> final var id = this.persistentIdGenerator.generate(principal, service);
<<<<<<< public void verifyNullTicket() throws Exception { final var ctx = new MockRequestContext(); final var action = new ======= public void verifyNullTicket() { final MockRequestContext ctx = new MockRequestContext(); final TicketGrantingTicketCheckAction action = new >>>>>>> public void verifyNullTicket() { final var ctx = new MockRequestContext(); final var action = new
<<<<<<< final var currentSystemTime = getCurrentSystemTime(); final var creationTime = ticketState.getCreationTime(); final var lastTimeUsed = ticketState.getLastTimeUsed(); ======= Assert.isTrue(this.maxTimeToLiveInSeconds >= this.timeToKillInSeconds, "maxTimeToLiveInSeconds must be greater than or equal to timeToKillInSeconds."); final ZonedDateTime currentSystemTime = getCurrentSystemTime(); final ZonedDateTime creationTime = ticketState.getCreationTime(); final ZonedDateTime lastTimeUsed = ticketState.getLastTimeUsed(); >>>>>>> Assert.isTrue(this.maxTimeToLiveInSeconds >= this.timeToKillInSeconds, "maxTimeToLiveInSeconds must be greater than or equal to timeToKillInSeconds.");
<<<<<<< protected Event doExecute(final RequestContext requestContext) { final var username = requestContext.getRequestParameters().get("username"); ======= public Event doExecute(final RequestContext requestContext) { final String username = requestContext.getRequestParameters().get("username"); >>>>>>> public Event doExecute(final RequestContext requestContext) { final var username = requestContext.getRequestParameters().get("username");
<<<<<<< final var props = new SamlIdPProperties(); final var resolver = new ClasspathResourceMetadataResolver(props, openSamlConfigBean); final var service = new SamlRegisteredService(); ======= final SamlIdPProperties props = new SamlIdPProperties(); props.getMetadata().setLocation(new FileSystemResource(FileUtils.getTempDirectory())); final ClasspathResourceMetadataResolver resolver = new ClasspathResourceMetadataResolver(props, openSamlConfigBean); final SamlRegisteredService service = new SamlRegisteredService(); >>>>>>> final var props = new SamlIdPProperties(); props.getMetadata().setLocation(new FileSystemResource(FileUtils.getTempDirectory())); final var resolver = new ClasspathResourceMetadataResolver(props, openSamlConfigBean); final var service = new SamlRegisteredService(); <<<<<<< final var props = new SamlIdPProperties(); final var resolver = new ClasspathResourceMetadataResolver(props, openSamlConfigBean); final var service = new SamlRegisteredService(); ======= final SamlIdPProperties props = new SamlIdPProperties(); props.getMetadata().setLocation(new FileSystemResource(FileUtils.getTempDirectory())); final ClasspathResourceMetadataResolver resolver = new ClasspathResourceMetadataResolver(props, openSamlConfigBean); final SamlRegisteredService service = new SamlRegisteredService(); >>>>>>> final var props = new SamlIdPProperties(); props.getMetadata().setLocation(new FileSystemResource(FileUtils.getTempDirectory())); final var resolver = new ClasspathResourceMetadataResolver(props, openSamlConfigBean); final var service = new SamlRegisteredService();
<<<<<<< final var providers = WebUtils.getResolvedMultifactorAuthenticationProviders(requestContext); ======= final Collection<String> providerIds = WebUtils.getResolvedMultifactorAuthenticationProviders(requestContext); final Collection<MultifactorAuthenticationProvider> providers = MultifactorAuthenticationUtils.getMultifactorAuthenticationProvidersByIds(providerIds, applicationContext); >>>>>>> final var providerIds = WebUtils.getResolvedMultifactorAuthenticationProviders(requestContext); final var providers = MultifactorAuthenticationUtils.getMultifactorAuthenticationProvidersByIds(providerIds, applicationContext); <<<<<<< final var duoAuthenticationService = provider.findProvider(pr.getId(), DuoMultifactorAuthenticationProvider.class).getDuoAuthenticationService(); final var viewScope = requestContext.getViewScope(); ======= final DuoSecurityAuthenticationService duoAuthenticationService = provider.findProvider(pr.getId(), DuoMultifactorAuthenticationProvider.class).getDuoAuthenticationService(); final MutableAttributeMap<Object> viewScope = requestContext.getViewScope(); >>>>>>> final var duoAuthenticationService = provider.findProvider(pr.getId(), DuoMultifactorAuthenticationProvider.class).getDuoAuthenticationService(); final var viewScope = requestContext.getViewScope();
<<<<<<< proxy10Handler.getIfAvailable(), argumentExtractor.getIfAvailable(), ======= proxy20Handler.getIfAvailable(), argumentExtractor, >>>>>>> proxy20Handler.getIfAvailable(), argumentExtractor.getIfAvailable(), <<<<<<< proxy10Handler.getIfAvailable(), argumentExtractor.getIfAvailable(), ======= proxy20Handler.getIfAvailable(), argumentExtractor, >>>>>>> proxy20Handler.getIfAvailable(), argumentExtractor.getIfAvailable(),
<<<<<<< import com.fasterxml.jackson.databind.DeserializationFeature; ======= import com.fasterxml.jackson.databind.JsonNode; >>>>>>> import com.fasterxml.jackson.databind.JsonNode; <<<<<<< private final ObjectMapper objectMapper = new IgnoringJaxbModuleJacksonObjectMapper() .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .findAndRegisterModules(); ======= private static final ObjectMapper MAPPER = new ObjectMapper().findAndRegisterModules(); >>>>>>> private static final ObjectMapper MAPPER = new ObjectMapper().findAndRegisterModules(); .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .findAndRegisterModules(); <<<<<<< @SuppressWarnings("JdkObsolete") private static Map<String, List<Object>> buildSyncopeUserAttributes(final UserTO user) { ======= @SuppressWarnings("unchecked") private static Map<String, List<Object>> buildSyncopeUserAttributes(final JsonNode user) { >>>>>>> @SuppressWarnings("unchecked") private static Map<String, List<Object>> buildSyncopeUserAttributes(final JsonNode user) { <<<<<<< if (user.getDynMemberships() != null && !user.getDynMemberships().isEmpty()) { attributes.put("syncopeUserDynMemberships", user.getDynMemberships() .stream() .map(MembershipTO::getGroupName) .collect(Collectors.toList())); ======= var dynMemberships = new ArrayList<>(); user.get("dynMemberships").forEach(m -> dynMemberships.add(m.get("groupName").asText())); if (dynMemberships.isEmpty()) { attributes.put("syncopeUserDynMemberships", dynMemberships); >>>>>>> var dynMemberships = new ArrayList<>(); user.get("dynMemberships").forEach(m -> dynMemberships.add(m.get("groupName").asText())); if (dynMemberships.isEmpty()) { attributes.put("syncopeUserDynMemberships", dynMemberships); <<<<<<< val userTO = this.objectMapper.readValue(result, UserTO.class); return Optional.ofNullable(userTO); ======= return Optional.of(MAPPER.readTree(result)); >>>>>>> return Optional.of(MAPPER.readTree(result));
<<<<<<< import org.apereo.cas.util.junit.ConditionalSpringRunner; ======= import org.junit.After; import org.junit.ClassRule; import org.junit.Rule; >>>>>>> import org.junit.ClassRule; import org.junit.Rule; <<<<<<< import org.junit.jupiter.api.AfterEach; import org.junit.runner.RunWith; ======= import org.junit.experimental.categories.Category; >>>>>>> import org.junit.experimental.categories.Category;
<<<<<<< final var properties = new PropertiesFactoryBean(); final List<Resource> resourceList = new ArrayList<>(); final var resourceLoader = new DefaultResourceLoader(); ======= final PropertiesFactoryBean properties = new PropertiesFactoryBean(); final DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); final List<String> commonNames = casProperties.getMessageBundle().getCommonNames(); final List<Resource> resourceList = commonNames .stream() .map(resourceLoader::getResource) .collect(Collectors.toList()); >>>>>>> final var properties = new PropertiesFactoryBean(); final var resourceLoader = new DefaultResourceLoader(); final List<String> commonNames = casProperties.getMessageBundle().getCommonNames(); final List<Resource> resourceList = commonNames .stream() .map(resourceLoader::getResource) .collect(Collectors.toList()); <<<<<<< for (final var resourceName : casProperties.getMessageBundle().getCommonNames()) { final var resource = resourceLoader.getResource(resourceName); // resource existence unknown at this point, let PropertiesFactoryBean determine and log resourceList.add(resource); } ======= >>>>>>> for (final var resourceName : casProperties.getMessageBundle().getCommonNames()) { final var resource = resourceLoader.getResource(resourceName);
<<<<<<< public Event doExecute(final RequestContext context) throws Exception { final var request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final var response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); ======= public Event doExecute(final RequestContext context) { final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final HttpServletResponse response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); >>>>>>> public Event doExecute(final RequestContext context) { final var request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final var response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
<<<<<<< public static boolean checkCallbackValid(final RegisteredService registeredService, final String redirectUri) { final var registeredServiceId = registeredService.getServiceId(); ======= public static boolean checkCallbackValid(@NonNull final RegisteredService registeredService, final String redirectUri) { final String registeredServiceId = registeredService.getServiceId(); >>>>>>> public static boolean checkCallbackValid(@NonNull final RegisteredService registeredService, final String redirectUri) { final var registeredServiceId = registeredService.getServiceId();
<<<<<<< final var tkt = this.ticketCatalog.find(ticketId); return this.entityManager.find(tkt.getImplementationClass(), ticketId, this.lockType); ======= final TicketDefinition tkt = ticketCatalog.find(ticketId); final String sql = String.format("select t from %s t where t.id = :id", getTicketEntityName(tkt)); final TypedQuery<? extends Ticket> query = entityManager.createQuery(sql, tkt.getImplementationClass()); query.setParameter("id", ticketId); query.setLockMode(this.lockType); final Ticket result = query.getSingleResult(); if (result != null && result.isExpired()) { LOGGER.debug("Ticket [{}] has expired and will be removed from the database", result.getId()); return null; } return result; >>>>>>> final TicketDefinition tkt = ticketCatalog.find(ticketId); final String sql = String.format("select t from %s t where t.id = :id", getTicketEntityName(tkt)); final TypedQuery<? extends Ticket> query = entityManager.createQuery(sql, tkt.getImplementationClass()); query.setParameter("id", ticketId); query.setLockMode(this.lockType); final Ticket result = query.getSingleResult(); if (result != null && result.isExpired()) { LOGGER.debug("Ticket [{}] has expired and will be removed from the database", result.getId()); return null; } return result; <<<<<<< return this.ticketCatalog.findAll().stream() .map(t -> this.entityManager.createQuery("select t from " + getTicketEntityName(t) + " t", t.getImplementationClass())) // Unwrap to Hibernate Query, which supports streams .map(q -> { final var hq = (org.hibernate.query.Query<Ticket>) q.unwrap(org.hibernate.query.Query.class); hq.setFetchSize(STREAM_BATCH_SIZE); hq.setLockOptions(LockOptions.NONE); return hq; ======= return this.ticketCatalog.findAll() .stream() .map(t -> { final String sql = String.format("select t from %s t", getTicketEntityName(t)); final org.hibernate.query.Query<Ticket> query = (org.hibernate.query.Query<Ticket>) entityManager.createQuery(sql, t.getImplementationClass()); query.setFetchSize(STREAM_BATCH_SIZE); query.setLockOptions(LockOptions.NONE); return query; >>>>>>> return this.ticketCatalog.findAll() .stream() .map(t -> { final String sql = String.format("select t from %s t", getTicketEntityName(t)); final org.hibernate.query.Query<Ticket> query = (org.hibernate.query.Query<Ticket>) entityManager.createQuery(sql, t.getImplementationClass()); query.setFetchSize(STREAM_BATCH_SIZE); query.setLockOptions(LockOptions.NONE); return query; <<<<<<< final var md = this.ticketCatalog.find(TicketGrantingTicket.PREFIX); return countToLong(this.entityManager.createQuery("select count(t) from " + getTicketEntityName(md) + " t").getSingleResult()); ======= final TicketDefinition md = this.ticketCatalog.find(TicketGrantingTicket.PREFIX); final String sql = String.format("select count(t) from %s t", getTicketEntityName(md)); final Query query = this.entityManager.createQuery(sql); return countToLong(query.getSingleResult()); >>>>>>> final var md = this.ticketCatalog.find(TicketGrantingTicket.PREFIX); final String sql = String.format("select count(t) from %s t", getTicketEntityName(md)); final Query query = this.entityManager.createQuery(sql); return countToLong(query.getSingleResult()); <<<<<<< final var md = this.ticketCatalog.find(ServiceTicket.PREFIX); return countToLong(this.entityManager.createQuery("select count(t) from " + getTicketEntityName(md) + " t").getSingleResult()); ======= final TicketDefinition md = this.ticketCatalog.find(ServiceTicket.PREFIX); final String sql = String.format("select count(t) from %s t", getTicketEntityName(md)); final Query query = this.entityManager.createQuery(sql); return countToLong(query.getSingleResult()); >>>>>>> final var md = this.ticketCatalog.find(ServiceTicket.PREFIX); final String sql = String.format("select count(t) from %s t", getTicketEntityName(md)); final Query query = this.entityManager.createQuery(sql); return countToLong(query.getSingleResult()); <<<<<<< final var query = entityManager.createQuery("delete from " + ticketEntityName + " o where o.id = :id"); ======= final String sql = String.format("delete from %s o where o.id = :id", ticketEntityName); final Query query = entityManager.createQuery(sql); >>>>>>> final String sql = String.format("delete from %s o where o.id = :id", ticketEntityName); final Query query = entityManager.createQuery(sql);
<<<<<<< ======= >>>>>>> <<<<<<< ldapAuthenticationHandlers().forEach(handler -> this.authenticationHandlersResolvers.put(handler, this.personDirectoryPrincipalResolver)); } @ConditionalOnMissingBean(name = "ldapPrincipalFactory") @Bean public PrincipalFactory ldapPrincipalFactory() { return new DefaultPrincipalFactory(); } @Bean public Collection<AuthenticationHandler> ldapAuthenticationHandlers() { final Collection<AuthenticationHandler> handlers = new TreeSet<>(); casProperties.getAuthn().getLdap() .stream() .filter(l -> { if (l.getType() == null) { LOGGER.warn("Skipping ldap authentication entry since no type is defined"); return false; } if (l.getBaseDn() == null) { LOGGER.warn("Skipping ldap authentication entry since no baseDn is defined"); return false; } if (l.getLdapUrl() == null) { LOGGER.warn("Skipping ldap authentication entry since no ldap url is defined"); return false; } return true; }) ======= casProperties.getAuthn().getLdap().stream() .filter(isACompleteLdap()) >>>>>>> ldapAuthenticationHandlers().forEach(handler -> this.authenticationHandlersResolvers.put(handler, this.personDirectoryPrincipalResolver)); } @ConditionalOnMissingBean(name = "ldapPrincipalFactory") @Bean public PrincipalFactory ldapPrincipalFactory() { return new DefaultPrincipalFactory(); } @Bean public Collection<AuthenticationHandler> ldapAuthenticationHandlers() { final Collection<AuthenticationHandler> handlers = new TreeSet<>(); casProperties.getAuthn().getLdap() .stream() .filter(ldapInstanceConfigurationPredicate()) <<<<<<< LOGGER.debug("Creating ldap authentication handler for {}", l.getLdapUrl()); final LdapAuthenticationHandler handler = new LdapAuthenticationHandler(); handler.setServicesManager(servicesManager); handler.setName(l.getName()); handler.setOrder(l.getOrder()); handler.setPrincipalFactory(ldapPrincipalFactory()); final List<String> additionalAttrs = l.getAdditionalAttributes(); if (StringUtils.isNotBlank(l.getPrincipalAttributeId())) { additionalAttrs.add(l.getPrincipalAttributeId()); } handler.setAdditionalAttributes(additionalAttrs); handler.setAllowMultiplePrincipalAttributeValues(l.isAllowMultiplePrincipalAttributeValues()); handler.setPasswordEncoder(Beans.newPasswordEncoder(l.getPasswordEncoder())); handler.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(l.getPrincipalTransformation())); if (StringUtils.isNotBlank(l.getCredentialCriteria())) { LOGGER.debug("Ldap authentication for {} is filtering credentials by {}", l.getCredentialCriteria()); final Predicate<String> predicate = Pattern.compile(l.getCredentialCriteria()).asPredicate(); handler.setCredentialSelectionPredicate(credential -> predicate.test(credential.getId())); } ======= >>>>>>> <<<<<<< handler.setAuthenticator(authenticator); LOGGER.debug("Initializing ldap authentication handler for {}", l.getLdapUrl()); ======= LOGGER.debug("Initializing ldap authentication handler..."); >>>>>>> LOGGER.debug("Initializing ldap authentication handler for {}", l.getLdapUrl());
<<<<<<< final var result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); try (var output = new FileWriter(backupFile)) { ======= final String result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); try (Writer output = Files.newBufferedWriter(backupFile.toPath(), StandardCharsets.UTF_8)) { >>>>>>> final var result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); try (Writer output = Files.newBufferedWriter(backupFile.toPath(), StandardCharsets.UTF_8)) {
<<<<<<< @Override public String handle(final Credential credential, final String proxyGrantingTicketId) { ======= public String handle(final Credential credential, final String proxyGrantingTicketId) { >>>>>>> @Override
<<<<<<< final var factory = new WebflowExecutorFactory(casProperties.getWebflow(), logoutFlowRegistry(), this.webflowCipherExecutor, new FlowExecutionListener[]{casFlowExecutionListener()}); ======= final WebflowExecutorFactory factory = new WebflowExecutorFactory(casProperties.getWebflow(), logoutFlowRegistry(), this.webflowCipherExecutor, new FlowExecutionListener[0]); >>>>>>> final var factory = new WebflowExecutorFactory(casProperties.getWebflow(), logoutFlowRegistry(), this.webflowCipherExecutor, new FlowExecutionListener[0]);
<<<<<<< final var aupAcceptedAction = createActionState(flow, AUP_ACCEPTED_ACTION, createAcceptableUsagePolicyAction("submit")); ======= final ActionState aupAcceptedAction = createActionState(flow, AUP_ACCEPTED_ACTION, "acceptableUsagePolicySubmitAction"); >>>>>>> final var aupAcceptedAction = createActionState(flow, AUP_ACCEPTED_ACTION, "acceptableUsagePolicySubmitAction"); <<<<<<< final var actionState = createActionState(flow, STATE_ID_AUP_CHECK, createAcceptableUsagePolicyAction("verify")); final var target = getRealSubmissionState(flow).getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS).getTargetStateId(); ======= final ActionState actionState = createActionState(flow, STATE_ID_AUP_CHECK, "acceptableUsagePolicyVerifyAction"); final String target = getRealSubmissionState(flow).getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS).getTargetStateId(); >>>>>>> final var actionState = createActionState(flow, STATE_ID_AUP_CHECK, "acceptableUsagePolicyVerifyAction"); final var target = getRealSubmissionState(flow).getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS).getTargetStateId();
<<<<<<< if (decision.getOptions() == ConsentOptions.ATTRIBUTE_NAME) { final var consentAttributesHash = sha512ConsentAttributeNames(consentAttributes); final var currentAttributesHash = sha512ConsentAttributeNames(attributes); ======= if (decision.getOptions() == ConsentReminderOptions.ATTRIBUTE_NAME) { final String consentAttributesHash = sha512ConsentAttributeNames(consentAttributes); final String currentAttributesHash = sha512ConsentAttributeNames(attributes); >>>>>>> if (decision.getOptions() == ConsentReminderOptions.ATTRIBUTE_NAME) { final var consentAttributesHash = sha512ConsentAttributeNames(consentAttributes); final var currentAttributesHash = sha512ConsentAttributeNames(attributes); <<<<<<< if (decision.getOptions() == ConsentOptions.ATTRIBUTE_VALUE) { final var consentAttributesHash = sha512ConsentAttributeNames(consentAttributes); final var currentAttributesHash = sha512ConsentAttributeNames(attributes); ======= if (decision.getOptions() == ConsentReminderOptions.ATTRIBUTE_VALUE) { final String consentAttributesHash = sha512ConsentAttributeNames(consentAttributes); final String currentAttributesHash = sha512ConsentAttributeNames(attributes); >>>>>>> if (decision.getOptions() == ConsentReminderOptions.ATTRIBUTE_VALUE) { final var consentAttributesHash = sha512ConsentAttributeNames(consentAttributes); final var currentAttributesHash = sha512ConsentAttributeNames(attributes);
<<<<<<< final var encTicketId = encodeTicketId(ticketId); if (encTicketId == null) { ======= final String encTicketId = encodeTicketId(ticketId); if (StringUtils.isBlank(encTicketId)) { >>>>>>> final var encTicketId = encodeTicketId(ticketId); if (StringUtils.isBlank(encTicketId)) {
<<<<<<< protected Event doExecute(final RequestContext requestContext) throws Exception { final var username = requestContext.getRequestParameters().get("username"); ======= public Event doExecute(final RequestContext requestContext) throws Exception { final String username = requestContext.getRequestParameters().get("username"); >>>>>>> public Event doExecute(final RequestContext requestContext) throws Exception { final var username = requestContext.getRequestParameters().get("username"); <<<<<<< final var image = EncodingUtils.encodeBase64ToByteArray(graphics.read()); requestContext.getFlowScope().put("guaUsername", username); requestContext.getFlowScope().put("guaUserImage", new String(image, StandardCharsets.UTF_8)); ======= final byte[] image = EncodingUtils.encodeBase64ToByteArray(graphics.read()); WebUtils.putGraphicalUserAuthenticationUsername(requestContext, username); WebUtils.putGraphicalUserAuthenticationImage(requestContext, new String(image, StandardCharsets.UTF_8)); >>>>>>> final var image = EncodingUtils.encodeBase64ToByteArray(graphics.read()); WebUtils.putGraphicalUserAuthenticationUsername(requestContext, username); WebUtils.putGraphicalUserAuthenticationImage(requestContext, new String(image, StandardCharsets.UTF_8));
<<<<<<< final var service = SamlIdPTestUtils.getSamlRegisteredService(); ======= final SamlRegisteredService service = getSamlRegisteredServiceForTestShib(); >>>>>>> final var service = getSamlRegisteredServiceForTestShib(); <<<<<<< final var service = SamlIdPTestUtils.getSamlRegisteredService(); ======= final SamlRegisteredService service = getSamlRegisteredServiceForTestShib(); >>>>>>> final var service = getSamlRegisteredServiceForTestShib(); <<<<<<< final var service = SamlIdPTestUtils.getSamlRegisteredService(); ======= final SamlRegisteredService service = getSamlRegisteredServiceForTestShib(); >>>>>>> final var service = getSamlRegisteredServiceForTestShib(); <<<<<<< final var service = SamlIdPTestUtils.getSamlRegisteredService(); ======= final SamlRegisteredService service = getSamlRegisteredServiceForTestShib(); >>>>>>> final var service = getSamlRegisteredServiceForTestShib();
<<<<<<< protected Pair<AuthenticationHandler, Principal> authenticateAndObtainPrincipal(final Credentials credentials) throws AuthenticationException { final Map<String, Exception> errorMap = new LinkedHashMap<String, Exception>(); ======= protected Pair<AuthenticationHandler, Principal> authenticateAndObtainPrincipal( final Credentials credentials) throws AuthenticationException { boolean foundOneThatWorks = false; >>>>>>> protected Pair<AuthenticationHandler, Principal> authenticateAndObtainPrincipal( final Credentials credentials) throws AuthenticationException { final Map<String, Exception> errorMap = new LinkedHashMap<String, Exception>(); <<<<<<< ======= AuthenticationException authException = BadCredentialsAuthenticationException.ERROR; >>>>>>> <<<<<<< handlerName = authenticationHandler.getName(); HandlerResult result = null; ======= foundOneThatWorks = true; boolean authenticated = false; handlerName = authenticationHandler.getClass().getName(); >>>>>>> handlerName = authenticationHandler.getName(); HandlerResult result = null; <<<<<<< errorMap.put(handlerName, e); } ======= } >>>>>>> errorMap.put(handlerName, e); }
<<<<<<< final ConsentOptions options) { final var attributes = resolveConsentableAttributesFrom(authentication, service, registeredService); final var principalId = authentication.getPrincipal().getId(); ======= final ConsentReminderOptions options) { final Map<String, Object> attributes = resolveConsentableAttributesFrom(authentication, service, registeredService); final String principalId = authentication.getPrincipal().getId(); >>>>>>> final ConsentReminderOptions options) { final var attributes = resolveConsentableAttributesFrom(authentication, service, registeredService); final var principalId = authentication.getPrincipal().getId();
<<<<<<< final var principal = resolver.resolve(credential, principalOut, new SimpleTestUsernamePasswordAuthenticationHandler()); ======= final Principal principal = resolver.resolve(credential, Optional.of(principalOut), Optional.of(new SimpleTestUsernamePasswordAuthenticationHandler())); >>>>>>> final var principal = resolver.resolve(credential, Optional.of(principalOut), Optional.of(new SimpleTestUsernamePasswordAuthenticationHandler()));
<<<<<<< final var request = context.getRequest(); final var checkParameterExist = validator.checkParameterExist(request, OAuth20Constants.CLIENT_ID) && validator.checkParameterExist(request, OAuth20Constants.REDIRECT_URI) && validator.checkParameterExist(request, OAuth20Constants.RESPONSE_TYPE); ======= final HttpServletRequest request = context.getRequest(); final boolean checkParameterExist = HttpRequestUtils.doesParameterExist(request, OAuth20Constants.CLIENT_ID) && HttpRequestUtils.doesParameterExist(request, OAuth20Constants.REDIRECT_URI) && HttpRequestUtils.doesParameterExist(request, OAuth20Constants.RESPONSE_TYPE); >>>>>>> final var request = context.getRequest(); final var checkParameterExist = validator.checkParameterExist(request, OAuth20Constants.CLIENT_ID) && HttpRequestUtils.doesParameterExist(request, OAuth20Constants.REDIRECT_URI) && HttpRequestUtils.doesParameterExist(request, OAuth20Constants.RESPONSE_TYPE); <<<<<<< final var responseType = request.getParameter(OAuth20Constants.RESPONSE_TYPE); if (!validator.checkResponseTypes(responseType, OAuth20ResponseTypes.values())) { ======= final String responseType = request.getParameter(OAuth20Constants.RESPONSE_TYPE); if (!OAuth20Utils.checkResponseTypes(responseType, OAuth20ResponseTypes.values())) { >>>>>>> final var responseType = request.getParameter(OAuth20Constants.RESPONSE_TYPE); if (!OAuth20Utils.checkResponseTypes(responseType, OAuth20ResponseTypes.values())) { <<<<<<< final var redirectUri = request.getParameter(OAuth20Constants.REDIRECT_URI); if (!validator.checkCallbackValid(registeredService, redirectUri)) { ======= final String redirectUri = request.getParameter(OAuth20Constants.REDIRECT_URI); if (!OAuth20Utils.checkCallbackValid(registeredService, redirectUri)) { >>>>>>> final var redirectUri = request.getParameter(OAuth20Constants.REDIRECT_URI); if (!OAuth20Utils.checkCallbackValid(registeredService, redirectUri)) {
<<<<<<< final var factory = new SamlServiceFactory(); final Service service = factory.createService(request); ======= final Service service = samlServiceFactory.createService(request); >>>>>>> final var service = samlServiceFactory.createService(request); <<<<<<< final var request = new MockHttpServletRequest(); final var factory = new SamlServiceFactory(); assertNull(factory.createService(request)); ======= final MockHttpServletRequest request = new MockHttpServletRequest(); assertNull(samlServiceFactory.createService(request)); } @Test public void verifyPayloadCanBeParsedProperly() { final String body = "<!-- Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work" + "for additional information regarding copyright ownership. Jasig licenses this file to you under the Apache License, " + "Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a " + "copy of the License at the following location: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing," + "software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." + "See the License for the specific language governing permissions and limitations under the License.-->" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns=\"urn:oasis:names:tc:SAML:1.0:protocol\"> <soap:Header/> " + "<soap:Body> <Request MajorVersion=\"1\" MinorVersion=\"1\" RequestID=\"_e444ee1af9a7f6d656d76e8810299544\" IssueInstant=\"2018-05-10T16:39:46Z\">" + "<AssertionArtifact>ST-AAHJJ4pD5ZyoQkY9i08GsvYRVOyKeWws4SA4xwv+5HX9UgL7fCRBp2Ad</AssertionArtifact> </Request> </soap:Body></soap:Envelope>"; final MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter(SamlProtocolConstants.CONST_PARAM_TARGET, "test"); request.setContent(body.getBytes(StandardCharsets.UTF_8)); assertNotNull(samlServiceFactory.createService(request)); >>>>>>> final var request = new MockHttpServletRequest(); assertNull(samlServiceFactory.createService(request)); } @Test public void verifyPayloadCanBeParsedProperly() { final var body = "<!-- Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work" + "for additional information regarding copyright ownership. Jasig licenses this file to you under the Apache License, " + "Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a " + "copy of the License at the following location: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing," + "software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." + "See the License for the specific language governing permissions and limitations under the License.-->" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns=\"urn:oasis:names:tc:SAML:1.0:protocol\"> <soap:Header/> " + "<soap:Body> <Request MajorVersion=\"1\" MinorVersion=\"1\" RequestID=\"_e444ee1af9a7f6d656d76e8810299544\" IssueInstant=\"2018-05-10T16:39:46Z\">" + "<AssertionArtifact>ST-AAHJJ4pD5ZyoQkY9i08GsvYRVOyKeWws4SA4xwv+5HX9UgL7fCRBp2Ad</AssertionArtifact> </Request> </soap:Body></soap:Envelope>"; final var request = new MockHttpServletRequest(); request.setParameter(SamlProtocolConstants.CONST_PARAM_TARGET, "test"); request.setContent(body.getBytes(StandardCharsets.UTF_8)); assertNotNull(samlServiceFactory.createService(request));
<<<<<<< final var ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); final var ticketGrantingTicketValueFromCookie = (String) context.getFlowScope().get(WebUtils.PARAMETER_TICKET_GRANTING_TICKET_ID); ======= final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); final String ticketGrantingTicketValueFromCookie = WebUtils.getTicketGrantingTicketIdFrom(context.getFlowScope()); >>>>>>> final var ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); final String ticketGrantingTicketValueFromCookie = WebUtils.getTicketGrantingTicketIdFrom(context.getFlowScope());
<<<<<<< import org.apereo.cas.util.serialization.SerializationUtils; ======= import org.apereo.cas.ticket.TicketState; >>>>>>> import org.apereo.cas.ticket.TicketState; import org.apereo.cas.util.serialization.SerializationUtils;
<<<<<<< ======= private static final String[] INCLUDE_PACKAGES = new String[] {"org.jasig"}; @Autowired private ApplicationContext applicationContext; >>>>>>> @Autowired private ApplicationContext applicationContext;
<<<<<<< final var ctx = new MockRequestContext(); WebUtils.putService(ctx, RegisteredServiceTestUtils.getService()); final var event = oidcRegisteredServiceUIAction.execute(ctx); ======= final MockRequestContext ctx = new MockRequestContext(); WebUtils.putService(ctx, null); final Event event = oidcRegisteredServiceUIAction.execute(ctx); >>>>>>> final var ctx = new MockRequestContext(); WebUtils.putService(ctx, null); final var event = oidcRegisteredServiceUIAction.execute(ctx); <<<<<<< "https://www.example.org?client_id=id&client_secret=secret&redirect_uri=https://oauth.example.org")); final var event = oidcRegisteredServiceUIAction.execute(ctx); ======= "https://www.example.org?client_id=id&client_secret=secret&redirect_uri=https://oauth.example.org")); final Event event = oidcRegisteredServiceUIAction.execute(ctx); >>>>>>> "https://www.example.org?client_id=id&client_secret=secret&redirect_uri=https://oauth.example.org")); final var event = oidcRegisteredServiceUIAction.execute(ctx);
<<<<<<< sts.getProperties().put(SecurityConstants.USERNAME, up.getUsername()); final var uid = credentialCipherExecutor.encode(up.getUsername()); sts.getProperties().put(SecurityConstants.PASSWORD, uid); final var token = sts.requestSecurityToken(rp.getAppliesTo()); final var tokenStr = EncodingUtils.encodeBase64(SerializationUtils.serialize(token)); ======= final Map<String, Object> properties = sts.getProperties(); properties.put(SecurityConstants.USERNAME, up.getUsername()); final String uid = credentialCipherExecutor.encode(up.getUsername()); properties.put(SecurityConstants.PASSWORD, uid); final SecurityToken token = sts.requestSecurityToken(rp.getAppliesTo()); final String tokenStr = EncodingUtils.encodeBase64(SerializationUtils.serialize(token)); >>>>>>> final var properties = sts.getProperties(); properties.put(SecurityConstants.USERNAME, up.getUsername()); properties.put(SecurityConstants.PASSWORD, uid); final var token = sts.requestSecurityToken(rp.getAppliesTo()); final var tokenStr = EncodingUtils.encodeBase64(SerializationUtils.serialize(token));
<<<<<<< public final Event submit(final RequestContext context, final Credentials credentials, final MessageContext messageContext) throws Exception { ======= public final String submit(final RequestContext context, final Credentials credentials, final MessageContext messageContext) throws Exception { >>>>>>> public final Event submit(final RequestContext context, final Credentials credentials, final MessageContext messageContext) throws Exception { <<<<<<< this.logger.warn("Invalid login ticket {}", providedLoginTicket); messageContext.addMessage(new MessageBuilder().code("error.invalid.loginticket").build()); return newEvent(ERROR); ======= log.warn("Invalid login ticket {}", providedLoginTicket); final String code = "INVALID_TICKET"; messageContext.addMessage( new MessageBuilder().error().code(code).arg(providedLoginTicket).defaultText(code).build()); return "error"; >>>>>>> log.warn("Invalid login ticket {}", providedLoginTicket); messageContext.addMessage(new MessageBuilder().code("error.invalid.loginticket").build()); return newEvent(ERROR); <<<<<<< return newEvent(WARN); } catch (final AuthenticationException e) { return newEvent(AUTHENTICATION_FAILURE, e); } catch (final TicketCreationException e) { logger.warn("Invalid attempt to access service using renew=true with different credentials. Ending SSO session."); ======= return "warn"; } catch (final TicketException e) { if (isCauseAuthenticationException(e)) { populateErrorsInstance(e, messageContext); return getAuthenticationExceptionEventId(e); } >>>>>>> return newEvent(WARN); } catch (final AuthenticationException e) { return newEvent(AUTHENTICATION_FAILURE, e); } catch (final TicketCreationException e) { log.warn("Invalid attempt to access service using renew=true with different credentials. Ending SSO session."); <<<<<<< } catch (final TicketException e) { return newEvent(ERROR, e); ======= log.debug("Attempted to generate a ServiceTicket using renew=true with different credentials", e); >>>>>>> } catch (final TicketException e) { return newEvent(ERROR, e); <<<<<<< private Event newEvent(final String id) { return new Event(this, id); ======= private String getAuthenticationExceptionEventId(final TicketException e) { final AuthenticationException authEx = getAuthenticationExceptionAsCause(e); log.debug("An authentication error has occurred. Returning the event id {}", authEx.getType()); return authEx.getType(); >>>>>>> private Event newEvent(final String id) { return new Event(this, id);
<<<<<<< import org.apereo.cas.git.GitRepository; import org.apereo.cas.services.util.RegisteredServiceJsonSerializer; import org.apereo.cas.services.util.RegisteredServiceYamlSerializer; import org.apereo.cas.util.CollectionUtils; ======= import org.apereo.cas.configuration.model.support.git.services.GitServiceRegistryProperties; >>>>>>> import org.apereo.cas.configuration.model.support.git.services.GitServiceRegistryProperties; import org.apereo.cas.git.GitRepository; import org.apereo.cas.services.util.RegisteredServiceJsonSerializer; import org.apereo.cas.services.util.RegisteredServiceYamlSerializer; import org.apereo.cas.util.CollectionUtils;
<<<<<<< import org.jasig.cas.authentication.Authentication; import org.jasig.cas.authentication.AuthenticationResult; import org.jasig.cas.authentication.AuthenticationResultBuilder; ======= import org.apache.commons.lang3.StringUtils; >>>>>>> import org.jasig.cas.authentication.Authentication; import org.apache.commons.lang3.StringUtils; import org.jasig.cas.authentication.AuthenticationResult; import org.jasig.cas.authentication.AuthenticationResultBuilder; <<<<<<< /** * Put authentication into conversation scope. * * @param authentication the authentication * @param ctx the ctx */ public static void putAuthentication(final Authentication authentication, final RequestContext ctx) { ctx.getConversationScope().put("authentication", authentication); } /** * Gets authentication from conversation scope. * * @param ctx the ctx * @return the authentication */ public static Authentication getAuthentication(final RequestContext ctx) { return ctx.getConversationScope().get("authentication", Authentication.class); } /** * Put authentication result builder. * * @param builder the builder * @param ctx the ctx */ public static void putAuthenticationResultBuilder(final AuthenticationResultBuilder builder, final RequestContext ctx) { ctx.getConversationScope().put("authenticationResultBuilder", builder); } /** * Gets authentication result builder. * * @param ctx the ctx * @return the authentication result builder */ public static AuthenticationResultBuilder getAuthenticationResultBuilder(final RequestContext ctx) { return ctx.getConversationScope().get("authenticationResultBuilder", AuthenticationResultBuilder.class); } /** * Put authentication result. * * @param authenticationResult the authentication result * @param context the context */ public static void putAuthenticationResult(final AuthenticationResult authenticationResult, final RequestContext context) { context.getConversationScope().put("authenticationResult", authenticationResult); } /** * Gets authentication result builder. * * @param ctx the ctx * @return the authentication context builder */ public static AuthenticationResult getAuthenticationResult(final RequestContext ctx) { return ctx.getConversationScope().get("authenticationResult", AuthenticationResult.class); } ======= /** * Gets http servlet request user agent. * * @param request the request * @return the http servlet request user agent */ public static String getHttpServletRequestUserAgent(final HttpServletRequest request) { if (request != null) { return request.getHeader(USER_AGENT_HEADER); } return null; } /** * Gets http servlet request user agent. * * @return the http servlet request user agent */ public static String getHttpServletRequestUserAgent() { return getHttpServletRequestUserAgent(getHttpServletRequest()); } /** * Gets http servlet request geo location. * * @return the http servlet request geo location */ public static HttpRequestGeoLocation getHttpServletRequestGeoLocation() { final int latIndex = 0; final int oongIndex = 1; final int accuIndex = 2; final int timeIndex = 3; final HttpServletRequest request = WebUtils.getHttpServletRequest(); final HttpRequestGeoLocation loc = new HttpRequestGeoLocation(); if (request != null) { final String geoLocationParam = request.getParameter("geolocation"); if (StringUtils.isNotBlank(geoLocationParam)) { final String[] geoLocation = geoLocationParam.split(","); loc.setLatitude(geoLocation[latIndex]); loc.setLongitude(geoLocation[oongIndex]); loc.setAccuracy(geoLocation[accuIndex]); loc.setTimestamp(geoLocation[timeIndex]); } } return loc; } >>>>>>> /** * Put authentication into conversation scope. * * @param authentication the authentication * @param ctx the ctx */ public static void putAuthentication(final Authentication authentication, final RequestContext ctx) { ctx.getConversationScope().put("authentication", authentication); } /** * Gets authentication from conversation scope. * * @param ctx the ctx * @return the authentication */ public static Authentication getAuthentication(final RequestContext ctx) { return ctx.getConversationScope().get("authentication", Authentication.class); } /** * Put authentication result builder. * * @param builder the builder * @param ctx the ctx */ public static void putAuthenticationResultBuilder(final AuthenticationResultBuilder builder, final RequestContext ctx) { ctx.getConversationScope().put("authenticationResultBuilder", builder); } /** * Gets authentication result builder. * * @param ctx the ctx * @return the authentication result builder */ public static AuthenticationResultBuilder getAuthenticationResultBuilder(final RequestContext ctx) { return ctx.getConversationScope().get("authenticationResultBuilder", AuthenticationResultBuilder.class); } /** * Put authentication result. * * @param authenticationResult the authentication result * @param context the context */ public static void putAuthenticationResult(final AuthenticationResult authenticationResult, final RequestContext context) { context.getConversationScope().put("authenticationResult", authenticationResult); } /** * Gets authentication result builder. * * @param ctx the ctx * @return the authentication context builder */ public static AuthenticationResult getAuthenticationResult(final RequestContext ctx) { return ctx.getConversationScope().get("authenticationResult", AuthenticationResult.class); } /** * Gets http servlet request user agent. * * @param request the request * @return the http servlet request user agent */ public static String getHttpServletRequestUserAgent(final HttpServletRequest request) { if (request != null) { return request.getHeader(USER_AGENT_HEADER); } return null; } /** * Gets http servlet request user agent. * * @return the http servlet request user agent */ public static String getHttpServletRequestUserAgent() { return getHttpServletRequestUserAgent(getHttpServletRequest()); } /** * Gets http servlet request geo location. * * @return the http servlet request geo location */ public static HttpRequestGeoLocation getHttpServletRequestGeoLocation() { final int latIndex = 0; final int longIndex = 1; final int accuIndex = 2; final int timeIndex = 3; final HttpServletRequest request = WebUtils.getHttpServletRequest(); final HttpRequestGeoLocation loc = new HttpRequestGeoLocation(); if (request != null) { final String geoLocationParam = request.getParameter("geolocation"); if (StringUtils.isNotBlank(geoLocationParam)) { final String[] geoLocation = geoLocationParam.split(","); loc.setLatitude(geoLocation[latIndex]); loc.setLongitude(geoLocation[longIndex]); loc.setAccuracy(geoLocation[accuIndex]); loc.setTimestamp(geoLocation[timeIndex]); } } return loc; }
<<<<<<< this.httpClient = httpClient; final var md = samlIdPProperties.getMetadata(); ======= final SamlIdPMetadataProperties md = samlIdPProperties.getMetadata(); >>>>>>> final var md = samlIdPProperties.getMetadata(); <<<<<<< final var metadataLocation = service.getMetadataLocation(); ======= final String metadataLocation = getMetadataLocationForService(service); >>>>>>> final String metadataLocation = getMetadataLocationForService(service); <<<<<<< final var metadataResource = ResourceUtils.getResourceFrom(metadataLocation); ======= final UrlResource metadataResource = new UrlResource(metadataLocation); >>>>>>> final UrlResource metadataResource = new UrlResource(metadataLocation); <<<<<<< final var metadataProvider = new FileBackedHTTPMetadataResolver( this.httpClient.getWrappedHttpClient(), metadataResource.getURL().toExternalForm(), canonicalPath); configureAndInitializeSingleMetadataResolver(metadataProvider, service); return CollectionUtils.wrap(metadataProvider); ======= >>>>>>> <<<<<<< final var metadataLocation = service.getMetadataLocation(); final var metadataResource = ResourceUtils.getResourceFrom(metadataLocation); ======= final String metadataLocation = getMetadataLocationForService(service); return StringUtils.isNotBlank(metadataLocation) && StringUtils.startsWith(metadataLocation, "http"); >>>>>>> final String metadataLocation = getMetadataLocationForService(service); final var metadataResource = ResourceUtils.getResourceFrom(metadataLocation);
<<<<<<< final var request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final var cookieValue = Optional.ofNullable(cookieGenerator.retrieveCookieValue(request)) .orElseGet(randomStringGenerator::getNewString); ======= final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final String cookieValue = Optional.ofNullable(cookieGenerator.retrieveCookieValue(request)).orElseGet(createDeviceFingerPrintCookieValue()); >>>>>>> final var request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); final String cookieValue = Optional.ofNullable(cookieGenerator.retrieveCookieValue(request)).orElseGet(createDeviceFingerPrintCookieValue()); <<<<<<< final var response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); cookieGenerator.addCookie(request, response, cookieValue); ======= createDeviceFingerPrintCookie(context, request, cookieValue); >>>>>>> createDeviceFingerPrintCookie(context, request, cookieValue);
<<<<<<< ======= import org.slf4j.Logger; import org.slf4j.LoggerFactory; >>>>>>> <<<<<<< import org.n52.sos.ds.FeatureQueryHandlerQueryObject; ======= import org.n52.sos.ds.FeatureQueryHandlerQueryObject; import org.n52.sos.ds.I18NDAO; >>>>>>> import org.n52.sos.ds.FeatureQueryHandlerQueryObject; <<<<<<< "An error occurs while querying feature identifiers for spatial filter!"); ======= "An error occurred while querying feature identifiers for spatial filter!"); >>>>>>> "An error occurred while querying feature identifiers for spatial filter!"); <<<<<<< private void addNameAndDescription(FeatureQueryHandlerQueryObject query, FeatureOfInterest feature, SamplingFeature samplingFeature, FeatureOfInterestDAO featureDAO) throws OwsExceptionReport { I18NDAO<I18NFeatureMetadata> i18nDAO = I18NDAORepository.getInstance().getDAO(I18NFeatureMetadata.class); Locale requestedLocale = query.getI18N(); // set name as human readable identifier if set if (feature.isSetName()) { samplingFeature.setHumanReadableIdentifier(feature.getName()); } if (i18nDAO == null) { // no i18n support samplingFeature.addName(featureDAO.getName(feature)); samplingFeature.setDescription(featureDAO.getDescription(feature)); } else { I18NFeatureMetadata i18n = i18nDAO.getMetadata(feature.getIdentifier()); if (requestedLocale != null) { // specific locale was requested Optional<LocalizedString> name = i18n.getName().getLocalizationOrDefault(requestedLocale); if (name.isPresent()) { samplingFeature.addName(name.get().asCodeType()); } Optional<LocalizedString> description = i18n.getDescription().getLocalizationOrDefault(requestedLocale); if (description.isPresent()) { samplingFeature.setDescription(description.get().getText()); } } else { if (ServiceConfiguration.getInstance().isShowAllLanguageValues()) { for (LocalizedString name : i18n.getName()) { samplingFeature.addName(name.asCodeType()); } } else { Optional<LocalizedString> name = i18n.getName().getDefaultLocalization(); if (name.isPresent()) { samplingFeature.addName(name.get().asCodeType()); } } // choose always the description in the default locale Optional<LocalizedString> description = i18n.getDescription().getDefaultLocalization(); if (description.isPresent()) { samplingFeature.setDescription(description.get().getText()); } } } } ======= private void addNameAndDescription(FeatureQueryHandlerQueryObject query, FeatureOfInterest feature, SamplingFeature samplingFeature, FeatureOfInterestDAO featureDAO) throws OwsExceptionReport { I18NDAO<I18NFeatureMetadata> i18nDAO = I18NDAORepository.getInstance().getDAO(I18NFeatureMetadata.class); Locale requestedLocale = query.getI18N(); if (i18nDAO == null) { // no i18n support samplingFeature.addName(featureDAO.getName(feature)); samplingFeature.setDescription(featureDAO.getDescription(feature)); } else { I18NFeatureMetadata i18n = i18nDAO.getMetadata(feature.getIdentifier()); if (requestedLocale != null) { // specific locale was requested Optional<LocalizedString> name = i18n.getName().getLocalizationOrDefault(requestedLocale); if (name.isPresent()) { samplingFeature.addName(name.get().asCodeType()); } Optional<LocalizedString> description = i18n.getDescription().getLocalizationOrDefault(requestedLocale); if (description.isPresent()) { samplingFeature.setDescription(description.get().getText()); } } else { if (ServiceConfiguration.getInstance().isShowAllLanguageValues()) { for (LocalizedString name : i18n.getName()) { samplingFeature.addName(name.asCodeType()); } } else { Optional<LocalizedString> name = i18n.getName().getDefaultLocalization(); if (name.isPresent()) { samplingFeature.addName(name.get().asCodeType()); } } // choose always the description in the default locale Optional<LocalizedString> description = i18n.getDescription().getDefaultLocalization(); if (description.isPresent()) { samplingFeature.setDescription(description.get().getText()); } } } } >>>>>>> private void addNameAndDescription(FeatureQueryHandlerQueryObject query, FeatureOfInterest feature, SamplingFeature samplingFeature, FeatureOfInterestDAO featureDAO) throws OwsExceptionReport { I18NDAO<I18NFeatureMetadata> i18nDAO = I18NDAORepository.getInstance().getDAO(I18NFeatureMetadata.class); Locale requestedLocale = query.getI18N(); // set name as human readable identifier if set if (feature.isSetName()) { samplingFeature.setHumanReadableIdentifier(feature.getName()); } if (i18nDAO == null) { // no i18n support samplingFeature.addName(featureDAO.getName(feature)); samplingFeature.setDescription(featureDAO.getDescription(feature)); } else { I18NFeatureMetadata i18n = i18nDAO.getMetadata(feature.getIdentifier()); if (requestedLocale != null) { // specific locale was requested Optional<LocalizedString> name = i18n.getName().getLocalizationOrDefault(requestedLocale); if (name.isPresent()) { samplingFeature.addName(name.get().asCodeType()); } Optional<LocalizedString> description = i18n.getDescription().getLocalizationOrDefault(requestedLocale); if (description.isPresent()) { samplingFeature.setDescription(description.get().getText()); } } else { if (ServiceConfiguration.getInstance().isShowAllLanguageValues()) { for (LocalizedString name : i18n.getName()) { samplingFeature.addName(name.asCodeType()); } } else { Optional<LocalizedString> name = i18n.getName().getDefaultLocalization(); if (name.isPresent()) { samplingFeature.addName(name.get().asCodeType()); } } // choose always the description in the default locale Optional<LocalizedString> description = i18n.getDescription().getDefaultLocalization(); if (description.isPresent()) { samplingFeature.setDescription(description.get().getText()); } } } } <<<<<<< featureOfInterestDAO.addIdentifierNameDescription(samplingFeature, feature, session); ======= featureOfInterestDAO.addIdentifier(samplingFeature, feature, session); >>>>>>> featureOfInterestDAO.addIdentifierNameDescription(samplingFeature, feature, session); <<<<<<< if (lastGeoemtry == null) { lastGeoemtry = geometry; } if (geometry.getSRID() != srid) { srid = geometry.getSRID(); } if (!geometry.equalsTopo(lastGeoemtry)) { coordinates.add(GeometryHandler.getInstance().switchCoordinateAxisFromToDatasourceIfNeeded(geometry).getCoordinate()); ======= if (lastGeoemtry == null || !geometry.equalsTopo(lastGeoemtry)) { coordinates.add(GeometryHandler.getInstance().switchCoordinateAxisOrderIfNeeded(geometry).getCoordinate()); >>>>>>> if (lastGeoemtry == null || !geometry.equalsTopo(lastGeoemtry)) { coordinates.add(GeometryHandler.getInstance().switchCoordinateAxisFromToDatasourceIfNeeded(geometry).getCoordinate());
<<<<<<< private static final Logger LOGGER = LoggerFactory.getLogger(LdapUtils.class); ======= public static final String OBJECTCLASS_ATTRIBUTE = "objectClass"; private static final Logger log = LoggerFactory.getLogger(LdapUtils.class); >>>>>>> public static final String OBJECTCLASS_ATTRIBUTE = "objectClass"; private static final Logger LOGGER = LoggerFactory.getLogger(LdapUtils.class); <<<<<<< * @param filter search filter * @param userName ldap userName used by the filter * @return the filtered string populated with the username ======= * @param context the Ldap connection to close >>>>>>> * @param context the Ldap connection to close <<<<<<< public static void closeContext(final DirContext context) { if (context != null) { try { context.close(); } catch (final NamingException ex) { LOGGER.warn("Could not close context", ex); } ======= public static String getString(final LdapEntry ctx, final String attribute, final String nullValue) { final LdapAttribute attr = ctx.getAttribute(attribute); if (attr == null) { return nullValue; } final String v = attr.getStringValue(); if (v != null) { return v; >>>>>>> public static String getString(final LdapEntry ctx, final String attribute, final String nullValue) { final LdapAttribute attr = ctx.getAttribute(attribute); if (attr == null) { return nullValue; } final String v = attr.getStringValue(); if (v != null) { return v;